From 1f34e91da869da09056ecc3b9827e4003e8b3ea7 Mon Sep 17 00:00:00 2001 From: Benex254 Date: Mon, 5 Aug 2024 09:47:02 +0300 Subject: [PATCH] feat: make the mpv player module work on android --- fastanime/cli/utils/mpv.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/fastanime/cli/utils/mpv.py b/fastanime/cli/utils/mpv.py index 6c037a8..18a1dc1 100644 --- a/fastanime/cli/utils/mpv.py +++ b/fastanime/cli/utils/mpv.py @@ -5,6 +5,19 @@ import subprocess def mpv(link, title, *custom_args): MPV = shutil.which("mpv") if not MPV: - print("mpv not found") - return - subprocess.run([MPV, *custom_args, f"--title={title}", link]) + args = [ + "nohup", + "am", + "start", + "--user", + "0", + "-a", + "android.intent.action.VIEW", + "-d", + link, + "-n", + "is.xyz.mpv/.MPVActivity", + ] + subprocess.run(args) + else: + subprocess.run([MPV, *custom_args, f"--title={title}", link])