From c00e6aa94827f4972dc33fa79a53b5d9a15a726e Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Thu, 4 Jun 2020 12:20:38 +0200 Subject: [PATCH 1/1] Nicer audiobooks admin and fix for YT queueing. --- src/archive/admin.py | 5 ++++- src/youtube/management/commands/youtube.py | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/archive/admin.py b/src/archive/admin.py index 577a0ae..f6fcd4a 100644 --- a/src/archive/admin.py +++ b/src/archive/admin.py @@ -5,7 +5,10 @@ admin.site.register(Project) class AudiobookAdmin(admin.ModelAdmin): - list_filter = ['license'] + list_display = ["title", "slug", "index", "part_name", "license", "youtube_volume"] + list_filter = ["license"] + list_search = ["title", "slug", "part_name", "youtube_volume"] + list_editable = ["youtube_volume"] admin.site.register(Audiobook, AudiobookAdmin) diff --git a/src/youtube/management/commands/youtube.py b/src/youtube/management/commands/youtube.py index 4a8dfb5..4277818 100644 --- a/src/youtube/management/commands/youtube.py +++ b/src/youtube/management/commands/youtube.py @@ -11,9 +11,11 @@ class Command(BaseCommand): parser.add_argument("--limit", type=int, default=6) def handle(self, *args, **options): - for audiobook in Audiobook.objects.exclude(youtube_queued=None).order_by( - "youtube_queued" - )[: options["limit"]]: + for audiobook in ( + Audiobook.objects.filter(status=status.QUEUED) + .exclude(youtube_queued=None) + .order_by("youtube_queued")[: options["limit"]] + ): audiobook.youtube_task = tasks.YouTubeTask.delay( None, audiobook.id, True ).task_id -- 2.20.1