Skip to content

Bulk asynchronous downloader for multiple file hosts

Use get_audio_properties instead of mutagen (#674)

Arkadiy Illarionovd6168ee143ac
diff --git a/.gitignore b/.gitignore
index 2c4681f05..1866efcbe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,6 @@
/Test-AppData-Dir/
/AppData/
/Downloads/
+
+# Python cache
+__pycache__
diff --git a/cyberdrop_dl/utils/sorting.py b/cyberdrop_dl/utils/sorting.py
index cc7052776..2169d5c19 100644
--- a/cyberdrop_dl/utils/sorting.py
+++ b/cyberdrop_dl/utils/sorting.py
@@ -3,11 +3,10 @@ import itertools
from pathlib import Path
from typing import TYPE_CHECKING
-import mutagen
-from videoprops import get_video_properties
from PIL import Image
+from videoprops import get_audio_properties, get_video_properties
-from cyberdrop_dl.utils.utilities import FILE_FORMATS, purge_dir, log_with_color
+from cyberdrop_dl.utils.utilities import FILE_FORMATS, log_with_color, purge_dir
if TYPE_CHECKING:
from cyberdrop_dl.managers.manager import Manager
@@ -88,10 +87,10 @@ class Sorter:
"""Sorts an audio file into the sorted audio folder"""
self.audio_count += 1
- file_info = mutagen.File(file).info
- length = file_info.length
- bitrate = file_info.bitrate
- sample_rate = file_info.sample_rate
+ props = get_audio_properties(str(file))
+ length = str(props['duration'])
+ bitrate = str(props['bit_rate'])
+ sample_rate = str(props['sample_rate'])
parent_name = file.parent.name
filename, ext = file.stem, file.suffix