Skip to content

draw a progress bar while playing a song#45

Merged
np1 merged 1 commit intomps-youtube:popen-non-slavefrom
thomasleveil:popen-non-slave/progress-bar
Mar 9, 2014
Merged

draw a progress bar while playing a song#45
np1 merged 1 commit intomps-youtube:popen-non-slavefrom
thomasleveil:popen-non-slave/progress-bar

Conversation

@thomasleveil
Copy link
Copy Markdown
Contributor

example output:

 ab9176Srb5Y; ogg; 3 Mb; 01:42 (39%)  [===========>..................]

@np1
Copy link
Copy Markdown
Contributor

np1 commented Mar 9, 2014

Thanks! Pretty neat!

I can't get this branch to play nicely with mpv. I realise the regex's need to be different for capturing the mpv output, but the issue is that when mpv is called it doesn't receive the keyboard input (q is echoed in the terminal window instead). I think it's to do with the red warning box described here: http://docs.python.org/2/library/subprocess.html#popen-objects

Another issue is that it doesn't work in Python3. When playing an item I get:

Traceback (most recent call last):                                          
  File "./mpsyt", line 2942, in <module>
    main()
  File "./mpsyt", line 2912, in main
    if matchfunction(k, v, userinput):
  File "./mpsyt", line 2824, in matchfunction
    globals()[funcname](*matches)
  File "./mpsyt", line 1897, in play
    play_range(songlist, shuffle, repeat, override)
  File "./mpsyt", line 1984, in play_range
    playsong(song, override=override)
  File "./mpsyt", line 1266, in playsong
    mplayer_status(p, songdata + ";")
  File "./mpsyt", line 1315, in mplayer_status
    if char in '\r\n':
TypeError: 'in <string>' requires string as left operand, not bytes

I tried messing with str and encode/decode but couldn't get it to work.

Having said that, I really appreciate these changes and want to include them in the main branch but at the moment they only work with Python 2 and mplayer. Not sure it works on Windows, I haven't tested it, I assume it does since you submitted it! Neither of the problems mentioned above are specific to this pull request.

@np1 np1 merged commit 1adb2a2 into mps-youtube:popen-non-slave Mar 9, 2014
@thomasleveil thomasleveil deleted the popen-non-slave/progress-bar branch March 9, 2014 18:04
@thomasleveil
Copy link
Copy Markdown
Contributor Author

Another issue is that it doesn't work in Python3
...
I tried messing with str and encode/decode but couldn't get it to work.

see #46

@np1
Copy link
Copy Markdown
Contributor

np1 commented Mar 9, 2014

Cool that works, thank you 👍

@thomasleveil
Copy link
Copy Markdown
Contributor Author

I can't get this branch to play nicely with mpv. I realise the regex's need to be different for capturing the mpv output

I can't get mpv working on my Windows system, nor can I succeed to compile or install it on my Ubuntu Quantal vm. Could give me an example of output from mpv so I can rework a regex ?

@np1
Copy link
Copy Markdown
Contributor

np1 commented Mar 9, 2014

Sure:

A: 00:00:07 / 00:05:37 (2%) Cache: 46%

and for video:

AV: 00:00:03 / 00:03:30 (1%) A-V: -0.000 Cache: 14%

@np1
Copy link
Copy Markdown
Contributor

np1 commented Mar 9, 2014

It looks like mpv is sending the progress time data to stderr, that could be the reason I was having the issues I mentioned earlier.

@thomasleveil
Copy link
Copy Markdown
Contributor Author

See #47 for mpv support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants