-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Web app setup creates duplicate channels #973
Comments
It would be useful to attach the m3u file to this ticket, so that we can reproduce the problem easiily. |
I have asked Glen if it I can attach his URL or his file to the ticket, since it is a private URL. |
URL of m3u file: |
I downloaded the m3u file and then used the local m3u file for testing. I can reproduce the issue with the classic mythtv-setup; each time a scan is done the same 26 channels are appended to the channel list. So doing it twice gives you 52 channels, channel 27 the same as channel 1. I do not really know if this a bug or intended behavior a.k.a. feature. It would make sense however to filter out duplicate channels as this is also what is done with conventional DVB and ATSC channel scanning. An obvious workaround may be to delete all channels before importing/scanning them again but there may be drawbacks to that such as the loss of manually entered additional channel data. |
In that case, the web app setup is consistent with mythtv-setup. |
A check on uniqueness of channel name combined with URL on insert should be sufficient I think. |
I am rather deep into IPTV at the moment because of #936 so I think I can fix the scanning as well while I am at it. It would be great if @bennettpeter can then fix what is needed to make it work in the web app. |
The web app calls ChannelScanner::ImportVBox in libs/libmythtv/channelscan/channelscanner.cpp to process the file. That is the same code used by mythtv-setup, so any fix made there would fix it for both. |
The new channel numbers are allocated in iptvchannelfetcher.cpp only for the "github.com" version of the M3U parser. This code has been added in commit a474d52 by @paul-h When the M3U file does have channel numbers then they are used; only when a channel does not have a channel number there is one automatically generated and that is then the first unused, i.e. existing highest channel number in the video source plus one. I think the way forward is to do a lookup in the database for the channel name plus the video source; if that matches then the channel number of that channel in the database is used. It is possible to also match on video source plus channel name plus URL to find the channel in the database. However, as I understand it, login credentials and subscription information can be encoded in the URL and that means that when you for instance extend your subscription a rescan will still result in new channels. |
When the IPTV channel scan does not contain a channel number for a channel then a default channel number is used. This is the first unused channel number in the database for that video source. The code for this looks at all channels, but the channels that have been deleted should be excluded. This is now fixed. Refs #936 Refs #973
The bug fix in the above commit does not solve the problem described in this issue but it does enable a workaround; when all channels are deleted before doing the scan then the first channel scanned gets number 1, etc. |
One remark on:
A user (myself included) can have multiple Channel scanning is performed at the Currently, to work around this limitation, users would need to configure a separate ("input connection ID": this approach may not fully align with a DVB setup, as DVB can contain multiple |
When a channel found in an IPTV channel scan does not have a channel number but only a name then it does now look in the database for the channel number. The lookup is done on channel name only. The lookup is done in the channels of the video source attached to the capture card used in the channel scan. When there is no channel number found in the IPTV channel scan and also not in the database then a default channel number is used. This is the first unused channel number in the database for that video source. Refs #936 Refs #973
When a channel found in an IPTV channel scan does not have a channel number but only a name then it does now look in the database for the channel number. The lookup is done on channel name only. The lookup is done in the channels of the video source attached to the capture card used in the channel scan. When there is no channel number found in the IPTV channel scan and also not in the database then a default channel number is used. This is the first unused channel number in the database for that video source. Refs #936 Refs #973
This is not a workaround but this is exactly how it all should work. I think it is a design flaw that the URL is part of capture card; it should be a part of the video source. However, you mention a very valid point and that is that you need to do multiple mythfilldatabase runs, one for each video source. My understanding of mythfilldatabase is limited, but the idea is that it adds guide data to a channel based on the XMLTVID of that channel. Why should it not do the channels of all video sources, or of a collection of video sources, in one pass? |
@bennettpeter and glenb, this issue should be fixed now. Can you please test? |
Use isEmpty instead of isNull in ChannelUtil::UpdateChannel to handle both an empty string and no string in the same way. With an IPTV channel rescan the existing values of xmltvid and icon are now preserved when there are no new values found in the scan. Refs MythTV#973
Use isEmpty instead of isNull in ChannelUtil::UpdateChannel to handle both an empty string and no string in the same way. With an IPTV channel rescan the existing values of xmltvid and icon are now preserved when there are no new values found in the scan. Refs #973
Reported by glenb:
on the m3u import, i am using tvheadend's exported playlist based on a tag in tvheadend to generate a playlist. if i add a single channel and then reimport the list. it makes all new channels for the whole list resulting in a large amount of duplicates. i assume it is something to do with the format and tags in the playlist. it looks like this:
its static the channels come out the same everytime. is there some way i could fix it so that the import would ignore existing channels already in myth with the same stream url ?
i can add a channel manually in the sql which is quicker by making a channel in channel editor and then adding a channel in iptvchannel table and that works.
the m3u import i am talking about is the input connections when a playlist url is specified as a capture card on freebox/iptv recorder. it is the same i assume as what was in mythtv-setup application (deprecated). when i had a manually made list it would not bring in repeated channels. when i have it automated to tvheadend, it does not. i thought maybe you knew. but i choose scan, and then choose m3u import, as type and it discovers the channels and adds them. i'm sure its coded on the 'extinf' parameters and the code does not see the entry as a duplicate probably on first parameter. anyway i'll narrow it down more. i have a way using sql commands to save time overall so i'll continue to do that.
The text was updated successfully, but these errors were encountered: