From ec005680086d89a433e526187898f1fcf526c887 Mon Sep 17 00:00:00 2001 From: simon Date: Sun, 20 Feb 2022 19:22:11 +0700 Subject: [PATCH 1/3] fix auto reset of playlist_subscribed --- tubearchivist/home/src/index/playlist.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tubearchivist/home/src/index/playlist.py b/tubearchivist/home/src/index/playlist.py index a9964a0..fce019d 100644 --- a/tubearchivist/home/src/index/playlist.py +++ b/tubearchivist/home/src/index/playlist.py @@ -35,8 +35,11 @@ class YoutubePlaylist(YouTubeItem): def build_json(self, scrape=False): """collection to create json_data""" - if not scrape: - self.get_from_es() + self.get_from_es() + if self.json_data: + subscribed = self.json_data.get("playlist_subscribed") + else: + subscribed = False if scrape or not self.json_data: self.get_from_youtube() @@ -44,13 +47,13 @@ class YoutubePlaylist(YouTubeItem): self.get_entries() self.json_data["playlist_entries"] = self.all_members self.get_playlist_art() + self.json_data["playlist_subscribed"] = subscribed def process_youtube_meta(self): """extract relevant fields from youtube""" self.json_data = { "playlist_id": self.youtube_id, "playlist_active": True, - "playlist_subscribed": False, "playlist_name": self.youtube_meta["title"], "playlist_channel": self.youtube_meta["channel"], "playlist_channel_id": self.youtube_meta["channel_id"], From b8b95f9d79e3462d75c589c3c6735c396f1a62a2 Mon Sep 17 00:00:00 2001 From: simon Date: Mon, 21 Feb 2022 20:59:04 +0700 Subject: [PATCH 2/3] inheirt VideoProgressView from base class to get auth --- tubearchivist/api/views.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/tubearchivist/api/views.py b/tubearchivist/api/views.py index 79932fa..5a71522 100644 --- a/tubearchivist/api/views.py +++ b/tubearchivist/api/views.py @@ -100,43 +100,42 @@ class VideoApiView(ApiBaseView): return Response(self.response, status=self.status_code) -class VideoProgressView(APIView): +class VideoProgressView(ApiBaseView): """resolves to /api/video// handle progress status for video """ - @staticmethod - def get(request, video_id): + def get(self, request, video_id): """get progress for a single video""" user_id = request.user.id key = f"{user_id}:progress:{video_id}" video_progress = RedisArchivist().get_message(key) position = video_progress.get("position", 0) - progress = { + self.response = { "youtube_id": video_id, "user_id": user_id, "position": position, } - return Response(progress) + return Response(self.response) - @staticmethod - def post(request, video_id): + def post(self, request, video_id): """set progress position in redis""" position = request.data.get("position", 0) key = f"{request.user.id}:progress:{video_id}" message = {"position": position} RedisArchivist().set_message(key, message, expire=False) + self.response = request.data - return Response(request.data) + return Response(self.response) - @staticmethod - def delete(request, video_id): + def delete(self, request, video_id): """delete progress position""" key = f"{request.user.id}:progress:{video_id}" RedisArchivist().del_message(key) + self.response = {"progress-reset": video_id} - return Response({"progress-reset": video_id}) + return Response(self.response) class ChannelApiView(ApiBaseView): From 8579fb4cc1053487c15382cd09ad007518913c0b Mon Sep 17 00:00:00 2001 From: simon Date: Mon, 21 Feb 2022 21:37:49 +0700 Subject: [PATCH 3/3] fix ffmpeg link grep by using master --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 371134b..b5145d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ RUN apt-get clean && apt-get -y update && apt-get -y install --no-install-recomm RUN if [ "$TARGETPLATFORM" = "linux/amd64" ] ; then \ curl -s https://api.github.com/repos/yt-dlp/FFmpeg-Builds/releases/latest \ | grep browser_download_url \ - | grep linux64-gpl-4.4.tar.xz \ + | grep ".*master.*linux64.*tar.xz" \ | cut -d '"' -f 4 \ | xargs curl -L --output ffmpeg.tar.xz && \ tar -xf ffmpeg.tar.xz --strip-components=2 --no-anchored -C /usr/bin/ "ffmpeg" && \