From 16f33feda0dd1c65f73186d0fee2eb56795f0761 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 10 Feb 2022 19:45:22 +0700 Subject: [PATCH] process subtitle media url paths --- tubearchivist/api/views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tubearchivist/api/views.py b/tubearchivist/api/views.py index ec75370..620c063 100644 --- a/tubearchivist/api/views.py +++ b/tubearchivist/api/views.py @@ -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"""