Browse Source

Merge pull request #2126 from MediaBrowser/dev

Dev
Luke 9 years ago
parent
commit
a7e9979865

+ 6 - 1
MediaBrowser.Api/Playback/MediaInfoService.cs

@@ -17,6 +17,7 @@ using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using MediaBrowser.Controller.Entities.Audio;
 using MediaBrowser.Controller.Entities.Audio;
 using MediaBrowser.Controller.MediaEncoding;
 using MediaBrowser.Controller.MediaEncoding;
+using MediaBrowser.Model.Serialization;
 
 
 namespace MediaBrowser.Api.Playback
 namespace MediaBrowser.Api.Playback
 {
 {
@@ -70,8 +71,9 @@ namespace MediaBrowser.Api.Playback
         private readonly INetworkManager _networkManager;
         private readonly INetworkManager _networkManager;
         private readonly IMediaEncoder _mediaEncoder;
         private readonly IMediaEncoder _mediaEncoder;
         private readonly IUserManager _userManager;
         private readonly IUserManager _userManager;
+        private readonly IJsonSerializer _json;
 
 
-        public MediaInfoService(IMediaSourceManager mediaSourceManager, IDeviceManager deviceManager, ILibraryManager libraryManager, IServerConfigurationManager config, INetworkManager networkManager, IMediaEncoder mediaEncoder, IUserManager userManager)
+        public MediaInfoService(IMediaSourceManager mediaSourceManager, IDeviceManager deviceManager, ILibraryManager libraryManager, IServerConfigurationManager config, INetworkManager networkManager, IMediaEncoder mediaEncoder, IUserManager userManager, IJsonSerializer json)
         {
         {
             _mediaSourceManager = mediaSourceManager;
             _mediaSourceManager = mediaSourceManager;
             _deviceManager = deviceManager;
             _deviceManager = deviceManager;
@@ -80,6 +82,7 @@ namespace MediaBrowser.Api.Playback
             _networkManager = networkManager;
             _networkManager = networkManager;
             _mediaEncoder = mediaEncoder;
             _mediaEncoder = mediaEncoder;
             _userManager = userManager;
             _userManager = userManager;
+            _json = json;
         }
         }
 
 
         public object Get(GetBitrateTestBytes request)
         public object Get(GetBitrateTestBytes request)
@@ -147,6 +150,8 @@ namespace MediaBrowser.Api.Playback
 
 
             var profile = request.DeviceProfile;
             var profile = request.DeviceProfile;
 
 
+            //Logger.Info("GetPostedPlaybackInfo profile: {0}", _json.SerializeToString(profile));
+
             if (profile == null)
             if (profile == null)
             {
             {
                 var caps = _deviceManager.GetCapabilities(authInfo.DeviceId);
                 var caps = _deviceManager.GetCapabilities(authInfo.DeviceId);

+ 8 - 2
MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs

@@ -142,9 +142,15 @@ namespace MediaBrowser.Common.Implementations.Security
             }
             }
             set
             set
             {
             {
-                if (value != LicenseFile.RegKey)
+                var newValue = value;
+                if (newValue != null)
                 {
                 {
-                    LicenseFile.RegKey = value;
+                    newValue = newValue.Trim();
+                }
+
+                if (newValue != LicenseFile.RegKey)
+                {
+                    LicenseFile.RegKey = newValue;
                     LicenseFile.Save();
                     LicenseFile.Save();
 
 
                     // re-load registration info
                     // re-load registration info

+ 1 - 1
MediaBrowser.Controller/Entities/CollectionFolder.cs

@@ -106,7 +106,7 @@ namespace MediaBrowser.Controller.Entities
             {
             {
                 LibraryOptions[path] = options;
                 LibraryOptions[path] = options;
 
 
-                options.SchemaVersion = 1;
+                options.SchemaVersion = 2;
                 XmlSerializer.SerializeToFile(options, GetLibraryOptionsPath(path));
                 XmlSerializer.SerializeToFile(options, GetLibraryOptionsPath(path));
             }
             }
         }
         }

+ 2 - 0
MediaBrowser.Model/Configuration/LibraryOptions.cs

@@ -6,6 +6,8 @@
         public bool EnablePhotos { get; set; }
         public bool EnablePhotos { get; set; }
         public bool EnableRealtimeMonitor { get; set; }
         public bool EnableRealtimeMonitor { get; set; }
         public int SchemaVersion { get; set; }
         public int SchemaVersion { get; set; }
+        public bool EnableChapterImageExtraction { get; set; }
+        public bool ExtractChapterImagesDuringLibraryScan { get; set; }
 
 
         public LibraryOptions()
         public LibraryOptions()
         {
         {

+ 8 - 1
MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs

@@ -261,11 +261,18 @@ namespace MediaBrowser.Providers.MediaInfo
 
 
                 NormalizeChapterNames(chapters);
                 NormalizeChapterNames(chapters);
 
 
+                var libraryOptions = _libraryManager.GetLibraryOptions(video);
+                var extractDuringScan = chapterOptions.ExtractDuringLibraryScan;
+                if (libraryOptions != null && libraryOptions.SchemaVersion >= 2)
+                {
+                    extractDuringScan = libraryOptions.ExtractChapterImagesDuringLibraryScan;
+                }
+
                 await _encodingManager.RefreshChapterImages(new ChapterImageRefreshOptions
                 await _encodingManager.RefreshChapterImages(new ChapterImageRefreshOptions
                 {
                 {
                     Chapters = chapters,
                     Chapters = chapters,
                     Video = video,
                     Video = video,
-                    ExtractImages = chapterOptions.ExtractDuringLibraryScan,
+                    ExtractImages = extractDuringScan,
                     SaveChapters = false
                     SaveChapters = false
 
 
                 }, cancellationToken).ConfigureAwait(false);
                 }, cancellationToken).ConfigureAwait(false);

+ 27 - 13
MediaBrowser.Server.Implementations/MediaEncoder/EncodingManager.cs

@@ -14,6 +14,7 @@ using System.Linq;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using CommonIO;
 using CommonIO;
+using MediaBrowser.Controller.Library;
 
 
 namespace MediaBrowser.Server.Implementations.MediaEncoder
 namespace MediaBrowser.Server.Implementations.MediaEncoder
 {
 {
@@ -24,16 +25,18 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
         private readonly ILogger _logger;
         private readonly ILogger _logger;
         private readonly IMediaEncoder _encoder;
         private readonly IMediaEncoder _encoder;
         private readonly IChapterManager _chapterManager;
         private readonly IChapterManager _chapterManager;
+        private readonly ILibraryManager _libraryManager;
 
 
         public EncodingManager(IFileSystem fileSystem, 
         public EncodingManager(IFileSystem fileSystem, 
             ILogger logger, 
             ILogger logger, 
             IMediaEncoder encoder, 
             IMediaEncoder encoder, 
-            IChapterManager chapterManager)
+            IChapterManager chapterManager, ILibraryManager libraryManager)
         {
         {
             _fileSystem = fileSystem;
             _fileSystem = fileSystem;
             _logger = logger;
             _logger = logger;
             _encoder = encoder;
             _encoder = encoder;
             _chapterManager = chapterManager;
             _chapterManager = chapterManager;
+            _libraryManager = libraryManager;
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -57,27 +60,38 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
                 return false;
                 return false;
             }
             }
 
 
-            var options = _chapterManager.GetConfiguration();
-
-            if (video is Movie)
+            var libraryOptions = _libraryManager.GetLibraryOptions(video);
+            if (libraryOptions != null && libraryOptions.SchemaVersion >= 2)
             {
             {
-                if (!options.EnableMovieChapterImageExtraction)
+                if (!libraryOptions.EnableChapterImageExtraction)
                 {
                 {
                     return false;
                     return false;
                 }
                 }
             }
             }
-            else if (video is Episode)
+            else
             {
             {
-                if (!options.EnableEpisodeChapterImageExtraction)
+                var options = _chapterManager.GetConfiguration();
+
+                if (video is Movie)
                 {
                 {
-                    return false;
+                    if (!options.EnableMovieChapterImageExtraction)
+                    {
+                        return false;
+                    }
                 }
                 }
-            }
-            else
-            {
-                if (!options.EnableOtherVideoChapterImageExtraction)
+                else if (video is Episode)
                 {
                 {
-                    return false;
+                    if (!options.EnableEpisodeChapterImageExtraction)
+                    {
+                        return false;
+                    }
+                }
+                else
+                {
+                    if (!options.EnableOtherVideoChapterImageExtraction)
+                    {
+                        return false;
+                    }
                 }
                 }
             }
             }
 
 

+ 1 - 1
MediaBrowser.Server.Startup.Common/ApplicationHost.cs

@@ -547,7 +547,7 @@ namespace MediaBrowser.Server.Startup.Common
             await RegisterMediaEncoder(innerProgress).ConfigureAwait(false);
             await RegisterMediaEncoder(innerProgress).ConfigureAwait(false);
             progress.Report(90);
             progress.Report(90);
 
 
-            EncodingManager = new EncodingManager(FileSystemManager, Logger, MediaEncoder, ChapterManager);
+            EncodingManager = new EncodingManager(FileSystemManager, Logger, MediaEncoder, ChapterManager, LibraryManager);
             RegisterSingleInstance(EncodingManager);
             RegisterSingleInstance(EncodingManager);
 
 
             RegisterSingleInstance(NativeApp.GetPowerManagement());
             RegisterSingleInstance(NativeApp.GetPowerManagement());

+ 1 - 1
MediaBrowser.Server.Startup.Common/Migrations/UpdateLevelMigration.cs

@@ -57,7 +57,7 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
 
 
         private async Task CheckVersion(Version currentVersion, PackageVersionClass updateLevel, CancellationToken cancellationToken)
         private async Task CheckVersion(Version currentVersion, PackageVersionClass updateLevel, CancellationToken cancellationToken)
         {
         {
-            var releases = await new GithubUpdater(_httpClient, _jsonSerializer, TimeSpan.FromMinutes(5))
+            var releases = await new GithubUpdater(_httpClient, _jsonSerializer, TimeSpan.FromMinutes(3))
                 .GetLatestReleases("MediaBrowser", "Emby", _releaseAssetFilename, cancellationToken).ConfigureAwait(false);
                 .GetLatestReleases("MediaBrowser", "Emby", _releaseAssetFilename, cancellationToken).ConfigureAwait(false);
 
 
             var newUpdateLevel = updateLevel;
             var newUpdateLevel = updateLevel;

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

@@ -281,9 +281,6 @@
     <Content Include="dashboard-ui\css\nowplayingbar.css">
     <Content Include="dashboard-ui\css\nowplayingbar.css">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     </Content>
-    <Content Include="dashboard-ui\components\imageeditor\imageeditor.template.html">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
     <Content Include="dashboard-ui\favorites.html">
     <Content Include="dashboard-ui\favorites.html">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     </Content>
@@ -1086,9 +1083,6 @@
     <Content Include="dashboard-ui\music.html">
     <Content Include="dashboard-ui\music.html">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     </Content>
-    <Content Include="dashboard-ui\components\imageeditor\imageeditor.js">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
     <Content Include="dashboard-ui\scripts\edititemmetadata.js">
     <Content Include="dashboard-ui\scripts\edititemmetadata.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     </Content>