trizen / pipe-viewer

A lightweight YouTube client for Linux, without requiring an API key.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bind pipe-viewer to the initial desktop?

TheChymera opened this issue · comments

So if I start playing a series of videos, once a video finishes and a new one starts, I get am mpv window popping up in whatever desctop is focused. Can I make it just use whatever desktop it was started on, i.e. start subsequent mpv windows in place of the original one?

To get mpv to start in a workspace check the geometry option. And to use the same window and not create another check the umpv script.

@sun95n thanks for the suggestion, I tried setting the following in my pipe-viewer config file:

...
  video_player_selected         => "umpv",
  video_players                 => {
                                     umpv => {
                                              arg => "--really-quiet --force-media-title=*TITLE* --no-ytdl *VIDEO*",
                                              audio => "--audio-file=*AUDIO*",
                                              cmd => "/usr/bin/umpv",
                                              fs => "--fullscreen",
                                              novideo => "--no-video",
                                              srt => "--sub-file=*SUB*",
                                            },
...

But now the mpv window does not play any sound. This is weird since both umpv and mpv play fine when pointed to a downloaded video on my local storage.

I also checked and the player is unmuted and the volume is set to a decent level, so it didn't just inherit parameters from some past instance (not that I think it should).

Yes that's because umpv is a python script (not a player). So you don't need to modify video_player_selected and video_players section just cmd.

@sun95n still no sound:

  video_player_selected         => "mpv",
  video_players                 => {
                                     mpv => {
                                              arg => "--really-quiet --force-media-title=*TITLE* --no-ytdl *VIDEO*",
                                              audio => "--audio-file=*AUDIO*",
                                              cmd => "umpv",
                                              fs => "--fullscreen",
                                              novideo => "--no-video",
                                              srt => "--sub-file=*SUB*",
                                            },

The umpv description within the script seems to indicate that it does not take command line arguments, maybe that's confusing it somehow? also tried to delete all the arguments from the video_players section, and no improvement. How did you get it to work?

Hi. Maybe you are forgetting something. These are my settings:

video_player_selected       => "mpv",
video_players               => {
                                   mpv => {
                                            arg   => "--really-quiet --force-media-title=*TITLE* --no-terminal *URL*",
                                            audio => "--audio-file=*AUDIO*",
                                            cmd   => "/usr/local/bin/umpv",
                                            fs    => "--fullscreen",
                                            srt   => "--sub-file=*SUB*",
                                          },

UPDATE: You need to pass the URL to mpv if you don't want to have problems with the *TITLE* string (I opened a new thread to deal with this problem). Please check my options again I modified arg to achieve what you want.

@sun95n with your settings it just won't play past the first video. (=mpv-0.35.0 and =pipe-viewer-0.4.4)

Output from pipe-viewer:

-> Command: /usr/bin/umpv --audio-file=https\:\/\/rr1\-\-\-sn\-bvvbax\-cvne\.googlevideo\.com\/videoplayback\?expire\=1672738696\&ei\=KKOzY_DBGIHHhwaR76WIDg\&ip\=2601\%3A18c\%3A4300\%3A6e21\%3A3de5\%3A1826\%3Aef82\%3A67f1\&id\=o\-AHS_xZT25wR4SN415hFz3Y01R4TVSUfPFQ7\-o7DRtbvS\&itag\=251\&source\=youtube\&requiressl\=yes\&mh\=du\&mm\=31\%2C29\&mn\=sn\-bvvbax\-cvne\%2Csn\-ab5l6nrr\&ms\=au\%2Crdu\&mv\=m\&mvi\=1\&pl\=34\&initcwndbps\=1833750\&vprv\=1\&mime\=audio\%2Fwebm\&gir\=yes\&clen\=5492980\&dur\=356\.021\&lmt\=1647354005213211\&mt\=1672716824\&fvip\=5\&keepalive\=yes\&fexp\=24001373\%2C24007246\&c\=ANDROID\&txp\=4532434\&sparams\=expire\%2Cei\%2Cip\%2Cid\%2Citag\%2Csource\%2Crequiressl\%2Cvprv\%2Cmime\%2Cgir\%2Cclen\%2Cdur\%2Clmt\&sig\=AOq0QJ8wRQIhANX6hbUTtgUHVMLtrzsHvOW3ERYQEJ\-sAcU4D83I4GFDAiBfsAmPHaqeFh_dFOA23cceY35dmJkB8sT\-Z_pPxpjJDQ\%3D\%3D\&lsparams\=mh\%2Cmm\%2Cmn\%2Cms\%2Cmv\%2Cmvi\%2Cpl\%2Cinitcwndbps\&lsig\=AG3C_xAwRgIhAOCPzSUe8QkpmUuNU3fVt_0OkpDRnbcFxEqaK3Nk7jNlAiEA54fORiOYYLk4d4DfX_wwdEDSj_GLJ\-ZimvcI59rHTQY\%3D --sub-file=\/home\/chymera\/\.cache\/pipe\-viewer\/uHKfrz65KSU_en\.srt --really-quiet --force-media-title=Baby\ Cats\ \-\ Cute\ and\ Funny\ Cat\ Videos\ Compilation\ \#8\ \|\ Aww\ Animals --no-terminal https\:\/\/www\.youtube\.com\/watch\?v\=uHKfrz65KSU
Traceback (most recent call last):
  File "/usr/bin/umpv", line 86, in <module>
    subprocess.check_call(opts)
  File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['mpv', '--no-terminal', '--force-window', '--input-ipc-server=/home/chymera/.umpv_socket', '--', '/home/chymera/--audio-file=https:/rr1---sn-bvvbax-cvne.googlevideo.com/videoplayback?expire=1672738696&ei=KKOzY_DBGIHHhwaR76WIDg&ip=2601%3A18c%3A4300%3A6e21%3A3de5%3A1826%3Aef82%3A67f1&id=o-AHS_xZT25wR4SN415hFz3Y01R4TVSUfPFQ7-o7DRtbvS&itag=251&source=youtube&requiressl=yes&mh=du&mm=31%2C29&mn=sn-bvvbax-cvne%2Csn-ab5l6nrr&ms=au%2Crdu&mv=m&mvi=1&pl=34&initcwndbps=1833750&vprv=1&mime=audio%2Fwebm&gir=yes&clen=5492980&dur=356.021&lmt=1647354005213211&mt=1672716824&fvip=5&keepalive=yes&fexp=24001373%2C24007246&c=ANDROID&txp=4532434&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIhANX6hbUTtgUHVMLtrzsHvOW3ERYQEJ-sAcU4D83I4GFDAiBfsAmPHaqeFh_dFOA23cceY35dmJkB8sT-Z_pPxpjJDQ%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhAOCPzSUe8QkpmUuNU3fVt_0OkpDRnbcFxEqaK3Nk7jNlAiEA54fORiOYYLk4d4DfX_wwdEDSj_GLJ-ZimvcI59rHTQY%3D', '/home/chymera/--sub-file=/home/chymera/.cache/pipe-viewer/uHKfrz65KSU_en.srt', '/home/chymera/--really-quiet', '/home/chymera/--force-media-title=Baby Cats - Cute and Funny Cat Videos Compilation #8 | Aww Animals', '/home/chymera/--no-terminal', 'https://www.youtube.com/watch?v=uHKfrz65KSU']' returned non-zero exit status 3.

diff between my old config and the changes you proposed:

100,101c100,101
<   video_player_selected         => "mpv",
<   video_players                 => {
---
>   video_player_selected       => "mpv",
>   video_players               => {
103c103
<                                               arg => "--force-media-title=*TITLE* --no-ytdl *VIDEO*",
---
>                                               arg   => "--really-quiet --force-media-title=*TITLE* --no-terminal *URL*",
105,109c105,108
<                                               cmd => "mpv",
<                                               fs => "--fullscreen",
<                                               novideo => "--no-video",
<                                               srt => "--sub-file=*SUB*",
<                                             },
---
>                                               cmd   => "/usr/bin/umpv",
>                                               fs    => "--fullscreen",
>                                               srt   => "--sub-file=*SUB*",
>                                           },

Your output points to umpv failing to recognize the arg and audio keys. Try the following:

video_player_selected       => "mpv",
video_players               => {
                                   mpv => {
                                            arg   => "*URL*",
                                            audio => "",
                                            cmd   => "/usr/bin/umpv",
                                            fs    => "--fullscreen",
                                            srt   => "--sub-file=*SUB*",
                                          },

If it fails again check that it is not a problem with umpv script or mpv otherwise this will not work in your case although for me the previous configuration and this one did.

It plays, but the window does not remain in place, and after the video is over re-spawns in the focused desktop and not in place of the original window, here's the output from pipe-viewer --debug:

--------------------------------------------------------------------------------------------------------------------------------------------
                                              =>> Happy Doggos To Make Your Day Better 🐶🥰 <<=

-> Channel   : Fluppy
-> ChannelID : UCIDvgzmxcpil52HZifHHGZQ
-> VideoID   : xYABBedOkwk
-> Category  : Pets & Animals
-> Duration  : 10:37
-> Likes     : 9,357
-> Rating    : 69%
-> Views     : 550,455
-> Published : 1 year ago
--------------------------------------------------------------------------------------------------------------------------------------------
-> Resolution: 480
-> Video itag: 244
-> Audio itag: 251
-> Video type: video/webm
-> Audio type: audio/webm
-> Command: /usr/bin/umpv  https\:\/\/www\.youtube\.com\/watch\?v\=xYABBedOkwk
** POST https://youtubei.googleapis.com/youtubei/v1/player?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8 ==> 200 OK (1s)
:: Using `player_response` to extract the streaming URLs...
:: Found 19 streaming URLs...
:: Extracting video info using the fallback method...
** GET https://m.youtube.com/watch?hl=en&v=40RVG_ij-cY ==> 200 OK

=> Description
--------------------------------------------------------------------------------------------------------------------------------------------
...
--------------------------------------------------------------------------------------------------------------------------------------------
=> URL: https://www.youtube.com/watch?v=40RVG_ij-cY
--------------------------------------------------------------------------------------------------------------------------------------------
                                                =>> Cute Funny Doggos | Funny Pet Videos <<=

-> Channel   : Funny Pet Videos
-> ChannelID : UCYK1TyKyMxyDQU8c6zF8ltg
-> VideoID   : 40RVG_ij-cY
-> Duration  : 10:39
-> Likes     : 974
-> Rating    : 61%
-> Views     : 79,857
-> Published : Mar 27, 2020
--------------------------------------------------------------------------------------------------------------------------------------------
-> Resolution: 480
-> Video itag: 244
-> Audio itag: 251
-> Video type: video/webm; codecs="vp9"
-> Audio type: audio/webm; codecs="opus"
-> Command: /usr/bin/umpv  https\:\/\/www\.youtube\.com\/watch\?v\=40RVG_ij\-cY
** POST https://youtubei.googleapis.com/youtubei/v1/player?key=AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8 ==> 200 OK
:: Using `player_response` to extract the streaming URLs...
:: Found 25 streaming URLs...
:: Extracting video info using the fallback method...
** GET https://m.youtube.com/watch?hl=en&v=0DPZ9b9ZZr4 ==> 200 OK (1s)

=> Description
--------------------------------------------------------------------------------------------------------------------------------------------
...

I assume you mean mpv (video window) right?

Then review the options that deal with this behavior:
screen
geometry
autofit

Although if you mean the window generated by the GTK version of pipe-viewer then you should consider it a bug and report it. I can't deal with it because I don't work as a developer of this project. Sorry.