feat: config to disable get m3u8 from device

This commit is contained in:
WorldObservationLog
2024-05-28 22:00:51 +08:00
parent 33b2efd82e
commit b82817c20e
3 changed files with 4 additions and 1 deletions

View File

@@ -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

View File

@@ -26,6 +26,7 @@ class M3U8Api(BaseModel):
class Download(BaseModel):
proxy: str
parallelNum: int
getM3u8FromDevice: bool
codecAlternative: bool
codecPriority: list[str]
atmosConventToM4a: bool

View File

@@ -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