|
@@ -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):
|