mirror of
https://github.com/WorldObservationLog/AppleMusicDecrypt.git
synced 2026-01-15 14:22:54 -03:00
fix: print logs when codecAlternative worked
Some checks failed
/ Build Windows (push) Has been cancelled
Some checks failed
/ Build Windows (push) Has been cancelled
This commit is contained in:
@@ -106,3 +106,6 @@ class RipLogger:
|
||||
|
||||
def selected_codec(self, selected_codec):
|
||||
self.logger.info(f"Selected codec: {selected_codec}")
|
||||
|
||||
def codec_alternative(self):
|
||||
self.logger.warning("Unable to find the specified audio, switched to another audio codec")
|
||||
@@ -18,6 +18,7 @@ from src.api import WebAPI
|
||||
from src.config import Config
|
||||
from src.exceptions import CodecNotFoundException
|
||||
from src.metadata import SongMetadata
|
||||
from src.task import Task
|
||||
from src.types import *
|
||||
from src.utils import find_best_codec, get_codec_from_codec_id, get_suffix, convent_mac_timestamp_to_datetime, \
|
||||
if_raw_atmos
|
||||
@@ -37,15 +38,15 @@ async def get_available_codecs(m3u8_url: str) -> Tuple[list[str], list[str]]:
|
||||
return codecs, codec_ids
|
||||
|
||||
|
||||
async def extract_media(m3u8_url: str, codec: str, song_metadata: SongMetadata) -> M3U8Info:
|
||||
async def extract_media(m3u8_url: str, codec: str, task: Task) -> M3U8Info:
|
||||
parsed_m3u8 = m3u8.loads(await it(WebAPI).download_m3u8(m3u8_url), uri=m3u8_url)
|
||||
specifyPlaylist = find_best_codec(parsed_m3u8, codec)
|
||||
if not specifyPlaylist and it(Config).download.codecAlternative:
|
||||
logger.warning(f"Codec {codec} of song: {song_metadata.artist} - {song_metadata.title} did not found")
|
||||
for a_codec in it(Config).download.codecPriority:
|
||||
specifyPlaylist = find_best_codec(parsed_m3u8, a_codec)
|
||||
if specifyPlaylist:
|
||||
codec = a_codec
|
||||
task.logger.codec_alternative()
|
||||
break
|
||||
if not specifyPlaylist:
|
||||
raise CodecNotFoundException
|
||||
|
||||
Reference in New Issue
Block a user