From 4e624c2cefd3b7f3358ca00253064b7e8cf89de4 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 26 May 2016 13:18:58 -0400 Subject: [PATCH] removed dead code --- .../MediaBrowser.Controller.csproj | 4 - .../Providers/IItemIdentityConverter.cs | 4 - .../Providers/IItemIdentityProvider.cs | 4 - .../Providers/IProviderManager.cs | 20 +---- .../Providers/ItemIdentifier.cs | 36 -------- .../Providers/ItemIdentities.cs | 16 ---- .../Manager/MetadataService.cs | 12 --- .../Manager/ProviderManager.cs | 19 ----- .../MediaBrowser.Providers.csproj | 1 - .../TV/TheTVDB/TvdbEpisodeProvider.cs | 82 +------------------ .../TV/TheTVDB/TvdbSeasonIdentityProvider.cs | 65 --------------- .../TV/TheTVDB/TvdbSeasonImageProvider.cs | 15 ---- .../TV/TheTVDB/TvdbSeriesProvider.cs | 2 +- .../LiveTv/EmbyTV/EmbyTV.cs | 4 +- .../ApplicationHost.cs | 2 - 15 files changed, 5 insertions(+), 281 deletions(-) delete mode 100644 MediaBrowser.Controller/Providers/IItemIdentityConverter.cs delete mode 100644 MediaBrowser.Controller/Providers/IItemIdentityProvider.cs delete mode 100644 MediaBrowser.Controller/Providers/ItemIdentifier.cs delete mode 100644 MediaBrowser.Controller/Providers/ItemIdentities.cs delete mode 100644 MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonIdentityProvider.cs diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 57855008d..4d9999b37 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -290,8 +290,6 @@ - - @@ -329,8 +327,6 @@ - - diff --git a/MediaBrowser.Controller/Providers/IItemIdentityConverter.cs b/MediaBrowser.Controller/Providers/IItemIdentityConverter.cs deleted file mode 100644 index bfdd1dbf3..000000000 --- a/MediaBrowser.Controller/Providers/IItemIdentityConverter.cs +++ /dev/null @@ -1,4 +0,0 @@ -namespace MediaBrowser.Controller.Providers -{ - public interface IItemIdentityConverter { } -} \ No newline at end of file diff --git a/MediaBrowser.Controller/Providers/IItemIdentityProvider.cs b/MediaBrowser.Controller/Providers/IItemIdentityProvider.cs deleted file mode 100644 index 6b403bb55..000000000 --- a/MediaBrowser.Controller/Providers/IItemIdentityProvider.cs +++ /dev/null @@ -1,4 +0,0 @@ -namespace MediaBrowser.Controller.Providers -{ - public interface IItemIdentityProvider { } -} \ No newline at end of file diff --git a/MediaBrowser.Controller/Providers/IProviderManager.cs b/MediaBrowser.Controller/Providers/IProviderManager.cs index 57e4ff320..a976a7f71 100644 --- a/MediaBrowser.Controller/Providers/IProviderManager.cs +++ b/MediaBrowser.Controller/Providers/IProviderManager.cs @@ -97,13 +97,11 @@ namespace MediaBrowser.Controller.Providers /// /// The image providers. /// The metadata services. - /// The identity providers. - /// The identity converters. /// The metadata providers. /// The savers. /// The image savers. /// The external ids. - void AddParts(IEnumerable imageProviders, IEnumerable metadataServices, IEnumerable identityProviders, IEnumerable identityConverters, IEnumerable metadataProviders, + void AddParts(IEnumerable imageProviders, IEnumerable metadataServices, IEnumerable metadataProviders, IEnumerable savers, IEnumerable imageSavers, IEnumerable externalIds); @@ -190,21 +188,5 @@ namespace MediaBrowser.Controller.Providers /// The cancellation token. /// Task{HttpResponseInfo}. Task GetSearchImage(string providerName, string url, CancellationToken cancellationToken); - - /// - /// Gets the item identity providers. - /// - /// The type of the t lookup information. - /// IEnumerable<IItemIdentityProvider<TLookupInfo, TIdentity>>. - IEnumerable> GetItemIdentityProviders() - where TLookupInfo : ItemLookupInfo; - - /// - /// Gets the item identity converters. - /// - /// The type of the t lookup information. - /// IEnumerable<IItemIdentityConverter<TIdentity>>. - IEnumerable> GetItemIdentityConverters() - where TLookupInfo : ItemLookupInfo; } } \ No newline at end of file diff --git a/MediaBrowser.Controller/Providers/ItemIdentifier.cs b/MediaBrowser.Controller/Providers/ItemIdentifier.cs deleted file mode 100644 index bbc6dd76c..000000000 --- a/MediaBrowser.Controller/Providers/ItemIdentifier.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Controller.Providers -{ - public static class ItemIdentifier - where TLookupInfo : ItemLookupInfo - { - public static async Task FindIdentities(TLookupInfo item, IProviderManager providerManager, CancellationToken cancellationToken) - { - var providers = providerManager.GetItemIdentityProviders(); - var converters = providerManager.GetItemIdentityConverters().ToList(); - - foreach (var provider in providers) - { - await provider.Identify(item); - } - - bool changesMade = true; - - while (changesMade) - { - changesMade = false; - - foreach (var converter in converters) - { - if (await converter.Convert(item)) - { - changesMade = true; - } - } - } - } - } -} \ No newline at end of file diff --git a/MediaBrowser.Controller/Providers/ItemIdentities.cs b/MediaBrowser.Controller/Providers/ItemIdentities.cs deleted file mode 100644 index 48316d0f4..000000000 --- a/MediaBrowser.Controller/Providers/ItemIdentities.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Threading.Tasks; - -namespace MediaBrowser.Controller.Providers -{ - public interface IItemIdentityProvider : IItemIdentityProvider - where TLookupInfo : ItemLookupInfo - { - Task Identify(TLookupInfo info); - } - - public interface IItemIdentityConverter : IItemIdentityConverter - where TLookupInfo : ItemLookupInfo - { - Task Convert(TLookupInfo info); - } -} \ No newline at end of file diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs index b84d1b0ff..678d495cb 100644 --- a/MediaBrowser.Providers/Manager/MetadataService.cs +++ b/MediaBrowser.Providers/Manager/MetadataService.cs @@ -179,18 +179,6 @@ namespace MediaBrowser.Providers.Manager lookupInfo.Year = result.ProductionYear; } - private async Task FindIdentities(TIdType id, CancellationToken cancellationToken) - { - try - { - await ItemIdentifier.FindIdentities(id, ProviderManager, cancellationToken).ConfigureAwait(false); - } - catch (Exception ex) - { - Logger.ErrorException("Error in FindIdentities", ex); - } - } - private DateTime GetLastRefreshDate(IHasMetadata item) { return item.DateLastRefreshed; diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.cs index c95d58a42..29897e073 100644 --- a/MediaBrowser.Providers/Manager/ProviderManager.cs +++ b/MediaBrowser.Providers/Manager/ProviderManager.cs @@ -55,8 +55,6 @@ namespace MediaBrowser.Providers.Manager private readonly IFileSystem _fileSystem; private IMetadataService[] _metadataServices = { }; - private IItemIdentityProvider[] _identityProviders = { }; - private IItemIdentityConverter[] _identityConverters = { }; private IMetadataProvider[] _metadataProviders = { }; private IEnumerable _savers; private IImageSaver[] _imageSavers; @@ -92,22 +90,17 @@ namespace MediaBrowser.Providers.Manager /// /// The image providers. /// The metadata services. - /// The identity providers. - /// The identity converters. /// The metadata providers. /// The metadata savers. /// The image savers. /// The external ids. public void AddParts(IEnumerable imageProviders, IEnumerable metadataServices, - IEnumerable identityProviders, IEnumerable identityConverters, IEnumerable metadataProviders, IEnumerable metadataSavers, IEnumerable imageSavers, IEnumerable externalIds) { ImageProviders = imageProviders.ToArray(); _metadataServices = metadataServices.OrderBy(i => i.Order).ToArray(); - _identityProviders = identityProviders.ToArray(); - _identityConverters = identityConverters.ToArray(); _metadataProviders = metadataProviders.ToArray(); _imageSavers = imageSavers.ToArray(); _externalIds = externalIds.OrderBy(i => i.Name).ToArray(); @@ -301,18 +294,6 @@ namespace MediaBrowser.Providers.Manager .ThenBy(GetDefaultOrder); } - public IEnumerable> GetItemIdentityProviders() - where TLookupInfo : ItemLookupInfo - { - return _identityProviders.OfType>(); - } - - public IEnumerable> GetItemIdentityConverters() - where TLookupInfo : ItemLookupInfo - { - return _identityConverters.OfType>(); - } - private IEnumerable GetRemoteImageProviders(IHasImages item, bool includeDisabled) { var options = GetMetadataOptions(item); diff --git a/MediaBrowser.Providers/MediaBrowser.Providers.csproj b/MediaBrowser.Providers/MediaBrowser.Providers.csproj index bbfa20738..240b2e2cc 100644 --- a/MediaBrowser.Providers/MediaBrowser.Providers.csproj +++ b/MediaBrowser.Providers/MediaBrowser.Providers.csproj @@ -177,7 +177,6 @@ - diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs index 7005ba8f5..a41a95c12 100644 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs @@ -24,7 +24,7 @@ namespace MediaBrowser.Providers.TV /// /// Class RemoteEpisodeProvider /// - class TvdbEpisodeProvider : IRemoteMetadataProvider, IItemIdentityProvider + class TvdbEpisodeProvider : IRemoteMetadataProvider { private static readonly string FullIdKey = MetadataProviders.Tvdb + "-Full"; @@ -871,86 +871,6 @@ namespace MediaBrowser.Providers.TV }); } - public Task Identify(EpisodeInfo info) - { - if (info.ProviderIds.ContainsKey(FullIdKey)) - { - return Task.FromResult(null); - } - - string seriesTvdbId; - info.SeriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out seriesTvdbId); - - if (string.IsNullOrEmpty(seriesTvdbId) || info.IndexNumber == null) - { - return Task.FromResult(null); - } - - var id = new Identity(seriesTvdbId, info.ParentIndexNumber, info.IndexNumber.Value, info.IndexNumberEnd); - info.SetProviderId(FullIdKey, id.ToString()); - - return Task.FromResult(id); - } - public int Order { get { return 0; } } - - public struct Identity - { - public string SeriesId { get; private set; } - public int? SeasonIndex { get; private set; } - public int EpisodeNumber { get; private set; } - public int? EpisodeNumberEnd { get; private set; } - - public Identity(string id) - : this() - { - this = ParseIdentity(id).Value; - } - - public Identity(string seriesId, int? seasonIndex, int episodeNumber, int? episodeNumberEnd) - : this() - { - SeriesId = seriesId; - SeasonIndex = seasonIndex; - EpisodeNumber = episodeNumber; - EpisodeNumberEnd = episodeNumberEnd; - } - - public override string ToString() - { - return string.Format("{0}:{1}:{2}", - SeriesId, - SeasonIndex != null ? SeasonIndex.Value.ToString() : "A", - EpisodeNumber + (EpisodeNumberEnd != null ? "-" + EpisodeNumberEnd.Value.ToString() : "")); - } - - public static Identity? ParseIdentity(string id) - { - if (string.IsNullOrEmpty(id)) - return null; - - try { - var parts = id.Split(':'); - var series = parts[0]; - var season = parts[1] != "A" ? (int?)int.Parse(parts[1]) : null; - - int index; - int? indexEnd; - - if (parts[2].Contains("-")) { - var split = parts[2].IndexOf("-", StringComparison.OrdinalIgnoreCase); - index = int.Parse(parts[2].Substring(0, split)); - indexEnd = int.Parse(parts[2].Substring(split + 1)); - } else { - index = int.Parse(parts[2]); - indexEnd = null; - } - - return new Identity(series, season, index, indexEnd); - } catch { - return null; - } - } - } } } diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonIdentityProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonIdentityProvider.cs deleted file mode 100644 index 4198430c9..000000000 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonIdentityProvider.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System.Threading.Tasks; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Entities; - -namespace MediaBrowser.Providers.TV -{ - public class TvdbSeasonIdentityProvider : IItemIdentityProvider - { - public static readonly string FullIdKey = MetadataProviders.Tvdb + "-Full"; - - public Task Identify(SeasonInfo info) - { - string tvdbSeriesId; - if (!info.SeriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out tvdbSeriesId) || string.IsNullOrEmpty(tvdbSeriesId) || info.IndexNumber == null) - { - return Task.FromResult(null); - } - - if (string.IsNullOrEmpty(info.GetProviderId(FullIdKey))) - { - var id = string.Format("{0}:{1}", tvdbSeriesId, info.IndexNumber.Value); - info.SetProviderId(FullIdKey, id); - } - - return Task.FromResult(null); - } - - public static TvdbSeasonIdentity? ParseIdentity(string id) - { - if (id == null) - { - return null; - } - - try - { - var parts = id.Split(':'); - return new TvdbSeasonIdentity(parts[0], int.Parse(parts[1])); - } - catch - { - return null; - } - } - } - - public struct TvdbSeasonIdentity - { - public string SeriesId { get; private set; } - public int Index { get; private set; } - - public TvdbSeasonIdentity(string id) - : this() - { - this = TvdbSeasonIdentityProvider.ParseIdentity(id).Value; - } - - public TvdbSeasonIdentity(string seriesId, int index) - : this() - { - SeriesId = seriesId; - Index = index; - } - } -} \ No newline at end of file diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonImageProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonImageProvider.cs index 71587db97..4b619665c 100644 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonImageProvider.cs +++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeasonImageProvider.cs @@ -70,21 +70,6 @@ namespace MediaBrowser.Providers.TV var seriesProviderIds = series.ProviderIds; var seasonNumber = season.IndexNumber.Value; - var identity = TvdbSeasonIdentityProvider.ParseIdentity(season.GetProviderId(TvdbSeasonIdentityProvider.FullIdKey)); - if (identity == null) - { - identity = new TvdbSeasonIdentity(series.GetProviderId(MetadataProviders.Tvdb), seasonNumber); - } - - if (identity != null) - { - var id = identity.Value; - seasonNumber = AdjustForSeriesOffset(series, id.Index); - - seriesProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase); - seriesProviderIds[MetadataProviders.Tvdb.ToString()] = id.SeriesId; - } - var seriesDataPath = await TvdbSeriesProvider.Current.EnsureSeriesInfo(seriesProviderIds, series.GetPreferredMetadataLanguage(), cancellationToken).ConfigureAwait(false); if (!string.IsNullOrWhiteSpace(seriesDataPath)) diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs index 15b0c97ac..49ca5cdf2 100644 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs +++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs @@ -25,7 +25,7 @@ using CommonIO; namespace MediaBrowser.Providers.TV { - public class TvdbSeriesProvider : IRemoteMetadataProvider, IItemIdentityProvider, IHasOrder + public class TvdbSeriesProvider : IRemoteMetadataProvider, IHasOrder { private const string TvdbSeriesOffset = "TvdbSeriesOffset"; private const string TvdbSeriesOffsetFormat = "{0}-{1}"; diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 205000fdc..25822a81b 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -929,10 +929,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV recordPath = recorder.GetOutputPath(mediaStreamInfo, recordPath); recordPath = EnsureFileUnique(recordPath, timer.Id); - _fileSystem.CreateDirectory(Path.GetDirectoryName(recordPath)); - activeRecordingInfo.Path = recordPath; _libraryMonitor.ReportFileSystemChangeBeginning(recordPath); + _fileSystem.CreateDirectory(Path.GetDirectoryName(recordPath)); + activeRecordingInfo.Path = recordPath; var duration = recordingEndDate - DateTime.UtcNow; diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs index 7b958779d..59a8a4f78 100644 --- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs +++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs @@ -804,8 +804,6 @@ namespace MediaBrowser.Server.Startup.Common ProviderManager.AddParts(GetExports(), GetExports(), - GetExports(), - GetExports(), GetExports(), GetExports(), GetExports(),