Skip to content

Conversation

@RomanKornev
Copy link
Contributor

@RomanKornev RomanKornev commented Jan 1, 2019

After #1576 we can add window title support to other players.

Due to limitations of PotPlayer, titles can only be added to URL streams and there is no separate title argument.
PotPlayer command line documentation in PotPlayer - About - Command Line:

  • You can specify titles for URLs by separating them with a backslash (\) at the end of URLs. ("http://...\title of this url")

Because of this, the title needs to be appended at the end of the filename so args need to be formatted after player check.

Here's an example of it working on Windows 10:
potplayer-title

@codecov
Copy link

codecov bot commented Jan 1, 2019

Codecov Report

Merging #2224 into master will increase coverage by 0.28%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #2224      +/-   ##
==========================================
+ Coverage   52.36%   52.65%   +0.28%     
==========================================
  Files         237      237              
  Lines       14712    14751      +39     
==========================================
+ Hits         7704     7767      +63     
+ Misses       7008     6984      -24

@codecov
Copy link

codecov bot commented Jan 1, 2019

Codecov Report

Merging #2224 into master will decrease coverage by 0.18%.
The diff coverage is 60%.

@@            Coverage Diff             @@
##           master    #2224      +/-   ##
==========================================
- Coverage   52.36%   52.18%   -0.19%     
==========================================
  Files         237      237              
  Lines       14712    14715       +3     
==========================================
- Hits         7704     7679      -25     
- Misses       7008     7036      +28

@RomanKornev
Copy link
Contributor Author

Added tests

@beardypig
Copy link
Member

Thanks for the PR @RomanKornev. Does the titles work with named pipes too? Maybe PotPlayer doesn't work with named pipes anyway. Can you test it with a title that has some quote characters? eg. --title "A \"{title}\""?

@RomanKornev
Copy link
Contributor Author

Does the titles work with named pipes too? Maybe PotPlayer doesn't work with named pipes anyway.

It doesn't work with named pipes: https://streamlink.github.io/players.html.
Is filename always "-" for regular stdin pipes?
In that case, title should remain Streaming media (stdin). Sadly, I haven't found a way to feed a title using stdin pipe to PotPlayer.

Can you test it with a title that has some quote characters? eg. --title "A \"{title}\""?

Upon further examination, PotPlayer just deletes any quotes anyway and doesn't recognize anything after closing quote. So before \"STREAMTITLE\" after would be before STREAMTITLE.
In that case, it might be better to just explicitly delete double quotes before passing the title.
Then --title "before \"{title}\" \"{author}\" after" would be before STREAMTITLE AUTHOR after.

"vlc": ["vlc", "vlc.exe"],
"mpv": ["mpv", "mpv.exe"]
"mpv": ["mpv", "mpv.exe"],
"pot": ["potplayer", "potplayermini64.exe", "potplayermini.exe"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there even a potplayer binary? as this player is windows only.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now tests are failing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Failing test:

self.assertEqual("potplayer", PlayerOutput.supported_player("C:\\PotPlayer\\PotPlayerMini64.exe"))

Unable to reproduce on Windows. Something to do with

if not is_win32:
# under a POSIX system use shlex to find the actual command
# under windows this is not an issue because executables end in .exe
cmd = shlex.split(cmd)[0]
cmd = os.path.basename(cmd.lower())
for player, possiblecmds in SUPPORTED_PLAYERS.items():
for possiblecmd in possiblecmds:
if cmd.startswith(possiblecmd):
return player

Is .exe getting split?

Copy link
Collaborator

Choose a reason for hiding this comment

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

it can't work there with cmd.startswith(possiblecmd)
seems like you need potplayer as a binary here to avoid bigger code changes

this is the output on linux

_________________________________________________________________________________________________________ TestPlayerOutput.test_supported_player_args_win32 _________________________________________________________________________________________________________

self = <tests.test_output.TestPlayerOutput testMethod=test_supported_player_args_win32>

    @patch("streamlink_cli.output.os.path.basename", new=ntpath.basename)
    def test_supported_player_args_win32(self):
        self.assertEqual("mpv",
                         PlayerOutput.supported_player("C:\\MPV\\mpv.exe --argh"))
        self.assertEqual("vlc",
                         PlayerOutput.supported_player("C:\\VLC\\vlc.exe --argh"))
        self.assertEqual("potplayer",
>                        PlayerOutput.supported_player("C:\\PotPlayer\\PotPlayerMini64.exe --argh"))
E       AssertionError: 'potplayer' != None

tests/test_output.py:43: AssertionError
----------------------------------------------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------------------------------------------
---
player = vlc
cmd = mpvmpv.exe
possiblecmd = vlc
possiblecmd = vlc.exe
---
player = mpv
cmd = mpvmpv.exe
possiblecmd = mpv
---
player = vlc
cmd = vlcvlc.exe
possiblecmd = vlc
---
player = vlc
cmd = potplayerpotplayermini64.exe
possiblecmd = vlc
possiblecmd = vlc.exe
---
player = mpv
cmd = potplayerpotplayermini64.exe
possiblecmd = mpv
possiblecmd = mpv.exe
---
player = potplayer
cmd = potplayerpotplayermini64.exe
possiblecmd = potplayermini64.exe
possiblecmd = potplayermini.exe
___________________________________________________________________________________________________________ TestPlayerOutput.test_supported_player_win32 ____________________________________________________________________________________________________________

self = <tests.test_output.TestPlayerOutput testMethod=test_supported_player_win32>

    @patch("streamlink_cli.output.os.path.basename", new=ntpath.basename)
    def test_supported_player_win32(self):
        self.assertEqual("mpv",
                         PlayerOutput.supported_player("C:\\MPV\\mpv.exe"))
        self.assertEqual("vlc",
                         PlayerOutput.supported_player("C:\\VLC\\vlc.exe"))
        self.assertEqual("potplayer",
>                        PlayerOutput.supported_player("C:\\PotPlayer\\PotPlayerMini64.exe"))
E       AssertionError: 'potplayer' != None

tests/test_output.py:27: AssertionError
----------------------------------------------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------------------------------------------
---
player = vlc
cmd = mpvmpv.exe
possiblecmd = vlc
possiblecmd = vlc.exe
---
player = mpv
cmd = mpvmpv.exe
possiblecmd = mpv
---
player = vlc
cmd = vlcvlc.exe
possiblecmd = vlc
---
player = vlc
cmd = potplayerpotplayermini64.exe
possiblecmd = vlc
possiblecmd = vlc.exe
---
player = mpv
cmd = potplayerpotplayermini64.exe
possiblecmd = mpv
possiblecmd = mpv.exe
---
player = potplayer
cmd = potplayerpotplayermini64.exe
possiblecmd = potplayermini64.exe
possiblecmd = potplayermini.exe

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted back to previous binary name.

"vlc": ["vlc", "vlc.exe"],
"mpv": ["mpv", "mpv.exe"]
"mpv": ["mpv", "mpv.exe"],
"pot": ["potplayer", "potplayermini64.exe", "potplayermini.exe"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Potplayer is always used as Potplayer

I can't find any references with just the name pot
so it should be named potplayer instead of pot

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed

-- Remove potplayer binary name
-- Fix tests
@back-to back-to merged commit 5075a5e into streamlink:master Feb 9, 2019
@RomanKornev RomanKornev deleted the potplayer-title branch February 11, 2019 11:02
jackyzy823 pushed a commit to jackyzy823/streamlink that referenced this pull request Mar 20, 2019
Billy2011 pushed a commit to Billy2011/streamlink-27 that referenced this pull request May 14, 2020
mkbloke pushed a commit to mkbloke/streamlink that referenced this pull request Aug 18, 2020
resiproxy pushed a commit to resiproxy/streamlink that referenced this pull request Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants