|
@@ -226,23 +226,44 @@ class CloudStorageView(View):
|
|
|
'''
|
|
|
conn = session.client('s3')
|
|
|
playlist_entries = []
|
|
|
- for i in range(fg):
|
|
|
- thumbspng = '{uid}/vod{channel}/{time}/ts{i}.ts'. \
|
|
|
- format(uid=uid, channel=channel, time=storeTime, i=i)
|
|
|
- response_url = conn.generate_presigned_url(
|
|
|
- 'get_object',
|
|
|
- Params={
|
|
|
- 'Bucket': bucket_name,
|
|
|
- 'Key': thumbspng
|
|
|
- },
|
|
|
- ExpiresIn=3600
|
|
|
- )
|
|
|
- # m3u8 = '{uid}/vod{channel}/{time}/{time}.m3u8'. \
|
|
|
- # format(uid=uid, channel=channel, time=vod['time'])
|
|
|
- playlist_entries.append({
|
|
|
- 'name': response_url,
|
|
|
- 'duration': sec,
|
|
|
- })
|
|
|
+ # for i in range(fg):
|
|
|
+ # thumbspng = '{uid}/vod{channel}/{time}/ts{i}.ts'. \
|
|
|
+ # format(uid=uid, channel=channel, time=storeTime, i=i)
|
|
|
+ # response_url = conn.generate_presigned_url(
|
|
|
+ # 'get_object',
|
|
|
+ # Params={
|
|
|
+ # 'Bucket': bucket_name,
|
|
|
+ # 'Key': thumbspng
|
|
|
+ # },
|
|
|
+ # ExpiresIn=3600
|
|
|
+ # )
|
|
|
+ # # m3u8 = '{uid}/vod{channel}/{time}/{time}.m3u8'. \
|
|
|
+ # # format(uid=uid, channel=channel, time=vod['time'])
|
|
|
+ # playlist_entries.append({
|
|
|
+ # 'name': response_url,
|
|
|
+ # 'duration': sec,
|
|
|
+ # })
|
|
|
+ for i in range(7):
|
|
|
+ shift = (i+1)*4
|
|
|
+ duration = (fg >> shift) & 0xf
|
|
|
+ if duration > 0:
|
|
|
+ tsFile = '{uid}/vod{channel}/{time}/ts{i}.ts'. \
|
|
|
+ format(uid=uid, channel=channel, time=storeTime, i=i)
|
|
|
+ response_url = conn.generate_presigned_url(
|
|
|
+ 'get_object',
|
|
|
+ Params={
|
|
|
+ 'Bucket': bucket_name,
|
|
|
+ 'Key': tsFile
|
|
|
+ },
|
|
|
+ ExpiresIn=3600
|
|
|
+ )
|
|
|
+ # m3u8 = '{uid}/vod{channel}/{time}/{time}.m3u8'. \
|
|
|
+ # format(uid=uid, channel=channel, time=vod['time'])
|
|
|
+ playlist_entries.append({
|
|
|
+ 'name': response_url,
|
|
|
+ 'duration': duration,
|
|
|
+ })
|
|
|
+
|
|
|
playlist = PlaylistGenerator(playlist_entries).generate()
|
|
|
response = HttpResponse(playlist)
|
|
|
response['Content-Type'] = 'application/octet-stream'
|
|
@@ -470,9 +491,9 @@ class CloudStorageView(View):
|
|
|
# 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?' \
|
|
|
+ vod_url = '{server_domain}/cloudstorage/signplaym3u8?' \
|
|
|
'uid={uid}&channel={channel}&time={time}&sign=tktktktk'. \
|
|
|
- format(uid=uid, channel=channel, time=vod['time'])
|
|
|
+ format(server_domain=SERVER_DOMAIN,uid=uid, channel=channel, time=vod['time'])
|
|
|
vod_play_list.append({
|
|
|
'name': vod['time'],
|
|
|
'sign_url': vod_url,
|