diff --git a/main.py b/main.py index cf4cf09..955bec0 100644 --- a/main.py +++ b/main.py @@ -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 diff --git a/src/constants.py b/src/constants.py index 82854a1..993eb6f 100644 --- a/src/constants.py +++ b/src/constants.py @@ -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" } \ No newline at end of file diff --git a/src/streaming.py b/src/streaming.py index 37f65c3..3dacea8 100644 --- a/src/streaming.py +++ b/src/streaming.py @@ -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):