diff --git a/MediaBrowser.Api/ItemUpdateService.cs b/MediaBrowser.Api/ItemUpdateService.cs index 6cb23a140..79aaccfe8 100644 --- a/MediaBrowser.Api/ItemUpdateService.cs +++ b/MediaBrowser.Api/ItemUpdateService.cs @@ -419,11 +419,6 @@ namespace MediaBrowser.Api series.Status = request.SeriesStatus; series.AirDays = request.AirDays; series.AirTime = request.AirTime; - - if (request.DisplaySpecialsWithSeasons.HasValue) - { - series.DisplaySpecialsWithSeasons = request.DisplaySpecialsWithSeasons.Value; - } } } diff --git a/MediaBrowser.Api/Subtitles/SubtitleService.cs b/MediaBrowser.Api/Subtitles/SubtitleService.cs index 0500f3305..160fda065 100644 --- a/MediaBrowser.Api/Subtitles/SubtitleService.cs +++ b/MediaBrowser.Api/Subtitles/SubtitleService.cs @@ -221,7 +221,7 @@ namespace MediaBrowser.Api.Subtitles if (string.Equals(request.Format, "vtt", StringComparison.OrdinalIgnoreCase) && request.AddVttTimeMap) { - //text = text.Replace("WEBVTT", "WEBVTT\nX-TIMESTAMP-MAP=MPEGTS:900000,LOCAL:00:00:00.000"); + text = text.Replace("WEBVTT", "WEBVTT\nX-TIMESTAMP-MAP=MPEGTS:900000,LOCAL:00:00:00.000"); } return ResultFactory.GetResult(text, MimeTypes.GetMimeType("file." + request.Format)); diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index a24148360..459b6dfb6 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -31,7 +31,6 @@ namespace MediaBrowser.Controller.Entities.TV RemoteTrailers = new List(); LocalTrailerIds = new List(); RemoteTrailerIds = new List(); - DisplaySpecialsWithSeasons = true; } [IgnoreDataMember] @@ -58,8 +57,6 @@ namespace MediaBrowser.Controller.Entities.TV } } - public bool DisplaySpecialsWithSeasons { get; set; } - public List LocalTrailerIds { get; set; } public List RemoteTrailerIds { get; set; } @@ -357,7 +354,7 @@ namespace MediaBrowser.Controller.Entities.TV return GetEpisodes(user, parentSeason, includeMissingEpisodes, includeVirtualUnairedEpisodes); } - var episodes = FilterEpisodesBySeason(allSeriesEpisodes, parentSeason, DisplaySpecialsWithSeasons); + var episodes = FilterEpisodesBySeason(allSeriesEpisodes, parentSeason, ConfigurationManager.Configuration.DisplaySpecialsWithinSeasons); if (!includeMissingEpisodes) { diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs index 44c69d4c1..44a0f264d 100644 --- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs +++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs @@ -408,7 +408,9 @@ namespace MediaBrowser.MediaEncoding.Probing Level = streamInfo.level, Index = streamInfo.index, PixelFormat = streamInfo.pix_fmt, - NalLengthSize = streamInfo.nal_length_size + NalLengthSize = streamInfo.nal_length_size, + TimeBase = streamInfo.time_base, + CodecTimeBase = streamInfo.codec_time_base }; if (string.Equals(streamInfo.is_avc, "true", StringComparison.OrdinalIgnoreCase) || diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index 993799f65..0ce69970f 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -200,6 +200,7 @@ namespace MediaBrowser.Model.Configuration public bool EnableLocalizedGuids { get; set; } public bool EnableFolderView { get; set; } public bool EnableGroupingIntoCollections { get; set; } + public bool DisplaySpecialsWithinSeasons { get; set; } /// /// Initializes a new instance of the class. @@ -210,6 +211,7 @@ namespace MediaBrowser.Model.Configuration EnableCustomPathSubFolders = true; EnableLocalizedGuids = true; + DisplaySpecialsWithinSeasons = true; ImageSavingConvention = ImageSavingConvention.Compatible; PublicPort = 8096; diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index 6a3c08425..868f6b64f 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -36,6 +36,9 @@ namespace MediaBrowser.Model.Entities /// The comment. public string Comment { get; set; } + public string TimeBase { get; set; } + public string CodecTimeBase { get; set; } + public string Title { get; set; } public string DisplayTitle diff --git a/MediaBrowser.Providers/TV/SeriesMetadataService.cs b/MediaBrowser.Providers/TV/SeriesMetadataService.cs index 041969a59..f440baf5b 100644 --- a/MediaBrowser.Providers/TV/SeriesMetadataService.cs +++ b/MediaBrowser.Providers/TV/SeriesMetadataService.cs @@ -76,11 +76,6 @@ namespace MediaBrowser.Providers.TV { targetItem.AirDays = sourceItem.AirDays; } - - if (mergeMetadataSettings) - { - targetItem.DisplaySpecialsWithSeasons = sourceItem.DisplaySpecialsWithSeasons; - } } } } diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index 5588405e3..2c31a8aae 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -1466,11 +1466,6 @@ namespace MediaBrowser.Server.Implementations.Dto dto.AirTime = series.AirTime; dto.SeriesStatus = series.Status; - if (fields.Contains(ItemFields.Settings)) - { - dto.DisplaySpecialsWithSeasons = series.DisplaySpecialsWithSeasons; - } - dto.AnimeSeriesIndex = series.AnimeSeriesIndex; } diff --git a/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs b/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs index 5b0b2ad84..4d2fc8bfe 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/Listings/XmlTvListingsProvider.cs @@ -41,9 +41,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings public Task> GetProgramsAsync(ListingsProviderInfo info, string channelNumber, string channelName, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken) { var reader = new XmlTvReader(info.Path, GetLanguage(), null); - string mappedChannel = channelNumber; - var results = reader.GetProgrammes(mappedChannel, startDateUtc, endDateUtc, cancellationToken); + var results = reader.GetProgrammes(channelNumber, startDateUtc, endDateUtc, cancellationToken); return Task.FromResult(results.Select(p => new ProgramInfo() { ChannelId = p.ChannelId, @@ -61,10 +60,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings IsSeries = p.IsSeries, IsRepeat = p.IsRepeat, // IsPremiere = !p.PreviouslyShown.HasValue, - IsKids = p.Categories.Any(info.KidsCategories.Contains), - IsMovie = p.Categories.Any(info.MovieCategories.Contains), - IsNews = p.Categories.Any(info.NewsCategories.Contains), - IsSports = p.Categories.Any(info.SportsCategories.Contains), + IsKids = p.Categories.Any(c => info.KidsCategories.Contains(c, StringComparer.InvariantCultureIgnoreCase)), + IsMovie = p.Categories.Any(c => info.MovieCategories.Contains(c, StringComparer.InvariantCultureIgnoreCase)), + IsNews = p.Categories.Any(c => info.NewsCategories.Contains(c, StringComparer.InvariantCultureIgnoreCase)), + IsSports = p.Categories.Any(c => info.SportsCategories.Contains(c, StringComparer.InvariantCultureIgnoreCase)), ImageUrl = p.Icon != null && !String.IsNullOrEmpty(p.Icon.Source) ? p.Icon.Source : null, HasImage = p.Icon != null && !String.IsNullOrEmpty(p.Icon.Source), OfficialRating = p.Rating != null && !String.IsNullOrEmpty(p.Rating.Value) ? p.Rating.Value : null, diff --git a/MediaBrowser.Server.Implementations/Persistence/MediaStreamColumns.cs b/MediaBrowser.Server.Implementations/Persistence/MediaStreamColumns.cs index 948e99cb8..1d9be2e0d 100644 --- a/MediaBrowser.Server.Implementations/Persistence/MediaStreamColumns.cs +++ b/MediaBrowser.Server.Implementations/Persistence/MediaStreamColumns.cs @@ -28,6 +28,8 @@ namespace MediaBrowser.Server.Implementations.Persistence AddNalColumn(); AddIsAvcColumn(); AddTitleColumn(); + AddTimeBaseColumn(); + AddCodecTimeBaseColumn(); } private void AddIsAvcColumn() @@ -61,6 +63,68 @@ namespace MediaBrowser.Server.Implementations.Persistence _connection.RunQueries(new[] { builder.ToString() }, _logger); } + private void AddTimeBaseColumn() + { + using (var cmd = _connection.CreateCommand()) + { + cmd.CommandText = "PRAGMA table_info(mediastreams)"; + + using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult)) + { + while (reader.Read()) + { + if (!reader.IsDBNull(1)) + { + var name = reader.GetString(1); + + if (string.Equals(name, "TimeBase", StringComparison.OrdinalIgnoreCase)) + { + return; + } + } + } + } + } + + var builder = new StringBuilder(); + + builder.AppendLine("alter table mediastreams"); + builder.AppendLine("add column TimeBase TEXT"); + + _connection.RunQueries(new[] { builder.ToString() }, _logger); + } + + private void AddCodecTimeBaseColumn() + { + using (var cmd = _connection.CreateCommand()) + { + cmd.CommandText = "PRAGMA table_info(mediastreams)"; + + using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult)) + { + while (reader.Read()) + { + if (!reader.IsDBNull(1)) + { + var name = reader.GetString(1); + + if (string.Equals(name, "CodecTimeBase", StringComparison.OrdinalIgnoreCase)) + { + return; + } + } + } + } + } + + var builder = new StringBuilder(); + + builder.AppendLine("alter table mediastreams"); + builder.AppendLine("add column CodecTimeBase TEXT"); + + _connection.RunQueries(new[] { builder.ToString() }, _logger); + } + private void AddTitleColumn() { using (var cmd = _connection.CreateCommand()) diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index 460a67ca7..a4cb0c48b 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -130,7 +130,7 @@ namespace MediaBrowser.Server.Implementations.Persistence _connection = await dbConnector.Connect(dbFile).ConfigureAwait(false); var createMediaStreamsTableCommand - = "create table if not exists mediastreams (ItemId GUID, StreamIndex INT, StreamType TEXT, Codec TEXT, Language TEXT, ChannelLayout TEXT, Profile TEXT, AspectRatio TEXT, Path TEXT, IsInterlaced BIT, BitRate INT NULL, Channels INT NULL, SampleRate INT NULL, IsDefault BIT, IsForced BIT, IsExternal BIT, Height INT NULL, Width INT NULL, AverageFrameRate FLOAT NULL, RealFrameRate FLOAT NULL, Level FLOAT NULL, PixelFormat TEXT, BitDepth INT NULL, IsAnamorphic BIT NULL, RefFrames INT NULL, CodecTag TEXT NULL, Comment TEXT NULL, NalLengthSize TEXT NULL, IsAvc BIT NULL, Title TEXT NULL, PRIMARY KEY (ItemId, StreamIndex))"; + = "create table if not exists mediastreams (ItemId GUID, StreamIndex INT, StreamType TEXT, Codec TEXT, Language TEXT, ChannelLayout TEXT, Profile TEXT, AspectRatio TEXT, Path TEXT, IsInterlaced BIT, BitRate INT NULL, Channels INT NULL, SampleRate INT NULL, IsDefault BIT, IsForced BIT, IsExternal BIT, Height INT NULL, Width INT NULL, AverageFrameRate FLOAT NULL, RealFrameRate FLOAT NULL, Level FLOAT NULL, PixelFormat TEXT, BitDepth INT NULL, IsAnamorphic BIT NULL, RefFrames INT NULL, CodecTag TEXT NULL, Comment TEXT NULL, NalLengthSize TEXT NULL, IsAvc BIT NULL, Title TEXT NULL, TimeBase TEXT NULL, CodecTimeBase TEXT NULL, PRIMARY KEY (ItemId, StreamIndex))"; string[] queries = { @@ -368,7 +368,9 @@ namespace MediaBrowser.Server.Implementations.Persistence "Comment", "NalLengthSize", "IsAvc", - "Title" + "Title", + "TimeBase", + "CodecTimeBase" }; /// @@ -3805,6 +3807,9 @@ namespace MediaBrowser.Server.Implementations.Persistence _saveStreamCommand.GetParameter(index++).Value = stream.IsAVC; _saveStreamCommand.GetParameter(index++).Value = stream.Title; + _saveStreamCommand.GetParameter(index++).Value = stream.TimeBase; + _saveStreamCommand.GetParameter(index++).Value = stream.CodecTimeBase; + _saveStreamCommand.Transaction = transaction; _saveStreamCommand.ExecuteNonQuery(); } @@ -3977,6 +3982,16 @@ namespace MediaBrowser.Server.Implementations.Persistence item.Title = reader.GetString(29); } + if (!reader.IsDBNull(30)) + { + item.TimeBase = reader.GetString(30); + } + + if (!reader.IsDBNull(31)) + { + item.CodecTimeBase = reader.GetString(31); + } + return item; }