From 85d12d6c683dc3dd171826f685fe89ac16d88476 Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 19 Nov 2021 16:57:07 +0700 Subject: [PATCH] dont index playlists without videos --- tubearchivist/home/tasks.py | 8 ++++++++ tubearchivist/home/views.py | 3 --- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tubearchivist/home/tasks.py b/tubearchivist/home/tasks.py index 4103655..a8887fd 100644 --- a/tubearchivist/home/tasks.py +++ b/tubearchivist/home/tasks.py @@ -232,6 +232,14 @@ def index_channel_playlists(channel_id): playlist_id, all_youtube_ids=all_youtube_ids ) playlist_handler.get_playlist_dict() + # don't add if no videos downloaded + downloaded = [ + i + for i in playlist_handler.playlist_dict["playlist_entries"] + if i["downloaded"] + ] + if not downloaded: + continue playlist_handler.upload_to_es() playlist_handler.add_vids_to_playlist() diff --git a/tubearchivist/home/views.py b/tubearchivist/home/views.py index d9348bb..d3ae262 100644 --- a/tubearchivist/home/views.py +++ b/tubearchivist/home/views.py @@ -782,9 +782,6 @@ class PlaylistView(View): } } ], - "filter": [ - {"term": {"playlist_entries.downloaded": True}} - ], "minimum_should_match": 1, } }