From b82817c20e3e5e6524e12a0b1bb6308f7d93fbc9 Mon Sep 17 00:00:00 2001 From: WorldObservationLog Date: Tue, 28 May 2024 22:00:51 +0800 Subject: [PATCH] feat: config to disable get m3u8 from device --- config.example.toml | 2 ++ src/config.py | 1 + src/rip.py | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config.example.toml b/config.example.toml index 22375c6..673891a 100644 --- a/config.example.toml +++ b/config.example.toml @@ -35,6 +35,8 @@ endpoint = "" proxy = "" # Number of concurrent song downloads parallelNum = 1 +# Get m3u8 from device +getM3u8FromDevice = true # After enabling this feature, if the specified codec does not exist, the script will look for other codec to download codecAlternative = true # Priority for script to look for alternative codec diff --git a/src/config.py b/src/config.py index 8ab439f..f640d0d 100644 --- a/src/config.py +++ b/src/config.py @@ -26,6 +26,7 @@ class M3U8Api(BaseModel): class Download(BaseModel): proxy: str parallelNum: int + getM3u8FromDevice: bool codecAlternative: bool codecPriority: list[str] atmosConventToM4a: bool diff --git a/src/rip.py b/src/rip.py index cbf9cd0..1d51a0e 100644 --- a/src/rip.py +++ b/src/rip.py @@ -69,7 +69,7 @@ async def rip_song(song: Song, auth_params: GlobalAuthParams, codec: str, config if not specified_m3u8 and not song_data.attributes.extendedAssetUrls.enhancedHls: logger.error(f"Failed to download song: {song_metadata.artist} - {song_metadata.title}. Lossless audio does not exist") return - if not specified_m3u8: + if not specified_m3u8 and config.download.getM3u8FromDevice: device_m3u8 = await device.get_m3u8(song.id) if device_m3u8: specified_m3u8 = device_m3u8