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

Additional information displayed #163

Merged
merged 2 commits into from
Dec 1, 2014
Merged
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: 9 additions & 3 deletions mps_youtube/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1788,7 +1788,7 @@ def generate_real_playerargs(song, override, failcount):
"Use mpv or download it" % song.title)

size = get_size(song.ytid, stream['url'])
songdata = song.ytid, stream['ext'], int(size / (1024 ** 2))
songdata = song.ytid, stream['ext'] + "@" + stream['quality'], int(size / (1024 ** 2))

Choose a reason for hiding this comment

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

The extra characters may cause the line to wrap around sometimes. Is it possible to adjust the width of the progress bar dynamically (according to the width of the information on the left)?

Copy link
Author

Choose a reason for hiding this comment

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

Problem is at line 1999, the size of the bar is not dynamically adjusted to the length of the information displayed before. I don't have access to the length of this text in the "make_status_line" function, however, so a quick fix would be to replace 50 by 54, which happens be sufficient. Does it seem ok?

Choose a reason for hiding this comment

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

That seems like a reasonable hot fix without changing much of the existing structure! @np1 what do you think of it?


# pylint: disable=E1103
# pylint thinks PLAYERARGS.get might be bool
Expand Down Expand Up @@ -1996,7 +1996,7 @@ def player_status(po_obj, prefix="", songlength=0, mpv=False):
def make_status_line(match_object, songlength=0):
""" Format progress line output. """
cw = getxy("width")
progress_bar_size = cw - 50
progress_bar_size = cw - 54

try:
h, m, s = map(int, match_object.groups())
Expand Down Expand Up @@ -2203,7 +2203,7 @@ def search(term, page=1, splash=True):


def user_pls(user, page=1, splash=True):
""" Retrieve use playlists. """
""" Retrieve user playlists. """
user = {"is_user": True, "term": user}
return pl_search(user, page=page, splash=splash)

Expand Down Expand Up @@ -3635,6 +3635,12 @@ def info(num):
out += i("\nCategory : " + p.category)
out += i("\nLink : " + "https://youtube.com/watch?v=%s" %
p.videoid)
# Information on streams
out += i("\nAvailable streams:")
for s in p.allstreams:
out += i("\n " + s.mediatype + " (" + s.extension + ") @ " + s.quality)


out += i("\n\n%s[%sPress enter to go back%s]%s" % (c.y, c.w, c.y, c.w))
g.content = out

Expand Down