From 2799d95119fe29dc3eb8d2892f753591c852d70e Mon Sep 17 00:00:00 2001 From: tcely Date: Mon, 23 Dec 2024 10:17:58 -0500 Subject: [PATCH 1/2] Only log new media Channels with thousands of videos, that won't be downloaded, create large blocks in the logs without this. --- tubesync/sync/tasks.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tubesync/sync/tasks.py b/tubesync/sync/tasks.py index 37983932..8fcc6630 100644 --- a/tubesync/sync/tasks.py +++ b/tubesync/sync/tasks.py @@ -191,7 +191,10 @@ def index_source_task(source_id): media.source = source try: media.save() - log.info(f'Indexed media: {source} / {media}') + log.debug(f'Indexed media: {source} / {media}') + # log the new media instances + if media.created >= source.last_crawl: + log.info(f'Indexed new media: {source} / {media}') except IntegrityError as e: log.error(f'Index media failed: {source} / {media} with "{e}"') # Tack on a cleanup of old completed tasks From d74e6bf2cadaed4ac1c11800770367737e1f1a7b Mon Sep 17 00:00:00 2001 From: tcely Date: Wed, 25 Dec 2024 20:16:07 -0500 Subject: [PATCH 2/2] Avoid the unlikely possibility of None comparison --- tubesync/sync/tasks.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tubesync/sync/tasks.py b/tubesync/sync/tasks.py index 8fcc6630..0dcacbbc 100644 --- a/tubesync/sync/tasks.py +++ b/tubesync/sync/tasks.py @@ -193,7 +193,12 @@ def index_source_task(source_id): media.save() log.debug(f'Indexed media: {source} / {media}') # log the new media instances - if media.created >= source.last_crawl: + new_media_instance = ( + media.created and + source.last_crawl and + media.created >= source.last_crawl + ) + if new_media_instance: log.info(f'Indexed new media: {source} / {media}') except IntegrityError as e: log.error(f'Index media failed: {source} / {media} with "{e}"')