2bc4 / streamlink-ttvlol

Streamlink Twitch plugin modified to work with the TTV.LOL API
BSD 2-Clause "Simplified" License
158 stars 6 forks source link

--twitch-reexec-on-ad is broken with appimage #43

Closed DonKatsu closed 11 months ago

DonKatsu commented 1 year ago

I just started using streamlink and this plugin, so excuse me if I'm just doing something wrong. While playing a Twitch stream that has ads, streamlink gets an exception if --twitch-reexec-on-ad kicks in.

$ ./streamlink-5.5.1-2-cp311-cp311-manylinux2014_x86_64.AppImage  --twitch-ttvlol --twitch-reexec-on-ad --player=mpv --player-args="pause=no" https://www.twitch.tv/mogra best
[plugins.twitch][info] Streamlink Twitch plugin (2bc4 fork).
[plugins.twitch][info] Please report issues to https://github.com/2bc4/streamlink-ttvlol/issues
[cli][info] Found matching plugin twitch for URL https://www.twitch.tv/mogra
[plugins.twitch][info] Using playlist proxy 'https://api.ttv.lol'
[cli][info] Available streams: audio_only, 160p (worst), 360p, 480p, 720p60, 1080p60 (best)
[cli][info] Opening stream: 1080p60 (hls)
[cli][info] Starting player: mpv
[plugins.twitch][info] Encountered an ad segment, re-execing to retrieve a new playlist
Exception in thread Thread-TwitchHLSStreamWriter:
Traceback (most recent call last):
  File "/tmp/.mount_streamNES9hh/opt/python3.11/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/tmp/.mount_streamNES9hh/opt/python3.11/lib/python3.11/site-packages/streamlink/stream/segmented.py", line 209, in run
    self.write(segment, result, *data)
  File "/tmp/.mount_streamNES9hh/opt/python3.11/lib/python3.11/site-packages/streamlink/stream/hls.py", line 216, in write
    if not self.should_filter_sequence(sequence):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.local/share/streamlink/plugins/twitch.py", line 189, in should_filter_sequence
    os.execv(sys.argv[0], sys.argv)
PermissionError: [Errno 13] Permission denied
[cli][info] Stream ended
error: Error when reading from stream: Read timeout, exiting
[cli][info] Closing currently open stream...

Trying to play the stream without --twitch-reexec-on-ad gives me this every time:

$ ./streamlink-5.5.1-2-cp311-cp311-manylinux2014_x86_64.AppImage  --twitch-ttvlol --player=mpv --player-args="pause=no" https://www.twitch.tv/mogra best
[plugins.twitch][info] Streamlink Twitch plugin (2bc4 fork).
[plugins.twitch][info] Please report issues to https://github.com/2bc4/streamlink-ttvlol/issues
[cli][info] Found matching plugin twitch for URL https://www.twitch.tv/mogra
[plugins.twitch][info] Using playlist proxy 'https://api.ttv.lol'
[plugins.twitch][error] Unable to open URL: https://api.ttv.lol/playlist/mogra.m3u8%3Fplayer%3Dtwitchweb%26type%3Dany%26allow_source%3Dtrue%26allow_audio_only%3Dtrue%26allow_spectre%3Dfalse%26fast_bread%3Dtrue (500 Server Error: Internal Server Error for url: https://api.ttv.lol/playlist/mogra.m3u8%3Fplayer%3Dtwitchweb%26type%3Dany%26allow_source%3Dtrue%26allow_audio_only%3Dtrue%26allow_spectre%3Dfalse%26fast_bread%3Dtrue)
error: No playable streams found on this URL: https://www.twitch.tv/mogra

I'm using Fedora 38, the streamlink 5.5.1 appimage, and the latest release version (5.4.0-20230415) of this plugin placed in ~/.local/share/streamlink/plugins.

2bc4 commented 1 year ago

PermissionError: [Errno 13] Permission denied

It seems it breaks with streamlink as an appimage. I didn't test this so I'll need to debug.

In the meantime you can probably get it to work if you install streamlink using a different method such as through your package manager (sudo dnf install streamlink) or through pip.

Kryptortio commented 1 year ago

I'm having different issue with --twitch-reexec-on-ad I'm executing streamlink with a script and I believe (not sure how to confirm) that when this get's triggered the process returns to the script making it believe that recording has stopped. That means that my script will try to start another recording leading to duplicates.

Just figured I'd mention it since if there is a possibility to retry in the same process that could possibly solve both issues.

DonKatsu commented 1 year ago

In the meantime you can probably get it to work if you install streamlink using a different method such as through your package manager (sudo dnf install streamlink) or through pip.

Fedora's streamlink is a little bit behind (5.3.1) and I somehow overlooked the pip version, whoops. I'll definitely go with the latter.