diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-06-23 13:48:30 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-06-23 13:48:30 -0400 |
| commit | d6cf7b51acda145d32c9944f1b66728c7e09a9f8 (patch) | |
| tree | 461ce04491def89ecf8b0aa41996a3f700e04334 /MediaBrowser.Controller/Providers | |
| parent | cc2cfabda83aa29532bc1808174e888b6fde2cd4 (diff) | |
added movie, series, folder and episode xml saving support
Diffstat (limited to 'MediaBrowser.Controller/Providers')
| -rw-r--r-- | MediaBrowser.Controller/Providers/BaseItemXmlParser.cs | 37 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Providers/IProviderManager.cs | 19 |
2 files changed, 45 insertions, 11 deletions
diff --git a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs index 645987437..d06c89a01 100644 --- a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs +++ b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs @@ -89,7 +89,7 @@ namespace MediaBrowser.Controller.Providers } private readonly CultureInfo _usCulture = new CultureInfo("en-US"); - + /// <summary> /// Fetches metadata from one Xml Element /// </summary> @@ -205,6 +205,17 @@ namespace MediaBrowser.Controller.Providers break; } + case "MPAADescription": + { + var rating = reader.ReadElementContentAsString(); + + if (!string.IsNullOrWhiteSpace(rating)) + { + item.OfficialRatingDescription = rating; + } + break; + } + case "CustomRating": { var val = reader.ReadElementContentAsString(); @@ -306,7 +317,7 @@ namespace MediaBrowser.Controller.Providers { var actors = reader.ReadInnerXml(); - + if (actors.Contains("<")) { // This is one of the mis-named "Actors" full nodes created by MB2 @@ -378,7 +389,7 @@ namespace MediaBrowser.Controller.Providers { float val; // All external meta is saving this as '.' for decimal I believe...but just to be sure - if (float.TryParse(rating.Replace(',','.'), NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out val)) + if (float.TryParse(rating.Replace(',', '.'), NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out val)) { item.CommunityRating = val; } @@ -412,6 +423,14 @@ namespace MediaBrowser.Controller.Providers } break; + case "CollectionNumber": + var tmdbCollection = reader.ReadElementContentAsString(); + if (!string.IsNullOrWhiteSpace(tmdbCollection)) + { + item.SetProviderId(MetadataProviders.TmdbCollection, tmdbCollection); + } + break; + case "TVcomId": var TVcomId = reader.ReadElementContentAsString(); if (!string.IsNullOrWhiteSpace(TVcomId)) @@ -602,8 +621,8 @@ namespace MediaBrowser.Controller.Providers { switch (reader.Name) { - // Removed support for "Value" tag as it conflicted with MPAA rating but leaving this function for possible - // future support of "Description" -ebr + // Removed support for "Value" tag as it conflicted with MPAA rating but leaving this function for possible + // future support of "Description" -ebr default: reader.Skip(); @@ -679,7 +698,7 @@ namespace MediaBrowser.Controller.Providers // Only split by comma if there is no pipe in the string // We have to be careful to not split names like Matthew, Jr. - var separator = value.IndexOf('|') == -1 ? ',' : '|'; + var separator = value.IndexOf('|') == -1 && value.IndexOf(';') == -1 ? new[] { ',' } : new[] { '|', ';' }; value = value.Trim().Trim(separator); @@ -690,12 +709,12 @@ namespace MediaBrowser.Controller.Providers /// Provides an additional overload for string.split /// </summary> /// <param name="val">The val.</param> - /// <param name="separator">The separator.</param> + /// <param name="separators">The separators.</param> /// <param name="options">The options.</param> /// <returns>System.String[][].</returns> - private static string[] Split(string val, char separator, StringSplitOptions options) + private static string[] Split(string val, char[] separators, StringSplitOptions options) { - return val.Split(new[] { separator }, options); + return val.Split(separators, options); } } diff --git a/MediaBrowser.Controller/Providers/IProviderManager.cs b/MediaBrowser.Controller/Providers/IProviderManager.cs index 99860bac0..7f80973e9 100644 --- a/MediaBrowser.Controller/Providers/IProviderManager.cs +++ b/MediaBrowser.Controller/Providers/IProviderManager.cs @@ -1,4 +1,5 @@ using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Library; using System.Collections.Generic; using System.IO; using System.Threading; @@ -6,6 +7,9 @@ using System.Threading.Tasks; namespace MediaBrowser.Controller.Providers { + /// <summary> + /// Interface IProviderManager + /// </summary> public interface IProviderManager { /// <summary> @@ -21,8 +25,17 @@ namespace MediaBrowser.Controller.Providers /// <exception cref="System.ArgumentNullException">item</exception> Task<string> DownloadAndSaveImage(BaseItem item, string source, string targetName, bool saveLocally, SemaphoreSlim resourcePool, CancellationToken cancellationToken); + /// <summary> + /// Saves the image. + /// </summary> + /// <param name="item">The item.</param> + /// <param name="source">The source.</param> + /// <param name="targetName">Name of the target.</param> + /// <param name="saveLocally">if set to <c>true</c> [save locally].</param> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns>Task{System.String}.</returns> Task<string> SaveImage(BaseItem item, Stream source, string targetName, bool saveLocally, CancellationToken cancellationToken); - + /// <summary> /// Saves to library filesystem. /// </summary> @@ -48,7 +61,9 @@ namespace MediaBrowser.Controller.Providers /// Adds the metadata providers. /// </summary> /// <param name="providers">The providers.</param> - void AddMetadataProviders(IEnumerable<BaseMetadataProvider> providers); + /// <param name="savers">The savers.</param> + void AddParts(IEnumerable<BaseMetadataProvider> providers, + IEnumerable<IMetadataSaver> savers); /// <summary> /// Gets the save path. |
