Giter Club home page Giter Club logo

Comments (17)

CTJohnK avatar CTJohnK commented on August 22, 2024 1

@tgorgdotcom That seems to have done the trick. I did leave 'current_location' and 'current-dma' set in LocastService.py to my lat/long and dma respectively.

I was able to watch a few minutes of live streaming and have setup a recording for later this evening. I'll let you know how that worked out.

Thank you for your help!

As for the geolocation issue. When I first signed up for Locast, I kept getting an error indicating I had selected the wrong market (this was with my previous internet provider). After several emails with Locast, I was able to connect without issue. I presumed they had tied a lat/long to my account to override whatever was being sent back; I guess that was an incorrect presumption.

In any event, I have not had any issue with the geolocation not being available or returning data, just a questionable value returned. As a note, I'm running the script on a RaspberryPi and not using a Docker container.

Again, glad to help in any way I can.

from locast2plex.

tgorgdotcom avatar tgorgdotcom commented on August 22, 2024 1

@CTJohnK Ah, okay. Yeah it's tough because I think they tie into the browser's geolocation API, and I think that method is more accurate than relying on geoIP alone. I haven't found an easy solution to do a similar geolocation yet, but I have an idea on how to override location that we can try that doesn't involve modifying code, and hopefully I'll resolve it in a few days.

from locast2plex.

CTJohnK avatar CTJohnK commented on August 22, 2024

This looks like a similar issue to #13 "Will Not Start".

from locast2plex.

CTJohnK avatar CTJohnK commented on August 22, 2024

I did a bit more digging and rather than changing the '501' to '533' in the .json files, I set "current_dma" in LocastService.py to equal 501 instead of 'None'. The script is running and currently Plex is refreshing the guide data. Hopefully that will solve the issue for now. I'll advise if everything is working after the refresh completes.

from locast2plex.

CTJohnK avatar CTJohnK commented on August 22, 2024

That didn't work. When I try to watch a show I receive a playback error indicating "Could not tune channel. Please check your tuner or antenna."

from locast2plex.

alexmarsaudon avatar alexmarsaudon commented on August 22, 2024

I have a similar issue (different KeyError):
docker run -d --name=locast2plex -e username=CENSORED -e 'password=CENSORED' -e external_addy=10.10.150.50 -p 6077:6077 --restart unless-stopped tgorg/locast2plex
Locast2Plex v0.4.2
Traceback (most recent call last):
File "/app/main.py", line 324, in
station_list = locast.get_stations()
DEBUG MODE ACTIVE
UUID found.
UUID set to: lrtrvhsi...
Logging into Locast using username [censored]...
Validating User Info...
User Info obtained.
User didDonate: True
User donationExpire: 1602950280
Getting user location...
User location obtained as 37.751/-97.822
Getting user's media market (DMA)...
DMA found as 678
Getting list of stations based on DMA...
Loading FCC Stations list...
File "/app/LocastService.py", line 195, in get_stations
fcc_market = dma_mapping[str(self.current_dma)]
KeyError: '678'

from locast2plex.

CTJohnK avatar CTJohnK commented on August 22, 2024

I should have also listed the error received when trying to force the DMA and then watch a show (from the Raspberry Pi) -

Exception happened during processing of request from ('127.0.0.1', 44892)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 293, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 655, in init
self.handle()
File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
self.handle_one_request()
File "/usr/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
method()
File "/home/pi/locast2plex/main.py", line 85, in do_GET
channelUri = self.local_locast.get_station_stream_uri(channelId)
File "/home/pi/locast2plex/LocastService.py", line 407, in get_station_stream_uri
print("Error when getting the video URL: " + videoUrlReqErr.message)
TypeError: cannot concatenate 'str' and 'getset_descriptor' objects

from locast2plex.

tgorgdotcom avatar tgorgdotcom commented on August 22, 2024

@CTJohnK I was looking into a few different issues related to this. It looks like my script identifies your location as in Connecticut correctly, and gets the DMA code for that market (533), even when it's not available for Locast currently. Changing the 501 to 533 would prevent a "KeyError", like you mentioned, but it probably won't return any channels, because there aren't any. I'm working on updating the code to better explain potential pitfalls in the future.

@alexmarsaudon Similar to CTJohnK's issue above, locast2plex detects your location to be a place that does not have Locast support currently.

from locast2plex.

CTJohnK avatar CTJohnK commented on August 22, 2024

@tgorgdotcom Thank you for looking into this. As i noted, forcing current_dma to 501 does allows the script to load and I was able to reload the Guide (which displayed correctly), but unfortunately playback does not work.

If there is anything I can do to assist, please let me know.

Recap:

  • first error listing was with no modifications.
  • first change: all listings of "501" to "533", no success.
  • next, reverted the above change and forced 'current_dma' to "501'. This allowed the script to complete loading, re-connect to Plex and re-load the Guide. However, playback and recordings do not work.

from locast2plex.

CTJohnK avatar CTJohnK commented on August 22, 2024

@tgorgdotcom Had some time this evening so I did a bit more digging, not sure if any of this helps.

Looking in "api_information.txt" and running a couple of them I see:
Using DMA by lat/long API:
-- Using lat/long which Locast reports - https://api.locastnet.org/api/watch/dma/41.4824/-73.2231 returns DMA 533, New Haven
-- Using Google maps lat/long for my town - https://api.locastnet.org/api/watch/dma/41.470340/-73.390683 returns 501, New York

Using station listing API:
-- https://api.locastnet.org/api/watch/epg/533 returns []
-- https://api.locastnet.org/api/watch/epg/501 returns station listings [{"id":104,"dma":501,"stationId":"16689","name":"WCBSDT","callSign":"2.1 CBS","logoUrl":"https://static.locastnet.org/logo/NewYork/WCBS.png",.....]

Please note the station id of "104" which is CBS out of New York. When I use "current_dma = 501" in LocastService.py and try to watch CBS, The following error is throw -

127.0.0.1 - - [18/Aug/2020 20:29:47] "GET /lineup.json HTTP/1.0" 200 -
127.0.0.1 - - [18/Aug/2020 20:29:47] "GET /discover.json HTTP/1.0" 200 -
127.0.0.1 - - [18/Aug/2020 20:29:47] "GET /lineup_status.json HTTP/1.0" 200 -
Getting station info for 104...

Exception happened during processing of request from ('127.0.0.1', 35940)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 293, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 655, in init
self.handle()
File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
self.handle_one_request()
File "/usr/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
method()
File "/home/pi/locast2plex/main.py", line 85, in do_GET
channelUri = self.local_locast.get_station_stream_uri(channelId)
File "/home/pi/locast2plex/LocastService.py", line 406, in get_station_stream_uri
print("Error when getting the video URL: " + videoUrlReqErr.message)
TypeError: cannot concatenate 'str' and 'getset_descriptor' objects

Looking at the script, that error is coming from 'get_station_stream_uri' which includes lat/long so I changed 'current_location = None' to 'current_location = 41.470340/-73.390683' to match my town to the 501 DMA noted earlier. Unfortunately, I receive the same error.

Based on seeing "TypeError: cannot concatenate 'str' and 'getset_descriptor' objects", it looks like the URL for 'get_station_stream_uri' is not being created properly, perhaps?

Again, hopefully this is helpful and let me know if there is anything I can do to help.

from locast2plex.

tgorgdotcom avatar tgorgdotcom commented on August 22, 2024

Hmmm, I'm thinking it's my geoip service that I'm using. I'm going to check what Locast does to geolocate and maybe I can start using that instead. I'll keep you posted

from locast2plex.

CTJohnK avatar CTJohnK commented on August 22, 2024

If I execute https://get.geojs.io/v1/ip/geo.json, it returns the following -
{"organization_name":"CHARTER-20115","region":"Connecticut","accuracy":10,"asn":20115,"organization":"AS20115 CHARTER-20115","timezone":"America/New_York","longitude":"-73.2231","country_code3":"USA","area_code":"0","ip":"75.xxx.xx.x","city":"Southbury","country":"United States","continent_code":"NA","country_code":"US","latitude":"41.4824"}

Which is correct to indicate I'm using Charter (Spectrum) and the service is coming out of Southbury, CT.

However, wouldn't setting 'current_location = 41.470340/-73.390683' bypass 'self.current_location' code?

from locast2plex.

tgorgdotcom avatar tgorgdotcom commented on August 22, 2024

Yep, you're right, but it needs to be in Python's dict format. What might be easier is if you check lines 310-314 in main.py. Comment out 310, uncomment 311-314, and put in your coordinates.

I think I need to definitely rethink the whole geolocation thing. It was designed to prevent users from overriding their location (and to prevent any more legal issues for Locast -- as it could draw the ire of sports teams that have specific contracts for showing their games out of their local region). Not only is the geolocation service returning incorrect locations for some users, but the service seems unaccessible from the script for some users.

from locast2plex.

tgorgdotcom avatar tgorgdotcom commented on August 22, 2024

Ah, interesting! Thanks for pointing that out. I'll check if my account returns a lat/long as well. Maybe going forward we can use that instead (or at least override my geo location is needed).

from locast2plex.

CTJohnK avatar CTJohnK commented on August 22, 2024

The recording worked last night.

I reached out to Locast this morning (email conversation below), and it would appear they do not tie a lat/long to the user. In my earlier case, perhaps they did something to re-map my ISP/IP address to show it in the NY market.

me - Subject: Travel - "I'll be doing some travel to WA, MA and CA over the coming months (unfortunately) and was wondering if i can use Locast to view the local TV stations in those areas (if available) or is my account 'locked' into the New York market?"

Locast - "Thank you for reaching out to us. Yes you will be able to use locast where our market covers. You can check availability here https://www.locast.org/dma . Keep in mind that you will not be able to watch broadcasting outside of the area you are visiting,"

Interesting note, the locast link they provided in the email took about 30-seconds to respond and it showed my DMA as 501 and a lat/long which is a couple of miles from my home. I'm not sure how they are determining the geo data, but can you piggyback on that link to return the lat/long from within the Python code?

from locast2plex.

CTJohnK avatar CTJohnK commented on August 22, 2024

@tgorgdotcom Okay. Let me know if there is anything you'd like tested, I have a 'test' setup on Windows so I can make changes without impacting my 'production'.

from locast2plex.

CTJohnK avatar CTJohnK commented on August 22, 2024

@tgorgdotcom I think we can call this 'solved', so I'm closing.

Thank you for your help

from locast2plex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.