mirror of
https://github.com/zhaarey/AppleMusicDecrypt.git
synced 2025-10-23 15:11:06 +00:00
fix: remove PlaylistMeta
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
from src.models.album_meta import AlbumMeta
|
||||
from src.models.playlist_meta import PlaylistMeta
|
||||
from src.models.artist_albums import ArtistAlbums
|
||||
from src.models.artist_info import ArtistInfo
|
||||
from src.models.artist_songs import ArtistSongs
|
||||
from src.models.playlist_info import PlaylistInfo
|
||||
from src.models.plsylist_tracks import PlaylistTracks
|
||||
from src.models.song_data import SongData
|
||||
from src.models.song_lyrics import SongLyrics
|
||||
from src.models.tracks_meta import TracksMeta
|
||||
from src.models.artist_albums import ArtistAlbums
|
||||
from src.models.artist_songs import ArtistSongs
|
||||
from src.models.artist_info import ArtistInfo
|
||||
from src.models.playlist_info import PlaylistInfo
|
||||
from src.models.plsylist_tracks import PlaylistTracks
|
||||
|
||||
@@ -1,147 +0,0 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Description(BaseModel):
|
||||
standard: Optional[str] = None
|
||||
short: Optional[str] = None
|
||||
|
||||
|
||||
class Artwork(BaseModel):
|
||||
width: Optional[int] = None
|
||||
url: Optional[str] = None
|
||||
height: Optional[int] = None
|
||||
textColor3: Optional[str] = None
|
||||
textColor2: Optional[str] = None
|
||||
textColor4: Optional[str] = None
|
||||
textColor1: Optional[str] = None
|
||||
bgColor: Optional[str] = None
|
||||
hasP3: Optional[bool] = None
|
||||
|
||||
|
||||
class PlayParams(BaseModel):
|
||||
id: Optional[str] = None
|
||||
kind: Optional[str] = None
|
||||
versionHash: Optional[str] = None
|
||||
|
||||
|
||||
class EditorialNotes(BaseModel):
|
||||
name: Optional[str] = None
|
||||
standard: Optional[str] = None
|
||||
short: Optional[str] = None
|
||||
|
||||
|
||||
class Attributes(BaseModel):
|
||||
lastModifiedDate: Optional[str] = None
|
||||
supportsSing: Optional[bool] = None
|
||||
description: Description
|
||||
artwork: Artwork
|
||||
playParams: PlayParams
|
||||
url: Optional[str] = None
|
||||
hasCollaboration: Optional[bool] = None
|
||||
curatorName: Optional[str] = None
|
||||
audioTraits: List
|
||||
name: Optional[str] = None
|
||||
isChart: Optional[bool] = None
|
||||
playlistType: Optional[str] = None
|
||||
editorialNotes: EditorialNotes
|
||||
artistName: Optional[str] = None
|
||||
|
||||
|
||||
class Artwork1(BaseModel):
|
||||
width: Optional[int] = None
|
||||
url: Optional[str] = None
|
||||
height: Optional[int] = None
|
||||
textColor3: Optional[str] = None
|
||||
textColor2: Optional[str] = None
|
||||
textColor4: Optional[str] = None
|
||||
textColor1: Optional[str] = None
|
||||
bgColor: Optional[str] = None
|
||||
hasP3: Optional[bool] = None
|
||||
|
||||
|
||||
class PlayParams1(BaseModel):
|
||||
id: Optional[str] = None
|
||||
kind: Optional[str] = None
|
||||
|
||||
|
||||
class Preview(BaseModel):
|
||||
url: Optional[str] = None
|
||||
|
||||
|
||||
class Attributes1(BaseModel):
|
||||
albumName: Optional[str] = None
|
||||
hasTimeSyncedLyrics: Optional[bool] = None
|
||||
genreNames: List[Optional[str]] = None
|
||||
trackNumber: Optional[int] = None
|
||||
releaseDate: Optional[str] = None
|
||||
durationInMillis: Optional[int] = None
|
||||
isVocalAttenuationAllowed: Optional[bool] = None
|
||||
isMasteredForItunes: Optional[bool] = None
|
||||
isrc: Optional[str] = None
|
||||
artwork: Artwork1
|
||||
composerName: Optional[str] = None
|
||||
audioLocale: Optional[str] = None
|
||||
url: Optional[str] = None
|
||||
playParams: PlayParams1
|
||||
discNumber: Optional[int] = None
|
||||
hasCredits: Optional[bool] = None
|
||||
hasLyrics: Optional[bool] = None
|
||||
isAppleDigitalMaster: Optional[bool] = None
|
||||
audioTraits: List[Optional[str]] = None
|
||||
name: Optional[str] = None
|
||||
previews: List[Preview]
|
||||
artistName: Optional[str] = None
|
||||
|
||||
|
||||
class Attributes2(BaseModel):
|
||||
name: Optional[str] = None
|
||||
|
||||
|
||||
class Datum2(BaseModel):
|
||||
id: Optional[str] = None
|
||||
type: Optional[str] = None
|
||||
href: Optional[str] = None
|
||||
attributes: Attributes2
|
||||
|
||||
|
||||
class Artists(BaseModel):
|
||||
href: Optional[str] = None
|
||||
data: List[Datum2]
|
||||
|
||||
|
||||
class Relationships1(BaseModel):
|
||||
artists: Artists
|
||||
|
||||
|
||||
class Datum1(BaseModel):
|
||||
id: Optional[str] = None
|
||||
type: Optional[str] = None
|
||||
href: Optional[str] = None
|
||||
attributes: Attributes1
|
||||
relationships: Relationships1
|
||||
|
||||
|
||||
class Tracks(BaseModel):
|
||||
href: Optional[str] = None
|
||||
next: Optional[Optional[str]] = None
|
||||
data: List[Datum1]
|
||||
|
||||
|
||||
class Relationships(BaseModel):
|
||||
tracks: Tracks
|
||||
|
||||
|
||||
class Datum(BaseModel):
|
||||
id: Optional[str] = None
|
||||
type: Optional[str] = None
|
||||
href: Optional[str] = None
|
||||
attributes: Attributes
|
||||
relationships: Relationships
|
||||
|
||||
|
||||
class PlaylistMeta(BaseModel):
|
||||
data: List[Datum]
|
||||
@@ -9,7 +9,7 @@ from src.api import (get_song_info, get_song_lyrics, get_album_info, download_so
|
||||
from src.config import Config, Device
|
||||
from src.decrypt import decrypt
|
||||
from src.metadata import SongMetadata
|
||||
from src.models import PlaylistMeta
|
||||
from src.models import PlaylistInfo
|
||||
from src.mp4 import extract_media, extract_song, encapsulate, write_metadata
|
||||
from src.save import save
|
||||
from src.types import GlobalAuthParams, Codec
|
||||
@@ -19,7 +19,7 @@ from src.utils import check_song_exists, if_raw_atmos
|
||||
|
||||
@logger.catch
|
||||
async def rip_song(song: Song, auth_params: GlobalAuthParams, codec: str, config: Config, device: Device,
|
||||
force_save: bool = False, specified_m3u8: str = "", playlist: PlaylistMeta = None):
|
||||
force_save: bool = False, specified_m3u8: str = "", playlist: PlaylistInfo = None):
|
||||
logger.debug(f"Task of song id {song.id} was created")
|
||||
token = auth_params.anonymousAccessToken
|
||||
song_data = await get_song_info(song.id, token, song.storefront, config.region.language)
|
||||
|
||||
@@ -10,7 +10,7 @@ from bs4 import BeautifulSoup
|
||||
|
||||
from src.config import Download
|
||||
from src.exceptions import NotTimeSyncedLyricsException
|
||||
from src.models import PlaylistMeta
|
||||
from src.models import PlaylistInfo
|
||||
from src.types import *
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ def ttml_convent_to_lrc(ttml: str) -> str:
|
||||
return "\n".join(lrc_lines)
|
||||
|
||||
|
||||
def check_song_exists(metadata, config: Download, codec: str, playlist: PlaylistMeta = None):
|
||||
def check_song_exists(metadata, config: Download, codec: str, playlist: PlaylistInfo = None):
|
||||
song_name, dir_path = get_song_name_and_dir_path(codec, config, metadata, playlist)
|
||||
return (Path(dir_path) / Path(song_name + get_suffix(codec, config.atmosConventToM4a))).exists()
|
||||
|
||||
@@ -142,7 +142,7 @@ def get_suffix(codec: str, save_raw_atmos: bool):
|
||||
return ".m4a"
|
||||
|
||||
|
||||
def playlist_metadata_to_params(playlist: PlaylistMeta):
|
||||
def playlist_metadata_to_params(playlist: PlaylistInfo):
|
||||
return {"playlistName": playlist.data[0].attributes.name,
|
||||
"playlistCuratorName": playlist.data[0].attributes.curatorName}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user