diff --git a/feed b/feed index c66b89d..275a5cb 100755 --- a/feed +++ b/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: