Comments (17)
@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.
@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.
This looks like a similar issue to #13 "Will Not Start".
from locast2plex.
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.
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.
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.
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.
@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.
@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.
@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.
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.
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.
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.
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.
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.
@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.
@tgorgdotcom I think we can call this 'solved', so I'm closing.
Thank you for your help
from locast2plex.
Related Issues (20)
- Consider increasing the value for the 'analyzeduration' and 'probesize' options HOT 7
- Two or more instances of Locast2Plex on Docker? HOT 3
- Error in function login: Forbidden HOT 87
- Channel Scan and Mapping HOT 3
- Locast2plex closes at login HOT 4
- Channel scan fails HOT 3
- Only 1 tuner from Locast2Plex
- Plex no longer able to find locast2plex DVR HOT 8
- pull access denied --restart, repository does not exist HOT 3
- Partial recording HOT 3
- Locast2Plex closes at login again HOT 14
- Locast cares program HOT 2
- Should I worry? HOT 1
- Playback Error: Source is unavailable HOT 2
- Error in Function login: Forbidden Version 1.24.1.4931 HOT 5
- Version 0.6.7: main.py: error: unrecognized arguments: 2>&1
- Remove donor requirement HOT 6
- Locast is kaput, the party is officially over..... HOT 21
- Petition to prevent DRM on ATSC 3.0 broadcasts HOT 1
- Modify this for puffer.stanford.edu? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from locast2plex.