aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2016-11-15 14:43:27 -0500
committerGitHub <noreply@github.com>2016-11-15 14:43:27 -0500
commit50b033f3aacd0664a6252410279b8c9c9b3d42d8 (patch)
treecfc936e2a43d3465bbbc1431249a196572398d39 /MediaBrowser.Controller
parent6d40ab7e1c40fdb5c18defb7a5f5521bbd0cfb2e (diff)
parentc0491fb56348c63d78b1f694f574e963f9526a9a (diff)
Merge pull request #2291 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs7
-rw-r--r--MediaBrowser.Controller/LiveTv/LiveTvProgram.cs37
2 files changed, 43 insertions, 1 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 10cac79922..cd61d2cce4 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -2134,7 +2134,7 @@ namespace MediaBrowser.Controller.Entities
{
MetadataCountryCode = GetPreferredMetadataCountryCode(),
MetadataLanguage = GetPreferredMetadataLanguage(),
- Name = Name,
+ Name = GetNameForMetadataLookup(),
ProviderIds = ProviderIds,
IndexNumber = IndexNumber,
ParentIndexNumber = ParentIndexNumber,
@@ -2143,6 +2143,11 @@ namespace MediaBrowser.Controller.Entities
};
}
+ protected virtual string GetNameForMetadataLookup()
+ {
+ return Name;
+ }
+
/// <summary>
/// This is called before any metadata refresh and returns true or false indicating if changes were made
/// </summary>
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs
index fd9507afa0..08fcc00353 100644
--- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs
+++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs
@@ -4,9 +4,12 @@ using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.LiveTv;
using System;
using System.Collections.Generic;
+using System.Linq;
+using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Serialization;
+using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Controller.LiveTv
{
@@ -236,6 +239,40 @@ namespace MediaBrowser.Controller.LiveTv
}
}
+ private LiveTvOptions GetConfiguration()
+ {
+ return ConfigurationManager.GetConfiguration<LiveTvOptions>("livetv");
+ }
+
+ private ListingsProviderInfo GetListingsProviderInfo()
+ {
+ if (string.Equals(ServiceName, "Emby", StringComparison.OrdinalIgnoreCase))
+ {
+ var config = GetConfiguration();
+
+ return config.ListingProviders.FirstOrDefault(i => !string.IsNullOrWhiteSpace(i.MoviePrefix));
+ }
+
+ return null;
+ }
+
+ protected override string GetNameForMetadataLookup()
+ {
+ var name = base.GetNameForMetadataLookup();
+
+ var listings = GetListingsProviderInfo();
+
+ if (listings != null)
+ {
+ if (!string.IsNullOrWhiteSpace(listings.MoviePrefix))
+ {
+ name = name.Replace(listings.MoviePrefix, string.Empty, StringComparison.OrdinalIgnoreCase).Trim();
+ }
+ }
+
+ return name;
+ }
+
public override List<ExternalUrl> GetRelatedUrls()
{
var list = base.GetRelatedUrls();