process subtitle media url paths

This commit is contained in:
simon 2022-02-10 19:45:22 +07:00
parent 3ea5e9c537
commit 16f33feda0
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
1 changed files with 6 additions and 0 deletions

View File

@ -60,6 +60,12 @@ class ApiBaseView(APIView):
cache_dir = self.default_conf["application"]["cache_dir"]
new_thumb = f"{cache_dir}/{vid_thumb_url}"
self.response["data"]["vid_thumb_url"] = new_thumb
if "subtitles" in all_keys:
all_subtitles = self.response["data"]["subtitles"]
for idx, _ in enumerate(all_subtitles):
url = self.response["data"]["subtitles"][idx]["media_url"]
new_url = f"/media/{url}"
self.response["data"]["subtitles"][idx]["media_url"] = new_url
def get_paginate(self):
"""add pagination detail to response"""