From b7e0a7ace4f47a7c8ac18609d894f0ee1ee46b94 Mon Sep 17 00:00:00 2001 From: boyska Date: Mon, 16 Nov 2020 15:30:02 +0100 Subject: [PATCH] continue when invalid files found if you have an invalid ogg file, ffprobe will exit!=0, so everything will crash. This commit just ignores the file --- feed | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/feed b/feed index 1ed374f..23b193f 100755 --- a/feed +++ b/feed @@ -238,15 +238,19 @@ def scan_dir_audio(dirname, extensions=("mp3", "oga", "wav", "ogg")): def get_audio_from_dir(dirpath): fpaths = scan_dir_audio(dirpath) - return [ - Audio( - "file://" + os.path.realpath(u), - date=datetime.datetime.fromtimestamp(os.path.getmtime(u)).replace( - tzinfo=datetime.timezone.utc - ), - ) - for u in fpaths - ] + ret = [] + for u in fpaths: + try: + a = Audio( + "file://" + os.path.realpath(u), + date=datetime.datetime.fromtimestamp(os.path.getmtime(u)).replace( + tzinfo=datetime.timezone.utc + ), + ) + except ValueError: + continue + ret.append(a) + return ret def get_item_date(el):