mirror of
https://github.com/glomatico/votify.git
synced 2026-10-11 10:22:11 +02:00
Use actual_file_format for audio filenames
This commit is contained in:
@@ -241,28 +241,25 @@ class SpotifyAudioDownloader(SpotifyBaseDownloader):
|
||||
item.media.cover_url,
|
||||
)
|
||||
|
||||
def get_staged_file_extension(self, file_format: str) -> str:
|
||||
if file_format == "mp4":
|
||||
return ".m4a"
|
||||
return "." + file_format
|
||||
|
||||
def parse_item(self, media: SpotifyMedia) -> DownloadItem:
|
||||
item = DownloadItem(media=media)
|
||||
|
||||
if not media.stream_info:
|
||||
file_format = self.interface.song.audio_quality_priority[0].file_format
|
||||
actual_file_format = self.interface.song.audio_quality_priority[
|
||||
0
|
||||
].actual_file_format
|
||||
else:
|
||||
file_format = media.stream_info.audio_track.file_format
|
||||
actual_file_format = media.stream_info.audio_track.actual_file_format
|
||||
|
||||
item.staged_path = self.get_temp_path(
|
||||
media.media_id,
|
||||
item.uuid_,
|
||||
"staged",
|
||||
self.get_staged_file_extension(file_format),
|
||||
"." + actual_file_format,
|
||||
)
|
||||
item.final_path = self.get_final_path(
|
||||
media.tags,
|
||||
self.get_staged_file_extension(file_format),
|
||||
"." + actual_file_format,
|
||||
media.playlist_tags,
|
||||
)
|
||||
if media.playlist_tags:
|
||||
|
||||
@@ -93,6 +93,7 @@ class SpotifyAudioInterface(SpotifyBaseInterface):
|
||||
stream_url=stream_url,
|
||||
widevine_pssh=pssh,
|
||||
file_format=audio_quality.file_format,
|
||||
actual_file_format=audio_quality.actual_file_format,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ class StreamInfo:
|
||||
stream_url: str | list[str]
|
||||
widevine_pssh: str
|
||||
file_format: str
|
||||
actual_file_format: str | None = None
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
Reference in New Issue
Block a user