tgorgdotcom / locast2plex

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

NYC DMA - Wrong sub-channel numbers - WJLPDT10 returned instead of WJLPDT1 #42

Open diana1055 opened 4 years ago

diana1055 commented 4 years ago

When running the python script everything works great except that it returns the wrong sub-channels. The channels on Locast are:

Call sign........Virtual Channel.............RF Channel WJLPDT1......33.1......................... ................3.1 WJLPDT2......33.2..........................................3.2 WJLPDT3......33.3..........................................3.3 WJLPDT4......33.4..........................................3.4 WJLPDT5......33.5..........................................3.5 WJLPDT8......33.8..........................................3.8 WJLPDT10...33.10.......................................3.10

However, the list returned to Plex by the script is: Call sign........Virtual Channel........... RF Channel WJLPDT10.....33.1.........................................3.10 WJLPDT2.......33.2.........................................3.2 WJLPDT3.......33.3.........................................3.3 WJLPDT4.......33.4.........................................3.4 WJLPDT5.......33.5.........................................3.5 WJLPDT8.......33.8.........................................3.8

As you can see, the script is returning WJLPDT10, when it should return WJLPDT1 and not returning WJLPDT1 at all.

I can forward any logs or perform any diagnostics you need.

Any advice you can offer to resolve this problem would be appreciated.

Thanks, Diana

diana1055 commented 4 years ago

Thus what the channel map looks like in PLEX:

image

No matter what I have triedm I can't get WJLPDT1 to show up in the Device Channels.

diana1055 commented 4 years ago

Closed by mistake.

CTJohnK commented 4 years ago

Given the partial Locast EPG results for DMA 501 below (listing data removed), could the issue be resolved by updating the "known_stations.json"?
If so, would the listing example below be correct based on https://en.wikipedia.org/wiki/WJLP#Digital_channels ?

{"id":866,"dma":501,"stationId":"75523","name":"WJLPDT","callSign":"3.1 METVN","logoUrl":"":[],"sequence":32,"logo226Url":"","tivoId":1067186567}, {"id":867,"dma":501,"stationId":"92098","name":"WJLPDT2","callSign":"3.2 LAFF","logoUrl":"","active":true,"listings":[],"sequence":33,"logo226Url":"","tivoId":1430812096}, {"id":868,"dma":501,"stationId":"99162","name":"WJLPDT3","callSign":"3.3 GRIT","logoUrl":"","active":true,"listings":[],"sequence":34,"logo226Url":"","tivoId":3546339735}, {"id":869,"dma":501,"stationId":"99163","name":"WJLPDT4","callSign":"3.4 MYS","logoUrl":"","active":true,"listings":[],"sequence":35,"logo226Url":"","tivoId":3546339767}, {"id":1436,"dma":501,"stationId":"111255","name":"WJLPDT5","callSign":"3.5 COURT","logoUrl":"","active":true,"listings":[],"sequence":36,"logo226Url":"","tivoId":7312791843}, {"id":10000,"dma":501,"stationId":"112951","name":"WJLPDT8","callSign":"3.8 NEWS NJ","logoUrl":"","active":true,"listings":[],"sequence":37,"logo226Url":"","tivoId":7917569308}, {"id":10001,"dma":501,"stationId":"105748","name":"WJLPDT10","callSign":"3.10 WJLP WX","logoUrl":"","active":true,"listings":[],"sequence":38,"logo226Url":"","tivoId":6073596066},

[ { "callSign": "WYBE", "name": "WPPT", "dma": 504, "analog": false, "rootChannel": "35", "subChannel": null }, { "callSign": "KAXT", "name": "KAXTLD", "dma": 807, "analog": false, "rootChannel": "1", "subChannel": "2" }, { "callSign": "3.1 METVN", "name": "WJLPDT", "dma": 501, "analog": false, "rootChannel": "33", "subChannel": 1 }, { "callSign": "3.2 LAFF", "name": "WJLPDT2", "dma": 501, "analog": false, "rootChannel": "33", "subChannel": 2 } ]

diana1055 commented 4 years ago

Nice idea, but no dice. I added the stations to the known stations JSON but the script STILL doesn't return WJLPDT1/3.1. The only sub-channels that show up after a scan are 2,3,4,5,8,and 10 - no 3.1 or WJLPDT1.

It has nothing to do with EPG...the channels list returned by the scan of the Silicon Dust Tuner emulator is wrong, before we ever get to the EPG selection.

image

I've been trying to find a place to intervene in the code, but I'm not familiar with Python and haven't been able to find a way to force the code to ignore 3.10.

diana1055 commented 4 years ago

Have discovered some more info. I inserted a print command inside LocastService.py to list the FCC stations found and I get 3.1 listed TWICE but no 3.10. Somewhere the subchannel value is being truncated to a single digit. This results in subchannel 10 being deduped as subchannel 1. I still haven't found where the string "WJLPDT10" is being constructed, or where the subchannel is getting truncated.

added to LocastService,py at line 280 (just before 'return stationRes'

        print(stationsRes[index]['channel'])

Output WITHOUT WJLP in known_stations.json:

Getting user's media market (DMA)... DMA found as 501 Getting list of stations based on DMA... Loading FCC Stations list... 2.1 2.2 2.3 3.1 3.2 3.3 3.4 3.5 3.8 3.1 4.1 4.2 5.1 5.2 5.4 5.5 7.1 7.2 7.3 9.1 9.3 9.4 11.1 11.2 11.3 11.4 13.1 13.2 14.1 21.1 21.2 21.3 21.4 31.1 31.2 31.3 41.1 41.2 46.1 47.1 47.2 48.1 48.2 48.3 68.1 68.2 68.3 Starting device server on 0.0.0.0:6077 Starting SSDP server...

CTJohnK commented 4 years ago

Looking at the code, it's not getting into the 'except' so the known_stations is not reviewed. And since the callSign is being converted into a float, the trailing zero is meaningless.

The other interesting thing is the is returning as '3.x', however according to the WJLP Wiki page (noted earlier) the channel is '33'.x

diana1055 commented 4 years ago

Locust puts it in as channel 3 which IS their broadcast channel (i.e. they broadcast on RF channel 3 from a tower on the Condé Nast building). There is a long and controversial history of broadcast conflicts and licensing gimmicks for this channel. Bottom line, their RF channel is 3 but their virtual channel is 33. Therefore, all EPGs list it as 33.x. However, most cable systems and Locast position it as channel 3.

The core problem is simply that Locast2plex seems to be unable to correctly handle a subchannel of 10. I’ve tried tracing execution using Wing to set breakpoints but the variables are all compound objects making it close to impossible to see where to insert remediation code.

Somewhere the “second” 3.1 (which is really 3.10) overwrites the “real” 3.1.

CTJohnK commented 4 years ago

It appears removing 'float' allows the channel to process, however, I notice 3.5, 3.6, 3.8 and 3.10 show no channel label. This occurs with or without the 'float'.

dvrsetup

CTJohnK commented 4 years ago

Never mind, I've experienced an ID-10T error, they are under '33.x'.

diana1055 commented 4 years ago

Removing the float conversion worked. I now get 3.1 tuned correctly when I select 33.1 in Plex. I wonder if the float conversion was done for some other reason that will show up later, but for now I finally have it working correctly. Thanks for tracking down that "float" function - I hadn't noticed it.

CTJohnK commented 4 years ago

I reloaded DMA 501 on my test setup and re-installed the DVR in Plex. Guide appeared correctly, I'm able to watch and record those channels.

@tgorgdotcom perhaps stationsRes[index]['channel'] = float(locast_station['callSign'].split()[0]) can be changed to stationsRes[index]['channel'] = (locast_station['callSign'].split()[0]) in LocastService.py for the next release or do you see an issue with that change long-term?

diana1055 commented 4 years ago

All I needed to do was relaunch Locast2plex and then re-scan channels in Plex and everything just fell into place. 3.1 showed up correctly in the device channels, and WJLPDT10 unmapped to a guide channel (my choice).

CTJohnK commented 4 years ago

Off topic, but how do you get Locast2Plex to re-scan? When I go back into the DVR config, it reports it cannot connect to Locast2Plex, but it always works, i.e. I can watch and record. Only way I can rescan and setup the channel list is to delete the DVR and re-add it.

If we had gone down to Ocean Beach, NJ this summer, WJLPDT10 would have been handy; I left that off my listing as well.

dvrsetup2

diana1055 commented 4 years ago

IIRC the device settings and channel map link both started working when I installed PLEX beta 1.30.1.3232:

image

As you can see, I also updated the template to provide 4 tuners - had them all recording yesterday. I switched to the Secaucus OTA guide because the NY EPG listed WJLP as 33.1-1 which made it sort to the end of 33.x channels. (These are all using PLEX's EPG - I had Listings Direct running for a few days, but couldn't get the channel logos to load and had run into the Plex bug regarding large XMLTV files that was fixed in the current beta (1.20.1.3252). When I have time, I'll update Plex and try LD again.

diana1055 commented 4 years ago

So far 1.20.1.3252 is solid. I was able to load a full 15 day guide from LD and load it up in PLEX. I had to configure the program to use web links for channel logos - trying to download them and load them from disk wasn’t working.

tgorgdotcom commented 4 years ago

I merged in a fix from FozzieBear for the incorrect channel detection, Hope that works @CTJohnK - I've noticed that Plex is finicky with Locast2Plex in that regard. I don't quite know why, but it's something I can look into.

deathbybandaid commented 4 years ago

I've made headway on retrieving the EPG from Locast directly, and then converting it to xmltv format. I'll check, but that may fix this.

deathbybandaid commented 4 years ago

I checked, and verified that my new system for creating xmltv.xml from Locasts API will fix this.

tgorgdotcom commented 4 years ago

I think this is already fixed -- but it's not in a tagged release yet.

deathbybandaid commented 4 years ago

I think my local copy is just git cloned master, and not fixed.

deathbybandaid commented 4 years ago

Locast legitimately has channels labeled as 3.x instead of 33.x

tgorgdotcom commented 4 years ago

Oh, that's right. I thought we were talking about the subchannel float issue, rather than the incorrect channel issue. Sorry for the confusion...