handle errors in duration

This commit is contained in:
boyska 2024-05-12 16:01:58 +02:00
parent 2995e979ab
commit 2bf468a2cf

30
feed
View file

@ -589,20 +589,23 @@ def retrieve(url, args):
def audio_passes_filters(audio, args):
logging.debug(audio.end_date)
if not audio.valid:
try:
logging.debug(audio.end_date)
if not audio.valid:
return False
if args.max_len and audio.duration > args.max_len:
return False
if args.fill and audio.duration > args.fill:
return False
if args.min_len and audio.duration < args.min_len:
return False
if args.min_age.total_seconds() and audio.age < args.min_age:
return False
if args.max_age.total_seconds() and audio.age > args.max_age:
return False
return True
except DurationNotFound:
return False
if args.max_len and audio.duration > args.max_len:
return False
if args.fill and audio.duration > args.fill:
return False
if args.min_len and audio.duration < args.min_len:
return False
if args.min_age.total_seconds() and audio.age < args.min_age:
return False
if args.max_age.total_seconds() and audio.age > args.max_age:
return False
return True
def expand_glob(sources: list, weights: list) -> tuple:
@ -629,6 +632,7 @@ def expand_glob(sources: list, weights: list) -> tuple:
return new_sources, new_weights
def get_audio_by_source(args, parser):
sources = args.urls
if args.source_weights: