diff --git a/MediaBrowser.Api/ItemUpdateService.cs b/MediaBrowser.Api/ItemUpdateService.cs index d7182d68e..4feba82b0 100644 --- a/MediaBrowser.Api/ItemUpdateService.cs +++ b/MediaBrowser.Api/ItemUpdateService.cs @@ -108,6 +108,12 @@ namespace MediaBrowser.Api hasTags.Tags = request.Tags; } + var hasShortOverview = item as IHasShortOverview; + if (hasShortOverview != null) + { + hasShortOverview.ShortOverview = request.ShortOverview; + } + var hasKeywords = item as IHasKeywords; if (hasKeywords != null) { diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index dd3351a93..c016f67ab 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -1594,11 +1594,6 @@ namespace MediaBrowser.Api.Playback { return source; } - - Logger.Warn("Invalid channel MediaSourceId requested, defaulting to first. Item: {0}. Requested MediaSourceId: {1}.", - id, - mediaSourceId - ); } return list.First(); diff --git a/MediaBrowser.Controller/Entities/IHasShortOverview.cs b/MediaBrowser.Controller/Entities/IHasShortOverview.cs new file mode 100644 index 000000000..437201faa --- /dev/null +++ b/MediaBrowser.Controller/Entities/IHasShortOverview.cs @@ -0,0 +1,12 @@ + +namespace MediaBrowser.Controller.Entities +{ + public interface IHasShortOverview + { + /// + /// Gets or sets the short overview. + /// + /// The short overview. + string ShortOverview { get; set; } + } +} diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs index 5510c795a..54cb3fcc9 100644 --- a/MediaBrowser.Controller/Entities/Movies/Movie.cs +++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs @@ -14,7 +14,7 @@ namespace MediaBrowser.Controller.Entities.Movies /// /// Class Movie /// - public class Movie : Video, IHasCriticRating, IHasSoundtracks, IHasProductionLocations, IHasBudget, IHasKeywords, IHasTrailers, IHasThemeMedia, IHasTaglines, IHasPreferredMetadataLanguage, IHasAwards, IHasMetascore, IHasLookupInfo, ISupportsBoxSetGrouping + public class Movie : Video, IHasCriticRating, IHasSoundtracks, IHasProductionLocations, IHasBudget, IHasKeywords, IHasTrailers, IHasThemeMedia, IHasTaglines, IHasPreferredMetadataLanguage, IHasAwards, IHasMetascore, IHasLookupInfo, ISupportsBoxSetGrouping, IHasShortOverview { public List SpecialFeatureIds { get; set; } @@ -52,6 +52,7 @@ namespace MediaBrowser.Controller.Entities.Movies ProductionLocations = new List(); } + public string ShortOverview { get; set; } public string AwardSummary { get; set; } public float? Metascore { get; set; } diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 5f3a06f79..1310e7797 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -133,6 +133,7 @@ + diff --git a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs index 41f994303..3cb90d360 100644 --- a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs +++ b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs @@ -1,5 +1,4 @@ using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using System; @@ -9,7 +8,6 @@ using System.IO; using System.Linq; using System.Text; using System.Threading; -using System.Threading.Tasks; using System.Xml; namespace MediaBrowser.Controller.Providers @@ -249,6 +247,23 @@ namespace MediaBrowser.Controller.Providers break; } + case "ShortOverview": + { + var val = reader.ReadElementContentAsString(); + + if (!string.IsNullOrWhiteSpace(val)) + { + var hasShortOverview = item as IHasShortOverview; + + if (hasShortOverview != null) + { + hasShortOverview.ShortOverview = val; + } + } + + break; + } + case "CriticRatingSummary": { var val = reader.ReadElementContentAsString(); @@ -812,19 +827,19 @@ namespace MediaBrowser.Controller.Providers { var val = reader.ReadElementContentAsString(); - if (string.Equals("HSBS", val)) + if (string.Equals("HSBS", val, StringComparison.CurrentCulture)) { video.Video3DFormat = Video3DFormat.HalfSideBySide; } - else if (string.Equals("HTAB", val)) + else if (string.Equals("HTAB", val, StringComparison.CurrentCulture)) { video.Video3DFormat = Video3DFormat.HalfTopAndBottom; } - else if (string.Equals("FTAB", val)) + else if (string.Equals("FTAB", val, StringComparison.CurrentCulture)) { video.Video3DFormat = Video3DFormat.FullTopAndBottom; } - else if (string.Equals("FSBS", val)) + else if (string.Equals("FSBS", val, StringComparison.CurrentCulture)) { video.Video3DFormat = Video3DFormat.FullSideBySide; } @@ -1195,10 +1210,10 @@ namespace MediaBrowser.Controller.Providers /// /// The reader. /// IEnumerable{PersonInfo}. - private IEnumerable GetPersonsFromXmlNode(XmlReader reader) + private IEnumerable GetPersonsFromXmlNode(XmlReader reader) { var name = string.Empty; - var type = "Actor"; // If type is not specified assume actor + var type = PersonType.Actor; // If type is not specified assume actor var role = string.Empty; int? sortOrder = null; @@ -1257,7 +1272,7 @@ namespace MediaBrowser.Controller.Providers } } - var personInfo = new Entities.PersonInfo + var personInfo = new PersonInfo { Name = name.Trim(), Role = role, diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs index e3d678a68..1d20080dd 100644 --- a/MediaBrowser.Model/Dto/BaseItemDto.cs +++ b/MediaBrowser.Model/Dto/BaseItemDto.cs @@ -147,6 +147,12 @@ namespace MediaBrowser.Model.Dto /// The overview. public string Overview { get; set; } + /// + /// Gets or sets the short overview. + /// + /// The short overview. + public string ShortOverview { get; set; } + /// /// Gets or sets the name of the TMDB collection. /// diff --git a/MediaBrowser.Model/Dto/SubtitleDownloadOptions.cs b/MediaBrowser.Model/Dto/SubtitleDownloadOptions.cs index a0b49f42c..02a016406 100644 --- a/MediaBrowser.Model/Dto/SubtitleDownloadOptions.cs +++ b/MediaBrowser.Model/Dto/SubtitleDownloadOptions.cs @@ -8,10 +8,22 @@ namespace MediaBrowser.Model.Dto /// The item identifier. public string ItemId { get; set; } + /// + /// Gets or sets the media source identifier. + /// + /// The media source identifier. + public string MediaSourceId { get; set; } + /// /// Gets or sets the index of the stream. /// /// The index of the stream. public int StreamIndex { get; set; } + + /// + /// Gets or sets the format. + /// + /// The format. + public string Format { get; set; } } } \ No newline at end of file diff --git a/MediaBrowser.Model/Querying/ItemFields.cs b/MediaBrowser.Model/Querying/ItemFields.cs index 45cce3c9f..790638446 100644 --- a/MediaBrowser.Model/Querying/ItemFields.cs +++ b/MediaBrowser.Model/Querying/ItemFields.cs @@ -131,6 +131,11 @@ namespace MediaBrowser.Model.Querying /// Revenue, + /// + /// The short overview + /// + ShortOverview, + /// /// The screenshot image tags /// diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.cs index 1f37d3609..593d88cf5 100644 --- a/MediaBrowser.Providers/Manager/ProviderManager.cs +++ b/MediaBrowser.Providers/Manager/ProviderManager.cs @@ -150,9 +150,13 @@ namespace MediaBrowser.Providers.Manager var preferredLanguage = item.GetPreferredMetadataLanguage(); - var language = query.IncludeAllLanguages ? null : preferredLanguage; + var languages = new List(); + if (!query.IncludeAllLanguages && !string.IsNullOrWhiteSpace(preferredLanguage)) + { + languages.Add(preferredLanguage); + } - var tasks = providers.Select(i => GetImages(item, cancellationToken, i, language, query.ImageType)); + var tasks = providers.Select(i => GetImages(item, cancellationToken, i, languages, query.ImageType)); var results = await Task.WhenAll(tasks).ConfigureAwait(false); @@ -167,10 +171,10 @@ namespace MediaBrowser.Providers.Manager /// The item. /// The cancellation token. /// The provider. - /// The preferred language. + /// The preferred languages. /// The type. /// Task{IEnumerable{RemoteImageInfo}}. - private async Task> GetImages(IHasImages item, CancellationToken cancellationToken, IRemoteImageProvider provider, string preferredLanguage, ImageType? type = null) + private async Task> GetImages(IHasImages item, CancellationToken cancellationToken, IRemoteImageProvider provider, List preferredLanguages, ImageType? type = null) { try { @@ -181,12 +185,18 @@ namespace MediaBrowser.Providers.Manager result = result.Where(i => i.Type == type.Value); } - if (string.Equals(preferredLanguage, "en", StringComparison.OrdinalIgnoreCase)) + if (preferredLanguages.Count > 0) { result = result.Where(i => string.IsNullOrEmpty(i.Language) || - string.Equals(i.Language, "en", StringComparison.OrdinalIgnoreCase)); + preferredLanguages.Contains(i.Language, StringComparer.OrdinalIgnoreCase)); } + //if (string.Equals(preferredLanguage, "en", StringComparison.OrdinalIgnoreCase)) + //{ + // result = result.Where(i => string.IsNullOrEmpty(i.Language) || + // string.Equals(i.Language, "en", StringComparison.OrdinalIgnoreCase)); + //} + return result; } catch (OperationCanceledException) diff --git a/MediaBrowser.Providers/Manager/ProviderUtils.cs b/MediaBrowser.Providers/Manager/ProviderUtils.cs index 9b9acdd09..2783fda6b 100644 --- a/MediaBrowser.Providers/Manager/ProviderUtils.cs +++ b/MediaBrowser.Providers/Manager/ProviderUtils.cs @@ -183,6 +183,7 @@ namespace MediaBrowser.Providers.Manager MergeAwards(source, target, lockedFields, replaceData); MergeTaglines(source, target, lockedFields, replaceData); MergeTrailers(source, target, lockedFields, replaceData); + MergeShortOverview(source, target, lockedFields, replaceData); if (mergeMetadataSettings) { @@ -216,6 +217,20 @@ namespace MediaBrowser.Providers.Manager } } + private static void MergeShortOverview(BaseItem source, BaseItem target, List lockedFields, bool replaceData) + { + var sourceHasShortOverview = source as IHasShortOverview; + var targetHasShortOverview = target as IHasShortOverview; + + if (sourceHasShortOverview != null && targetHasShortOverview != null) + { + if (replaceData || string.IsNullOrEmpty(targetHasShortOverview.ShortOverview)) + { + targetHasShortOverview.ShortOverview = sourceHasShortOverview.ShortOverview; + } + } + } + private static void MergeAlbumArtist(BaseItem source, BaseItem target, List lockedFields, bool replaceData) { var sourceHasAlbumArtist = source as IHasAlbumArtist; diff --git a/MediaBrowser.Providers/MediaBrowser.Providers.csproj b/MediaBrowser.Providers/MediaBrowser.Providers.csproj index ab8483e01..3234a8ae0 100644 --- a/MediaBrowser.Providers/MediaBrowser.Providers.csproj +++ b/MediaBrowser.Providers/MediaBrowser.Providers.csproj @@ -220,6 +220,7 @@ + diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs index ac0724a9a..0f2ed1642 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs @@ -286,7 +286,6 @@ namespace MediaBrowser.Providers.MediaInfo if (!string.Equals(originalVal, val, StringComparison.OrdinalIgnoreCase)) { - // TODO: Preserve casing from original value artistsFound.Add(whitelistArtist); } } diff --git a/MediaBrowser.Providers/Omdb/OmdbProvider.cs b/MediaBrowser.Providers/Omdb/OmdbProvider.cs index 75f9cf06d..2dc3245f3 100644 --- a/MediaBrowser.Providers/Omdb/OmdbProvider.cs +++ b/MediaBrowser.Providers/Omdb/OmdbProvider.cs @@ -129,6 +129,13 @@ namespace MediaBrowser.Providers.Omdb { hasAwards.AwardSummary = WebUtility.HtmlDecode(result.Awards); } + + var hasShortOverview = item as IHasShortOverview; + if (hasShortOverview != null) + { + // Imdb plots are usually pretty short + hasShortOverview.ShortOverview = result.Plot; + } } private bool ShouldFetchGenres(BaseItem item) diff --git a/MediaBrowser.Providers/Savers/AlbumXmlSaver.cs b/MediaBrowser.Providers/Savers/AlbumXmlSaver.cs index 58e5ad123..4f08f0d82 100644 --- a/MediaBrowser.Providers/Savers/AlbumXmlSaver.cs +++ b/MediaBrowser.Providers/Savers/AlbumXmlSaver.cs @@ -1,7 +1,6 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Library; -using MediaBrowser.Model.Entities; using System.Collections.Generic; using System.IO; using System.Text; diff --git a/MediaBrowser.Providers/Savers/MovieXmlSaver.cs b/MediaBrowser.Providers/Savers/MovieXmlSaver.cs index 9a31fd091..cd5f2faec 100644 --- a/MediaBrowser.Providers/Savers/MovieXmlSaver.cs +++ b/MediaBrowser.Providers/Savers/MovieXmlSaver.cs @@ -56,8 +56,6 @@ namespace MediaBrowser.Providers.Savers return false; } - private static readonly CultureInfo UsCulture = new CultureInfo("en-US"); - /// /// Saves the specified item. /// diff --git a/MediaBrowser.Providers/Savers/XmlSaverHelpers.cs b/MediaBrowser.Providers/Savers/XmlSaverHelpers.cs index 6b51c62f9..6b9ebbfe9 100644 --- a/MediaBrowser.Providers/Savers/XmlSaverHelpers.cs +++ b/MediaBrowser.Providers/Savers/XmlSaverHelpers.cs @@ -135,9 +135,7 @@ namespace MediaBrowser.Providers.Savers //Add the new node to the document. xmlDocument.InsertBefore(xmlDocument.CreateXmlDeclaration("1.0", "UTF-8", "yes"), xmlDocument.DocumentElement); - var parentPath = Path.GetDirectoryName(path); - - Directory.CreateDirectory(parentPath); + Directory.CreateDirectory(Path.GetDirectoryName(path)); var wasHidden = false; @@ -259,9 +257,13 @@ namespace MediaBrowser.Providers.Savers } } - if (!string.IsNullOrEmpty(item.Overview)) + var hasShortOverview = item as IHasShortOverview; + if (hasShortOverview != null) { - builder.Append(""); + if (!string.IsNullOrEmpty(hasShortOverview.ShortOverview)) + { + builder.Append(""); + } } if (!string.IsNullOrEmpty(item.CustomRating)) @@ -655,7 +657,7 @@ namespace MediaBrowser.Providers.Savers if (video != null) { - AddChapters(video, builder, itemRepository); + //AddChapters(video, builder, itemRepository); if (video.Video3DFormat.HasValue) { diff --git a/MediaBrowser.Providers/TV/SeriesXmlParser.cs b/MediaBrowser.Providers/TV/SeriesXmlParser.cs index 9f68ad7a4..237fcf73a 100644 --- a/MediaBrowser.Providers/TV/SeriesXmlParser.cs +++ b/MediaBrowser.Providers/TV/SeriesXmlParser.cs @@ -89,12 +89,6 @@ namespace MediaBrowser.Providers.TV } break; } - case "SeriesName": - // TODO: Deprecate in mid-2014 - // No longer saving this tag but will still read it for a while - item.Name = reader.ReadElementContentAsString(); - break; - case "Status": { var status = reader.ReadElementContentAsString(); diff --git a/MediaBrowser.Providers/Videos/VideoXmlProvider.cs b/MediaBrowser.Providers/Videos/VideoXmlProvider.cs new file mode 100644 index 000000000..779f3faa7 --- /dev/null +++ b/MediaBrowser.Providers/Videos/VideoXmlProvider.cs @@ -0,0 +1,37 @@ +using MediaBrowser.Common.IO; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Providers; +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Logging; +using MediaBrowser.Providers.Movies; +using System.Collections.Generic; +using System.IO; +using System.Threading; + +namespace MediaBrowser.Providers.Videos +{ + class VideoXmlProvider : BaseXmlProvider