Add ability to remove a ChannelMapping (#12970)

* Add ability to remove a ChannelMapping

Remove a ChannelMapping by selecting the same mapping again.
This should be an intuitive way to de-select a mapping which currently requires the manual editing of a config file:
https://forum.jellyfin.org/t-how-to-unmap-livetv-channels

---------

Co-authored-by: Bond-009 <bond.009@outlook.com>
pull/13378/head
Sven Giermann 2 weeks ago committed by GitHub
parent 37e6ed5feb
commit 2624021d67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -230,10 +230,15 @@ public class ListingsManager : IListingsManager
var listingsProviderInfo = config.ListingProviders
.First(info => string.Equals(providerId, info.Id, StringComparison.OrdinalIgnoreCase));
var channelMappingExists = listingsProviderInfo.ChannelMappings
.Any(pair => string.Equals(pair.Name, tunerChannelNumber, StringComparison.OrdinalIgnoreCase)
&& string.Equals(pair.Value, providerChannelNumber, StringComparison.OrdinalIgnoreCase));
listingsProviderInfo.ChannelMappings = listingsProviderInfo.ChannelMappings
.Where(pair => !string.Equals(pair.Name, tunerChannelNumber, StringComparison.OrdinalIgnoreCase)).ToArray();
if (!string.Equals(tunerChannelNumber, providerChannelNumber, StringComparison.OrdinalIgnoreCase))
if (!string.Equals(tunerChannelNumber, providerChannelNumber, StringComparison.OrdinalIgnoreCase)
&& !channelMappingExists)
{
var newItem = new NameValuePair
{

Loading…
Cancel
Save