diff options
| author | tikuf <admin@nyalindee.com> | 2014-03-29 21:34:16 +1100 |
|---|---|---|
| committer | tikuf <admin@nyalindee.com> | 2014-03-29 21:34:16 +1100 |
| commit | 241be6dd93f6e0ec96ef88f0182b8985eb275995 (patch) | |
| tree | ac42c23908911099ebc2840bc6b9549de565bab6 /MediaBrowser.Controller | |
| parent | 520b77a098a5f3755c098636821a7ff3742a055f (diff) | |
| parent | 5e5b1f180c2a13152c8f318f045547c6508c5b3e (diff) | |
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Diffstat (limited to 'MediaBrowser.Controller')
18 files changed, 405 insertions, 161 deletions
diff --git a/MediaBrowser.Controller/Dlna/CodecProfile.cs b/MediaBrowser.Controller/Dlna/CodecProfile.cs index 2b9a40ea0..e2eb60d9a 100644 --- a/MediaBrowser.Controller/Dlna/CodecProfile.cs +++ b/MediaBrowser.Controller/Dlna/CodecProfile.cs @@ -1,13 +1,18 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Xml.Serialization; namespace MediaBrowser.Controller.Dlna { public class CodecProfile { + [XmlAttribute("type")] public CodecType Type { get; set; } + public ProfileCondition[] Conditions { get; set; } + + [XmlAttribute("codec")] public string Codec { get; set; } public CodecProfile() @@ -30,16 +35,23 @@ namespace MediaBrowser.Controller.Dlna public enum CodecType { - VideoCodec = 0, - VideoAudioCodec = 1, - AudioCodec = 2 + Video = 0, + VideoAudio = 1, + Audio = 2 } public class ProfileCondition { + [XmlAttribute("condition")] public ProfileConditionType Condition { get; set; } + + [XmlAttribute("property")] public ProfileConditionValue Property { get; set; } + + [XmlAttribute("value")] public string Value { get; set; } + + [XmlAttribute("isRequired")] public bool IsRequired { get; set; } public ProfileCondition() @@ -69,8 +81,6 @@ namespace MediaBrowser.Controller.Dlna VideoBitrate, VideoFramerate, VideoLevel, - VideoPacketLength, - VideoProfile, - VideoTimestamp + VideoProfile } } diff --git a/MediaBrowser.Controller/Dlna/ContainerProfile.cs b/MediaBrowser.Controller/Dlna/ContainerProfile.cs index 3bd3c9eaf..1029ba72c 100644 --- a/MediaBrowser.Controller/Dlna/ContainerProfile.cs +++ b/MediaBrowser.Controller/Dlna/ContainerProfile.cs @@ -1,12 +1,16 @@ using System.Collections.Generic; using System.Linq; +using System.Xml.Serialization; namespace MediaBrowser.Controller.Dlna { public class ContainerProfile { + [XmlAttribute("type")] public DlnaProfileType Type { get; set; } public ProfileCondition[] Conditions { get; set; } + + [XmlAttribute("container")] public string Container { get; set; } public ContainerProfile() diff --git a/MediaBrowser.Controller/Dlna/DeviceIdentification.cs b/MediaBrowser.Controller/Dlna/DeviceIdentification.cs index 461c77537..c9cd4bc70 100644 --- a/MediaBrowser.Controller/Dlna/DeviceIdentification.cs +++ b/MediaBrowser.Controller/Dlna/DeviceIdentification.cs @@ -1,4 +1,6 @@ +using System.Xml.Serialization; + namespace MediaBrowser.Controller.Dlna { public class DeviceIdentification @@ -41,9 +43,7 @@ namespace MediaBrowser.Controller.Dlna /// <summary> /// Gets or sets the manufacturer. /// </summary> - /// <value> - /// The manufacturer. - /// </value> + /// <value>The manufacturer.</value> public string Manufacturer { get; set; } /// <summary> /// Gets or sets the manufacturer URL. @@ -64,8 +64,13 @@ namespace MediaBrowser.Controller.Dlna public class HttpHeaderInfo { + [XmlAttribute("name")] public string Name { get; set; } + + [XmlAttribute("value")] public string Value { get; set; } + + [XmlAttribute("match")] public HeaderMatchType Match { get; set; } } diff --git a/MediaBrowser.Controller/Dlna/DeviceProfile.cs b/MediaBrowser.Controller/Dlna/DeviceProfile.cs index f3de1bc34..c1fc713e4 100644 --- a/MediaBrowser.Controller/Dlna/DeviceProfile.cs +++ b/MediaBrowser.Controller/Dlna/DeviceProfile.cs @@ -1,6 +1,13 @@ - +using MediaBrowser.Model.Dlna; +using MediaBrowser.Model.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml.Serialization; + namespace MediaBrowser.Controller.Dlna { + [XmlRoot("Profile")] public class DeviceProfile { /// <summary> @@ -9,25 +16,11 @@ namespace MediaBrowser.Controller.Dlna /// <value>The name.</value> public string Name { get; set; } - /// <summary> - /// Gets or sets the type of the client. - /// </summary> - /// <value>The type of the client.</value> - public string ClientType { get; set; } - - /// <summary> - /// Gets or sets the transcoding profiles. - /// </summary> - /// <value>The transcoding profiles.</value> - public TranscodingProfile[] TranscodingProfiles { get; set; } - - /// <summary> - /// Gets or sets the direct play profiles. - /// </summary> - /// <value>The direct play profiles.</value> - public DirectPlayProfile[] DirectPlayProfiles { get; set; } + [XmlIgnore] + public string Id { get; set; } - public ContainerProfile[] ContainerProfiles { get; set; } + [XmlIgnore] + public DeviceProfileType ProfileType { get; set; } /// <summary> /// Gets or sets the identification. @@ -43,7 +36,9 @@ namespace MediaBrowser.Controller.Dlna public string ModelNumber { get; set; } public string ModelUrl { get; set; } public bool IgnoreTranscodeByteRangeRequests { get; set; } - public bool SupportsAlbumArtInDidl { get; set; } + public bool EnableAlbumArtInDidl { get; set; } + + public string SupportedMediaTypes { get; set; } /// <summary> /// Controls the content of the X_DLNADOC element in the urn:schemas-dlna-org:device-1-0 namespace. @@ -60,14 +55,27 @@ namespace MediaBrowser.Controller.Dlna public string ProtocolInfo { get; set; } - public MediaProfile[] MediaProfiles { get; set; } - public CodecProfile[] CodecProfiles { get; set; } - public int TimelineOffsetSeconds { get; set; } - public bool RequiresPlainVideoItems { get; set; } public bool RequiresPlainFolders { get; set; } + /// <summary> + /// Gets or sets the direct play profiles. + /// </summary> + /// <value>The direct play profiles.</value> + public DirectPlayProfile[] DirectPlayProfiles { get; set; } + + /// <summary> + /// Gets or sets the transcoding profiles. + /// </summary> + /// <value>The transcoding profiles.</value> + public TranscodingProfile[] TranscodingProfiles { get; set; } + + public ContainerProfile[] ContainerProfiles { get; set; } + + public CodecProfile[] CodecProfiles { get; set; } + public MediaProfile[] MediaProfiles { get; set; } + public DeviceProfile() { DirectPlayProfiles = new DirectPlayProfile[] { }; @@ -75,6 +83,149 @@ namespace MediaBrowser.Controller.Dlna MediaProfiles = new MediaProfile[] { }; CodecProfiles = new CodecProfile[] { }; ContainerProfiles = new ContainerProfile[] { }; + + SupportedMediaTypes = "Audio,Photo,Video"; + } + + public List<string> GetSupportedMediaTypes() + { + return (SupportedMediaTypes ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToList(); + } + + public TranscodingProfile GetAudioTranscodingProfile(string container, string audioCodec) + { + container = (container ?? string.Empty).TrimStart('.'); + + return TranscodingProfiles.FirstOrDefault(i => + { + if (i.Type != DlnaProfileType.Audio) + { + return false; + } + + if (!string.Equals(container, i.Container, StringComparison.OrdinalIgnoreCase)) + { + return false; + } + + if (!i.GetAudioCodecs().Contains(audioCodec ?? string.Empty)) + { + return false; + } + + return true; + }); + } + + public TranscodingProfile GetVideoTranscodingProfile(string container, string audioCodec, string videoCodec) + { + container = (container ?? string.Empty).TrimStart('.'); + + return TranscodingProfiles.FirstOrDefault(i => + { + if (i.Type != DlnaProfileType.Video) + { + return false; + } + + if (!string.Equals(container, i.Container, StringComparison.OrdinalIgnoreCase)) + { + return false; + } + + if (!i.GetAudioCodecs().Contains(audioCodec ?? string.Empty)) + { + return false; + } + + if (!string.Equals(videoCodec, i.VideoCodec, StringComparison.OrdinalIgnoreCase)) + { + return false; + } + + return true; + }); + } + + public MediaProfile GetAudioMediaProfile(string container, string audioCodec, MediaStream audioStream) + { + container = (container ?? string.Empty).TrimStart('.'); + + return MediaProfiles.FirstOrDefault(i => + { + if (i.Type != DlnaProfileType.Audio) + { + return false; + } + + var containers = i.GetContainers().ToList(); + if (containers.Count > 0 && !containers.Contains(container)) + { + return false; + } + + var audioCodecs = i.GetAudioCodecs().ToList(); + if (audioCodecs.Count > 0 && !audioCodecs.Contains(audioCodec ?? string.Empty)) + { + return false; + } + + return true; + }); + } + + public MediaProfile GetVideoMediaProfile(string container, string audioCodec, string videoCodec, MediaStream audioStream, MediaStream videoStream) + { + container = (container ?? string.Empty).TrimStart('.'); + + return MediaProfiles.FirstOrDefault(i => + { + if (i.Type != DlnaProfileType.Video) + { + return false; + } + + var containers = i.GetContainers().ToList(); + if (containers.Count > 0 && !containers.Contains(container)) + { + return false; + } + + var audioCodecs = i.GetAudioCodecs().ToList(); + if (audioCodecs.Count > 0 && !audioCodecs.Contains(audioCodec ?? string.Empty)) + { + return false; + } + + var videoCodecs = i.GetVideoCodecs().ToList(); + if (videoCodecs.Count > 0 && !videoCodecs.Contains(videoCodec ?? string.Empty)) + { + return false; + } + + return true; + }); + } + + public MediaProfile GetPhotoMediaProfile(string container) + { + container = (container ?? string.Empty).TrimStart('.'); + + return MediaProfiles.FirstOrDefault(i => + { + if (i.Type != DlnaProfileType.Photo) + { + return false; + } + + var containers = i.GetContainers().ToList(); + if (containers.Count > 0 && !containers.Contains(container)) + { + return false; + } + + return true; + }); } } } diff --git a/MediaBrowser.Controller/Dlna/DirectPlayProfile.cs b/MediaBrowser.Controller/Dlna/DirectPlayProfile.cs index 686b31287..ad70640da 100644 --- a/MediaBrowser.Controller/Dlna/DirectPlayProfile.cs +++ b/MediaBrowser.Controller/Dlna/DirectPlayProfile.cs @@ -1,14 +1,21 @@ using System.Collections.Generic; using System.Linq; +using System.Xml.Serialization; namespace MediaBrowser.Controller.Dlna { public class DirectPlayProfile { + [XmlAttribute("container")] public string Container { get; set; } + + [XmlAttribute("audioCodec")] public string AudioCodec { get; set; } + + [XmlAttribute("videoCodec")] public string VideoCodec { get; set; } + [XmlAttribute("type")] public DlnaProfileType Type { get; set; } public List<string> GetContainers() diff --git a/MediaBrowser.Controller/Dlna/IDlnaManager.cs b/MediaBrowser.Controller/Dlna/IDlnaManager.cs index 6de17e551..521d17e01 100644 --- a/MediaBrowser.Controller/Dlna/IDlnaManager.cs +++ b/MediaBrowser.Controller/Dlna/IDlnaManager.cs @@ -1,22 +1,55 @@ -using System.Collections.Generic; +using MediaBrowser.Model.Dlna; +using System.Collections.Generic; namespace MediaBrowser.Controller.Dlna { public interface IDlnaManager { /// <summary> - /// Gets the dlna profiles. + /// Gets the profile infos. /// </summary> - /// <returns>IEnumerable{DlnaProfile}.</returns> - IEnumerable<DeviceProfile> GetProfiles(); + /// <returns>IEnumerable{DeviceProfileInfo}.</returns> + IEnumerable<DeviceProfileInfo> GetProfileInfos(); + + /// <summary> + /// Gets the profile. + /// </summary> + /// <param name="headers">The headers.</param> + /// <returns>DeviceProfile.</returns> + DeviceProfile GetProfile(IDictionary<string,string> headers); /// <summary> /// Gets the default profile. /// </summary> - /// <returns>DlnaProfile.</returns> + /// <returns>DeviceProfile.</returns> DeviceProfile GetDefaultProfile(); /// <summary> + /// Creates the profile. + /// </summary> + /// <param name="profile">The profile.</param> + void CreateProfile(DeviceProfile profile); + + /// <summary> + /// Updates the profile. + /// </summary> + /// <param name="profile">The profile.</param> + void UpdateProfile(DeviceProfile profile); + + /// <summary> + /// Deletes the profile. + /// </summary> + /// <param name="id">The identifier.</param> + void DeleteProfile(string id); + + /// <summary> + /// Gets the profile. + /// </summary> + /// <param name="id">The identifier.</param> + /// <returns>DeviceProfile.</returns> + DeviceProfile GetProfile(string id); + + /// <summary> /// Gets the profile. /// </summary> /// <param name="deviceInfo">The device information.</param> diff --git a/MediaBrowser.Controller/Dlna/MediaProfile.cs b/MediaBrowser.Controller/Dlna/MediaProfile.cs index 1d2613fac..bf3057294 100644 --- a/MediaBrowser.Controller/Dlna/MediaProfile.cs +++ b/MediaBrowser.Controller/Dlna/MediaProfile.cs @@ -1,16 +1,27 @@ using System.Collections.Generic; using System.Linq; +using System.Xml.Serialization; namespace MediaBrowser.Controller.Dlna { public class MediaProfile { + [XmlAttribute("container")] public string Container { get; set; } + + [XmlAttribute("audioCodec")] public string AudioCodec { get; set; } + + [XmlAttribute("videoCodec")] public string VideoCodec { get; set; } + [XmlAttribute("type")] public DlnaProfileType Type { get; set; } + + [XmlAttribute("orgPn")] public string OrgPn { get; set; } + + [XmlAttribute("mimeType")] public string MimeType { get; set; } public ProfileCondition[] Conditions { get; set; } @@ -19,6 +30,11 @@ namespace MediaBrowser.Controller.Dlna { Conditions = new ProfileCondition[] {}; } + + public List<string> GetContainers() + { + return (Container ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToList(); + } public List<string> GetAudioCodecs() { diff --git a/MediaBrowser.Controller/Dlna/TranscodingProfile.cs b/MediaBrowser.Controller/Dlna/TranscodingProfile.cs index 007cb632e..707f0c573 100644 --- a/MediaBrowser.Controller/Dlna/TranscodingProfile.cs +++ b/MediaBrowser.Controller/Dlna/TranscodingProfile.cs @@ -1,17 +1,33 @@ - +using System.Collections.Generic; +using System.Linq; +using System.Xml.Serialization; + namespace MediaBrowser.Controller.Dlna { public class TranscodingProfile { + [XmlAttribute("container")] public string Container { get; set; } + [XmlAttribute("type")] public DlnaProfileType Type { get; set; } + [XmlAttribute("videoCodec")] public string VideoCodec { get; set; } + + [XmlAttribute("audioCodec")] public string AudioCodec { get; set; } + [XmlAttribute("protocol")] + public string Protocol { get; set; } + + [XmlAttribute("estimateContentLength")] public bool EstimateContentLength { get; set; } + [XmlAttribute("enableMpegtsM2TsMode")] + public bool EnableMpegtsM2TsMode { get; set; } + + [XmlAttribute("transcodeSeekInfo")] public TranscodeSeekInfo TranscodeSeekInfo { get; set; } public TranscodingSetting[] Settings { get; set; } @@ -21,12 +37,19 @@ namespace MediaBrowser.Controller.Dlna Settings = new TranscodingSetting[] { }; } - public bool EnableMpegtsM2TsMode { get; set; } + + public List<string> GetAudioCodecs() + { + return (AudioCodec ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToList(); + } } public class TranscodingSetting { + [XmlAttribute("name")] public TranscodingSettingType Name { get; set; } + + [XmlAttribute("value")] public string Value { get; set; } } diff --git a/MediaBrowser.Controller/Entities/Trailer.cs b/MediaBrowser.Controller/Entities/Trailer.cs index b3d73dc34..53ec030a7 100644 --- a/MediaBrowser.Controller/Entities/Trailer.cs +++ b/MediaBrowser.Controller/Entities/Trailer.cs @@ -3,8 +3,9 @@ using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; -using System.Runtime.Serialization; +using System.Globalization; using System.Linq; +using System.Runtime.Serialization; namespace MediaBrowser.Controller.Entities { @@ -22,7 +23,7 @@ namespace MediaBrowser.Controller.Entities /// </summary> /// <value>The preferred metadata country code.</value> public string PreferredMetadataCountryCode { get; set; } - + public Trailer() { RemoteTrailers = new List<MediaUrl>(); @@ -33,19 +34,19 @@ namespace MediaBrowser.Controller.Entities } public float? Metascore { get; set; } - + public List<Guid> LocalTrailerIds { get; set; } - + public List<MediaUrl> RemoteTrailers { get; set; } public List<string> Keywords { get; set; } - + /// <summary> /// Gets or sets the taglines. /// </summary> /// <value>The taglines.</value> public List<string> Taglines { get; set; } - + /// <summary> /// Gets or sets the budget. /// </summary> @@ -92,6 +93,12 @@ namespace MediaBrowser.Controller.Entities { key = key + "-trailer"; + // Make sure different trailers have their own data. + if (RunTimeTicks.HasValue) + { + key += "-" + RunTimeTicks.Value.ToString(CultureInfo.InvariantCulture); + } + return key; } diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs index e6a62c181..0a34b8016 100644 --- a/MediaBrowser.Controller/Entities/User.cs +++ b/MediaBrowser.Controller/Entities/User.cs @@ -121,10 +121,7 @@ namespace MediaBrowser.Controller.Entities { _configuration = value; - if (value == null) - { - _configurationInitialized = false; - } + _configurationInitialized = value != null; } } diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 5e6297d06..9915ac044 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -157,6 +157,7 @@ <Compile Include="Localization\ILocalizationManager.cs" /> <Compile Include="MediaEncoding\ChapterImageRefreshOptions.cs" /> <Compile Include="MediaEncoding\IEncodingManager.cs" /> + <Compile Include="MediaEncoding\ImageEncodingOptions.cs" /> <Compile Include="MediaEncoding\IMediaEncoder.cs" /> <Compile Include="MediaEncoding\InternalMediaInfoResult.cs" /> <Compile Include="Net\IHasResultFactory.cs" /> @@ -187,6 +188,7 @@ <Compile Include="Providers\MetadataRefreshOptions.cs" /> <Compile Include="Providers\NameParser.cs" /> <Compile Include="Providers\MetadataStatus.cs" /> + <Compile Include="Providers\ISeriesOrderManager.cs" /> <Compile Include="Session\ISessionManager.cs" /> <Compile Include="Drawing\ImageExtensions.cs" /> <Compile Include="Entities\AggregateFolder.cs" /> diff --git a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs index 119688fa7..e9081fe8a 100644 --- a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs +++ b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs @@ -24,16 +24,23 @@ namespace MediaBrowser.Controller.MediaEncoding string Version { get; } /// <summary> - /// Extracts the image. + /// Extracts the audio image. + /// </summary> + /// <param name="path">The path.</param> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns>Task{Stream}.</returns> + Task<Stream> ExtractAudioImage(string path, CancellationToken cancellationToken); + + /// <summary> + /// Extracts the video image. /// </summary> /// <param name="inputFiles">The input files.</param> /// <param name="type">The type.</param> - /// <param name="isAudio">if set to <c>true</c> [is audio].</param> /// <param name="threedFormat">The threed format.</param> /// <param name="offset">The offset.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task{Stream}.</returns> - Task<Stream> ExtractImage(string[] inputFiles, InputType type, bool isAudio, Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken); + Task<Stream> ExtractVideoImage(string[] inputFiles, InputType type, Video3DFormat? threedFormat, TimeSpan? offset, CancellationToken cancellationToken); /// <summary> /// Extracts the text subtitle. @@ -81,6 +88,14 @@ namespace MediaBrowser.Controller.MediaEncoding /// <param name="type">The type.</param> /// <returns>System.String.</returns> string GetInputArgument(string[] inputFiles, InputType type); + + /// <summary> + /// Encodes the image. + /// </summary> + /// <param name="options">The options.</param> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns>Task{Stream}.</returns> + Task<Stream> EncodeImage(ImageEncodingOptions options, CancellationToken cancellationToken); } /// <summary> diff --git a/MediaBrowser.Controller/MediaEncoding/ImageEncodingOptions.cs b/MediaBrowser.Controller/MediaEncoding/ImageEncodingOptions.cs new file mode 100644 index 000000000..a8d1e5a0f --- /dev/null +++ b/MediaBrowser.Controller/MediaEncoding/ImageEncodingOptions.cs @@ -0,0 +1,20 @@ + +namespace MediaBrowser.Controller.MediaEncoding +{ + public class ImageEncodingOptions + { + public string InputPath { get; set; } + + public int? Width { get; set; } + + public int? Height { get; set; } + + public int? MaxWidth { get; set; } + + public int? MaxHeight { get; set; } + + public int? Quality { get; set; } + + public string Format { get; set; } + } +} diff --git a/MediaBrowser.Controller/MediaEncoding/InternalMediaInfoResult.cs b/MediaBrowser.Controller/MediaEncoding/InternalMediaInfoResult.cs index e113521ec..39d1c3220 100644 --- a/MediaBrowser.Controller/MediaEncoding/InternalMediaInfoResult.cs +++ b/MediaBrowser.Controller/MediaEncoding/InternalMediaInfoResult.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Model.Entities; -using System.Collections.Generic; +using System.Collections.Generic; namespace MediaBrowser.Controller.MediaEncoding { @@ -24,7 +23,18 @@ namespace MediaBrowser.Controller.MediaEncoding /// Gets or sets the chapters. /// </summary> /// <value>The chapters.</value> - public List<ChapterInfo> Chapters { get; set; } + public MediaChapter[] Chapters { get; set; } + } + + public class MediaChapter + { + public int id { get; set; } + public string time_base { get; set; } + public long start { get; set; } + public string start_time { get; set; } + public long end { get; set; } + public string end_time { get; set; } + public Dictionary<string, string> tags { get; set; } } /// <summary> diff --git a/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs b/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs index 184033177..fd1f65101 100644 --- a/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs +++ b/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs @@ -154,7 +154,8 @@ namespace MediaBrowser.Controller.MediaEncoding Codec = streamInfo.codec_name, Profile = streamInfo.profile, Level = streamInfo.level, - Index = streamInfo.index + Index = streamInfo.index, + PixelFormat = streamInfo.pix_fmt }; if (streamInfo.tags != null) @@ -196,24 +197,21 @@ namespace MediaBrowser.Controller.MediaEncoding } // Get stream bitrate - if (stream.Type != MediaStreamType.Subtitle) - { - var bitrate = 0; + var bitrate = 0; - if (!string.IsNullOrEmpty(streamInfo.bit_rate)) - { - bitrate = int.Parse(streamInfo.bit_rate, UsCulture); - } - else if (formatInfo != null && !string.IsNullOrEmpty(formatInfo.bit_rate)) - { - // If the stream info doesn't have a bitrate get the value from the media format info - bitrate = int.Parse(formatInfo.bit_rate, UsCulture); - } + if (!string.IsNullOrEmpty(streamInfo.bit_rate)) + { + bitrate = int.Parse(streamInfo.bit_rate, UsCulture); + } + else if (formatInfo != null && !string.IsNullOrEmpty(formatInfo.bit_rate) && stream.Type == MediaStreamType.Video) + { + // If the stream info doesn't have a bitrate get the value from the media format info + bitrate = int.Parse(formatInfo.bit_rate, UsCulture); + } - if (bitrate > 0) - { - stream.BitRate = bitrate; - } + if (bitrate > 0) + { + stream.BitRate = bitrate; } if (streamInfo.disposition != null) diff --git a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs index d71c7af32..70b49efec 100644 --- a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs +++ b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs @@ -1,5 +1,4 @@ using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; @@ -284,22 +283,6 @@ namespace MediaBrowser.Controller.Providers break; } - case "TagLine": - { - var tagline = reader.ReadElementContentAsString(); - - var hasTaglines = item as IHasTaglines; - if (hasTaglines != null) - { - if (!string.IsNullOrWhiteSpace(tagline)) - { - hasTaglines.AddTagline(tagline); - } - } - - break; - } - case "Language": { var val = reader.ReadElementContentAsString(); @@ -380,9 +363,7 @@ namespace MediaBrowser.Controller.Providers } case "ContentRating": - case "certification": case "MPAARating": - case "ESRBRating": { var rating = reader.ReadElementContentAsString(); @@ -415,7 +396,6 @@ namespace MediaBrowser.Controller.Providers break; } - case "Runtime": case "RunningTime": { var text = reader.ReadElementContentAsString(); @@ -431,19 +411,6 @@ namespace MediaBrowser.Controller.Providers break; } - case "Genre": - { - foreach (var name in SplitNames(reader.ReadElementContentAsString())) - { - if (string.IsNullOrWhiteSpace(name)) - { - continue; - } - item.AddGenre(name); - } - break; - } - case "AspectRatio": { var val = reader.ReadElementContentAsString(); @@ -587,7 +554,6 @@ namespace MediaBrowser.Controller.Providers break; } - case "ReleaseYear": case "ProductionYear": { var val = reader.ReadElementContentAsString(); @@ -606,7 +572,6 @@ namespace MediaBrowser.Controller.Providers case "Rating": case "IMDBrating": - case "TGDBRating": { var rating = reader.ReadElementContentAsString(); @@ -683,22 +648,6 @@ namespace MediaBrowser.Controller.Providers } break; } - case "MusicbrainzId": - { - var mbz = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(mbz)) - { - if (item is MusicAlbum) - { - item.SetProviderId(MetadataProviders.MusicBrainzAlbum, mbz); - } - else if (item is MusicArtist) - { - item.SetProviderId(MetadataProviders.MusicBrainzArtist, mbz); - } - } - break; - } case "MusicBrainzAlbumId": { var mbz = reader.ReadElementContentAsString(); @@ -802,9 +751,7 @@ namespace MediaBrowser.Controller.Providers } break; - case "IMDB_ID": case "IMDB": - case "IMDbId": var imDbId = reader.ReadElementContentAsString(); if (!string.IsNullOrWhiteSpace(imDbId)) { @@ -856,15 +803,6 @@ namespace MediaBrowser.Controller.Providers break; } - case "ParentalRating": - { - using (var subtree = reader.ReadSubtree()) - { - FetchFromParentalRatingNode(subtree, item); - } - break; - } - case "Studios": { using (var subtree = reader.ReadSubtree()) @@ -1228,32 +1166,6 @@ namespace MediaBrowser.Controller.Providers } /// <summary> - /// Fetches from parental rating node. - /// </summary> - /// <param name="reader">The reader.</param> - /// <param name="item">The item.</param> - private void FetchFromParentalRatingNode(XmlReader reader, T item) - { - reader.MoveToContent(); - - while (reader.Read()) - { - if (reader.NodeType == XmlNodeType.Element) - { - 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 - - default: - reader.Skip(); - break; - } - } - } - } - - /// <summary> /// Gets the persons from XML node. /// </summary> /// <param name="reader">The reader.</param> diff --git a/MediaBrowser.Controller/Providers/ISeriesOrderManager.cs b/MediaBrowser.Controller/Providers/ISeriesOrderManager.cs new file mode 100644 index 000000000..a3adab1b9 --- /dev/null +++ b/MediaBrowser.Controller/Providers/ISeriesOrderManager.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using MediaBrowser.Common; + +namespace MediaBrowser.Controller.Providers +{ + public interface ISeriesOrderProvider + { + string OrderType { get; } + Task<int?> FindSeriesIndex(string seriesName); + } + + public static class SeriesOrderTypes + { + public const string Anime = "Anime"; + } + + public interface ISeriesOrderManager + { + Task<int?> FindSeriesIndex(string orderType, string seriesName); + void AddParts(IEnumerable<ISeriesOrderProvider> orderProviders); + } +} diff --git a/MediaBrowser.Controller/Session/ISessionController.cs b/MediaBrowser.Controller/Session/ISessionController.cs index 21206af75..02cc875bd 100644 --- a/MediaBrowser.Controller/Session/ISessionController.cs +++ b/MediaBrowser.Controller/Session/ISessionController.cs @@ -60,6 +60,14 @@ namespace MediaBrowser.Controller.Session Task SendPlaystateCommand(PlaystateRequest command, CancellationToken cancellationToken); /// <summary> + /// Sends the generic command. + /// </summary> + /// <param name="command">The command.</param> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns>Task.</returns> + Task SendGenericCommand(GenericCommand command, CancellationToken cancellationToken); + + /// <summary> /// Sends the library update info. /// </summary> /// <param name="info">The info.</param> |
