Media Player is now configurable

MPV will still be the main recommendation
**Very useful when MPV is installed as a flatpak**

Signed-off-by: nanometer5088 <code.deleo@simplelogin.com>
This commit is contained in:
nanometer5088
2023-06-20 21:37:45 -03:00
parent b16c1b7679
commit e136fa36b8
3 changed files with 12 additions and 5 deletions

View File

@@ -171,11 +171,12 @@ def main():
# Error handling for MPV media player or MPV not found in PATH
except subprocess.CalledProcessError:
log(
"Tried to run MPV media player, but it was not found in the PATH, so the software exited"
"Tried to run media player, but it was either not found in the PATH or incorrectly configured on src/constants.py, so the software exited"
)
os.system("cls || clear")
print(
"MPV media player was not found on your system path. Make sure it's installed and try again."
"""The media player was either not found in the PATH or incorrectly configured on src/constants.py.
If you never modified constants.py, install MPV and try again"""
)
# Error handling for exiting the code with CTRL + C

View File

@@ -1,11 +1,16 @@
# Do not change anything here
APP = {
"name": "CLI TikTok",
"version": 0.81
"version": 0.82
}
# Here are the app settings. You are free to configure this field
OPTIONS = {
"proxitok_instance": "https://proxitok.pabloferreiro.es"
# This controls the Proxitok instance that will be scraped to obtain the URLs.
"proxitok_instance": "https://proxitok.pabloferreiro.es",
# This handles the command used to playback videos. It's heavily recommended to use MPV
# Make sure your player can launch through the CLI and exits after playback
"player_command": "mpv"
}

View File

@@ -6,6 +6,7 @@ from yt_dlp.utils import DownloadError
from log import logtofile as log
from src.functions import url_redirection
from src.constants import OPTIONS
def getVideoInfo(url):
@@ -15,7 +16,7 @@ def getVideoInfo(url):
def mpv(url):
subprocess.check_output(f'mpv "{getVideoInfo(url)}"', shell=True)
subprocess.check_output(f'{OPTIONS["player_command"]} "{getVideoInfo(url)}"', shell=True)
def playbackrandom(urls, datas):