tgorgdotcom / locast2plex

A very simple script to connect locast to Plex's live tv/dvr feature.
MIT License
232 stars 43 forks source link

Could not tune channel. Please check your tuner or antenna. #81

Open jdotsmith opened 3 years ago

jdotsmith commented 3 years ago

Im running Locast2Plex on my Synology in a docker container. I couldnt get it to work with the Docker image natively in the DS but the Docker command in the installation worked.

Got through the setup, added the tuner, selected the Locast OTA Broadcast, shows the channels and the guide. When I try to watch something in Plex I get the error "Could not tune channel. Please check your tuner or antenna." I did donate and I can watch live on locast directly. Nothing jumping out in the logs.

Locast2Plex v0.5.2 Tuner count set to 3 UUID set to: ... Logging into Locast using username Validating User Info... User Info obtained. User didDonate: True User donationExpire: 1604866400 Getting user location... User location obtained as Getting user's media market (DMA)... DMA found as 819: Seattle Getting list of stations based on DMA... Loading FCC Stations list... Starting device server on 192.168.1.101:6077 Starting SSDP server... Locast2Plex is active and listening... 172.17.0.1 - - [08/Sep/2020 22:39:50] "GET /discover.json HTTP/1.0" 200 - 172.17.0.1 - - [08/Sep/2020 22:39:50] "GET /lineup.json HTTP/1.0" 200 - 172.17.0.1 - - [08/Sep/2020 22:39:50] "GET /lineup_status.json HTTP/1.0" 200 - 172.17.0.1 - - [08/Sep/2020 22:39:50] "GET /discover.json HTTP/1.0" 200 - 172.17.0.1 - - [08/Sep/2020 22:39:50] "GET /lineup_status.json HTTP/1.0" 200 - 172.17.0.1 - - [08/Sep/2020 23:44:19] "GET /discover.json HTTP/1.0" 200 - 172.17.0.1 - - [08/Sep/2020 23:44:19] "GET /lineup.json HTTP/1.0" 200 - 172.17.0.1 - - [08/Sep/2020 23:44:19] "GET /lineup_status.json HTTP/1.0" 200 - 172.17.0.1 - - [08/Sep/2020 23:44:19] "GET /discover.json HTTP/1.0" 200 - 172.17.0.1 - - [08/Sep/2020 23:44:19] "GET /lineup_status.json HTTP/1.0" 200 - 172.17.0.1 - - [08/Sep/2020 23:46:06] "GET /lineup.json HTTP/1.0" 200 -

1498will commented 3 years ago

Similar issue. Using Terminal. I was able to add and scan for channels. However whenever I try to watch something. "Could not tune channel. Please check your tuner or antenna."

MacMini Running OSX 10.14.6 Plex 4.34.4

Im a novice when with Python. Im guessing this is the issue I need to fix "OSError: [Errno 2] No such file or directory" Im unclear as to how.

Plexs-Mac-mini:~ plex$ PYTHONHTTPSVERIFY=0 python ~/Desktop/locast2plex-master/main.py Locast2Plex v0.5.2 Tuner count set to 3 UUID set to: nqpzrrvj... Logging into Locast using username XXXXX@gmail.com... Validating User Info... User Info obtained. User didDonate: True User donationExpire: 1602216730 Getting user location... User location obtained as XX.XXXX/-XX.XXXX Getting user's media market (DMA)... DMA found as 803: Los Angeles Getting list of stations based on DMA... Loading FCC Stations list... Starting device server on 127.0.0.1:6077 Starting SSDP server... Locast2Plex is active and listening... 127.0.0.1 - - [08/Sep/2020 22:44:05] "GET / HTTP/1.1" 200 - Unknown request to /favicon.ico 127.0.0.1 - - [08/Sep/2020 22:44:05] "GET /favicon.ico HTTP/1.1" 501 - 127.0.0.1 - - [08/Sep/2020 22:47:41] "GET /lineup.json HTTP/1.0" 200 - 127.0.0.1 - - [08/Sep/2020 22:47:41] "GET /discover.json HTTP/1.0" 200 - 127.0.0.1 - - [08/Sep/2020 22:47:41] "GET /lineup_status.json HTTP/1.0" 200 - Getting station info for 1078... Determining best video stream for 1078... Found 0 Playlists No variant streams found for this station. Assuming single stream only. 127.0.0.1 - - [08/Sep/2020 22:47:41] "GET /watch/1078 HTTP/1.1" 200 -

Exception happened during processing of request from ('127.0.0.1', 58658) Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 293, in _handle_request_noblock self.process_request(request, client_address) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 321, in process_request self.finish_request(request, client_address) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 334, in finish_request self.RequestHandlerClass(request, client_address, self) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 655, in init self.handle() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 340, in handle self.handle_one_request() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request method() File "/Users/plex/Desktop/locast2plex-master/main.py", line 101, in do_GET ffmpeg_proc = subprocess.Popen(["ffmpeg", "-i", channelUri, "-codec", "copy", "-f", "mpegts", "pipe:1"], stdout=subprocess.PIPE) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 394, in init errread, errwrite) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1047, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory

1498will commented 3 years ago

was able to figure it out.. i was installing ffmpeg manually.

but i installed homebrew and had that install ffmpeg

  1. /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

  2. brew install ffmpeg

arejay73 commented 3 years ago

What version of ffmpeg is installed? I am having the same problem, but I have been unable to resolve. I have ffmpeg installed via brew as well.

jdotsmith commented 3 years ago

Mine is running in a docker container... does it need ffmpeg installed?

atnoslen commented 3 years ago

Running docker container. Also having same issue.

erocconi commented 3 years ago

I was having this same issue within docker as well. I resolved it by setting 'plex_accessible_ip = locast2plex' in the config.ini file. locast2plex being the container name so it is resolvable.

jdotsmith commented 3 years ago

I was having this same issue within docker as well. I resolved it by setting 'plex_accessible_ip = locast2plex' in the config.ini file. locast2plex being the container name so it is resolvable.

That didnt work for me.

ThePorpoipotamus commented 3 years ago

I, too, have the same issue. FYI, I have ZERO programming experience, but I can sometimes follow instructions. My scenario... Synology NAS running Plex server, installed Locast2plex version 4.2 via Synology's built in Docker. EPG loads but can't get Plex to tune. I assume it's because I don't have FFMPEG installed, but I don't know how (through Synology). However, I do notice that the time stamp in the L2P log is 7 hours ahead (it's 14:30 right now, log shows 21:30), so perhaps that's an issue? Any help for this floundering fish is appreciated.

jgsawyers commented 3 years ago

Several different possible problems listed in this issue. Couple notes:

Anyway, if you're running on a Synology, just to make sure there aren't any config issues:

  1. Is your Plex server on the NAS? If so, are you running the Synology Plex package, or a Plex docker container?
  2. What do you have configured for the plex_accessible_ip and plex_accessible_port in the config.ini file? (unless you're doing some non-bridge networking this should typically be the IP of your NAS)
  3. Is the plex_accessible_port mapped in the docker configuration? (see below) image
  4. Just to validate\sanity check, go to http://`plex_accessible_ip`:`plex_accessible_portin a browser. What is returned in the ` field?
  5. What IP:Port are you using to add the tuner in Plex?
jdotsmith commented 3 years ago

Several different possible problems listed in this issue. Couple notes:

  • If you're using the docker image (tgorg/locast2plex from Docker Hub) you do not need to do anything extra for FFmpeg. It's included in the image.
  • Running on a Synology NAS is a little bit of an odd duck environment. The Synology Plex 'package' runs directly on the NAS, while the docker container runs in an isolated bridge with only the ports in the container configuration exposed through from the host to the container. DMS already runs a UPnP service on UDP\1900, so that can't be exposed from the container without disabling the UPnP services in DMS, or using an alternative Docker network type (like macvlan).

Anyway, if you're running on a Synology, just to make sure there aren't any config issues:

  1. Is your Plex server on the NAS? If so, are you running the Synology Plex package, or a Plex docker container?
  2. What do you have configured for the plex_accessible_ip and plex_accessible_port in the config.ini file? (unless you're doing some non-bridge networking this should typically be the IP of your NAS)
  3. Is the plex_accessible_port mapped in the docker configuration? (see below) image
  4. Just to validate\sanity check, go to http://`plex_accessible_ip`:`plex_accessible_portin a browser. What is returned in the ` field?
  5. What IP:Port are you using to add the tuner in Plex?

I couldnt get the locast2plex docker container to run natively on the Synology through the docker UI (it would just keep restarting), so I ran the docker command in the instructions and it created it, and works.

My plex server is running on a separate Fedora server. 192.168.1.101.

My Synology IP is 192.168.1.102, port 6077 is configured in the locast2plex docker container.

My plex_accessible_ip is 192.168.1.101 but I dont have the plex_accessible_port configured.

Halfway through typing checking some settings, I changed the following and now it works.

plex_accessible_ip=192.168.1.102 (IP of my Synology, it was 192.168.1.101) The external_addy was 192.168.1.102 in the docker container, I changed it to 192.168.1.101.

Not sure which one fixed it, but Im guessing it was one of the 2. Maybe add more descriptive notes on which one does which?

tgorgdotcom commented 3 years ago

Ahh, yup I could definitely refine the readme. plex_accessible_ip is the IP address of the locast2plex server, not the IP address of the Plex server (my thought for naming it that way was "the IP that Plex can use to access locast2plex")

Also note, the external_addy argument isn't necessary anymore.

cguay commented 3 years ago

I am having this issue , but running Windows error is =

"Determining best video stream for 471...

Exception happened during processing of request from ('127.0.0.1', 60282) Traceback (most recent call last): File "C:\Python27\lib\SocketServer.py", line 284, in _handle_request_noblock self.process_request(request, client_address) File "C:\Python27\lib\SocketServer.py", line 310, in process_request self.finish_request(request, client_address) File "C:\Python27\lib\SocketServer.py", line 323, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\Python27\lib\SocketServer.py", line 639, in init self.handle() File "C:\Python27\lib\BaseHTTPServer.py", line 337, in handle self.handle_one_request() File "C:\Python27\lib\BaseHTTPServer.py", line 325, in handle_one_request method() File "main.py", line 95, in do_GET channelUri = self.local_locast.get_station_stream_uri(channelId) File "C:\locast2plex-master\LocastService.py", line 469, in get_station_stream_uri videoUrlM3u = m3u8.load(videoUrlRes['streamUrl']) File "C:\locast2plex-master\m3u8__init.py", line 56, in load return _load_from_uri(uri, timeout, headers, custom_tags_parser, verify_ssl) File "C:\locast2plex-master\m3u8\init__.py", line 68, in _load_from_uri resource = urlopen(request, timeout=timeout, context=context) TypeError: urlopen() got an unexpected keyword argument 'context' ----------------------------------------"

It was working till today...

zathrath03 commented 3 years ago

I'm also receiving the Playback Error: Could not tune channel. Please check your tuner or antenna.

Setup is as follows: -Running plex media server as a standalone application on my Terramaster NAS. The NAS and Plex are both accessible at 192.168.50.144 with plex on port 32400 -Using the Docker Container from Docker Hub (tgorg/locast2plex) -Setup includes the following selections during container launch:

--General
---Container name: locast2plex
---Enable automatic restart: true
--Volume
---File/Directory: /mnt/md0/appdata/locast2plex/config.ini
---Loading path: /app/config.ini
---Read Only: false
--Network: bridge
--Port Settings
---Local Port: 6077
---Network Port: 6077
---Type: tcp
--Environment
---PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
---LD_LIBRARY_PATH: /usr/local/lib:/usr/local/lib64
---username: <redacted>@gmail.com
---password: <redacted>
---external_addy: 192.168.50.144
---external_port: 6077
---debug: true

config.ini is as follows:

[main]
locast_username = <redacted>@gmail.com
locast_password = <redacted>
plex_accessible_ip = 192.168.50.144
uuid = twuolptv

Launching the container shows the following in the log:

Locast2Plex v0.5.2
--
21:01:48 | Tuner count set to 3
21:01:48 | UUID set to: twuolptv...
21:01:48 | Logging into Locast using username <redacted>@gmail.com...
21:01:48 | Validating User Info...
21:01:49 | User Info obtained.
21:01:49 | User didDonate: True
21:01:49 | User donationExpire: 2020-10-13 15:41:53
21:01:49 | Getting user location...
21:01:49 | Getting location via IP Address.
21:01:49 | Got external IP <redacted>.
21:01:50 | Got location as Seattle - DMA 819 - Lat\Lon 47.6262\-122.5212
21:01:50 | Getting list of stations based on DMA...
21:01:51 | Loading FCC Stations list...
21:01:51 | Starting device server on 192.168.50.144:6077
21:01:51 | Starting SSDP server...
21:01:51 | Locast2Plex is active and listening...
21:02:04 | 192.168.50.207 - - [13/Sep/2020 21:02:04] "GET / HTTP/1.1" 200 -
21:02:04 | Unknown request to /favicon.ico
21:02:04 | 192.168.50.207 - - [13/Sep/2020 21:02:04] "GET /favicon.ico HTTP/1.1" 501 -
21:02:07 | 192.168.50.207 - - [13/Sep/2020 21:02:07] "GET / HTTP/1.1" 200 -
21:02:08 | Unknown request to /favicon.ico
21:02:08 | 192.168.50.207 - - [13/Sep/2020 21:02:08] "GET /favicon.ico HTTP/1.1" 501 -
21:19:06 | 172.17.0.1 - - [13/Sep/2020 21:19:06] "GET /lineup.json HTTP/1.0" 200 -
21:19:06 | 172.17.0.1 - - [13/Sep/2020 21:19:06] "GET /discover.json HTTP/1.0" 200 -
21:19:06 | 172.17.0.1 - - [13/Sep/2020 21:19:06] "GET /lineup_status.json HTTP/1.0" 200 -
21:19:09 | 172.17.0.1 - - [13/Sep/2020 21:19:09] "GET /discover.json HTTP/1.0" 200 -
21:19:09 | 172.17.0.1 - - [13/Sep/2020 21:19:09] "GET /lineup_status.json HTTP/1.0" 200 -
21:19:12 | 172.17.0.1 - - [13/Sep/2020 21:19:12] "GET /discover.json HTTP/1.0" 200 -
21:19:12 | 172.17.0.1 - - [13/Sep/2020 21:19:12] "GET /lineup_status.json HTTP/1.0" 200 -
21:19:12 | 172.17.0.1 - - [13/Sep/2020 21:19:12] "GET /discover.json HTTP/1.0" 200 -

I have no idea where the 172.17.0.1 is coming from - it doesn't exist on my subnet. 192.168.50.207 is my primary desktop.

Browsing to 192.168.50.144:6077 shows:

<root xmlns="urn:schemas-upnp-org:device-1-0">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<device>
<deviceType>urn:schemas-upnp-org:device:MediaServer:1</deviceType>
<friendlyName>Locast2Plex</friendlyName>
<manufacturer>Silicondust</manufacturer>
<modelName>HDHR3-US</modelName>
<modelNumber>HDHR3-US</modelNumber>
<serialNumber/>
<UDN>uuid:twuolptv</UDN>
</device>
<URLBase>http://192.168.50.144:6077</URLBase>
</root>

Attempting to add locast2plex as a DVR device using 192.168.50.144:6077 results in the error There was a problem adding the device: 192.168.50.144:6077 Attempting to add locast2plex as a DVR device using 127.0.0.1:6077 results in the "device" being located, and the setup seeming to complete normally, but the list of DVR devices states

Locast2Plex
—
127.0.0.1:6077
Device not found. Ensure your device is powered on and connected to your network.

I have seen it actually show the correct device status as if it was a physical tuner connected, but I didn't change anything to get there, nor did I change anything since then and it's back to device not found.

When attempting to launch a live program I receive Playback Error Could not tune channel. Please check your tuner or antenna. I've attached the plex log for when I attempted to play a live program. I chopped it in an attempt to only include the time period in question, but let me know if I'm missing data I should include. Plex Media Server.log The docker container log for locast2plex shows no new entries

Hopefully this helps determine where the problem lays. Anything I can provide to help, just let me know!

tgorgdotcom commented 3 years ago

@zathrath03 Could you change the plex_accessible_ip value to 127.0.0.1 in config.ini, then restart the docker container, then retry adding the tuner in Plex?

@cguay What version of Python are you running?

zathrath03 commented 3 years ago

@tgorgdotcom

BLUF: I was able to get everything working.

Background: My config file has been updated as follows:

[main]
locast_username = <redacted>@gmail.com
locast_password = <redacted>
plex_accessible_ip = 127.0.0.1
uuid = twuolptv

The docker container wouldn't start. Unfortunately, the docker implementation in Terramaster isn't robust, so the docker log doesn't reflect the reason it won't start, simply the fact that I directed it to enable. Nothing appears in the container's log at all. I tried deleting all the environment variables from the container creation (since it appears they're not longer required with the change to the config file) and the container still wouldn't spin.

Deleted and downloaded a new image and attempted to spin up a new container using the following settings:

--General
---Container name: locast2plex
---Enable automatic restart: true
--Volume
---File/Directory: /mnt/md0/appdata/locast2plex/config.ini
---Loading path: /app/config.ini
---Read Only: false
--Network: bridge
--Port Settings
---Local Port: 6077
---Network Port: 6077
---Type: tcp
---Local Port: 1900
---Network Port: 1900
---Type: udp
--Environment
---PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
---LD_LIBRARY_PATH: /usr/local/lib:/usr/local/lib64

Same result. The container created, but did not start despite giving no indications as to why.

I deleted the container, edited config.ini back to plex_accessible_ip = 192.168.50.144, and spun up a new container with no problems. I edited the config.ini back to plex_accessible_ip = 127.0.0.1 on that existing container and hit restart and it restarted no problem. Log showed:

Locast2Plex v0.5.3
--
17:57:53 | Tuner count set to 3
17:57:53 | UUID set to: twuolptv...
17:57:53 | Logging into Locast using username <redacted>@gmail.com...
17:57:54 | Validating User Info...
17:57:54 | User Info obtained.
17:57:54 | User didDonate: True
17:57:54 | User donationExpire: 2020-10-13 15:41:53
17:57:54 | Getting user location...
17:57:54 | Getting location via IP Address.
17:57:54 | Got external IP <redacted>.
17:57:55 | Got location as Seattle - DMA 819 - Lat\Lon 47.6262\-122.5212
17:57:55 | Getting list of stations based on DMA...
17:57:57 | Loading FCC Stations list...
17:57:58 | Starting device server on 192.168.50.144:6077
17:57:58 | Starting SSDP server...
17:57:58 | Locast2Plex is active and listening...
18:00:16 | Locast2Plex v0.5.3
18:00:16 | Tuner count set to 3
18:00:16 | UUID set to: twuolptv...
18:00:16 | Logging into Locast using username <redacted>@gmail.com...
18:00:16 | Validating User Info...
18:00:17 | User Info obtained.
18:00:17 | User didDonate: True
18:00:17 | User donationExpire: 2020-10-13 15:41:53
18:00:17 | Getting user location...
18:00:17 | Getting location via IP Address.
18:00:17 | Got external IP <redacted>.
18:00:17 | Got location as Seattle - DMA 819 - Lat\Lon 47.6262\-122.5212
18:00:17 | Getting list of stations based on DMA...
18:00:19 | Loading FCC Stations list...
18:00:19 | Starting device server on 127.0.0.1:6077
18:00:19 | Starting SSDP server...
18:00:19 | Locast2Plex is active and listening...

When adding the DVR, I had to add the network address manually (was not discovered). Additionally, Live TV & DVR in settings still listed

Locast2Plex
—
127.0.0.1:6077
Device not found. Ensure your device is powered on and connected to your network.

The docker container log showed

18:05:32 | 172.17.0.1 - - [19/Sep/2020 18:05:32] "GET /discover.json HTTP/1.0" 200 -
18:05:32 | 172.17.0.1 - - [19/Sep/2020 18:05:32] "GET /lineup_status.json HTTP/1.0" 200 -
18:05:32 | 172.17.0.1 - - [19/Sep/2020 18:05:32] "GET /discover.json HTTP/1.0" 200 -
18:05:32 | 172.17.0.1 - - [19/Sep/2020 18:05:32] "GET /lineup_status.json HTTP/1.0" 200 -
18:05:35 | 172.17.0.1 - - [19/Sep/2020 18:05:35] "GET /lineup.json HTTP/1.0" 200 -
18:05:41 | 172.17.0.1 - - [19/Sep/2020 18:05:41] "POST /lineup.post?scan=start&source=Antenna HTTP/1.0" 200 -
18:05:41 | Getting list of stations based on DMA...
18:05:52 | Loading FCC Stations list...
18:05:52 | 172.17.0.1 - - [19/Sep/2020 18:05:52] "GET /discover.json HTTP/1.0" 200 -
18:05:52 | 172.17.0.1 - - [19/Sep/2020 18:05:52] "GET /lineup_status.json HTTP/1.0" 200 -
18:05:52 | 172.17.0.1 - - [19/Sep/2020 18:05:52] "GET /discover.json HTTP/1.0" 200 -
18:05:52 | 172.17.0.1 - - [19/Sep/2020 18:05:52] "GET /lineup_status.json HTTP/1.0" 200 -
18:05:53 | 172.17.0.1 - - [19/Sep/2020 18:05:53] "GET /lineup.json HTTP/1.0" 200 -
18:06:01 | 172.17.0.1 - - [19/Sep/2020 18:06:01] "GET /lineup.json HTTP/1.0" 200 -
18:06:15 | 172.17.0.1 - - [19/Sep/2020 18:06:15] "GET /lineup.json HTTP/1.0" 200 -
18:06:25 | 172.17.0.1 - - [19/Sep/2020 18:06:25] "GET /lineup.json HTTP/1.0" 200 -
18:06:47 | 172.17.0.1 - - [19/Sep/2020 18:06:47] "GET /discover.json HTTP/1.0" 200 -
18:06:47 | 172.17.0.1 - - [19/Sep/2020 18:06:47] "GET /lineup_status.json HTTP/1.0" 200 -
18:06:47 | 172.17.0.1 - - [19/Sep/2020 18:06:47] "GET /discover.json HTTP/1.0" 200 -
18:06:47 | 172.17.0.1 - - [19/Sep/2020 18:06:47] "GET /lineup_status.json HTTP/1.0" 200 -

The channels are visible in Plex and tunable, so everything seems to be working at the end of it. Thanks!

cguay commented 3 years ago

Running on Windows 10 64 bit Python 2.7.18 , reinstalled off github , i am still getting the issue.

SERVER - - [19/Sep/2020 20:09:09] "GET /lineup_status.json HTTP/1.0" 200 - Determining best video stream for 1571514243579...

Exception happened during processing of request from ('127.0.0.1', 50080) Traceback (most recent call last): File "C:\Python27\lib\SocketServer.py", line 284, in _handle_request_noblock self.process_request(request, client_address) File "C:\Python27\lib\SocketServer.py", line 310, in process_request self.finish_request(request, client_address) File "C:\Python27\lib\SocketServer.py", line 323, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\Python27\lib\SocketServer.py", line 639, in init self.handle() File "C:\Python27\lib\BaseHTTPServer.py", line 337, in handle self.handle_one_request() File "C:\Python27\lib\BaseHTTPServer.py", line 325, in handle_one_request method() File "main.py", line 121, in do_GET channelUri = self.local_locast.get_station_stream_uri(channelId) File "C:\locast2plex\LocastService.py", line 474, in get_station_stream_uri videoUrlM3u = m3u8.load(videoUrlRes['streamUrl']) File "C:\locast2plex\m3u8__init.py", line 56, in load return _load_from_uri(uri, timeout, headers, custom_tags_parser, verify_ssl) File "C:\locast2plex\m3u8\init__.py", line 68, in _load_from_uri resource = urlopen(request, timeout=timeout, context=context) TypeError: urlopen() got an unexpected keyword argument 'context'

here is my config.ini , [main] locast_username = XXX locast_password = XXXX plex_accessible_ip = 127.0.0.1 uuid = nnvmijkr override_latitude=42.578106 override_longitude=-70.925290

arejay73 commented 3 years ago

I had a similar issue and was able to get it to work by using the terminal command:

sudo python main.py

locast2Plex: 0.5.3 Plex Server: 1.20.1.3252 MacOS: 10.15.6

ejms-hub commented 3 years ago

I was having the same problem until I read the comment above from FozzieBear that said:

Just to validate\sanity check, go to http://plex_accessible_ip:plex_accessible_port in a browser. What is returned in the field?

I tried it and it gave me in the URLBase field 127.0.0.1:6077:6077, so the 6077 port was doubled, and that was in the config.ini file. I had in the config.ini file 127.0.0.1:6077, I removed the :6077, restarted the container and it all works now. I am not a developer nor a programmer, just an average person that has been spending hours trying to set this all up and figure this all out and OMG, I was about to give up until I read this. The simple things...

williamsba commented 3 years ago

I was receiving the same error on a Mac with a manual Terminal install: "Could not tune channel. Please check your tuner or antenna."

The fix for me was to make sure ffmpeg, and supporting apps, were installed. I followed the instructions in the video below and that fixed the issue for me. Don't forget to stop and restart the locast2plex python script after you have finished. Hope this helps others!

https://www.youtube.com/watch?v=zl4vo0dhLRk

luhem commented 3 years ago

@tgorgdotcom I'm having the same issue. I have Plex server setup on a Mac mini and configured locast2plex on the same server. I'm able to successfully add the tuner to Plex and refresh the guide. When I go to play the connect, I get the same error 'Could not tune channel. Please check your tuner and antenna.". I have ffmpeg installed based on the instructions from the YouTube link in the previous post.

Python 3.9.5 (v3.9.5:0a7dcbdb13, May 3 2021, 13:17:02) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license()" for more information.

================== RESTART: /usr/local/bin/locast2plex/main.py ================= Initiating Locast2Plex v0.6.5 Opening and Verifying Configuration File. /usr/local/bin/locast2plex/config/config.ini /usr/local/bin/locast2plex/config.ini Loading Configuration File: /usr/local/bin/locast2plex/config.ini Tuner count set to 3 Server is set to run on 127.0.0.1:6077 UUID set to: imlqslvq... Getting user location... Getting location via provided lat\lon coordinates. Got location as Philadelphia - DMA 504 - xxxxxxxxxxxxxxxxx Logging into Locast using username xxxxxxxxxx@gmail.com... Validating User Info... User Info obtained. User didDonate: True User donationExpire: 2021-07-04 16:05:08 Starting First time Stations refresh... Checking FCC facilities database for updates. Cached facilities database is current. Getting list of stations based on DMA... Found 63 stations for DMA 504 Starting Stations thread... Starting device server on 127.0.0.1:6077 Now listening for requests. Starting SSDP server... Starting First time EPG refresh... FROM CACHE: /usr/local/bin/locast2plex/cache/504_epg/06-05-2021.json FROM CACHE: /usr/local/bin/locast2plex/cache/504_epg/06-06-2021.json FROM CACHE: /usr/local/bin/locast2plex/cache/504_epg/06-07-2021.json FROM CACHE: /usr/local/bin/locast2plex/cache/504_epg/06-08-2021.json FROM CACHE: /usr/local/bin/locast2plex/cache/504_epg/06-09-2021.json FROM CACHE: /usr/local/bin/locast2plex/cache/504_epg/06-10-2021.json Starting EPG thread... Locast2Plex is now online. 127.0.0.1 - - [05/Jun/2021 11:18:44] "GET /discover.json HTTP/1.1" 200 - 127.0.0.1 - - [05/Jun/2021 11:18:44] "GET /lineup.json HTTP/1.1" 200 - 127.0.0.1 - - [05/Jun/2021 11:18:44] "GET /lineup_status.json HTTP/1.1" 200 - Getting station info for 1603624631652... Determining best video stream for 1603624631652... Found 0 Playlists No variant streams found for this station. Assuming single stream only. 127.0.0.1 - - [05/Jun/2021 11:18:45] "GET /watch/1603624631652 HTTP/1.1" 200 -

Exception occurred during processing of request from ('127.0.0.1', 63636) Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 316, in _handle_request_noblock self.process_request(request, client_address) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 347, in process_request self.finish_request(request, client_address) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 360, in finish_request self.RequestHandlerClass(request, client_address, self) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 747, in init self.handle() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/server.py", line 427, in handle self.handle_one_request() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/server.py", line 415, in handle_one_request method() File "/usr/local/bin/locast2plex/lib/tuner_interface.py", line 109, in do_GET self.do_tuning(contentPath.replace('/watch/', '')) File "/usr/local/bin/locast2plex/lib/tuner_interface.py", line 347, in do_tuning ffmpeg_proc = subprocess.Popen(ffmpeg_command, stdout=subprocess.PIPE) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 951, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1821, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg'

Getting station info for 1603624631652... Determining best video stream for 1603624631652... Found 0 Playlists No variant streams found for this station. Assuming single stream only. 127.0.0.1 - - [05/Jun/2021 11:18:48] "GET /watch/1603624631652 HTTP/1.1" 200 - 127.0.0.1 - - [05/Jun/2021 11:18:48] "GET /discover.json HTTP/1.1" 200 - ----------------------------------------127.0.0.1 - - [05/Jun/2021 11:18:48] "GET /lineup_status.json HTTP/1.1" 200 -

Exception occurred during processing of request from ('127.0.0.1', 63639) Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 316, in _handle_request_noblock self.process_request(request, client_address) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 347, in process_request self.finish_request(request, client_address) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 360, in finish_request self.RequestHandlerClass(request, client_address, self) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 747, in init self.handle() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/server.py", line 427, in handle self.handle_one_request() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/server.py", line 415, in handle_one_request method() File "/usr/local/bin/locast2plex/lib/tuner_interface.py", line 109, in do_GET self.do_tuning(contentPath.replace('/watch/', '')) File "/usr/local/bin/locast2plex/lib/tuner_interface.py", line 347, in do_tuning ffmpeg_proc = subprocess.Popen(ffmpeg_command, stdout=subprocess.PIPE) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 951, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1821, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg'

Getting station info for 1603624631652... Determining best video stream for 1603624631652... Found 0 Playlists127.0.0.1 - - [05/Jun/2021 11:18:51] "GET /discover.json HTTP/1.1" 200 -

127.0.0.1 - - [05/Jun/2021 11:18:51] "GET /lineup_status.json HTTP/1.1" 200 - No variant streams found for this station. Assuming single stream only. 127.0.0.1 - - [05/Jun/2021 11:18:51] "GET /watch/1603624631652 HTTP/1.1" 200 -

Exception occurred during processing of request from ('127.0.0.1', 63648) Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 316, in _handle_request_noblock self.process_request(request, client_address) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 347, in process_request self.finish_request(request, client_address) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 360, in finish_request self.RequestHandlerClass(request, client_address, self) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 747, in init self.handle() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/server.py", line 427, in handle self.handle_one_request() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/server.py", line 415, in handle_one_request method() File "/usr/local/bin/locast2plex/lib/tuner_interface.py", line 109, in do_GET self.do_tuning(contentPath.replace('/watch/', '')) File "/usr/local/bin/locast2plex/lib/tuner_interface.py", line 347, in do_tuning ffmpeg_proc = subprocess.Popen(ffmpeg_command, stdout=subprocess.PIPE) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 951, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1821, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg'

127.0.0.1 - - [05/Jun/2021 11:18:54] "GET /discover.json HTTP/1.1" 200 - 127.0.0.1 - - [05/Jun/2021 11:18:54] "GET /lineup_status.json HTTP/1.1" 200 - Getting station info for 1603624631652... Determining best video stream for 1603624631652…a Found 0 Playlists No variant streams found for this station. Assuming single stream only. 127.0.0.1 - - [05/Jun/2021 11:18:56] "GET /watch/1603624631652 HTTP/1.1" 400 - 127.0.0.1 - - [05/Jun/2021 11:18:57] "GET /discover.json HTTP/1.1" 200 - 127.0.0.1 - - [05/Jun/2021 11:18:57] "GET /lineup_status.json HTTP/1.1" 200 - 127.0.0.1 - - [05/Jun/2021 11:19:00] "GET /discover.json HTTP/1.1" 200 - 127.0.0.1 - - [05/Jun/2021 11:19:00] "GET /lineup_status.json HTTP/1.1" 200 - Getting station info for 1603624631652...127.0.0.1 - - [05/Jun/2021 11:19:03] "GET /discover.json HTTP/1.1" 200 -

127.0.0.1 - - [05/Jun/2021 11:19:03] "GET /lineup_status.json HTTP/1.1" 200 - Determining best video stream for 1603624631652... Found 0 Playlists No variant streams found for this station. Assuming single stream only. 127.0.0.1 - - [05/Jun/2021 11:19:04] "GET /watch/1603624631652 HTTP/1.1" 400 - 127.0.0.1 - - [05/Jun/2021 11:19:07] "GET /discover.json HTTP/1.1" 200 - 127.0.0.1 - - [05/Jun/2021 11:19:07] "GET /lineup_status.json HTTP/1.1" 200 - 127.0.0.1 - - [05/Jun/2021 11:19:10] "GET /discover.json HTTP/1.1" 200 - 127.0.0.1 - - [05/Jun/2021 11:19:10] "GET /lineup_status.json HTTP/1.1" 200 - 127.0.0.1 - - [05/Jun/2021 11:19:21] "GET /lineup.json HTTP/1.1" 200 - 127.0.0.1 - - [05/Jun/2021 11:25:02] "GET /lineup.json HTTP/1.1" 200 - 127.0.0.1 - - [05/Jun/2021 11:25:02] "GET /discover.json HTTP/1.1" 200 - Getting station info for 1603624636184...127.0.0.1 - - [05/Jun/2021 11:25:03] "GET /lineup_status.json HTTP/1.1" 200 -

Determining best video stream for 1603624636184... Found 0 Playlists No variant streams found for this station. Assuming single stream only. 127.0.0.1 - - [05/Jun/2021 11:25:04] "GET /watch/1603624636184 HTTP/1.1" 400 - 127.0.0.1 - - [05/Jun/2021 11:25:04] "GET /discover.json HTTP/1.1" 200 - 127.0.0.1 - - [05/Jun/2021 11:25:04] "GET /lineup_status.json HTTP/1.1" 200 - 127.0.0.1 - - [05/Jun/2021 11:26:14] "GET /discover.json HTTP/1.1" 200 - 127.0.0.1 - - [05/Jun/2021 11:26:14] "GET /lineup.json HTTP/1.1" 200 - 127.0.0.1 - - [05/Jun/2021 11:26:14] "GET /lineup_status.json HTTP/1.1" 200 - Getting station info for 557... Determining best video stream for 557... Found 3 Playlists 557 will use 1280x720 resolution at 2700000bps 127.0.0.1 - - [05/Jun/2021 11:26:15] "GET /watch/557 HTTP/1.1" 400 - 127.0.0.1 - - [05/Jun/2021 11:26:15] "GET /discover.json HTTP/1.1" 200 - 127.0.0.1 - - [05/Jun/2021 11:26:15] "GET /lineup_status.json HTTP/1.1" 200 -