Fix tracknumber for mp4s
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
"""Python Soundcloud Music Downloader."""
|
||||
|
||||
__version__ = "v2.11.1"
|
||||
__version__ = "v2.11.2"
|
||||
|
||||
@@ -34,6 +34,7 @@ class MetadataInfo:
|
||||
album_title: Optional[str]
|
||||
album_author: Optional[str]
|
||||
album_track_num: Optional[int]
|
||||
album_total_track_num: Optional[int]
|
||||
|
||||
|
||||
@singledispatch
|
||||
@@ -161,7 +162,7 @@ def _(file: mp4.MP4, meta: MetadataInfo) -> None:
|
||||
file["aART"] = meta.album_author
|
||||
|
||||
if meta.album_track_num is not None:
|
||||
file["trkn"] = str(meta.album_track_num)
|
||||
file["trkn"] = [(meta.album_track_num, meta.album_total_track_num)]
|
||||
|
||||
if meta.description:
|
||||
file["\251cmt"] = meta.description
|
||||
|
||||
@@ -197,6 +197,7 @@ class PlaylistInfo(TypedDict):
|
||||
title: str
|
||||
tracknumber_int: int
|
||||
tracknumber: str
|
||||
tracknumber_total: int
|
||||
|
||||
|
||||
class SoundCloudException(Exception): # noqa: N818
|
||||
@@ -698,6 +699,7 @@ def download_playlist(
|
||||
"title": playlist.title,
|
||||
"tracknumber_int": 0,
|
||||
"tracknumber": "0",
|
||||
"tracknumber_total": playlist.track_count,
|
||||
}
|
||||
|
||||
if not kwargs.get("no_playlist_folder"):
|
||||
@@ -1319,6 +1321,7 @@ def _add_metadata_to_stream(
|
||||
album_title=playlist_info["title"] if album_available else None, # type: ignore[index]
|
||||
album_author=playlist_info["author"] if album_available else None, # type: ignore[index]
|
||||
album_track_num=playlist_info["tracknumber_int"] if album_available else None, # type: ignore[index]
|
||||
album_total_track_num=playlist_info["tracknumber_total"] if album_available else None, # type: ignore[index]
|
||||
)
|
||||
|
||||
mutagen_file = mutagen.File(stream)
|
||||
|
||||
Reference in New Issue
Block a user