mirror of
https://github.com/zhaarey/AppleMusicDecrypt.git
synced 2025-10-23 15:11:06 +00:00
feat: check dependencies installed
This commit is contained in:
@@ -17,7 +17,7 @@ from src.quality import get_available_song_audio_quality
|
|||||||
from src.rip import rip_song, rip_album, rip_artist, rip_playlist
|
from src.rip import rip_song, rip_album, rip_artist, rip_playlist
|
||||||
from src.types import GlobalAuthParams
|
from src.types import GlobalAuthParams
|
||||||
from src.url import AppleMusicURL, URLType, Song
|
from src.url import AppleMusicURL, URLType, Song
|
||||||
from src.utils import get_song_id_from_m3u8
|
from src.utils import get_song_id_from_m3u8, check_dep
|
||||||
|
|
||||||
|
|
||||||
class NewInteractiveShell:
|
class NewInteractiveShell:
|
||||||
@@ -30,6 +30,12 @@ class NewInteractiveShell:
|
|||||||
parser: argparse.ArgumentParser
|
parser: argparse.ArgumentParser
|
||||||
|
|
||||||
def __init__(self, loop: asyncio.AbstractEventLoop):
|
def __init__(self, loop: asyncio.AbstractEventLoop):
|
||||||
|
dep_installed, missing_dep = check_dep()
|
||||||
|
if not dep_installed:
|
||||||
|
logger.error(f"Dependence {missing_dep} was not installed!")
|
||||||
|
loop.stop()
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
self.loop = loop
|
self.loop = loop
|
||||||
self.config = Config.load_from_config()
|
self.config = Config.load_from_config()
|
||||||
init_client_and_lock(self.config.download.proxy, self.config.download.parallelNum)
|
init_client_and_lock(self.config.download.proxy, self.config.download.parallelNum)
|
||||||
|
|||||||
10
src/utils.py
10
src/utils.py
@@ -1,4 +1,5 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
@@ -206,3 +207,12 @@ def playlist_write_song_index(playlist: PlaylistInfo):
|
|||||||
def convent_mac_timestamp_to_datetime(timestamp: int):
|
def convent_mac_timestamp_to_datetime(timestamp: int):
|
||||||
d = datetime.strptime("01-01-1904", "%m-%d-%Y")
|
d = datetime.strptime("01-01-1904", "%m-%d-%Y")
|
||||||
return d + timedelta(seconds=timestamp)
|
return d + timedelta(seconds=timestamp)
|
||||||
|
|
||||||
|
|
||||||
|
def check_dep():
|
||||||
|
for dep in ["ffmpeg", "gpac", "mp4box", "mp4edit", "mp4extract", "adb"]:
|
||||||
|
try:
|
||||||
|
subprocess.run(dep, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||||
|
except FileNotFoundError:
|
||||||
|
return False, dep
|
||||||
|
return True, None
|
||||||
|
|||||||
Reference in New Issue
Block a user