diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 3993866cf5..e1f4799f18 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -1358,6 +1358,8 @@ namespace MediaBrowser.Api.Playback state.ReadInputAtNativeFramerate = recording.RecordingInfo.Status == RecordingStatus.InProgress; state.AudioSync = "1000"; state.DeInterlace = true; + state.InputVideoSync = "-1"; + state.InputAudioSync = "1"; } else if (item is LiveTvChannel) { @@ -1387,6 +1389,8 @@ namespace MediaBrowser.Api.Playback state.ReadInputAtNativeFramerate = true; state.AudioSync = "1000"; state.DeInterlace = true; + state.InputVideoSync = "-1"; + state.InputAudioSync = "1"; } else { @@ -1503,6 +1507,16 @@ namespace MediaBrowser.Api.Playback inputModifier += " -acodec " + state.InputAudioCodec; } + if (!string.IsNullOrEmpty(state.InputAudioSync)) + { + inputModifier += " -async " + state.InputAudioSync; + } + + if (!string.IsNullOrEmpty(state.InputVideoSync)) + { + inputModifier += " -vsync " + state.InputVideoSync; + } + if (state.ReadInputAtNativeFramerate) { inputModifier += " -re"; diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs index 961ac0a2a2..88daf9f623 100644 --- a/MediaBrowser.Api/Playback/StreamState.cs +++ b/MediaBrowser.Api/Playback/StreamState.cs @@ -64,6 +64,9 @@ namespace MediaBrowser.Api.Playback public string AudioSync = "1"; public string VideoSync = "vfr"; + public string InputAudioSync { get; set; } + public string InputVideoSync { get; set; } + public bool DeInterlace { get; set; } public bool ReadInputAtNativeFramerate { get; set; } diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index 25f47aead6..76e0e1fc53 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -418,12 +418,13 @@ namespace MediaBrowser.Controller.Entities { IEnumerable files; - var path = Path; - var currentFilename = System.IO.Path.GetFileNameWithoutExtension(path) ?? string.Empty; - // Only support this for video files. For folder rips, they'll have to use the linking feature if (VideoType == VideoType.VideoFile || VideoType == VideoType.Iso) { + var path = Path; + + var filenamePrefix = System.IO.Path.GetFileName(System.IO.Path.GetDirectoryName(path)); + files = fileSystemChildren.Where(i => { if ((i.Attributes & FileAttributes.Directory) == FileAttributes.Directory) @@ -433,7 +434,7 @@ namespace MediaBrowser.Controller.Entities return !string.Equals(i.FullName, path, StringComparison.OrdinalIgnoreCase) && EntityResolutionHelper.IsVideoFile(i.FullName) && - i.Name.StartsWith(currentFilename, StringComparison.OrdinalIgnoreCase); + i.Name.StartsWith(filenamePrefix + " - ", StringComparison.OrdinalIgnoreCase); }); } else diff --git a/MediaBrowser.Model/Querying/ItemFields.cs b/MediaBrowser.Model/Querying/ItemFields.cs index 405ba3d777..65509fd6d3 100644 --- a/MediaBrowser.Model/Querying/ItemFields.cs +++ b/MediaBrowser.Model/Querying/ItemFields.cs @@ -51,6 +51,11 @@ namespace MediaBrowser.Model.Querying /// DisplayPreferencesId, + /// + /// The display media type + /// + DisplayMediaType, + /// /// The external urls /// diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index f6753fc007..c94cdda846 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -725,7 +725,11 @@ namespace MediaBrowser.Server.Implementations.Dto dto.DateCreated = item.DateCreated; } - dto.DisplayMediaType = item.DisplayMediaType; + if (fields.Contains(ItemFields.DisplayMediaType)) + { + dto.DisplayMediaType = item.DisplayMediaType; + } + dto.IsUnidentified = item.IsUnidentified; if (fields.Contains(ItemFields.Settings)) @@ -1351,7 +1355,7 @@ namespace MediaBrowser.Server.Implementations.Dto { var name = ""; - var stream = video.GetDefaultVideoStream(); + var videoStream = video.GetDefaultVideoStream(); if (video.Video3DFormat.HasValue) { @@ -1393,44 +1397,42 @@ namespace MediaBrowser.Server.Implementations.Dto } name = name.Trim(); } - else if (video.VideoType == VideoType.VideoFile) + + if (videoStream != null) { - if (stream != null) + if (videoStream.Width.HasValue) { - if (stream.Width.HasValue) + if (videoStream.Width.Value >= 3800) { - if (stream.Width.Value >= 3800) - { - name = name + " " + "4K"; - name = name.Trim(); - } - else if (stream.Width.Value >= 1900) - { - name = name + " " + "1080P"; - name = name.Trim(); - } - else if (stream.Width.Value >= 1270) - { - name = name + " " + "720P"; - name = name.Trim(); - } - else if (stream.Width.Value >= 700) - { - name = name + " " + "480p"; - name = name.Trim(); - } - else - { - name = name + " " + "SD"; - name = name.Trim(); - } + name = name + " " + "4K"; + name = name.Trim(); + } + else if (videoStream.Width.Value >= 1900) + { + name = name + " " + "1080P"; + name = name.Trim(); + } + else if (videoStream.Width.Value >= 1270) + { + name = name + " " + "720P"; + name = name.Trim(); + } + else if (videoStream.Width.Value >= 700) + { + name = name + " " + "480p"; + name = name.Trim(); + } + else + { + name = name + " " + "SD"; + name = name.Trim(); } } } - if (stream != null && !string.IsNullOrWhiteSpace(stream.Codec)) + if (videoStream != null && !string.IsNullOrWhiteSpace(videoStream.Codec)) { - name = name + " " + stream.Codec.ToUpper(); + name = name + " " + videoStream.Codec.ToUpper(); name = name.Trim(); } diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs index b11457ec54..d7b2b1321d 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs @@ -396,7 +396,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies private T GetMovieWithAlternateVersions(IEnumerable movies) where T : Video, new() { - var sortedMovies = movies.OrderBy(i => i.Path.Length).ToList(); + var sortedMovies = movies.OrderBy(i => i.Path).ToList(); // Cap this at five to help avoid incorrect matching if (sortedMovies.Count > 5) @@ -406,11 +406,11 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies var firstMovie = sortedMovies[0]; - var filenamePrefix = Path.GetFileNameWithoutExtension(firstMovie.Path); + var filenamePrefix = Path.GetFileName(Path.GetDirectoryName(firstMovie.Path)); if (!string.IsNullOrWhiteSpace(filenamePrefix)) { - if (sortedMovies.Skip(1).All(i => Path.GetFileNameWithoutExtension(i.Path).StartsWith(filenamePrefix + " - ", StringComparison.OrdinalIgnoreCase))) + if (sortedMovies.All(i => Path.GetFileNameWithoutExtension(i.Path).StartsWith(filenamePrefix + " - ", StringComparison.OrdinalIgnoreCase))) { firstMovie.HasLocalAlternateVersions = true; diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index af49445457..16eec26408 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -162,7 +162,9 @@ PreserveNewest - + + PreserveNewest + PreserveNewest