Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Use get_audio_properties instead of mutagen #674

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
/Test-AppData-Dir/
/AppData/
/Downloads/

# Python cache
__pycache__
13 changes: 6 additions & 7 deletions cyberdrop_dl/utils/sorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
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
Expand Down Expand Up @@ -88,10 +87,10 @@ async def sort_audio(self, file: Path, base_name: str) -> None:
"""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
Expand Down
Loading