diff --git a/tubesync/sync/tasks.py b/tubesync/sync/tasks.py index 0e0e607..2597649 100644 --- a/tubesync/sync/tasks.py +++ b/tubesync/sync/tasks.py @@ -310,20 +310,28 @@ def download_media(media_id): return if media.skip: # Media was toggled to be skipped after the task was scheduled - log.warn(f'Download task triggeredd media: {media} (UUID: {media.pk}) but it ' - f'is now marked to be skipped, not downloading') + log.warn(f'Download task triggered for media: {media} (UUID: {media.pk}) but ' + f'it is now marked to be skipped, not downloading') return if media.downloaded and media.media_file: # Media has been marked as downloaded before the download_media task was fired, # skip it - log.warn(f'Download task triggeredd media: {media} (UUID: {media.pk}) but it ' - f'has already been marked as downloaded, not downloading again') + log.warn(f'Download task triggered for media: {media} (UUID: {media.pk}) but ' + f'it has already been marked as downloaded, not downloading again') return if not media.source.download_media: - log.warn(f'Download task triggeredd media: {media} (UUID: {media.pk}) but the ' - f'source {media.source} has since been marked to not download media, ' + log.warn(f'Download task triggered for media: {media} (UUID: {media.pk}) but ' + f'the source {media.source} has since been marked to not download, ' f'not downloading') return + max_cap_age = media.source.download_cap_date + published = instance.published + if max_cap_age and published: + if published <= max_cap_age: + log.warn(f'Download task triggered media: {media} (UUID: {media.pk}) but ' + f'the source has a download cap and the media is now too old, ' + f'not downloading') + return filepath = media.filepath log.info(f'Downloading media: {media} (UUID: {media.pk}) to: "{filepath}"') format_str, container = media.download_media()