mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
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>
This commit is contained in:
parent
37e6ed5feb
commit
2624021d67
@ -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…
x
Reference in New Issue
Block a user