Browse Source

update sync settings

Luke Pulverenti 8 years ago
parent
commit
17e1c8c22b

+ 3 - 11
MediaBrowser.Api/Playback/BaseStreamingService.cs

@@ -1589,13 +1589,6 @@ namespace MediaBrowser.Api.Playback
                     }
                     }
                 }
                 }
                 else if (i == 25)
                 else if (i == 25)
-                {
-                    if (videoRequest != null)
-                    {
-                        videoRequest.ForceLiveStream = string.Equals("true", val, StringComparison.OrdinalIgnoreCase);
-                    }
-                }
-                else if (i == 26)
                 {
                 {
                     if (!string.IsNullOrWhiteSpace(val) && videoRequest != null)
                     if (!string.IsNullOrWhiteSpace(val) && videoRequest != null)
                     {
                     {
@@ -1606,18 +1599,18 @@ namespace MediaBrowser.Api.Playback
                         }
                         }
                     }
                     }
                 }
                 }
-                else if (i == 27)
+                else if (i == 26)
                 {
                 {
                     request.TranscodingMaxAudioChannels = int.Parse(val, UsCulture);
                     request.TranscodingMaxAudioChannels = int.Parse(val, UsCulture);
                 }
                 }
-                else if (i == 28)
+                else if (i == 27)
                 {
                 {
                     if (videoRequest != null)
                     if (videoRequest != null)
                     {
                     {
                         videoRequest.EnableSubtitlesInManifest = string.Equals("true", val, StringComparison.OrdinalIgnoreCase);
                         videoRequest.EnableSubtitlesInManifest = string.Equals("true", val, StringComparison.OrdinalIgnoreCase);
                     }
                     }
                 }
                 }
-                else if (i == 29)
+                else if (i == 28)
                 {
                 {
                     request.Tag = val;
                     request.Tag = val;
                 }
                 }
@@ -2218,7 +2211,6 @@ namespace MediaBrowser.Api.Playback
                     if (state.VideoRequest != null)
                     if (state.VideoRequest != null)
                     {
                     {
                         state.VideoRequest.CopyTimestamps = transcodingProfile.CopyTimestamps;
                         state.VideoRequest.CopyTimestamps = transcodingProfile.CopyTimestamps;
-                        state.VideoRequest.ForceLiveStream = transcodingProfile.ForceLiveStream;
                         state.VideoRequest.EnableSubtitlesInManifest = transcodingProfile.EnableSubtitlesInManifest;
                         state.VideoRequest.EnableSubtitlesInManifest = transcodingProfile.EnableSubtitlesInManifest;
                     }
                     }
                 }
                 }

+ 0 - 5
MediaBrowser.Api/Playback/Hls/BaseHlsService.cs

@@ -281,11 +281,6 @@ namespace MediaBrowser.Api.Playback.Hls
         {
         {
             var isLiveStream = (state.RunTimeTicks ?? 0) == 0;
             var isLiveStream = (state.RunTimeTicks ?? 0) == 0;
 
 
-            if (state.VideoRequest.ForceLiveStream)
-            {
-                return true;
-            }
-
             return isLiveStream;
             return isLiveStream;
         }
         }
     }
     }

+ 0 - 2
MediaBrowser.Api/Playback/StreamRequest.cs

@@ -193,8 +193,6 @@ namespace MediaBrowser.Api.Playback
         [ApiMember(Name = "CopyTimestamps", Description = "Whether or not to copy timestamps when transcoding with an offset. Defaults to false.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
         [ApiMember(Name = "CopyTimestamps", Description = "Whether or not to copy timestamps when transcoding with an offset. Defaults to false.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
         public bool CopyTimestamps { get; set; }
         public bool CopyTimestamps { get; set; }
 
 
-        public bool ForceLiveStream { get; set; }
-
         public bool EnableSubtitlesInManifest { get; set; }
         public bool EnableSubtitlesInManifest { get; set; }
 
 
         public VideoStreamRequest()
         public VideoStreamRequest()

+ 13 - 0
MediaBrowser.Api/Sync/SyncHelper.cs

@@ -24,6 +24,19 @@ namespace MediaBrowser.Api.Sync
                         }
                         }
                         break;
                         break;
                     }
                     }
+                    if (item.IsAudio)
+                    {
+                        options.Add(SyncJobOption.Quality);
+                        options.Add(SyncJobOption.Profile);
+                        break;
+                    }
+                    if (item.IsMusicGenre || item.IsArtist|| item.IsType("musicalbum"))
+                    {
+                        options.Add(SyncJobOption.Quality);
+                        options.Add(SyncJobOption.Profile);
+                        options.Add(SyncJobOption.ItemLimit);
+                        break;
+                    }
                     if (item.IsFolderItem && !item.IsMusicGenre && !item.IsArtist && !item.IsType("musicalbum") && !item.IsGameGenre)
                     if (item.IsFolderItem && !item.IsMusicGenre && !item.IsArtist && !item.IsType("musicalbum") && !item.IsGameGenre)
                     {
                     {
                         options.Add(SyncJobOption.Quality);
                         options.Add(SyncJobOption.Quality);

+ 2 - 1
MediaBrowser.Api/Sync/SyncService.cs

@@ -291,7 +291,8 @@ namespace MediaBrowser.Api.Sync
                 {
                 {
                     Fields = new List<ItemFields>
                     Fields = new List<ItemFields>
                     {
                     {
-                        ItemFields.SyncInfo
+                        ItemFields.SyncInfo,
+                        ItemFields.BasicSyncInfo
                     }
                     }
                 };
                 };
 
 

+ 6 - 1
MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs

@@ -36,8 +36,13 @@ namespace MediaBrowser.Controller.MediaEncoding
             return new[] {videoPath};
             return new[] {videoPath};
         }
         }
 
 
-        public static List<string> GetPlayableStreamFiles(IFileSystem fileSystem, string rootPath, IEnumerable<string> filenames)
+        private static List<string> GetPlayableStreamFiles(IFileSystem fileSystem, string rootPath, List<string> filenames)
         {
         {
+            if (filenames.Count == 0)
+            {
+                return new List<string>();
+            }
+
             var allFiles = fileSystem
             var allFiles = fileSystem
                 .GetFilePaths(rootPath, true)
                 .GetFilePaths(rootPath, true)
                 .ToList();
                 .ToList();

+ 0 - 1
MediaBrowser.Dlna/Profiles/DefaultProfile.cs

@@ -33,7 +33,6 @@ namespace MediaBrowser.Dlna.Profiles
             MaxStreamingBitrate = 20000000;
             MaxStreamingBitrate = 20000000;
             MaxStaticBitrate = 20000000;
             MaxStaticBitrate = 20000000;
             MusicStreamingTranscodingBitrate = 192000;
             MusicStreamingTranscodingBitrate = 192000;
-            MusicSyncBitrate = 192000;
 
 
             EnableAlbumArtInDidl = false;
             EnableAlbumArtInDidl = false;
 
 

+ 0 - 2
MediaBrowser.Dlna/Profiles/KodiProfile.cs

@@ -11,9 +11,7 @@ namespace MediaBrowser.Dlna.Profiles
             Name = "Kodi";
             Name = "Kodi";
 
 
             MaxStreamingBitrate = 100000000;
             MaxStreamingBitrate = 100000000;
-            MaxStaticBitrate = 100000000;
             MusicStreamingTranscodingBitrate = 1280000;
             MusicStreamingTranscodingBitrate = 1280000;
-            MusicSyncBitrate = 1280000;
 
 
             TimelineOffsetSeconds = 5;
             TimelineOffsetSeconds = 5;
 
 

+ 5 - 1
MediaBrowser.Model/Dlna/AudioOptions.cs

@@ -59,7 +59,7 @@ namespace MediaBrowser.Model.Dlna
         /// Gets the maximum bitrate.
         /// Gets the maximum bitrate.
         /// </summary>
         /// </summary>
         /// <returns>System.Nullable&lt;System.Int32&gt;.</returns>
         /// <returns>System.Nullable&lt;System.Int32&gt;.</returns>
-        public int? GetMaxBitrate()
+        public int? GetMaxBitrate(bool isAudio)
         {
         {
             if (MaxBitrate.HasValue)
             if (MaxBitrate.HasValue)
             {
             {
@@ -70,6 +70,10 @@ namespace MediaBrowser.Model.Dlna
             {
             {
                 if (Context == EncodingContext.Static)
                 if (Context == EncodingContext.Static)
                 {
                 {
+                    if (isAudio && Profile.MaxStaticMusicBitrate.HasValue)
+                    {
+                        return Profile.MaxStaticMusicBitrate;
+                    }
                     return Profile.MaxStaticBitrate;
                     return Profile.MaxStaticBitrate;
                 }
                 }
 
 

+ 1 - 2
MediaBrowser.Model/Dlna/DeviceProfile.cs

@@ -55,7 +55,7 @@ namespace MediaBrowser.Model.Dlna
         public int? MaxStaticBitrate { get; set; }
         public int? MaxStaticBitrate { get; set; }
 
 
         public int? MusicStreamingTranscodingBitrate { get; set; }
         public int? MusicStreamingTranscodingBitrate { get; set; }
-        public int? MusicSyncBitrate { get; set; }
+        public int? MaxStaticMusicBitrate { get; set; }
 
 
         /// <summary>
         /// <summary>
         /// Controls the content of the X_DLNADOC element in the urn:schemas-dlna-org:device-1-0 namespace.
         /// Controls the content of the X_DLNADOC element in the urn:schemas-dlna-org:device-1-0 namespace.
@@ -115,7 +115,6 @@ namespace MediaBrowser.Model.Dlna
             MaxStreamingBitrate = 8000000;
             MaxStreamingBitrate = 8000000;
             MaxStaticBitrate = 8000000;
             MaxStaticBitrate = 8000000;
             MusicStreamingTranscodingBitrate = 128000;
             MusicStreamingTranscodingBitrate = 128000;
-            MusicSyncBitrate = 128000;
         }
         }
 
 
         public List<string> GetSupportedMediaTypes()
         public List<string> GetSupportedMediaTypes()

+ 21 - 14
MediaBrowser.Model/Dlna/StreamBuilder.cs

@@ -55,7 +55,7 @@ namespace MediaBrowser.Model.Dlna
                 stream.DeviceProfileId = options.Profile.Id;
                 stream.DeviceProfileId = options.Profile.Id;
             }
             }
 
 
-            return GetOptimalStream(streams, options.GetMaxBitrate());
+            return GetOptimalStream(streams, options.GetMaxBitrate(true));
         }
         }
 
 
         public StreamInfo BuildVideoItem(VideoOptions options)
         public StreamInfo BuildVideoItem(VideoOptions options)
@@ -88,7 +88,7 @@ namespace MediaBrowser.Model.Dlna
                 stream.DeviceProfileId = options.Profile.Id;
                 stream.DeviceProfileId = options.Profile.Id;
             }
             }
 
 
-            return GetOptimalStream(streams, options.GetMaxBitrate());
+            return GetOptimalStream(streams, options.GetMaxBitrate(false));
         }
         }
 
 
         private StreamInfo GetOptimalStream(List<StreamInfo> streams, int? maxBitrate)
         private StreamInfo GetOptimalStream(List<StreamInfo> streams, int? maxBitrate)
@@ -275,24 +275,32 @@ namespace MediaBrowser.Model.Dlna
                     playlistItem.MaxAudioChannels = Math.Min(options.MaxAudioChannels.Value, currentValue);
                     playlistItem.MaxAudioChannels = Math.Min(options.MaxAudioChannels.Value, currentValue);
                 }
                 }
 
 
-                int configuredBitrate = options.AudioTranscodingBitrate ??
-                    (options.Context == EncodingContext.Static ? options.Profile.MusicSyncBitrate : options.Profile.MusicStreamingTranscodingBitrate) ??
+                int transcodingBitrate = options.AudioTranscodingBitrate ??
+                    options.Profile.MusicStreamingTranscodingBitrate ??
                     128000;
                     128000;
 
 
-                playlistItem.AudioBitrate = Math.Min(configuredBitrate, playlistItem.AudioBitrate ?? configuredBitrate);
+                int? configuredBitrate = options.GetMaxBitrate(true);
+
+                if (configuredBitrate.HasValue)
+                {
+                    transcodingBitrate = Math.Min(configuredBitrate.Value, transcodingBitrate);
+                }
+
+                playlistItem.AudioBitrate = Math.Min(transcodingBitrate, playlistItem.AudioBitrate ?? transcodingBitrate);
+
             }
             }
 
 
             return playlistItem;
             return playlistItem;
         }
         }
 
 
-        private int? GetBitrateForDirectPlayCheck(MediaSourceInfo item, AudioOptions options)
+        private int? GetBitrateForDirectPlayCheck(MediaSourceInfo item, AudioOptions options, bool isAudio)
         {
         {
             if (item.Protocol == MediaProtocol.File)
             if (item.Protocol == MediaProtocol.File)
             {
             {
                 return options.Profile.MaxStaticBitrate;
                 return options.Profile.MaxStaticBitrate;
             }
             }
 
 
-            return options.GetMaxBitrate();
+            return options.GetMaxBitrate(isAudio);
         }
         }
 
 
         private List<PlayMethod> GetAudioDirectPlayMethods(MediaSourceInfo item, MediaStream audioStream, AudioOptions options)
         private List<PlayMethod> GetAudioDirectPlayMethods(MediaSourceInfo item, MediaStream audioStream, AudioOptions options)
@@ -312,7 +320,7 @@ namespace MediaBrowser.Model.Dlna
             if (directPlayProfile != null)
             if (directPlayProfile != null)
             {
             {
                 // While options takes the network and other factors into account. Only applies to direct stream
                 // While options takes the network and other factors into account. Only applies to direct stream
-                if (item.SupportsDirectStream && IsAudioEligibleForDirectPlay(item, options.GetMaxBitrate()) && options.EnableDirectStream)
+                if (item.SupportsDirectStream && IsAudioEligibleForDirectPlay(item, options.GetMaxBitrate(true)) && options.EnableDirectStream)
                 {
                 {
                     playMethods.Add(PlayMethod.DirectStream);
                     playMethods.Add(PlayMethod.DirectStream);
                 }
                 }
@@ -320,7 +328,7 @@ namespace MediaBrowser.Model.Dlna
                 // The profile describes what the device supports
                 // The profile describes what the device supports
                 // If device requirements are satisfied then allow both direct stream and direct play
                 // If device requirements are satisfied then allow both direct stream and direct play
                 if (item.SupportsDirectPlay &&
                 if (item.SupportsDirectPlay &&
-                    IsAudioEligibleForDirectPlay(item, GetBitrateForDirectPlayCheck(item, options)) && options.EnableDirectPlay)
+                    IsAudioEligibleForDirectPlay(item, GetBitrateForDirectPlayCheck(item, options, true)) && options.EnableDirectPlay)
                 {
                 {
                     playMethods.Add(PlayMethod.DirectPlay);
                     playMethods.Add(PlayMethod.DirectPlay);
                 }
                 }
@@ -403,8 +411,8 @@ namespace MediaBrowser.Model.Dlna
             MediaStream videoStream = item.VideoStream;
             MediaStream videoStream = item.VideoStream;
 
 
             // TODO: This doesn't accout for situation of device being able to handle media bitrate, but wifi connection not fast enough
             // TODO: This doesn't accout for situation of device being able to handle media bitrate, but wifi connection not fast enough
-            bool isEligibleForDirectPlay = options.EnableDirectPlay && (options.ForceDirectPlay || IsEligibleForDirectPlay(item, GetBitrateForDirectPlayCheck(item, options), subtitleStream, options, PlayMethod.DirectPlay));
-            bool isEligibleForDirectStream = options.EnableDirectStream && (options.ForceDirectStream || IsEligibleForDirectPlay(item, options.GetMaxBitrate(), subtitleStream, options, PlayMethod.DirectStream));
+            bool isEligibleForDirectPlay = options.EnableDirectPlay && (options.ForceDirectPlay || IsEligibleForDirectPlay(item, GetBitrateForDirectPlayCheck(item, options, true), subtitleStream, options, PlayMethod.DirectPlay));
+            bool isEligibleForDirectStream = options.EnableDirectStream && (options.ForceDirectStream || IsEligibleForDirectPlay(item, options.GetMaxBitrate(false), subtitleStream, options, PlayMethod.DirectStream));
 
 
             _logger.Info("Profile: {0}, Path: {1}, isEligibleForDirectPlay: {2}, isEligibleForDirectStream: {3}",
             _logger.Info("Profile: {0}, Path: {1}, isEligibleForDirectPlay: {2}, isEligibleForDirectStream: {3}",
                 options.Profile.Name ?? "Unknown Profile",
                 options.Profile.Name ?? "Unknown Profile",
@@ -469,7 +477,6 @@ namespace MediaBrowser.Model.Dlna
 
 
                 playlistItem.VideoCodec = transcodingProfile.VideoCodec;
                 playlistItem.VideoCodec = transcodingProfile.VideoCodec;
                 playlistItem.CopyTimestamps = transcodingProfile.CopyTimestamps;
                 playlistItem.CopyTimestamps = transcodingProfile.CopyTimestamps;
-                playlistItem.ForceLiveStream = transcodingProfile.ForceLiveStream;
                 playlistItem.EnableSubtitlesInManifest = transcodingProfile.EnableSubtitlesInManifest;
                 playlistItem.EnableSubtitlesInManifest = transcodingProfile.EnableSubtitlesInManifest;
 
 
                 if (!string.IsNullOrEmpty(transcodingProfile.MaxAudioChannels))
                 if (!string.IsNullOrEmpty(transcodingProfile.MaxAudioChannels))
@@ -570,10 +577,10 @@ namespace MediaBrowser.Model.Dlna
                     playlistItem.MaxAudioChannels = Math.Min(options.MaxAudioChannels.Value, currentValue);
                     playlistItem.MaxAudioChannels = Math.Min(options.MaxAudioChannels.Value, currentValue);
                 }
                 }
 
 
-                int audioBitrate = GetAudioBitrate(playlistItem.SubProtocol, options.GetMaxBitrate(), playlistItem.TargetAudioChannels, playlistItem.TargetAudioCodec, audioStream);
+                int audioBitrate = GetAudioBitrate(playlistItem.SubProtocol, options.GetMaxBitrate(false), playlistItem.TargetAudioChannels, playlistItem.TargetAudioCodec, audioStream);
                 playlistItem.AudioBitrate = Math.Min(playlistItem.AudioBitrate ?? audioBitrate, audioBitrate);
                 playlistItem.AudioBitrate = Math.Min(playlistItem.AudioBitrate ?? audioBitrate, audioBitrate);
 
 
-                int? maxBitrateSetting = options.GetMaxBitrate();
+                int? maxBitrateSetting = options.GetMaxBitrate(false);
                 // Honor max rate
                 // Honor max rate
                 if (maxBitrateSetting.HasValue)
                 if (maxBitrateSetting.HasValue)
                 {
                 {

+ 1 - 3
MediaBrowser.Model/Dlna/StreamInfo.cs

@@ -36,7 +36,6 @@ namespace MediaBrowser.Model.Dlna
         public string VideoProfile { get; set; }
         public string VideoProfile { get; set; }
 
 
         public bool CopyTimestamps { get; set; }
         public bool CopyTimestamps { get; set; }
-        public bool ForceLiveStream { get; set; }
         public bool EnableSubtitlesInManifest { get; set; }
         public bool EnableSubtitlesInManifest { get; set; }
         public string[] AudioCodecs { get; set; }
         public string[] AudioCodecs { get; set; }
 
 
@@ -216,7 +215,7 @@ namespace MediaBrowser.Model.Dlna
             list.Add(new NameValuePair("MaxWidth", item.MaxWidth.HasValue ? StringHelper.ToStringCultureInvariant(item.MaxWidth.Value) : string.Empty));
             list.Add(new NameValuePair("MaxWidth", item.MaxWidth.HasValue ? StringHelper.ToStringCultureInvariant(item.MaxWidth.Value) : string.Empty));
             list.Add(new NameValuePair("MaxHeight", item.MaxHeight.HasValue ? StringHelper.ToStringCultureInvariant(item.MaxHeight.Value) : string.Empty));
             list.Add(new NameValuePair("MaxHeight", item.MaxHeight.HasValue ? StringHelper.ToStringCultureInvariant(item.MaxHeight.Value) : string.Empty));
 
 
-            if (StringHelper.EqualsIgnoreCase(item.SubProtocol, "hls") && !item.ForceLiveStream)
+            if (StringHelper.EqualsIgnoreCase(item.SubProtocol, "hls"))
             {
             {
                 list.Add(new NameValuePair("StartTimeTicks", string.Empty));
                 list.Add(new NameValuePair("StartTimeTicks", string.Empty));
             }
             }
@@ -246,7 +245,6 @@ namespace MediaBrowser.Model.Dlna
             }
             }
 
 
             list.Add(new NameValuePair("CopyTimestamps", item.CopyTimestamps.ToString().ToLower()));
             list.Add(new NameValuePair("CopyTimestamps", item.CopyTimestamps.ToString().ToLower()));
-            list.Add(new NameValuePair("ForceLiveStream", item.ForceLiveStream.ToString().ToLower()));
             list.Add(new NameValuePair("SubtitleMethod", item.SubtitleStreamIndex.HasValue && item.SubtitleDeliveryMethod != SubtitleDeliveryMethod.External ? item.SubtitleDeliveryMethod.ToString() : string.Empty));
             list.Add(new NameValuePair("SubtitleMethod", item.SubtitleStreamIndex.HasValue && item.SubtitleDeliveryMethod != SubtitleDeliveryMethod.External ? item.SubtitleDeliveryMethod.ToString() : string.Empty));
 
 
             list.Add(new NameValuePair("TranscodingMaxAudioChannels", item.TranscodingMaxAudioChannels.HasValue ? StringHelper.ToStringCultureInvariant(item.TranscodingMaxAudioChannels.Value) : string.Empty));
             list.Add(new NameValuePair("TranscodingMaxAudioChannels", item.TranscodingMaxAudioChannels.HasValue ? StringHelper.ToStringCultureInvariant(item.TranscodingMaxAudioChannels.Value) : string.Empty));

+ 0 - 3
MediaBrowser.Model/Dlna/TranscodingProfile.cs

@@ -35,9 +35,6 @@ namespace MediaBrowser.Model.Dlna
         [XmlAttribute("context")]
         [XmlAttribute("context")]
         public EncodingContext Context { get; set; }
         public EncodingContext Context { get; set; }
 
 
-        [XmlAttribute("forceLiveStream")]
-        public bool ForceLiveStream { get; set; }
-
         [XmlAttribute("enableSubtitlesInManifest")]
         [XmlAttribute("enableSubtitlesInManifest")]
         public bool EnableSubtitlesInManifest { get; set; }
         public bool EnableSubtitlesInManifest { get; set; }
 
 

+ 1 - 1
MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs

@@ -123,7 +123,7 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
                 {
                 {
                     if (extractImages)
                     if (extractImages)
                     {
                     {
-                        if (video.VideoType == VideoType.HdDvd || video.VideoType == VideoType.Iso || video.VideoType == VideoType.BluRay)
+                        if (video.VideoType == VideoType.HdDvd || video.VideoType == VideoType.Iso || video.VideoType == VideoType.BluRay || video.VideoType == VideoType.Dvd)
                         {
                         {
                             continue;
                             continue;
                         }
                         }

+ 5 - 0
MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs

@@ -85,6 +85,11 @@ namespace MediaBrowser.Server.Implementations.Sync
                 {
                 {
                     Name = "Low",
                     Name = "Low",
                     Id = "low"
                     Id = "low"
+                },
+                new SyncQualityOption
+                {
+                    Name = "Custom",
+                    Id = "custom"
                 }
                 }
             };
             };
         }
         }