浏览代码

record time base

Luke Pulverenti 9 年之前
父节点
当前提交
19ee883ca2

+ 0 - 5
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;
-                }
             }
         }
 

+ 1 - 1
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));

+ 1 - 4
MediaBrowser.Controller/Entities/TV/Series.cs

@@ -31,7 +31,6 @@ namespace MediaBrowser.Controller.Entities.TV
             RemoteTrailers = new List<MediaUrl>();
             LocalTrailerIds = new List<Guid>();
             RemoteTrailerIds = new List<Guid>();
-            DisplaySpecialsWithSeasons = true;
         }
 
         [IgnoreDataMember]
@@ -58,8 +57,6 @@ namespace MediaBrowser.Controller.Entities.TV
             }
         }
 
-        public bool DisplaySpecialsWithSeasons { get; set; }
-
         public List<Guid> LocalTrailerIds { get; set; }
         public List<Guid> 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)
             {

+ 3 - 1
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) ||

+ 2 - 0
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; }
 
         /// <summary>
         /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
@@ -210,6 +211,7 @@ namespace MediaBrowser.Model.Configuration
 
             EnableCustomPathSubFolders = true;
             EnableLocalizedGuids = true;
+            DisplaySpecialsWithinSeasons = true;
 
             ImageSavingConvention = ImageSavingConvention.Compatible;
             PublicPort = 8096;

+ 3 - 0
MediaBrowser.Model/Entities/MediaStream.cs

@@ -36,6 +36,9 @@ namespace MediaBrowser.Model.Entities
         /// <value>The comment.</value>
         public string Comment { get; set; }
 
+        public string TimeBase { get; set; }
+        public string CodecTimeBase { get; set; }
+
         public string Title { get; set; }
 
         public string DisplayTitle

+ 0 - 5
MediaBrowser.Providers/TV/SeriesMetadataService.cs

@@ -76,11 +76,6 @@ namespace MediaBrowser.Providers.TV
             {
                 targetItem.AirDays = sourceItem.AirDays;
             }
-
-            if (mergeMetadataSettings)
-            {
-                targetItem.DisplaySpecialsWithSeasons = sourceItem.DisplaySpecialsWithSeasons;
-            }
         }
     }
 }

+ 0 - 5
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;
             }
 

+ 64 - 0
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())

+ 17 - 2
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"
         };
 
         /// <summary>
@@ -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;
         }