forked from kenzuya/unshackle
style: run ruff format over the codebase
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
from .display import MusicHeaderInfo, TrackRow, render_album_header, render_artwork_preview, render_track_panel
|
||||
from .extract import (build_music_from_songs, classify_release_kind, dedupe_track_options, duration_seconds,
|
||||
first_number, first_text, format_duration, format_names, year_from_value)
|
||||
from .extract import (
|
||||
build_music_from_songs,
|
||||
classify_release_kind,
|
||||
dedupe_track_options,
|
||||
duration_seconds,
|
||||
first_number,
|
||||
first_text,
|
||||
format_duration,
|
||||
format_names,
|
||||
year_from_value,
|
||||
)
|
||||
from .hasher import file_md5
|
||||
from .integrity import MusicAudioIntegrityError, MusicAudioIntegrityResult, verify_music_audio
|
||||
from .manifest import write_music_manifest
|
||||
|
||||
@@ -40,7 +40,9 @@ class MusicAudioIntegrityResult:
|
||||
}
|
||||
|
||||
|
||||
def verify_music_audio(path: Path, *, song: Any = None, track: Any = None, media_info: Optional[MediaInfo] = None) -> MusicAudioIntegrityResult:
|
||||
def verify_music_audio(
|
||||
path: Path, *, song: Any = None, track: Any = None, media_info: Optional[MediaInfo] = None
|
||||
) -> MusicAudioIntegrityResult:
|
||||
"""Verify a downloaded music audio file after it is playable/decrypted."""
|
||||
path = Path(path)
|
||||
if not path.exists():
|
||||
|
||||
@@ -21,7 +21,8 @@ class MusicPlanner:
|
||||
plan = MusicDownloadPlan(
|
||||
kind=getattr(music, "kind", "music"),
|
||||
title=getattr(music, "title", None) or (first_song.album if first_song else ""),
|
||||
artist=getattr(music, "artist", None) or (first_song.album_artist or first_song.artist if first_song else ""),
|
||||
artist=getattr(music, "artist", None)
|
||||
or (first_song.album_artist or first_song.artist if first_song else ""),
|
||||
album_artist=(first_song.album_artist if first_song else "") or "",
|
||||
year=getattr(music, "year", None) or (first_song.year if first_song else None),
|
||||
released=self._first_text(
|
||||
@@ -180,9 +181,14 @@ class MusicPlanner:
|
||||
|
||||
if any(option.atmos for option in options):
|
||||
return "Dolby Atmos"
|
||||
if any(option.hires and (option.lossless or str(option.codec or "").upper() in {"FLAC", "ALAC", "WAV", "AIFF"}) for option in options):
|
||||
if any(
|
||||
option.hires and (option.lossless or str(option.codec or "").upper() in {"FLAC", "ALAC", "WAV", "AIFF"})
|
||||
for option in options
|
||||
):
|
||||
return "Hi-Res Lossless"
|
||||
if any(option.lossless or str(option.codec or "").upper() in {"FLAC", "ALAC", "WAV", "AIFF"} for option in options):
|
||||
if any(
|
||||
option.lossless or str(option.codec or "").upper() in {"FLAC", "ALAC", "WAV", "AIFF"} for option in options
|
||||
):
|
||||
return "Lossless"
|
||||
if "AAC" in codecs:
|
||||
return "AAC"
|
||||
|
||||
@@ -57,9 +57,7 @@ class MusicRenderer:
|
||||
metadata.get("released_at"),
|
||||
)
|
||||
)
|
||||
length = self._format_total_duration(
|
||||
getattr(music, "total_duration", None) or self._sum_duration(music)
|
||||
)
|
||||
length = self._format_total_duration(getattr(music, "total_duration", None) or self._sum_duration(music))
|
||||
quality = self._quality_summary(
|
||||
self._first_text(
|
||||
getattr(music, "quality", None),
|
||||
|
||||
@@ -15,8 +15,23 @@ except ImportError: # pragma: no cover - optional artwork enhancement
|
||||
|
||||
try:
|
||||
from mutagen.flac import FLAC, Picture
|
||||
from mutagen.id3 import (APIC, COMM, TALB, TCOM, TCON, TCOP, TDRC, TIT2, TPE1, TPE2, TPOS, TRCK, TSRC, TXXX,
|
||||
ID3NoHeaderError)
|
||||
from mutagen.id3 import (
|
||||
APIC,
|
||||
COMM,
|
||||
TALB,
|
||||
TCOM,
|
||||
TCON,
|
||||
TCOP,
|
||||
TDRC,
|
||||
TIT2,
|
||||
TPE1,
|
||||
TPE2,
|
||||
TPOS,
|
||||
TRCK,
|
||||
TSRC,
|
||||
TXXX,
|
||||
ID3NoHeaderError,
|
||||
)
|
||||
from mutagen.mp3 import MP3
|
||||
from mutagen.mp4 import MP4, MP4Cover
|
||||
except ImportError: # pragma: no cover - optional tagging dependency
|
||||
|
||||
Reference in New Issue
Block a user