aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Giermann <sven.giermann@gmail.com>2025-01-15 11:26:39 +0100
committerGitHub <noreply@github.com>2025-01-15 11:26:39 +0100
commit2624021d67005835cdffd51694c557bb771f4565 (patch)
tree48b70078a62fd2eb50355096b1007f1613b5c2f8
parent37e6ed5febd3784a71f26b9777ab35e39e15dbaf (diff)
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>
-rw-r--r--src/Jellyfin.LiveTv/Listings/ListingsManager.cs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Jellyfin.LiveTv/Listings/ListingsManager.cs b/src/Jellyfin.LiveTv/Listings/ListingsManager.cs
index 3df2d0d2c..39c2bd375 100644
--- a/src/Jellyfin.LiveTv/Listings/ListingsManager.cs
+++ b/src/Jellyfin.LiveTv/Listings/ListingsManager.cs
@@ -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
{