interlark / ustvgo-iptv

USTVGO Free IPTV
154 stars 42 forks source link

Cannot start ustvgo-iptv using the Autostart tutorial provided by the script creator. #30

Closed Nostradamus1973 closed 2 years ago

Nostradamus1973 commented 2 years ago

Good morning everyone,

I've been using this script for a few days now and I'm LOVING it. Unfortunately, there is a huge problem for me because I can't get ustvgp-iptv to start as a service with Kubuntu 22.04; I've looked at the tutorial and gone through it repeatedly only to fail to start every time. Having to manually restart this won't work for me, so, I'm wondering if anyone else is having problems pertaining to Autostarting in Ubuntu. I've gone through the Autostart instruction set over and over again(without any luck), if someone could please help me with this I'd be very grateful.

Thank you for your help and time.

yarafie commented 2 years ago

Maybe you need to look into running this in a docker

Nostradamus1973 commented 2 years ago

As much as I'd like to start playing around with Docker, it's not going to happen in this case. Besides, when something doesn't work for me, my resolve becomes indelible until I solve the issue. I managed to get it working with Kubuntu 22.04 by adding: StartLimitBurst=0 In the [Service] section.... because the start request repeated too quickly and chmod u+x /home/USERNAME/.local/bin/ustvgo-iptv of course the USERNAME must be changed to whatever the person's username is After doing that everything seems to be working following several test-reboots.

I hope this helps anyone having the same problem as I did because this really is an amazing script.

interlark commented 2 years ago

By default, if systemd service failed 5 times within 10 seconds it won't try again no more. For some mysterious reasons your service failed to startup first N times.

Sure, you could put StartLimitBurst=0 in your service file, but I suggest you to add also RestartSec=1 to decrease stress on your server on possible infinite restart loops.

I could add disabling checking of service starts in README Autostart section later.

Nostradamus1973 commented 2 years ago

Thanks for that tip, I'll add RestartSec=1 into the [Service] section.

Unfortunately, I'm having a different problem that seemed to start yesterday and I can't seem to get it to stop with reboots or reloading the m3u/epg info. Videos will load and play, however, they only last approximately 45-55 seconds and then they stop, which is very reminiscent of the IPTVcat links that never really work. I was thinking it could be a VPN related issue, however, everything was working fine for a few days and now they are not.

Does anyone know what is causing this?

Thx again

interlark commented 2 years ago

That happens to all of your channels? What player do you use? Maybe Access logs show something suspicious?

Nostradamus1973 commented 2 years ago

Thank you for getting back to me, I really like your script and hope that I/we can figure out what is wrong because it's been ages since I've been excited about IPTV, the past frustrations of having channels go down like domino's daily steered me clear away from that insanity. Back to my current problem: It happens on all the USTVGO channels I've tried, I also have a few separate "backup channels" like NBC, CBS, FOX, ABC, and a few others that I've scraped from a few places, and those said backup channels work fine. I'm using the latest unstable version of Jellyfin to view the channels. Would you like to take a look at me logs?

interlark commented 2 years ago

Sure, attach it and I'll take a look.

Nostradamus1973 commented 2 years ago

Awesome, here you go

Nostradamus_JellyFin-log-8-2-22a.txt Nostradamus_JellyFin-ffmpeg-8-2-22a.txt

Thank you

interlark commented 2 years ago

Looks like you are using Web Jellyfin that can't passthrough existing HLS stream to the browser without re-encoding and uses ffmpeg (which I believe can decode HLS with only experimental options). 1) Why don't you use https://github.com/jellyfin/jellyfin-media-player? It has MPV backend and can directly consume HLS streams without re-encoding and loosing image quality. 2) Could you play IPTV with VLC, MPV or IPTVNator to understand whether the issue coming from jellyfin or whether it's a connection problem? I wrote about them here. 3) Also would be useful to see Access logs at the moment issue appears. image

Nostradamus1973 commented 2 years ago

Good morning, Thx for looking into my logs and giving me a direction to go in. Sorry for the delay, it's HOT where I am and my server rooms aren't very comfortable unless it's very early in the AM.

So, I tried a myriad of slightly different players for Jellyfin yesterday, I used the LG(WebOS), FireTV, AndroidTV, and also the linux version you referred to, all with the same results, within a minute the streams go dead. I did try the MPV method you mentioned and it seemed to play fine for the first minute, then I get errors and it moves onto the next stream: Playing: http://:6363/Cinemax/myStream/playlist.m3u8 AV: 00:01:11 / 00:01:11 (100%) A-V: 0.000 Dropped: 2127 Cache: 0.0s [ffmpeg] tcp: Connection to tcp://:6363 failed: Connection refused Failed to open http://:6363/Cinemax/myStream/playlist.m3u8. [ytdl_hook] ERROR: Unable to download webpage: <urlopen error [Errno 111] Connection refused> (caused by URLError(ConnectionRefusedError(111, 'Connection refused'))) [ytdl_hook] youtube-dl failed: unexpected error ocurred

Playing: http://:6363/CMT/myStream/playlist.m3u8 AV: 00:01:11 / 00:01:11 (100%) A-V: 0.000 Dropped: 2127 Cache: 0.0s [ffmpeg] tcp: Connection to tcp://:6363 failed: Connection refused Failed to open http://:6363/CMT/myStream/playlist.m3u8. [ytdl_hook] ERROR: Unable to download webpage: <urlopen error [Errno 111] Connection refused> (caused by URLError(ConnectionRefusedError(111, 'Connection refused'))) [ytdl_hook] youtube-dl failed: unexpected error ocurred

Playing: http://:6363/CN/myStream/playlist.m3u8 AV: 00:01:11 / 00:01:11 (100%) A-V: 0.000 Dropped: 2127 Cache: 0.0s [ffmpeg] tcp: Connection to tcp://:6363 failed: Connection refused Failed to open http://:6363/CN/myStream/playlist.m3u8. [ytdl_hook] ERROR: Unable to download webpage: <urlopen error [Errno 111] Connection refused> (caused by URLError(ConnectionRefusedError(111, 'Connection refused'))) [ytdl_hook] youtube-dl failed: unexpected error ocurred

Playing: http://:6363/CNBC/myStream/playlist.m3u8 AV: 00:01:11 / 00:01:11 (100%) A-V: 0.000 Dropped: 2127 Cache: 0.0s [ffmpeg] tcp: Connection to tcp://:6363 failed: Connection refused Failed to open http://:6363/CNBC/myStream/playlist.m3u8. AV: 00:01:11 / 00:01:11 (100%) A-V: 0.000 Dropped: 2127 Cache: 0.0s (+) Video --vid=1 (h264 640x360) (+) Audio --aid=1 (aac 2ch 48000Hz) (+) Video --vid=1 (h264 640x360) (+) Audio --aid=1 (aac 2ch 48000Hz) Subs --sid=1 (*) (eia_608) I removed the all IP addresses Besides failing with MPV, It also fails with VLC and Kubuntu's default media player.

My knowledge of linux is in the the User-Verse, not the Coding-Verse like you, so, I can't really tell if it's a ffmpeg issue or something else. I was ALMOST ready to drop into the Jellyfin Github thread and start asking them if they knew what-was-up, however, I'm glad I didn't given that this is happening outside of Jellyfin.

Do you have anymore suggestions for me to try or troubleshoot? I thought I gave you the logs right after my errors occurred, my apologies. How did you get that log GUI screen, and how can I get you the latest log after the errors? It may take a bit to get back to you given today is going to be HOT where I am, so, it may be tomorrow morning when I respond.

Thx again for your help and time.

interlark commented 2 years ago

You could find GUI app in Releases. It works the same as CLI, but with user friendly graphical interface.

  1. Do you use VPN, if so have you tried play streams without VPN?
  2. Do video plays well with your browser, for example https://ustvgo.tv/destination-america?
  3. Also try to play direct USTVGO channel stream with MPV or VLC, so we can understand if the problem related to aiohttp proxying server or to video playback itself. Here are steps of how to get the channel URL: 3.1 Open https://ustvgo.tv/destination-america 3.2 Press F12 to open Developer console 3.3 Paste the following code and hit Enter: document.getElementsByTagName('iframe')[0].contentDocument.querySelector('html>body>script').innerHTML.match("'(https:[^']+)'")[0] 3.4 It would give channel URL, you should play it with MPV or VLC, like mpv "https://h3.ustvgo.la/DA/myStream/playlist.m3u8?wmsAuthSign=c2VydmVyX3RpbWU9..." or vlc "https://h3.ustvgo.la/DA/myStream/playlist.m3u8?wmsAuthSign=c2VydmVyX3RpbWU9..." image

If you prefer use GUI, here's how you could open given URL with VLC:

  1. Open VLC and press Ctrl + N.
  2. Paste URL without quotation marks.
  3. Press "Play" button. image

The point is if VLC can play direct stream URL https://h3.ustvgo.la/DA/myStream/playlist.m3u8?wmsAuthSign=... and can not play our proxy URL http://localhost:6363/DA/myStream/playlist.m3u8 then the problem is related to the our proxying server, no to video playback or how ustvgo streaming ends handle your requests.

Nostradamus1973 commented 2 years ago

Okay, I'm very sorry for taking so long to get back here, we are experiencing a heat-wave in Rhode Island and I have very limited time in my study because the heat is unbearable in a small room that reaches over 100 degrees Fahrenheit quickly with a few PC's running. Your always so quick to get back to me and I feel terrible making you wait. Back to my situation: I'm not using a VPN for your script, I do have NordVPN(NordLynx) for my Linux-Mint NAS, BUT, I'm not using it for the rest of my network. So, I did as you said, I extrapolated the URL and dropped it into VLC and it played without incidence, same with Firefox when going to https://ustvgo.tv/destination-america as a web-page. So, is it like you said? Your proxy-server is creating this issue? If it is your proxy server, how come I am the only one experiencing it? Is there a solution to this? BTW, Thank you for taking the time to explain everything in detail, that sort of thing matters to me, it helps me understand your course of action, on top of me learning something Screenshot_20220809_094141 Screenshot_20220809_094018 EDIT: I figured that I should add this as it may help. I have Verizon FiOS, if it is a proxy server thing, I thought this info might help. Thx again

interlark commented 2 years ago

Indeed, you're the only person at the moment who bumped into this issue.

Could copy and send me your Access Logs during the issue, I still haven't got them from you? They could give a hint on server status codes.

You can get them by clicking "Access logs" checkbox in case you are using GUI Access logs

or by adding argument --access-logs if you're using CLI, for example ustvgo-iptv --access-logs

Nostradamus1973 commented 2 years ago

Good Morning, I'll get right on sending over the logs, I'll try opening a few streams and then send you the logs from those events. When using CLI, where are the logs located?

Nostradamus1973 commented 2 years ago

I figured out how to view the logs, but, in doing so stumbled across something. I just tried loading a few streams, and now they seem to be working for the first time, however there is a BIG catch. I stopped the service, by doing systemctl stop ustvgo and then I did ustvgo-iptv --access-logs and things seem to be working fine. I restarted Ubuntu to let the systemd service take over and now I'm back to square one. I did issue a command yesterday pip install ustvgo-iptv because 2 channels were added, so, I figured this would update things and I should be able to proceed normally. Could this be related to the issue? I then stopped the systemd service again using systemctl stop ustvgo and restarted it using ustvgo-iptv --access-logs and everything is working again. How can this be? ustvgo-working_8-10-22.txt

Nostradamus1973 commented 2 years ago

Just verify this again, for the 3rd time, I just restarted Ubuntu again and verified that the systemd service is running. systemd-ustvgo-running.txt The same problem persists. If I stop the service and run ustvgo-iptv everything seems to work perfectly fine, but, I can't close the terminal window(or hit Ctrl + C) OR autostart it which is what I really need. Why is it that it will run one way and not the other?

interlark commented 2 years ago

Hi. v0.1.8 with 2 extra channels have no any this issue related changes.

Your Access logs looks good. If I got you right, you have this issue when you run ustvgo as a systemd service and when you manually start ustvgo by running ustvgo-iptv command you have no troubles at all, is that right?

Maybe your service is configured wrong and it restarts over and over causing playback troubles. To check that you can read your systemd service logs by running following command journalctl -u ustvgo.service.

Also you could try to remove your current service and recreate it from scratch by guide in README's Autostart section. Probably I would write a script that installs systemd service automatically in future or a docker image.

Commands to remove your current systemd service:

sudo systemctl stop ustvgo
sudo systemctl disable ustvgo
sudo rm /etc/systemd/system/ustvgo.service
sudo systemctl daemon-reload
sudo systemctl reset-failed
Nostradamus1973 commented 2 years ago

Yes, correct. ustvgo as a sytemd service doesn't work, manually starting it via ustvgo-iptv works My ustvgo.service has the following in it: [Unit] Description=USTVGO Free IPTV After=network.target

[Service] User=nostradamus Type=notify Restart=always ExecStart=/home/nostradamus/.local/bin/ustvgo-iptv StartLimitBurst=0 RestartSec=1

[Install] WantedBy=multi-user.target

If you remember I was getting an error in the beginning where the request started too quickly, so, I added those 2 lines in the [Service] section Do I need to issue this journalctl -u ustvgo.service command while the service is running to access the service logs? Because I get the following when the service is not running(meaning I'm using the ustvgo-iptv command instead): nostradamus@Megalodon:~$ journalctl -u ustvgo.service Jul 31 10:47:16 Megalodon systemd[1]: Starting USTVGO Free IPTV... Jul 31 10:47:16 Megalodon systemd[1814]: ustvgo.service: Failed to determine user credentials: No such process Jul 31 10:47:16 Megalodon systemd[1814]: ustvgo.service: Failed at step USER spawning /home/nostradamus/.local/bin/ustvgo> Jul 31 10:47:16 Megalodon systemd[1]: ustvgo.service: Main process exited, code=exited, status=217/USER Jul 31 10:47:16 Megalodon systemd[1]: ustvgo.service: Failed with result 'exit-code'. Jul 31 10:47:16 Megalodon systemd[1]: Failed to start USTVGO Free IPTV. Jul 31 10:47:16 Megalodon systemd[1]: ustvgo.service: Scheduled restart job, restart counter is at 1. Jul 31 10:47:16 Megalodon systemd[1]: Stopped USTVGO Free IPTV. Jul 31 10:47:16 Megalodon systemd[1]: Starting USTVGO Free IPTV... Jul 31 10:47:16 Megalodon systemd[1889]: ustvgo.service: Failed to determine user credentials: No such process Jul 31 10:47:16 Megalodon systemd[1889]: ustvgo.service: Failed at step USER spawning /home/nostradamus/.local/bin/ustvgo> Jul 31 10:47:16 Megalodon systemd[1]: ustvgo.service: Main process exited, code=exited, status=217/USER Jul 31 10:47:16 Megalodon systemd[1]: ustvgo.service: Failed with result 'exit-code'. Jul 31 10:47:16 Megalodon systemd[1]: Failed to start USTVGO Free IPTV. Jul 31 10:47:16 Megalodon systemd[1]: ustvgo.service: Scheduled restart job, restart counter is at 2. Jul 31 10:47:16 Megalodon systemd[1]: Stopped USTVGO Free IPTV. Jul 31 10:47:16 Megalodon systemd[1]: Starting USTVGO Free IPTV... Jul 31 10:47:16 Megalodon systemd[1974]: ustvgo.service: Failed to determine user credentials: No such process Jul 31 10:47:16 Megalodon systemd[1974]: ustvgo.service: Failed at step USER spawning /home/nostradamus/.local/bin/ustvgo> Jul 31 10:47:16 Megalodon systemd[1]: ustvgo.service: Main process exited, code=exited, status=217/USER Jul 31 10:47:16 Megalodon systemd[1]: ustvgo.service: Failed with result 'exit-code'. I'll restart the service and BRB and see what response I get.

Nostradamus1973 commented 2 years ago

Oops, I'm sorry, that Log is HUGE and I just realized I can't get to the end of it showing today's date because it's massive. Is there another way to show the log? Do you still want me to remove my systemd service after seeing how I setup the autostart?

interlark commented 2 years ago

It have to be huge as the service restarts over and over all the time.

Yes, try to recreate it with StartLimitInterval=0, Type=simple and RestartSec=5 as it's written in the guide I mentioned earlier.

Nostradamus1973 commented 2 years ago

Okay, I did as you said, I used the newer setup instructions and Viola! It works!!! I know I told you how amazing your script is, now I'll add you to that same amazing category! HOLY MACARONI, You just made my day! Thank you!

I think I should note that these errors that were created happened because I'm not familiar with linux coding, I can do tons of utility work with CLI, but, in the end I created my own mess and you got me out of it, Thank You.

There are two more things I wanted to ask you: I'm not seeing teen-nick or reelz on my guide, if I ran pip install ustvgo-iptv again, would it install the latest version? Or could it be that those 2 channels reside in the 25 channels out of 100 that aren't available because I'm not behind the USTVGO VPN?

And lastly, I know you said your script updates twice per hour, should I set Jellyfin to update the guide that often as well?

interlark commented 2 years ago

I'm glad your issue is solved, it's hard to remotely debug such problems so I created a docker file to prevent something similar in future. With docker you get ustvgo-iptv server without any issues and autostart included with only one line installation command:

  docker run -d --name=ustvgo-iptv -p 6363:6363 --restart unless-stopped ghcr.io/interlark/ustvgo-iptv:latest

For dark icons append following argument: --icons-for-light-bg

1) pip install ustvgo-iptv always grab and install the latest version, if you are using v0.1.8 then you have those extra 2 channels. Probably your playlist is cached, try to refresh it.

2) You can set EPG update interval whatever you want, EPG TV Guide contains programs info for about 6 hours ahead.