Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix edge cases of player app setup #870

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions mps_youtube/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,29 @@ def init():

# set player to mpv or mplayer if found, otherwise unset
suffix = ".exe" if mswin else ""
mplayer, mpv = "mplayer" + suffix, "mpv" + suffix
mplayer, mpv, vlc = "mplayer" + suffix, "mpv" + suffix, "vlc" + suffix

if not os.path.exists(g.CFFILE):

if has_exefile(mpv):
config.PLAYER.set(mpv)

elif has_exefile(vlc):
config.PLAYER.set(vlc)

elif has_exefile(mplayer):
config.PLAYER.set(mplayer)

config.save()

else:
config.load()
assign_player(config.PLAYER.get) # Player is not assigned when config is loaded
try:
assign_player(config.PLAYER.get) # Player is not assigned when config is loaded
except FileNotFoundError:
print("Configured player " + config.PLAYER.get + " does not exist.")
print("A new one must be specified by the command 'set player <mplayer|mpv|vlc>' within the app")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set player is not limited to mplayer, mpv and vlc.

input("Press Enter to continue")

_init_readline()
cache.load()
Expand Down