tgorgdotcom / locast2plex

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

Error in function get_ip_location: [Errno -3] #197

Open kingstonwa opened 3 years ago

kingstonwa commented 3 years ago

Just tried to install the new version via SSH and got the following error, please help

[~] # docker run -v /share/CACHEDEV1_DATA/homes/bob/config.ini:/app/config/config.ini -p 6077:6077 tgorg/locast2plex Initiating Locast2Plex v0.6.2 Opening and Verifying Configuration File. /app/config/config.ini Loading Configuration File: /app/config/config.ini Tuner count set to 3 Server is set to run on 127.0.0.1:6077 UUID set to: lmxjmviw... Getting user location... Getting location via IP Address. Error in function get_ip_location: [Errno -3] Try again Could not acertain location. Exiting...

kingstonwa commented 3 years ago

Well I restarted my Qnap and that error went away, now I get

[/share/CACHEDEV1_DATA/homes/locast2plex] # docker run -v /share/CACHEDEV1_DATA/homes/locast2plex/config.ini:/app/config/config.ini -p 6077:6077 tgorg/locast2plex Initiating Locast2Plex v0.6.2 Opening and Verifying Configuration File. /app/config/config.ini Loading Configuration File: /app/config/config.ini Tuner count set to 3 Server is set to run on 127.0.0.1:6077 UUID set to: xxxxxx... Getting user location... Getting location via IP Address. Got external IP xxxxxxxxxxxxx. Got location as Seattle - DMA 819 - Lat\Lon 47.7557-122.3415 Logging into Locast using username xxxxxxxxxxxxxxxxxxxx... Validating User Info... User Info obtained. User didDonate: True User donationExpire: 2021-02-18 05:20:14 Starting First time Stations refresh... Checking FCC facilities database for updates. Traceback (most recent call last): File "/app/main.py", line 67, in stations.refresh_dma_stations_and_channels(config, locast, location_info.location) File "/app/lib/stations.py", line 38, in refresh_dma_stations_and_channels fcc_stations = get_fcc_stations(config) File "/app/lib/stations.py", line 144, in get_fcc_stations online_file_time = get_online_file_time(facility_url) File "/app/lib/stations.py", line 44, in get_online_file_time resp = urllib.request.urlopen(url_head) File "/usr/local/lib/python3.8/urllib/request.py", line 222, in urlopen return opener.open(url, data, timeout) File "/usr/local/lib/python3.8/urllib/request.py", line 525, in open response = self._open(req, data) File "/usr/local/lib/python3.8/urllib/request.py", line 542, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "/usr/local/lib/python3.8/urllib/request.py", line 502, in _call_chain result = func(*args) File "/usr/local/lib/python3.8/urllib/request.py", line 1379, in http_open return self.do_open(http.client.HTTPConnection, req) File "/usr/local/lib/python3.8/urllib/request.py", line 1354, in do_open r = h.getresponse() File "/usr/local/lib/python3.8/http/client.py", line 1347, in getresponse response.begin() File "/usr/local/lib/python3.8/http/client.py", line 307, in begin version, status, reason = self._read_status() File "/usr/local/lib/python3.8/http/client.py", line 268, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") File "/usr/local/lib/python3.8/socket.py", line 669, in readinto return self._sock.recv_into(b) ConnectionResetError: [Errno 104] Connection reset by peer

parasoft-sang commented 3 years ago

To me, main branch execution fails and similar error:

ocast2plex@duckie:~$ python3.9 main.py Initiating Locast2Plex v0.6.4 Opening and Verifying Configuration File. /opt/locast2plex/config/config.ini /opt/locast2plex/config.ini Loading Configuration File: /opt/locast2plex/config.ini Tuner count set to 4 Server is set to run on 127.0.0.1:6077 UUID set to: XXXXX... Getting user location... Getting location via IP Address. Got external IP xxxxx. Got location as xxxxxx Logging into Locast using username XXXXXXX... Validating User Info... User Info obtained. User didDonate: True User donationExpire: 2022-08-17 08:26:17 Starting First time Stations refresh... Checking FCC facilities database for updates. Traceback (most recent call last): File "/usr/lib/python3.9/urllib/request.py", line 1342, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/usr/lib/python3.9/http/client.py", line 1255, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/lib/python3.9/http/client.py", line 1301, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/lib/python3.9/http/client.py", line 1250, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/lib/python3.9/http/client.py", line 1010, in _send_output self.send(msg) File "/usr/lib/python3.9/http/client.py", line 950, in send self.connect() File "/usr/lib/python3.9/http/client.py", line 1424, in connect self.sock = self._context.wrap_socket(self.sock, File "/usr/lib/python3.9/ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "/usr/lib/python3.9/ssl.py", line 1040, in _create self.do_handshake() File "/usr/lib/python3.9/ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1122)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/locast2plex/main.py", line 67, in stations.refresh_dma_stations_and_channels(config, locast, location_info.location) File "/opt/locast2plex/lib/stations.py", line 38, in refresh_dma_stations_and_channels fcc_stations = get_fcc_stations(config) File "/opt/locast2plex/lib/stations.py", line 144, in get_fcc_stations online_file_time = get_online_file_time(facility_url) File "/opt/locast2plex/lib/stations.py", line 44, in get_online_file_time resp = urllib.request.urlopen(url_head) File "/usr/lib/python3.9/urllib/request.py", line 214, in urlopen return opener.open(url, data, timeout) File "/usr/lib/python3.9/urllib/request.py", line 517, in open response = self._open(req, data) File "/usr/lib/python3.9/urllib/request.py", line 534, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain result = func(*args) File "/usr/lib/python3.9/urllib/request.py", line 1385, in https_open return self.do_open(http.client.HTTPSConnection, req, File "/usr/lib/python3.9/urllib/request.py", line 1345, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1122)>

I tried with python 3.6, 3.8 (default), and 3.9 but all python errors are the same. The host is Ubuntu 20.04.1 LTS

tgorgdotcom commented 3 years ago

@kingstonwa - The first error was just fixed with our v0.6.4 release. Upgrading should fix that issue for docker users

@parasoft-sang - This is related issue that arose for some installations with v0.6.4 I have a fix for this with some good results from another user -- would you be able to test it out too?

Attached below is an updated version of stations.py (you'll need to unzip it first), located in the /lib folder in your locast2plex directory. If you could check to see if this fixes it, I can push it out for the next release.
stations.zip

daveman918 commented 3 years ago

Was having the same errors. The new stations.py fixed it. Back up and running. Thanks!

libersongm commented 3 years ago

Have similar error tonight, will check and report back.

Thanks, Gary

libersongm commented 3 years ago

Well that seems to fix it. Thanks keep you posted on any other issues.

Very Respectfully, Gary

parasoft-sang commented 3 years ago

Hi,

It fixed the issue. Thank you

Sent from my T-Mobile 5G Device Get Outlook for Androidhttps://aka.ms/ghei36


From: Thomas Gorgolione notifications@github.com Sent: Thursday, January 21, 2021 6:58:27 PM To: tgorgdotcom/locast2plex locast2plex@noreply.github.com Cc: Sang U. Seong sang.seong@parasoft.com; Mention mention@noreply.github.com Subject: Re: [tgorgdotcom/locast2plex] Error in function get_ip_location: [Errno -3] (#197)

@kingstonwahttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkingstonwa&data=04%7C01%7Csang.seong%40parasoft.com%7Cdfdda53d4c5b47dccb2408d8be8197b6%7Cb83b7f7b805d469ab12446d508b4e59a%7C0%7C0%7C637468811112348092%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=9dZJvHJGUzw4b69pO6niQDWIw6zzXTMWpr3Bi4ZvyxI%3D&reserved=0 - The first error was just fixed with our v0.6.4 release. Upgrading should fix that issue for docker users

@parasoft-sanghttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fparasoft-sang&data=04%7C01%7Csang.seong%40parasoft.com%7Cdfdda53d4c5b47dccb2408d8be8197b6%7Cb83b7f7b805d469ab12446d508b4e59a%7C0%7C0%7C637468811112358084%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=1%2F9x%2BwRxC3DkSufz1dUCXFMay6Pnmlf99pErM471C1c%3D&reserved=0 - This is related issue that arose for some installations with v0.6.4 I have a fix for this with some good results from another user -- would you be able to test it out too?

Attached below is an updated version of stations.py (you'll need to unzip it first), located in the /lib folder in your locast2plex directory. If you could check to see if this fixes it, I can push it out for the next release. stations.ziphttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftgorgdotcom%2Flocast2plex%2Ffiles%2F5853324%2Fstations.zip&data=04%7C01%7Csang.seong%40parasoft.com%7Cdfdda53d4c5b47dccb2408d8be8197b6%7Cb83b7f7b805d469ab12446d508b4e59a%7C0%7C0%7C637468811112358084%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=yy6p7tEaFeNKVoim97sNJaWHHfm4g6xInKsnbLgqVSc%3D&reserved=0

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftgorgdotcom%2Flocast2plex%2Fissues%2F197%23issuecomment-765086349&data=04%7C01%7Csang.seong%40parasoft.com%7Cdfdda53d4c5b47dccb2408d8be8197b6%7Cb83b7f7b805d469ab12446d508b4e59a%7C0%7C0%7C637468811112368085%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Rqr9K7tiKENvIwKv%2FO1R1oW4UKl7%2BNuTVntMnJ%2Fm8Bo%3D&reserved=0, or unsubscribehttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAB32VEI6ATB732PW2JAJHGLS3DSVHANCNFSM4WNMDSQQ&data=04%7C01%7Csang.seong%40parasoft.com%7Cdfdda53d4c5b47dccb2408d8be8197b6%7Cb83b7f7b805d469ab12446d508b4e59a%7C0%7C0%7C637468811112368085%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=j9kD%2Fg1YumBOc67NlZVx40o7zEflChl9zVSx3pvnsXw%3D&reserved=0.

kingstonwa commented 3 years ago

Hi @tgorgdotcom please pardon my ignorance, but when using the docker run -v /share/CACHEDEV1_DATA/.... method on my Qnap to create the docker, where is the root folder for the locast2plex files that may need updating?

gluesniffined commented 3 years ago

The new stations.py fixed the issue for me as well. Thank you so much!

Distributor ID: Ubuntu Description: Ubuntu 20.04.1 LTS Release: 20.04 Codename: focal

tgorgdotcom commented 3 years ago

@kingstonwa - if you're using docker, just update the docker image associated with the image, rather than update files manually.

tgorgdotcom commented 3 years ago

Hello all. I implemented the changes in stations.py to v0.6.5. Let me know if anyone is running into any additional issues.

shinycard255 commented 3 years ago

@tgorgdotcom Tried getting locast2plex up and running and am running into this same issue... I'm also relatively new to docker so please pardon my ignorance when it comes to this. Downloaded the latest image and created the container through portainer.

Initiating Locast2Plex v0.6.5 Opening and Verifying Configuration File. /app/config/config.ini /app/config.ini Loading Configuration File: /app/config.ini Tuner count set to 3 Server is set to run on 127.0.0.1:6077 UUID set to: ulvpqnhq... Getting user location... Getting location via IP Address. Error in function get_ip_location: [Errno -3] Try again Could not acertain location. Exiting...

ghost commented 3 years ago

having same error condition: _Error in function get_iplocation: [Errno -3] Try again Could not acertain location. Exiting.

I tried using the zipcode, lat and log overrides but no change. I suspect it's something with my docker not providing an IP to the container or proxying it or something... but i can't figure it out.

wolffcatsky commented 3 years ago

having same error condition: _Error in function get_iplocation: [Errno -3] Try again Could not acertain location. Exiting.

I tried using the zipcode, lat and log overrides but no change. I suspect it's something with my docker not providing an IP to the container or proxying it or something... but i can't figure it out.

I'm NOT using Docker and get the same error.

ghost commented 3 years ago

My work around when using Docker was to use the 'Host' network instead of 'Bridge'. I suspect something with the virtual network bridge uses was causing the IP geolocation to fail when connecting to Locast Api.

On Tue, Mar 16, 2021, 6:45 PM wolffcatsky @.***> wrote:

having same error condition: Error in function get_ip_location: [Errno -3] Try again Could not acertain location. Exiting.

I tried using the zipcode, lat and log overrides but no change. I suspect it's something with my docker not providing an IP to the container or proxying it or something... but i can't figure it out.

I'm NOT using Docker and get the same error.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tgorgdotcom/locast2plex/issues/197#issuecomment-800662324, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGVMAKYV3ZVHKHVSKX44FR3TD7NSDANCNFSM4WNMDSQQ .

wolffcatsky commented 3 years ago

Thanks.  I wasn’t using Docker,  it I’ll try it. On Mar 16, 2021, 3:56 PM -0700, Mike McLeish @.***>, wrote:

My work around when using Docker was to use the 'Host' network instead of 'Bridge'. I suspect something with the virtual network bridge uses was causing the IP geolocation to fail when connecting to Locast Api.

On Tue, Mar 16, 2021, 6:45 PM wolffcatsky @.***> wrote:

having same error condition: Error in function get_ip_location: [Errno -3] Try again Could not acertain location. Exiting.

I tried using the zipcode, lat and log overrides but no change. I suspect it's something with my docker not providing an IP to the container or proxying it or something... but i can't figure it out.

I'm NOT using Docker and get the same error.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tgorgdotcom/locast2plex/issues/197#issuecomment-800662324, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGVMAKYV3ZVHKHVSKX44FR3TD7NSDANCNFSM4WNMDSQQ .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

shinycard255 commented 3 years ago

@RXtreme8 i will have to give this a try. thanks!

shinycard255 commented 3 years ago

@RXtreme8 using 'Host' network fixed my issue. thank you

rqbanerjee commented 3 years ago

I also got it to work by using Host mode. Here's my docker-compose.yml file. I

  1. added the network_mode line
  2. removed the ports section
    
    version: '2'
    services:
    locast2plex:
    network_mode: "host"
    image: tgorg/locast2plex
    container_name: locast2plex
    restart: unless-stopped
    environment:
      - username=email@yahoo.com
      - 'password=abcdefg
      - external_addy=192.168.1.999
      - external_port=6077
      - debug=yes
    volumes:
      - ./config.ini:/app/config/config.ini