Procházet zdrojové kódy

rework settings page

Luke Pulverenti před 10 roky
rodič
revize
d95057f13b

+ 5 - 0
MediaBrowser.Controller/Entities/BaseItem.cs

@@ -1124,6 +1124,11 @@ namespace MediaBrowser.Controller.Entities
                 rating = OfficialRatingForComparison;
                 rating = OfficialRatingForComparison;
             }
             }
 
 
+            if (string.IsNullOrWhiteSpace(rating))
+            {
+                return null;
+            }
+
             return LocalizationManager.GetRatingLevel(rating);
             return LocalizationManager.GetRatingLevel(rating);
         }
         }
 
 

+ 2 - 2
MediaBrowser.Controller/Entities/InternalItemsQuery.cs

@@ -1,6 +1,6 @@
-using System.Collections.Generic;
-using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Entities;
 using System;
 using System;
+using System.Collections.Generic;
 
 
 namespace MediaBrowser.Controller.Entities
 namespace MediaBrowser.Controller.Entities
 {
 {

+ 14 - 0
MediaBrowser.Controller/LiveTv/LiveTvProgram.cs

@@ -227,5 +227,19 @@ namespace MediaBrowser.Controller.LiveTv
             info.IsMovie = IsMovie; 
             info.IsMovie = IsMovie; 
             return info;
             return info;
         }
         }
+
+        public override bool SupportsPeople
+        {
+            get
+            {
+                // Optimization
+                if (IsNews || IsSports)
+                {
+                    return false;
+                }
+
+                return base.SupportsPeople;
+            }
+        }
     }
     }
 }
 }

+ 0 - 18
MediaBrowser.Controller/MediaEncoding/ISubtitleEncoder.cs

@@ -7,24 +7,6 @@ namespace MediaBrowser.Controller.MediaEncoding
 {
 {
     public interface ISubtitleEncoder
     public interface ISubtitleEncoder
     {
     {
-        /// <summary>
-        /// Converts the subtitles.
-        /// </summary>
-        /// <param name="stream">The stream.</param>
-        /// <param name="inputFormat">The input format.</param>
-        /// <param name="outputFormat">The output format.</param>
-        /// <param name="startTimeTicks">The start time ticks.</param>
-        /// <param name="endTimeTicks">The end time ticks.</param>
-        /// <param name="cancellationToken">The cancellation token.</param>
-        /// <returns>Task{Stream}.</returns>
-        Task<Stream> ConvertSubtitles(
-            Stream stream,
-            string inputFormat,
-            string outputFormat,
-            long startTimeTicks,
-            long? endTimeTicks,
-            CancellationToken cancellationToken);
-
         /// <summary>
         /// <summary>
         /// Gets the subtitles.
         /// Gets the subtitles.
         /// </summary>
         /// </summary>

+ 5 - 12
MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs

@@ -53,7 +53,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
             }
             }
         }
         }
 
 
-        public async Task<Stream> ConvertSubtitles(Stream stream,
+        private async Task<Stream> ConvertSubtitles(Stream stream,
             string inputFormat,
             string inputFormat,
             string outputFormat,
             string outputFormat,
             long startTimeTicks,
             long startTimeTicks,
@@ -64,7 +64,9 @@ namespace MediaBrowser.MediaEncoding.Subtitles
 
 
             try
             try
             {
             {
-                var trackInfo = await GetTrackInfo(stream, inputFormat, cancellationToken).ConfigureAwait(false);
+                var reader = GetReader(inputFormat, true);
+
+                var trackInfo = reader.Parse(stream, cancellationToken);
 
 
                 FilterEvents(trackInfo, startTimeTicks, endTimeTicks, false);
                 FilterEvents(trackInfo, startTimeTicks, endTimeTicks, false);
 
 
@@ -190,7 +192,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
             {
             {
                 throw new ArgumentNullException("charset");
                 throw new ArgumentNullException("charset");
             }
             }
-
+            
             try
             try
             {
             {
                 return Encoding.GetEncoding(charset);
                 return Encoding.GetEncoding(charset);
@@ -257,15 +259,6 @@ namespace MediaBrowser.MediaEncoding.Subtitles
             return new Tuple<string, MediaProtocol, string, bool>(subtitleStream.Path, protocol, currentFormat, true);
             return new Tuple<string, MediaProtocol, string, bool>(subtitleStream.Path, protocol, currentFormat, true);
         }
         }
 
 
-        private async Task<SubtitleTrackInfo> GetTrackInfo(Stream stream,
-            string inputFormat,
-            CancellationToken cancellationToken)
-        {
-            var reader = GetReader(inputFormat, true);
-
-            return reader.Parse(stream, cancellationToken);
-        }
-
         private ISubtitleParser GetReader(string format, bool throwIfMissing)
         private ISubtitleParser GetReader(string format, bool throwIfMissing)
         {
         {
             if (string.IsNullOrEmpty(format))
             if (string.IsNullOrEmpty(format))

+ 14 - 2
MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs

@@ -1,4 +1,5 @@
-using MediaBrowser.Common.IO;
+using System.ComponentModel;
+using MediaBrowser.Common.IO;
 using MediaBrowser.Common.ScheduledTasks;
 using MediaBrowser.Common.ScheduledTasks;
 using MediaBrowser.Controller.Configuration;
 using MediaBrowser.Controller.Configuration;
 using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities;
@@ -338,7 +339,7 @@ namespace MediaBrowser.Server.Implementations.IO
             }
             }
             catch
             catch
             {
             {
-                
+
             }
             }
             finally
             finally
             {
             {
@@ -370,6 +371,17 @@ namespace MediaBrowser.Server.Implementations.IO
             Logger.ErrorException("Error in Directory watcher for: " + dw.Path, ex);
             Logger.ErrorException("Error in Directory watcher for: " + dw.Path, ex);
 
 
             DisposeWatcher(dw);
             DisposeWatcher(dw);
+
+            if (ex is Win32Exception)
+            {
+                Logger.Info("Disabling realtime monitor to prevent future instability");
+
+                if (ConfigurationManager.Configuration.EnableLibraryMonitor == AutoOnOff.Auto)
+                {
+                    ConfigurationManager.Configuration.EnableLibraryMonitor = AutoOnOff.Disabled;
+                    Stop();
+                }
+            }
         }
         }
 
 
         /// <summary>
         /// <summary>

+ 9 - 6
MediaBrowser.Server.Implementations/Library/LibraryManager.cs

@@ -2071,14 +2071,17 @@ namespace MediaBrowser.Server.Implementations.Library
 
 
         public List<PersonInfo> GetPeople(BaseItem item)
         public List<PersonInfo> GetPeople(BaseItem item)
         {
         {
-            var people = GetPeople(new InternalPeopleQuery
+            if (item.SupportsPeople)
             {
             {
-                ItemId = item.Id
-            });
+                var people = GetPeople(new InternalPeopleQuery
+                {
+                    ItemId = item.Id
+                });
 
 
-            if (people.Count > 0)
-            {
-                return people;
+                if (people.Count > 0)
+                {
+                    return people;
+                }
             }
             }
 
 
             return item.People ?? new List<PersonInfo>();
             return item.People ?? new List<PersonInfo>();

+ 1 - 3
MediaBrowser.Server.Implementations/Localization/Core/core.json

@@ -173,7 +173,5 @@
     "HeaderProducer": "Producers",
     "HeaderProducer": "Producers",
     "HeaderWriter": "Writers",
     "HeaderWriter": "Writers",
     "HeaderParentalRatings": "Parental Ratings",
     "HeaderParentalRatings": "Parental Ratings",
-    "HeaderCommunityRatings": "Community ratings",
-
-
+    "HeaderCommunityRatings": "Community ratings"
 }
 }

+ 1 - 0
MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj

@@ -204,6 +204,7 @@
     <Content Include="dashboard-ui\mypreferenceshome.html">
     <Content Include="dashboard-ui\mypreferenceshome.html">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     </Content>
+    <Content Include="dashboard-ui\mypreferencesmenu.html" />
     <Content Include="dashboard-ui\scripts\actionsheet.js">
     <Content Include="dashboard-ui\scripts\actionsheet.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     </Content>