|
@@ -2,8 +2,9 @@
|
|
|
# @File : VodHlsService.py
|
|
|
# @Time : 2023/2/1 15:57
|
|
|
import random
|
|
|
+from Ansjer.config import LOGGER
|
|
|
from django.db import connection
|
|
|
-from django.db.models import Value, CharField, Count, Case, When, IntegerField, Sum
|
|
|
+from django.db.models import Value, CharField, Count
|
|
|
from Model.models import VodHls01, VodHls02, VodHls03, VodHls04, VodHls05, VodHls06, VodHls07, VodHls08, VodHls09, \
|
|
|
VodHls10, VodHls11, VodHls12, VodHls13, VodHls14, VodHls15, VodHls16, VodHls17, VodHls18, VodHls19, VodHls20, \
|
|
|
VodHls21, VodHls22, VodHls23, VodHls24, VodHls25, VodHls26, VodHls27, VodHls28, VodHls29, VodHls30, VodHls31, \
|
|
@@ -47,20 +48,23 @@ class SplitVodHlsObject:
|
|
|
@return: vod_hls
|
|
|
"""
|
|
|
vod_hls_union = VodHls01.objects.none().annotate(tab_val=Value(11, output_field=CharField()))
|
|
|
- if kwargs['type_list']:
|
|
|
- kwargs = self.vod_query_param(**kwargs)
|
|
|
- if 'id__in' in kwargs:
|
|
|
- for item in kwargs['id__in']:
|
|
|
- tab_val = str(item['tab_val'] + 10)
|
|
|
- vod_hls_union = vod_hls_union.union(
|
|
|
- Vod_Hls_List[item['tab_val'] - 1].objects.filter(id=item['vod_id']).annotate(
|
|
|
- tab_val=Value(tab_val, output_field=CharField())))
|
|
|
- else:
|
|
|
- kwargs.pop('type_list')
|
|
|
- for index, vod_hls_model in enumerate(Vod_Hls_List):
|
|
|
- tab_val = str(index + 11)
|
|
|
- vod_hls_union = vod_hls_union.union(vod_hls_model.objects.filter(**kwargs).annotate(
|
|
|
- tab_val=Value(tab_val, output_field=CharField())))
|
|
|
+ try:
|
|
|
+ if kwargs['type_list']:
|
|
|
+ kwargs = self.vod_query_param(**kwargs)
|
|
|
+ if 'id__in' in kwargs:
|
|
|
+ for item in kwargs['id__in']:
|
|
|
+ tab_val = str(item['tab_val'] + 10)
|
|
|
+ vod_hls_union = vod_hls_union.union(
|
|
|
+ Vod_Hls_List[item['tab_val'] - 1].objects.filter(id=item['vod_id']).annotate(
|
|
|
+ tab_val=Value(tab_val, output_field=CharField())))
|
|
|
+ else:
|
|
|
+ kwargs.pop('type_list')
|
|
|
+ for index, vod_hls_model in enumerate(Vod_Hls_List):
|
|
|
+ tab_val = str(index + 11)
|
|
|
+ vod_hls_union = vod_hls_union.union(vod_hls_model.objects.filter(**kwargs).annotate(
|
|
|
+ tab_val=Value(tab_val, output_field=CharField())))
|
|
|
+ except Exception as e:
|
|
|
+ LOGGER.info('get_vod_hls_data异常详情,kwargs:{},errLine:{},errMsg:{}'.format(kwargs, e.__traceback__.tb_lineno, repr(e)))
|
|
|
return vod_hls_union
|
|
|
|
|
|
def get_vod_hls_date(self, **kwargs):
|