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 different issues #872

Open
wants to merge 1 commit 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: 8 additions & 4 deletions mps_youtube/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,11 @@ def play(self, songlist, shuffle=False, repeat=False, override=False):
break

# skip forbidden, video removed/no longer available, etc. tracks
except TypeError:
# when receiving an HTTPError, the player should continue
except (TypeError, HTTPError) as e:
self.song_no += 1
if self.song_no == len(songlist):
g.message = util.F('cant get track') % str(e)
pass

if config.SET_TITLE.get:
Expand Down Expand Up @@ -124,9 +127,8 @@ def _playsong(self, failcount=0, softrepeat=False):
if config.NOTIFIER.get:
subprocess.Popen(shlex.split(config.NOTIFIER.get) + [self.song.title])

size = streams.get_size(self.song.ytid, self.stream['url'])
songdata = (self.song.ytid, self.stream['ext'] + " " + self.stream['quality'],
int(size / (1024 ** 2)))
int(self.stream['size'] / (1024 ** 2)))
self.songdata = "%s; %s; %s Mb" % songdata
screen.writestatus(self.songdata)

Expand Down Expand Up @@ -344,10 +346,12 @@ def stream_details(song, failcount=0, override=False, softrepeat=False):
m4a = "mplayer" not in config.PLAYER.get
cached = g.streams[song.ytid]
stream = streams.select(cached, q=failcount, audio=(not video), m4a_ok=m4a)
stream['size'] = streams.get_size(song.ytid, stream['url'])

# handle no audio stream available, or m4a with mplayer
# by switching to video stream and suppressing video output.
if (not stream or failcount) and not video:
# only do that on the last try of failcount
if (not stream and failcount == g.max_retries) and not video:
util.dbg(c.r + "no audio or mplayer m4a, using video stream" + c.w)
override = "a-v"
video = True
Expand Down