handle errors in duration
This commit is contained in:
parent
2995e979ab
commit
2bf468a2cf
1 changed files with 17 additions and 13 deletions
30
feed
30
feed
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue