From 8b39ed2f63a08597e1faf368c3c0506dbe960127 Mon Sep 17 00:00:00 2001 From: LukePulverenti Luke Pulverenti luke pulverenti Date: Sat, 8 Sep 2012 15:05:18 -0400 Subject: [PATCH] Moved TV into the main project and added Series properties to DTOBaseItem --- MediaBrowser.Api/ApiService.cs | 24 +++++- MediaBrowser.Controller/Kernel.cs | 41 +++------- .../MediaBrowser.Controller.csproj | 11 ++- .../Providers/AudioInfoProvider.cs | 51 +++---------- .../{Xml => Providers}/BaseItemXmlParser.cs | 7 +- .../Providers/BaseMetadataProvider.cs | 21 +----- .../Providers/FolderProviderFromXml.cs | 7 +- .../ImageFromMediaLocationProvider.cs | 6 +- .../Providers/LocalTrailerProvider.cs | 8 +- .../EpisodeImageFromMediaLocationProvider.cs | 11 ++- .../Providers/TV}/EpisodeProviderFromXml.cs | 12 ++- .../Providers/TV}/EpisodeXmlParser.cs | 7 +- .../Providers/TV}/SeriesProviderFromXml.cs | 12 ++- .../Providers/TV}/SeriesXmlParser.cs | 9 +-- .../Providers/VideoInfoProvider.cs | 18 +---- .../Resolvers/TV}/EpisodeResolver.cs | 9 +-- .../Resolvers/TV}/SeasonResolver.cs | 9 +-- .../Resolvers/TV}/SeriesResolver.cs | 11 ++- .../Resolvers/TV}/TVUtils.cs | 6 +- .../MediaBrowser.InternetProviders.csproj | 75 ------------------- MediaBrowser.InternetProviders/Plugin.cs | 14 ---- .../PluginConfiguration.cs | 8 -- .../Properties/AssemblyInfo.cs | 36 --------- MediaBrowser.Model/DTO/DTOBaseItem.cs | 2 +- MediaBrowser.Model/Entities/TV/Episode.cs | 7 ++ .../Entities/TV}/Season.cs | 7 +- .../Entities/TV}/Series.cs | 3 +- MediaBrowser.Model/MediaBrowser.Model.csproj | 3 + MediaBrowser.TV/Entities/Episode.cs | 8 -- MediaBrowser.TV/MediaBrowser.TV.csproj | 12 --- MediaBrowser.sln | 12 --- 31 files changed, 126 insertions(+), 341 deletions(-) rename MediaBrowser.Controller/{Xml => Providers}/BaseItemXmlParser.cs (96%) rename {MediaBrowser.TV/Providers => MediaBrowser.Controller/Providers/TV}/EpisodeImageFromMediaLocationProvider.cs (88%) rename {MediaBrowser.TV/Providers => MediaBrowser.Controller/Providers/TV}/EpisodeProviderFromXml.cs (85%) rename {MediaBrowser.TV/Metadata => MediaBrowser.Controller/Providers/TV}/EpisodeXmlParser.cs (90%) rename {MediaBrowser.TV/Providers => MediaBrowser.Controller/Providers/TV}/SeriesProviderFromXml.cs (77%) rename {MediaBrowser.TV/Metadata => MediaBrowser.Controller/Providers/TV}/SeriesXmlParser.cs (91%) rename {MediaBrowser.TV/Resolvers => MediaBrowser.Controller/Resolvers/TV}/EpisodeResolver.cs (69%) rename {MediaBrowser.TV/Resolvers => MediaBrowser.Controller/Resolvers/TV}/SeasonResolver.cs (81%) rename {MediaBrowser.TV/Resolvers => MediaBrowser.Controller/Resolvers/TV}/SeriesResolver.cs (89%) rename {MediaBrowser.TV => MediaBrowser.Controller/Resolvers/TV}/TVUtils.cs (95%) delete mode 100644 MediaBrowser.InternetProviders/MediaBrowser.InternetProviders.csproj delete mode 100644 MediaBrowser.InternetProviders/Plugin.cs delete mode 100644 MediaBrowser.InternetProviders/PluginConfiguration.cs delete mode 100644 MediaBrowser.InternetProviders/Properties/AssemblyInfo.cs create mode 100644 MediaBrowser.Model/Entities/TV/Episode.cs rename {MediaBrowser.TV/Entities => MediaBrowser.Model/Entities/TV}/Season.cs (73%) rename {MediaBrowser.TV/Entities => MediaBrowser.Model/Entities/TV}/Series.cs (74%) delete mode 100644 MediaBrowser.TV/Entities/Episode.cs diff --git a/MediaBrowser.Api/ApiService.cs b/MediaBrowser.Api/ApiService.cs index 25820f518e..895ca3d198 100644 --- a/MediaBrowser.Api/ApiService.cs +++ b/MediaBrowser.Api/ApiService.cs @@ -1,11 +1,12 @@ using MediaBrowser.Controller; using MediaBrowser.Model.DTO; using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Entities.TV; using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using System.Net; +using System.Threading.Tasks; namespace MediaBrowser.Api { @@ -92,7 +93,7 @@ namespace MediaBrowser.Api } AttachBasicFields(dto, item, user); - + // Make sure all the tasks we kicked off have completed. if (tasks.Count > 0) { @@ -116,7 +117,7 @@ namespace MediaBrowser.Api { dto.Genres = item.Genres.ToArray(); } - + dto.HasArt = !string.IsNullOrEmpty(item.ArtImagePath); dto.HasBanner = !string.IsNullOrEmpty(item.BannerImagePath); dto.HasLogo = !string.IsNullOrEmpty(item.LogoImagePath); @@ -182,6 +183,7 @@ namespace MediaBrowser.Api dto.IsVirtualFolder = folder.IsVirtualFolder; } + // Add AudioInfo Audio audio = item as Audio; if (audio != null) @@ -196,6 +198,7 @@ namespace MediaBrowser.Api }; } + // Add VideoInfo Video video = item as Video; if (video != null) @@ -219,6 +222,21 @@ namespace MediaBrowser.Api dto.VideoInfo.Subtitles = video.Subtitles.ToArray(); } } + + // Add SeriesInfo + Series series = item as Series; + + if (series != null) + { + DayOfWeek[] airDays = series.AirDays == null ? new DayOfWeek[] { } : series.AirDays.ToArray(); ; + + dto.SeriesInfo = new SeriesInfo() + { + AirDays = airDays, + AirTime = series.AirTime, + Status = series.Status + }; + } } /// diff --git a/MediaBrowser.Controller/Kernel.cs b/MediaBrowser.Controller/Kernel.cs index 0e4f7e5fd8..f493d33002 100644 --- a/MediaBrowser.Controller/Kernel.cs +++ b/MediaBrowser.Controller/Kernel.cs @@ -8,6 +8,7 @@ using MediaBrowser.Controller.Weather; using MediaBrowser.Model.Authentication; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Entities.TV; using MediaBrowser.Model.Progress; using System; using System.Collections.Generic; @@ -111,12 +112,6 @@ namespace MediaBrowser.Controller // Sort the providers by priority MetadataProviders = MetadataProvidersEnumerable.OrderBy(e => e.Priority).ToArray(); - - // Initialize the metadata providers - Parallel.ForEach(MetadataProviders, provider => - { - provider.Init(); - }); } /// @@ -126,17 +121,26 @@ namespace MediaBrowser.Controller /// void ItemController_PreBeginResolvePath(object sender, PreBeginResolveEventArgs e) { + // Ignore hidden files and folders if (e.IsHidden || e.IsSystemFile) { - // Ignore hidden files and folders e.Cancel = true; } + // Ignore any folders named "trailers" else if (Path.GetFileName(e.Path).Equals("trailers", StringComparison.OrdinalIgnoreCase)) { - // Ignore any folders named "trailers" e.Cancel = true; } + + // Don't try and resolve files within the season metadata folder + else if (Path.GetFileName(e.Path).Equals("metadata", StringComparison.OrdinalIgnoreCase) && e.IsDirectory) + { + if (e.Parent is Season || e.Parent is Series) + { + e.Cancel = true; + } + } } /// @@ -383,26 +387,5 @@ namespace MediaBrowser.Controller } } } - - protected override void DisposeComposableParts() - { - base.DisposeComposableParts(); - - DisposeProviders(); - } - - /// - /// Disposes all providers - /// - private void DisposeProviders() - { - if (MetadataProviders != null) - { - foreach (var provider in MetadataProviders) - { - provider.Dispose(); - } - } - } } } diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 66da56480f..1ebc384d4f 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -59,8 +59,17 @@ + + + + + + + + + @@ -82,7 +91,7 @@ - + diff --git a/MediaBrowser.Controller/Providers/AudioInfoProvider.cs b/MediaBrowser.Controller/Providers/AudioInfoProvider.cs index 3b55cd4925..5c2f8dea2e 100644 --- a/MediaBrowser.Controller/Providers/AudioInfoProvider.cs +++ b/MediaBrowser.Controller/Providers/AudioInfoProvider.cs @@ -1,17 +1,15 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.Composition; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using MediaBrowser.Common.Logging; -using MediaBrowser.Controller.FFMpeg; +using MediaBrowser.Controller.FFMpeg; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Entities; +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using System.Linq; +using System.Threading.Tasks; namespace MediaBrowser.Controller.Providers { - //[Export(typeof(BaseMetadataProvider))] + [Export(typeof(BaseMetadataProvider))] public class AudioInfoProvider : BaseMediaInfoProvider