feat: make the downloads command use the mpv module to enable compatibility with mobile

This commit is contained in:
Benex254
2024-08-05 09:47:02 +03:00
parent cb18e9299c
commit da49aadd5c
2 changed files with 8 additions and 9 deletions

View File

@@ -1,10 +1,9 @@
import os
import shutil
import subprocess
import click
from ... import USER_VIDEOS_DIR
from ...cli.utils.mpv import mpv
from ...libs.fzf import fzf
from ..utils.tools import exit_app
@@ -13,11 +12,6 @@ from ..utils.tools import exit_app
help="View and watch your downloads using mpv", short_help="Watch downloads"
)
def downloads():
MPV = shutil.which("mpv")
if not MPV:
print("mpv not found")
exit_app()
return
playlists = os.listdir(USER_VIDEOS_DIR)
playlists.append("Exit")
@@ -25,8 +19,9 @@ def downloads():
playlist_name = fzf.run(playlists, "Enter Playlist Name", "Downloads")
if playlist_name == "Exit":
exit_app()
return
playlist = os.path.join(USER_VIDEOS_DIR, playlist_name)
subprocess.run([MPV, playlist])
mpv(playlist)
stream()
stream()

View File

@@ -2,7 +2,11 @@ import shutil
import subprocess
def mpv(link, title, *custom_args):
def mpv(
link,
*custom_args,
title="anime",
):
MPV = shutil.which("mpv")
if not MPV:
args = [