cgomesu / tvhlink

TVHlink (Tvheadend + Streamlink) integration
https://cgomesu.com/blog/Tvhlink
55 stars 8 forks source link

Tvheadend playlist playback problem #15

Closed muzena closed 2 years ago

muzena commented 2 years ago

Hi @cgomesu I use Tvheadend on PC with dvb-C tuner card for managing/watching dvb-c channels. I follow your tutorial and try to add your youtube.m3u playlist to Tvheadend. When I start streamlink with youtube video link from terminal, link is working in vlc player. But when I start channel from imported playlist in Tvheadend I get this error in Tvheadend debug window:

Tvheadend error ``` 2022-04-04 13:09:39.050 mpegts: youtube.m3u - Euronews English in Youtube Playlist - tuning on IPTV #1 2022-04-04 13:09:39.065 subscription: 0691: "HTTP" subscribing on channel "Euronews English", weight: 100, adapter: "IPTV #1", network: "Youtube Playlist", mux: "youtube.m3u - Euronews English", service: "Euronews English", profile="webtv-vp8-vorbis-webm", hostname="::ffff:192.168.0.11", client="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36" 2022-04-04 13:09:39.065 spawn: Executing "/usr/bin/env" 2022-04-04 13:09:39.436 spawn: Traceback (most recent call last): 2022-04-04 13:09:39.436 spawn: File "/usr/bin/streamlink", line 33, in 2022-04-04 13:09:39.436 spawn: sys.exit(load_entry_point('streamlink==3.1.1', 'console_scripts', 'streamlink')()) 2022-04-04 13:09:39.436 spawn: File "/usr/share/streamlink/streamlink_cli/main.py", line 1000, in main 2022-04-04 13:09:39.436 spawn: setup_config_args(parser, ignore_unknown=True) 2022-04-04 13:09:39.436 spawn: File "/usr/share/streamlink/streamlink_cli/main.py", line 669, in setup_config_args 2022-04-04 13:09:39.436 spawn: for config_file in filter(lambda path: path.is_file(), CONFIG_FILES): 2022-04-04 13:09:39.436 spawn: File "/usr/share/streamlink/streamlink_cli/main.py", line 669, in 2022-04-04 13:09:39.436 spawn: for config_file in filter(lambda path: path.is_file(), CONFIG_FILES): 2022-04-04 13:09:39.436 spawn: File "/usr/lib/python3.8/pathlib.py", line 1439, in is_file 2022-04-04 13:09:39.436 spawn: return S_ISREG(self.stat().st_mode) 2022-04-04 13:09:39.436 spawn: File "/usr/lib/python3.8/pathlib.py", line 1198, in stat 2022-04-04 13:09:39.436 spawn: return self._accessor.stat(self) 2022-04-04 13:09:39.436 spawn: PermissionError: [Errno 13] Permission denied: '/home/hts/.config/streamlink/config' 2022-04-04 13:09:39.436 spawn: Error in sys.excepthook: 2022-04-04 13:09:39.436 spawn: Traceback (most recent call last): 2022-04-04 13:09:39.436 spawn: File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 153, in apport_excepthook 2022-04-04 13:09:39.436 spawn: with os.fdopen(os.open(pr_filename, 2022-04-04 13:09:39.436 spawn: FileNotFoundError: [Errno 2] No such file or directory: '/var/crash/_usr_share_streamlink_streamlink.126.crash' 2022-04-04 13:09:39.436 spawn: Original exception was: 2022-04-04 13:09:39.436 spawn: Traceback (most recent call last): 2022-04-04 13:09:39.436 spawn: File "/usr/bin/streamlink", line 33, in 2022-04-04 13:09:39.436 spawn: sys.exit(load_entry_point('streamlink==3.1.1', 'console_scripts', 'streamlink')()) 2022-04-04 13:09:39.436 spawn: File "/usr/share/streamlink/streamlink_cli/main.py", line 1000, in main 2022-04-04 13:09:39.436 spawn: setup_config_args(parser, ignore_unknown=True) 2022-04-04 13:09:39.436 spawn: File "/usr/share/streamlink/streamlink_cli/main.py", line 669, in setup_config_args 2022-04-04 13:09:39.436 spawn: for config_file in filter(lambda path: path.is_file(), CONFIG_FILES): 2022-04-04 13:09:39.436 spawn: File "/usr/share/streamlink/streamlink_cli/main.py", line 669, in 2022-04-04 13:09:39.436 spawn: for config_file in filter(lambda path: path.is_file(), CONFIG_FILES): 2022-04-04 13:09:39.436 spawn: File "/usr/lib/python3.8/pathlib.py", line 1439, in is_file 2022-04-04 13:09:39.436 spawn: return S_ISREG(self.stat().st_mode) 2022-04-04 13:09:39.436 spawn: File "/usr/lib/python3.8/pathlib.py", line 1198, in stat 2022-04-04 13:09:39.436 spawn: return self._accessor.stat(self) 2022-04-04 13:09:39.436 spawn: PermissionError: [Errno 13] Permission denied: '/home/hts/.config/streamlink/config' 2022-04-04 13:09:39.474 iptv: stdin pipe 188 unexpectedly closed: No data ```

I don't know is it problem in Tvheadend, streamlink, or why is streamlink options is in '/home/hts/.config/streamlink/config' folder, or is problem in permissions of this folder.

cgomesu commented 2 years ago

I've never seen that issue before, @muzena. How did you install streamlink on that host? which streamlink should indicate where the executable is being called from. For reference, it should be accessible globally for TVH to be able to use it. (If you check closed issues here, you'll find a few users who had issues with that and how they fixed them.) If everything looks good, start by upgrading your streamlink (it looks like you are still on 3.1.1). Also, I think py 3.8 is still supported but all my hosts have been running 3.9 for some time now, so you might want to give that one a try (i.e., upgrade Python).

why is streamlink options is in '/home/hts/.config/streamlink/config' folder, or is problem in permissions of this folder.

https://streamlink.github.io/latest/cli/config.html

You try setting the environmental variables (${XDG_CONFIG_HOME:-${HOME}/.config}) before issuing the streamlink command when running from TVH or using the --config option.

muzena commented 2 years ago

I install debian package and tried pip install 3.1.2, tried also --config options and manually creating /hts/.config/streamlink/config' folder, changing group to hts and owner, but nothing work.

muzena commented 2 years ago

And this config paths https://streamlink.github.io/latest/cli/config.html does not exist on my system, i tried to create them manually also.

cgomesu commented 2 years ago

did you install via apt or pip?

Message ID: @.***>

muzena commented 2 years ago

I tried and apt and pip and appimage version

cgomesu commented 2 years ago

pip install 3.1.2

the latest streamlink version is 3.2.0, though, so this looks strange already.

in any case, start by uninstalling all versions you installed on your host machine (uninstall via pip, purge via apt). then, install it via pip as follows:

sudo python3 -m pip install --upgrade pip setuptools
sudo python3 -m pip install streamlink

this should upgrade pip and setuptools and then install streamlink globally.

after that, try running streamlink with your own user, as follows:

streamlink --stdout https://www.youtube.com/c/FRANCE24English best

and hit Ctrl+c to interrupt once you start seeing a bunch on random characters on your terminal. if you do not see this, then there's an issue and you should talk with the folks at the Streamlink Github repo. otherwise, go to your TVH server and try running a channel that uses a pipe:// command with streamlink and check the logs for error messages.

if you continue having issues, I'll suggest you to try the Docker container for TVH instead.

muzena commented 2 years ago

ok I trying now on clean install on Ubuntu 22.04 on laptop

muzena commented 2 years ago

I trying now on clean install on Ubuntu 22.04 on laptop

On clean installation it works. Problem is in old python3.8 version. I tried to upgrade from this tutorial but , this gave me another error, then resolve this error, then again another error, and error after error, etc.

cgomesu commented 2 years ago

glad you managed to find the culprit. re the python upgrade issue, try uninstalling your current python version completely first, then install either python 3.9 (or 3.10) from apt or install it from source. for the apt method (recommended), you can type sudo apt info ptyhon3.9 to check if it can find a valid candidate in your apt repos. in Debian bullseye, for example, I can find 3.9.2-1 in the main branch:

Package: python3.9
Version: 3.9.2-1
Priority: optional
Section: python
Maintainer: Matthias Klose <doko@debian.org>
Installed-Size: 554 kB
Depends: python3.9-minimal (= 3.9.2-1), libpython3.9-stdlib (= 3.9.2-1), media-types | mime-support
Suggests: python3.9-venv, python3.9-doc, binutils
Breaks: python3-all (<< 3.6.5~rc1-1), python3-dev (<< 3.6.5~rc1-1), python3-venv (<< 3.6.5-2)
Download-Size: 466 kB
APT-Manual-Installed: no
APT-Sources: http://deb.debian.org/debian bullseye/main amd64 Packages
Description: Interactive high-level object-oriented language (version 3.9)
 Python is a high-level, interactive, object-oriented language. Its 3.9 version
 includes an extensive class library with lots of goodies for
 network programming, system administration, sounds and graphics.

please notice that if you uninstall your current python, you do need to reinstall pip and then, install both setuptools and streamlink via pip (Python's package manager).

muzena commented 2 years ago

I found/resolve this problem. Problem was in .config folder with some symlink:

/home/hts/.config/pulse/82929df7ee394b73b81252fe3b4e5020-runtime

After removing this folder, the streamlink has worked.

muzena commented 2 years ago

Can you add this livestream to youtube.m3u playlist? https://www.youtube.com/channel/UC_yXEx3-Gk5drg9qhPzSQSg

cgomesu commented 2 years ago

Hurrah! Nicely done, @muzena. I'll go ahead and close this issue then.

Can you add this livestream to youtube.m3u playlist? https://www.youtube.com/channel/UC_yXEx3-Gk5drg9qhPzSQSg

Just added it via 8c474743319fb88ef7562cc5d2303873a030063e. If you configured your TVH server to fetch from my repo, it should automatically update the list of channels in an hour or so.