diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-11-15 12:55:26 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-11-15 12:55:26 -0500 |
| commit | 70aebff444b30e98365d5d4ff477e88e77430a5c (patch) | |
| tree | 55036110828ca13ffc2ccc47e7c87937d9944858 /MediaBrowser.Controller/LiveTv/LiveTvProgram.cs | |
| parent | 420fa8bf7fc3b656207fcc9d41d11ab7d4d906d0 (diff) | |
add movie prefix feature
Diffstat (limited to 'MediaBrowser.Controller/LiveTv/LiveTvProgram.cs')
| -rw-r--r-- | MediaBrowser.Controller/LiveTv/LiveTvProgram.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs index fd9507afa..08fcc0035 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(); |
