From 8508e07bb9d1af326ef4c1c1b891e0d49288167b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 13 Aug 2016 16:54:29 -0400 Subject: improve genre displays --- MediaBrowser.Model/Configuration/LibraryOptions.cs | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 MediaBrowser.Model/Configuration/LibraryOptions.cs (limited to 'MediaBrowser.Model/Configuration/LibraryOptions.cs') diff --git a/MediaBrowser.Model/Configuration/LibraryOptions.cs b/MediaBrowser.Model/Configuration/LibraryOptions.cs new file mode 100644 index 000000000..c6f7bbb9d --- /dev/null +++ b/MediaBrowser.Model/Configuration/LibraryOptions.cs @@ -0,0 +1,7 @@ +namespace MediaBrowser.Model.Configuration +{ + public class LibraryOptions + { + public bool EnableArchiveMediaFiles { get; set; } + } +} -- cgit v1.2.3 From caab8299d1c8ebb7db7de1c83fc7a26070309a6e Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 15 Aug 2016 00:36:17 -0400 Subject: add setting for photo libraries --- MediaBrowser.Model/Configuration/LibraryOptions.cs | 6 ++++++ MediaBrowser.Server.Implementations/Library/LibraryManager.cs | 2 +- .../Library/Resolvers/PhotoResolver.cs | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'MediaBrowser.Model/Configuration/LibraryOptions.cs') diff --git a/MediaBrowser.Model/Configuration/LibraryOptions.cs b/MediaBrowser.Model/Configuration/LibraryOptions.cs index c6f7bbb9d..e15df37c1 100644 --- a/MediaBrowser.Model/Configuration/LibraryOptions.cs +++ b/MediaBrowser.Model/Configuration/LibraryOptions.cs @@ -3,5 +3,11 @@ public class LibraryOptions { public bool EnableArchiveMediaFiles { get; set; } + public bool EnablePhotos { get; set; } + + public LibraryOptions() + { + EnablePhotos = true; + } } } diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index 52961668d..a19f70e68 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -364,7 +364,7 @@ namespace MediaBrowser.Server.Implementations.Library if (item.IsFolder) { - if (!(item is ICollectionFolder) && !(item is UserView) && !(item is Channel)) + if (!(item is ICollectionFolder) && !(item is UserView) && !(item is Channel) && !(item is AggregateFolder)) { if (item.SourceType != SourceType.Library) { diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/PhotoResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/PhotoResolver.cs index 78df465b1..3f9475480 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/PhotoResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/PhotoResolver.cs @@ -34,8 +34,9 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers // Must be an image file within a photo collection var collectionType = args.GetCollectionType(); + if (string.Equals(collectionType, CollectionType.Photos, StringComparison.OrdinalIgnoreCase) || - string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase)) + (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) && args.GetLibraryOptions().EnablePhotos)) { if (IsImageFile(args.Path, _imageProcessor)) { -- cgit v1.2.3 From c46e38725e40171639d6b1fec930081be129a1bc Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 24 Aug 2016 16:46:26 -0400 Subject: support realtime monitor per library --- .../Entities/CollectionFolder.cs | 1 + MediaBrowser.Model/Configuration/LibraryOptions.cs | 3 ++ .../IO/LibraryMonitor.cs | 40 ++++++++++++---------- 3 files changed, 25 insertions(+), 19 deletions(-) (limited to 'MediaBrowser.Model/Configuration/LibraryOptions.cs') diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index e120f2e23..597ecf973 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -106,6 +106,7 @@ namespace MediaBrowser.Controller.Entities { LibraryOptions[path] = options; + options.SchemaVersion = 1; XmlSerializer.SerializeToFile(options, GetLibraryOptionsPath(path)); } } diff --git a/MediaBrowser.Model/Configuration/LibraryOptions.cs b/MediaBrowser.Model/Configuration/LibraryOptions.cs index e15df37c1..3fe694553 100644 --- a/MediaBrowser.Model/Configuration/LibraryOptions.cs +++ b/MediaBrowser.Model/Configuration/LibraryOptions.cs @@ -4,10 +4,13 @@ { public bool EnableArchiveMediaFiles { get; set; } public bool EnablePhotos { get; set; } + public bool EnableRealtimeMonitor { get; set; } + public int SchemaVersion { get; set; } public LibraryOptions() { EnablePhotos = true; + EnableRealtimeMonitor = true; } } } diff --git a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs index ea9e58ee4..7ed4dc71e 100644 --- a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs +++ b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs @@ -172,27 +172,29 @@ namespace MediaBrowser.Server.Implementations.IO } } - public void Start() + private bool IsLibraryMonitorEnabaled(BaseItem item) { - if (EnableLibraryMonitor) + var options = LibraryManager.GetLibraryOptions(item); + + if (options != null && options.SchemaVersion >= 1) { - StartInternal(); + return options.EnableRealtimeMonitor; } + + return EnableLibraryMonitor; } - /// - /// Starts this instance. - /// - private void StartInternal() + public void Start() { LibraryManager.ItemAdded += LibraryManager_ItemAdded; LibraryManager.ItemRemoved += LibraryManager_ItemRemoved; - var pathsToWatch = new List { LibraryManager.RootFolder.Path }; + var pathsToWatch = new List { }; var paths = LibraryManager .RootFolder .Children + .Where(IsLibraryMonitorEnabaled) .OfType() .SelectMany(f => f.PhysicalLocations) .Distinct(StringComparer.OrdinalIgnoreCase) @@ -213,6 +215,14 @@ namespace MediaBrowser.Server.Implementations.IO } } + private void StartWatching(BaseItem item) + { + if (IsLibraryMonitorEnabaled(item)) + { + StartWatchingPath(item.Path); + } + } + /// /// Handles the ItemRemoved event of the LibraryManager control. /// @@ -235,7 +245,7 @@ namespace MediaBrowser.Server.Implementations.IO { if (e.Item.GetParent() is AggregateFolder) { - StartWatchingPath(e.Item.Path); + StartWatching(e.Item); } } @@ -382,14 +392,6 @@ namespace MediaBrowser.Server.Implementations.IO Logger.ErrorException("Error in Directory watcher for: " + dw.Path, ex); DisposeWatcher(dw); - - if (ConfigurationManager.Configuration.EnableLibraryMonitor == AutoOnOff.Auto) - { - Logger.Info("Disabling realtime monitor to prevent future instability"); - - ConfigurationManager.Configuration.EnableLibraryMonitor = AutoOnOff.Disabled; - Stop(); - } } /// @@ -420,8 +422,8 @@ namespace MediaBrowser.Server.Implementations.IO var filename = Path.GetFileName(path); - var monitorPath = !string.IsNullOrEmpty(filename) && - !_alwaysIgnoreFiles.Contains(filename, StringComparer.OrdinalIgnoreCase) && + var monitorPath = !string.IsNullOrEmpty(filename) && + !_alwaysIgnoreFiles.Contains(filename, StringComparer.OrdinalIgnoreCase) && !_alwaysIgnoreExtensions.Contains(Path.GetExtension(path) ?? string.Empty, StringComparer.OrdinalIgnoreCase); // Ignore certain files -- cgit v1.2.3