Browse Source

update thumb_url

lang 4 years ago
parent
commit
e2d14d7d6f
1 changed files with 20 additions and 20 deletions
  1. 20 20
      Controller/CloudStorage.py

+ 20 - 20
Controller/CloudStorage.py

@@ -445,25 +445,25 @@ class CloudStorageView(View):
                                         params={'x-oss-process': 'video/snapshot,t_10000,m_fast,w_300'})
                 vod_play_list.append({'name': vod['time'], 'sign_url': vod_play_url, 'thumb': thumb, 'sec': vod['sec']})
             elif bucket__mold == 1:
-                # aws_access_key_id = 'AKIA2E67UIMD45Y3HL53'
-                # aws_secret_access_key = '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'
-                # session = Session(
-                #     aws_access_key_id=aws_access_key_id,
-                #     aws_secret_access_key=aws_secret_access_key,
-                #     region_name=bucket__region
-                # )
-                # conn = session.client('s3')
-                # thumbspng = '{uid}/vod{channel}/{time}/thumbs.png'. \
-                #     format(uid=uid, channel=channel, time=vod['time'])
-                # response_url = conn.generate_presigned_url(
-                #     'get_object',
-                #     Params={
-                #         'Bucket': bucket_name,
-                #         'Key': thumbspng
-                #     },
-                #     ExpiresIn=3600
-                # )
-                # thumb_url = response_url
+                aws_access_key_id = 'AKIA2E67UIMD45Y3HL53'
+                aws_secret_access_key = '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'
+                session = Session(
+                    aws_access_key_id=aws_access_key_id,
+                    aws_secret_access_key=aws_secret_access_key,
+                    region_name=bucket__region
+                )
+                conn = session.client('s3')
+                thumbspng = '{uid}/vod{channel}/{time}/thumbs.jpg'. \
+                    format(uid=uid, channel=channel, time=vod['time'])
+                response_url = conn.generate_presigned_url(
+                    'get_object',
+                    Params={
+                        'Bucket': bucket_name,
+                        'Key': thumbspng
+                    },
+                    ExpiresIn=3600
+                )
+                thumb_url = response_url
                 # m3u8 = '{uid}/vod{channel}/{time}/{time}.m3u8'. \
                 #     format(uid=uid, channel=channel, time=vod['time'])
                 vod_url = 'http://test.dvema.com/cloudstorage/signplaym3u8?' \
@@ -472,7 +472,7 @@ class CloudStorageView(View):
                 vod_play_list.append({
                     'name': vod['time'],
                     'sign_url': vod_url,
-                    # 'thumb': thumb_url,
+                    'thumb': thumb_url,
                     'sec': vod['sec']})
         print('--------------end')
         print(int(time.time()))