From 449485d3d2044185f16af3e7dc185ff86a0ed72b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 20 Jan 2015 15:19:54 -0500 Subject: [PATCH] add organize now/sync prepare buttons --- MediaBrowser.Providers/TV/DummySeasonProvider.cs | 1 - MediaBrowser.Providers/TV/MissingEpisodeProvider.cs | 1 - .../Channels/ChannelManager.cs | 2 -- .../Collections/CollectionManager.cs | 1 - .../Devices/CameraUploadsFolder.cs | 1 - .../FileOrganization/OrganizerScheduledTask.cs | 7 ++++++- .../Library/ResolverHelper.cs | 12 ------------ .../Library/UserManager.cs | 7 +++++++ .../Localization/Server/server.json | 2 ++ .../Sync/SyncScheduledTask.cs | 11 ++++++++--- 10 files changed, 23 insertions(+), 22 deletions(-) diff --git a/MediaBrowser.Providers/TV/DummySeasonProvider.cs b/MediaBrowser.Providers/TV/DummySeasonProvider.cs index 5bf40de0f1..f82439de98 100644 --- a/MediaBrowser.Providers/TV/DummySeasonProvider.cs +++ b/MediaBrowser.Providers/TV/DummySeasonProvider.cs @@ -112,7 +112,6 @@ namespace MediaBrowser.Providers.TV Name = seasonName, IndexNumber = seasonNumber, Parent = series, - DisplayMediaType = typeof(Season).Name, Id = (series.Id + (seasonNumber ?? -1).ToString(_usCulture) + seasonName).GetMBId(typeof(Season)) }; diff --git a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs index 53b60c1b8b..8b46b082b9 100644 --- a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs @@ -406,7 +406,6 @@ namespace MediaBrowser.Providers.TV IndexNumber = episodeNumber, ParentIndexNumber = seasonNumber, Parent = season, - DisplayMediaType = typeof(Episode).Name, Id = (series.Id + seasonNumber.ToString(_usCulture) + name).GetMBId(typeof(Episode)) }; diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs index 3e50375536..a7e248ea46 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs @@ -1263,8 +1263,6 @@ namespace MediaBrowser.Server.Implementations.Channels var mediaSource = info.MediaSources.FirstOrDefault(); item.Path = mediaSource == null ? null : mediaSource.Path; - - item.DisplayMediaType = channelMediaItem.ContentType.ToString(); } if (isNew) diff --git a/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs b/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs index 28f3ed89cf..d92db34e33 100644 --- a/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs +++ b/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs @@ -69,7 +69,6 @@ namespace MediaBrowser.Server.Implementations.Collections { Name = name, Parent = parentFolder, - DisplayMediaType = "Collection", Path = path, IsLocked = options.IsLocked, ProviderIds = options.ProviderIds, diff --git a/MediaBrowser.Server.Implementations/Devices/CameraUploadsFolder.cs b/MediaBrowser.Server.Implementations/Devices/CameraUploadsFolder.cs index 10fc2ad911..2fe5d8f742 100644 --- a/MediaBrowser.Server.Implementations/Devices/CameraUploadsFolder.cs +++ b/MediaBrowser.Server.Implementations/Devices/CameraUploadsFolder.cs @@ -10,7 +10,6 @@ namespace MediaBrowser.Server.Implementations.Devices public CameraUploadsFolder() { Name = "Camera Uploads"; - DisplayMediaType = "CollectionFolder"; } public override bool IsVisible(User user) diff --git a/MediaBrowser.Server.Implementations/FileOrganization/OrganizerScheduledTask.cs b/MediaBrowser.Server.Implementations/FileOrganization/OrganizerScheduledTask.cs index 8dfdfdaece..74b994c28f 100644 --- a/MediaBrowser.Server.Implementations/FileOrganization/OrganizerScheduledTask.cs +++ b/MediaBrowser.Server.Implementations/FileOrganization/OrganizerScheduledTask.cs @@ -13,7 +13,7 @@ using System.Threading.Tasks; namespace MediaBrowser.Server.Implementations.FileOrganization { - public class OrganizerScheduledTask : IScheduledTask, IConfigurableScheduledTask, IScheduledTaskActivityLog + public class OrganizerScheduledTask : IScheduledTask, IConfigurableScheduledTask, IScheduledTaskActivityLog, IHasKey { private readonly ILibraryMonitor _libraryMonitor; private readonly ILibraryManager _libraryManager; @@ -82,5 +82,10 @@ namespace MediaBrowser.Server.Implementations.FileOrganization { get { return false; } } + + public string Key + { + get { return "AutoOrganize"; } + } } } diff --git a/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs b/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs index 03e28d7ba1..b6a93408ad 100644 --- a/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs +++ b/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs @@ -39,12 +39,6 @@ namespace MediaBrowser.Server.Implementations.Library item.Id = libraryManager.GetNewItemId(item.Path, item.GetType()); - // If the resolver didn't specify this - if (string.IsNullOrEmpty(item.DisplayMediaType)) - { - item.DisplayMediaType = item.GetType().Name; - } - item.IsLocked = item.Path.IndexOf("[dontfetchmeta]", StringComparison.OrdinalIgnoreCase) != -1 || item.Parents.Any(i => i.IsLocked); @@ -79,12 +73,6 @@ namespace MediaBrowser.Server.Implementations.Library item.Id = libraryManager.GetNewItemId(item.Path, item.GetType()); - // If the resolver didn't specify this - if (string.IsNullOrEmpty(item.DisplayMediaType)) - { - item.DisplayMediaType = item.GetType().Name; - } - // Make sure the item has a name EnsureName(item, args.FileInfo); diff --git a/MediaBrowser.Server.Implementations/Library/UserManager.cs b/MediaBrowser.Server.Implementations/Library/UserManager.cs index 3d64326363..3020a224de 100644 --- a/MediaBrowser.Server.Implementations/Library/UserManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserManager.cs @@ -411,6 +411,7 @@ namespace MediaBrowser.Server.Implementations.Library catch { user.Policy.EnabledFolders = new string[] { }; + user.Policy.EnableAllFolders = true; } } else @@ -419,6 +420,12 @@ namespace MediaBrowser.Server.Implementations.Library user.Policy.EnabledFolders = new string[] { }; } + // Just to be safe + if (user.Policy.EnabledFolders.Length == 0) + { + user.Policy.EnableAllFolders = true; + } + user.Policy.BlockedMediaFolders = null; await UpdateUserPolicy(user, user.Policy, false); diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json index ccba2e6979..3c44adc60b 100644 --- a/MediaBrowser.Server.Implementations/Localization/Server/server.json +++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json @@ -46,6 +46,8 @@ "OptionEnableWebClientResourceMinification": "Enable web client resource minification", "LabelDashboardSourcePath": "Web client source path:", "LabelDashboardSourcePathHelp": "If running the server from source, specify the path to the dashboard-ui folder. All web client files will be served from this location.", + "ButtonConvertMedia": "Convert media", + "ButtonOrganizeNow": "Organize now", "ButtonOk": "Ok", "ButtonCancel": "Cancel", "ButtonNew": "New", diff --git a/MediaBrowser.Server.Implementations/Sync/SyncScheduledTask.cs b/MediaBrowser.Server.Implementations/Sync/SyncScheduledTask.cs index 360cf54213..b68a97817b 100644 --- a/MediaBrowser.Server.Implementations/Sync/SyncScheduledTask.cs +++ b/MediaBrowser.Server.Implementations/Sync/SyncScheduledTask.cs @@ -13,7 +13,7 @@ using System.Threading.Tasks; namespace MediaBrowser.Server.Implementations.Sync { - public class SyncScheduledTask : IScheduledTask, IConfigurableScheduledTask + public class SyncScheduledTask : IScheduledTask, IConfigurableScheduledTask, IHasKey { private readonly ILibraryManager _libraryManager; private readonly ISyncRepository _syncRepo; @@ -42,7 +42,7 @@ namespace MediaBrowser.Server.Implementations.Sync public string Name { - get { return "Sync preparation"; } + get { return "Convert media"; } } public string Description @@ -54,7 +54,7 @@ namespace MediaBrowser.Server.Implementations.Sync { get { - return "Library"; + return "Sync"; } } @@ -82,5 +82,10 @@ namespace MediaBrowser.Server.Implementations.Sync { get { return true; } } + + public string Key + { + get { return "SyncPrepare"; } + } } }