refactored and added for possibility for multiple sources per track
This commit is contained in:
@@ -156,10 +156,9 @@ class Musify(AudioSource):
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def fetch_audio(cls, row: dict):
|
||||
super().fetch_audio(row)
|
||||
def fetch_audio(cls, url: str, row: dict):
|
||||
super().fetch_audio(url, row)
|
||||
|
||||
url = row['url']
|
||||
file_ = row['file']
|
||||
return cls.download_from_musify(file_, url)
|
||||
|
||||
|
||||
@@ -16,5 +16,5 @@ class AudioSource:
|
||||
logger.info(f"try getting source {row['title']} from {cls.__name__}")
|
||||
|
||||
@classmethod
|
||||
def fetch_audio(cls, row: dict):
|
||||
def fetch_audio(cls, url: str,row: dict):
|
||||
logger.info(f"downloading audio from {row['url']} from {cls.__name__} to {row['file']}")
|
||||
|
||||
@@ -59,10 +59,9 @@ class Youtube(AudioSource):
|
||||
return final_result['url']
|
||||
|
||||
@classmethod
|
||||
def fetch_audio(cls, row: dict, trie: int=0):
|
||||
super().fetch_audio(row)
|
||||
def fetch_audio(cls, url: str, row: dict, trie: int=0):
|
||||
super().fetch_audio(url, row)
|
||||
|
||||
url = row['url']
|
||||
file_ = row['file']
|
||||
options = {
|
||||
'format': 'bestaudio/best',
|
||||
@@ -79,7 +78,7 @@ class Youtube(AudioSource):
|
||||
logger.warning("too many tries, returning")
|
||||
logger.warning(f"retrying in {WAIT_BETWEEN_BLOCK} seconds again")
|
||||
time.sleep(WAIT_BETWEEN_BLOCK)
|
||||
return cls.fetch_audio(row, trie=trie + 1)
|
||||
return cls.fetch_audio(url, row, trie=trie + 1)
|
||||
|
||||
"""
|
||||
def get_youtube_from_isrc(isrc: str) -> List[dict]:
|
||||
|
||||
Reference in New Issue
Block a user