Browse Source

record time base

Luke Pulverenti 9 years ago
parent
commit
19ee883ca2

+ 0 - 5
MediaBrowser.Api/ItemUpdateService.cs

@@ -419,11 +419,6 @@ namespace MediaBrowser.Api
                 series.Status = request.SeriesStatus;
                 series.Status = request.SeriesStatus;
                 series.AirDays = request.AirDays;
                 series.AirDays = request.AirDays;
                 series.AirTime = request.AirTime;
                 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)
                     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));
                     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>();
             RemoteTrailers = new List<MediaUrl>();
             LocalTrailerIds = new List<Guid>();
             LocalTrailerIds = new List<Guid>();
             RemoteTrailerIds = new List<Guid>();
             RemoteTrailerIds = new List<Guid>();
-            DisplaySpecialsWithSeasons = true;
         }
         }
 
 
         [IgnoreDataMember]
         [IgnoreDataMember]
@@ -58,8 +57,6 @@ namespace MediaBrowser.Controller.Entities.TV
             }
             }
         }
         }
 
 
-        public bool DisplaySpecialsWithSeasons { get; set; }
-
         public List<Guid> LocalTrailerIds { get; set; }
         public List<Guid> LocalTrailerIds { get; set; }
         public List<Guid> RemoteTrailerIds { get; set; }
         public List<Guid> RemoteTrailerIds { get; set; }
 
 
@@ -357,7 +354,7 @@ namespace MediaBrowser.Controller.Entities.TV
                 return GetEpisodes(user, parentSeason, includeMissingEpisodes, includeVirtualUnairedEpisodes);
                 return GetEpisodes(user, parentSeason, includeMissingEpisodes, includeVirtualUnairedEpisodes);
             }
             }
 
 
-            var episodes = FilterEpisodesBySeason(allSeriesEpisodes, parentSeason, DisplaySpecialsWithSeasons);
+            var episodes = FilterEpisodesBySeason(allSeriesEpisodes, parentSeason, ConfigurationManager.Configuration.DisplaySpecialsWithinSeasons);
 
 
             if (!includeMissingEpisodes)
             if (!includeMissingEpisodes)
             {
             {

+ 3 - 1
MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs

@@ -408,7 +408,9 @@ namespace MediaBrowser.MediaEncoding.Probing
                 Level = streamInfo.level,
                 Level = streamInfo.level,
                 Index = streamInfo.index,
                 Index = streamInfo.index,
                 PixelFormat = streamInfo.pix_fmt,
                 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) ||
             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 EnableLocalizedGuids { get; set; }
         public bool EnableFolderView { get; set; }
         public bool EnableFolderView { get; set; }
         public bool EnableGroupingIntoCollections { get; set; }
         public bool EnableGroupingIntoCollections { get; set; }
+        public bool DisplaySpecialsWithinSeasons { get; set; }
 
 
         /// <summary>
         /// <summary>
         /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
         /// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
@@ -210,6 +211,7 @@ namespace MediaBrowser.Model.Configuration
 
 
             EnableCustomPathSubFolders = true;
             EnableCustomPathSubFolders = true;
             EnableLocalizedGuids = true;
             EnableLocalizedGuids = true;
+            DisplaySpecialsWithinSeasons = true;
 
 
             ImageSavingConvention = ImageSavingConvention.Compatible;
             ImageSavingConvention = ImageSavingConvention.Compatible;
             PublicPort = 8096;
             PublicPort = 8096;

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

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

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

@@ -76,11 +76,6 @@ namespace MediaBrowser.Providers.TV
             {
             {
                 targetItem.AirDays = sourceItem.AirDays;
                 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.AirTime = series.AirTime;
                 dto.SeriesStatus = series.Status;
                 dto.SeriesStatus = series.Status;
 
 
-                if (fields.Contains(ItemFields.Settings))
-                {
-                    dto.DisplaySpecialsWithSeasons = series.DisplaySpecialsWithSeasons;
-                }
-
                 dto.AnimeSeriesIndex = series.AnimeSeriesIndex;
                 dto.AnimeSeriesIndex = series.AnimeSeriesIndex;
             }
             }
 
 

+ 64 - 0
MediaBrowser.Server.Implementations/Persistence/MediaStreamColumns.cs

@@ -28,6 +28,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
             AddNalColumn();
             AddNalColumn();
             AddIsAvcColumn();
             AddIsAvcColumn();
             AddTitleColumn();
             AddTitleColumn();
+            AddTimeBaseColumn();
+            AddCodecTimeBaseColumn();
         }
         }
 
 
         private void AddIsAvcColumn()
         private void AddIsAvcColumn()
@@ -61,6 +63,68 @@ namespace MediaBrowser.Server.Implementations.Persistence
             _connection.RunQueries(new[] { builder.ToString() }, _logger);
             _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()
         private void AddTitleColumn()
         {
         {
             using (var cmd = _connection.CreateCommand())
             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);
             _connection = await dbConnector.Connect(dbFile).ConfigureAwait(false);
 
 
             var createMediaStreamsTableCommand
             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 = {
             string[] queries = {
 
 
@@ -368,7 +368,9 @@ namespace MediaBrowser.Server.Implementations.Persistence
             "Comment",
             "Comment",
             "NalLengthSize",
             "NalLengthSize",
             "IsAvc",
             "IsAvc",
-            "Title"
+            "Title",
+            "TimeBase",
+            "CodecTimeBase"
         };
         };
 
 
         /// <summary>
         /// <summary>
@@ -3805,6 +3807,9 @@ namespace MediaBrowser.Server.Implementations.Persistence
                     _saveStreamCommand.GetParameter(index++).Value = stream.IsAVC;
                     _saveStreamCommand.GetParameter(index++).Value = stream.IsAVC;
                     _saveStreamCommand.GetParameter(index++).Value = stream.Title;
                     _saveStreamCommand.GetParameter(index++).Value = stream.Title;
 
 
+                    _saveStreamCommand.GetParameter(index++).Value = stream.TimeBase;
+                    _saveStreamCommand.GetParameter(index++).Value = stream.CodecTimeBase;
+
                     _saveStreamCommand.Transaction = transaction;
                     _saveStreamCommand.Transaction = transaction;
                     _saveStreamCommand.ExecuteNonQuery();
                     _saveStreamCommand.ExecuteNonQuery();
                 }
                 }
@@ -3977,6 +3982,16 @@ namespace MediaBrowser.Server.Implementations.Persistence
                 item.Title = reader.GetString(29);
                 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;
             return item;
         }
         }