From a2ae2630bbc8a8eb16e443698aa05367b4e71daa Mon Sep 17 00:00:00 2001 From: Eric Reed Date: Thu, 14 Mar 2013 13:16:07 -0400 Subject: [PATCH 1/5] Need to delay building of IRequiresRegistration until other parts are registered. --- .../Security/PluginSecurityManager.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs b/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs index c345e122f3..6ac4d2d5d2 100644 --- a/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs +++ b/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs @@ -47,6 +47,13 @@ namespace MediaBrowser.Common.Implementations.Security private IJsonSerializer _jsonSerializer; private IApplicationHost _appHost; private IEnumerable _registeredEntities; + protected IEnumerable RegisteredEntities + { + get + { + return _registeredEntities ?? (_registeredEntities = _appHost.GetExports()); + } + } /// /// Initializes a new instance of the class. @@ -61,7 +68,6 @@ namespace MediaBrowser.Common.Implementations.Security _appHost = appHost; _httpClient = httpClient; _jsonSerializer = jsonSerializer; - _registeredEntities = _appHost.GetExports(); MBRegistration.Init(appPaths); } @@ -74,7 +80,7 @@ namespace MediaBrowser.Common.Implementations.Security var tasks = new List(); ResetSupporterInfo(); - tasks.AddRange(_registeredEntities.Select(i => i.LoadRegistrationInfoAsync())); + tasks.AddRange(RegisteredEntities.Select(i => i.LoadRegistrationInfoAsync())); await Task.WhenAll(tasks); } From e821d82ac2615ae708b1c54d3fcf606f13f28b33 Mon Sep 17 00:00:00 2001 From: Eric Reed Date: Thu, 14 Mar 2013 14:14:12 -0400 Subject: [PATCH 2/5] fix #57 --- MediaBrowser.WebDashboard/Html/scripts/AddPluginPage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.WebDashboard/Html/scripts/AddPluginPage.js b/MediaBrowser.WebDashboard/Html/scripts/AddPluginPage.js index 8b45747bbf..24f7581e9c 100644 --- a/MediaBrowser.WebDashboard/Html/scripts/AddPluginPage.js +++ b/MediaBrowser.WebDashboard/Html/scripts/AddPluginPage.js @@ -52,8 +52,8 @@ if (new Date(pkg.expDate).getTime() < new Date(1970, 1, 1).getTime()) { regStatus += "This feature has no registration information"; } else { - if (pkg.expDate <= new Date().getTime()) { - regStatus += "The trial period for this feature has expired on this machine"; + if (new Date(pkg.expDate).getTime() <= new Date().getTime()) { + regStatus += "The trial period for this feature has expired"; } else { regStatus += "The trial period for this feature will expire in " + Math.round((new Date(pkg.expDate).getTime() - new Date().getTime()) / (86400000)) + " day(s)"; } From f3b367628a8a36ced1db3ae1660c8b68542d1458 Mon Sep 17 00:00:00 2001 From: Eric Reed Date: Thu, 14 Mar 2013 14:22:58 -0400 Subject: [PATCH 3/5] One more shot at #19 --- MediaBrowser.Common.Implementations/BaseApplicationHost.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs index 1789ab298b..40c91979db 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs +++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs @@ -500,14 +500,14 @@ namespace MediaBrowser.Common.Implementations if (ConfigurationManager.CommonConfiguration.RunAtStartup) { //Copy our shortut into the startup folder for this user - File.Copy(ProductShortcutPath, Environment.GetFolderPath(Environment.SpecialFolder.Startup), true); + File.Copy(ProductShortcutPath, Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup),Path.GetFileName(ProductShortcutPath) ?? "MBstartup.lnk"), true); } else { //Remove our shortcut from the startup folder for this user try { - File.Delete(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), Path.GetFileName(ProductShortcutPath))); + File.Delete(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), Path.GetFileName(ProductShortcutPath) ?? "MBstartup.lnk")); } catch (FileNotFoundException) { From a82fc184d5e7f5aa0849f02f572bdb05b7b5d12c Mon Sep 17 00:00:00 2001 From: Eric Reed Date: Thu, 14 Mar 2013 15:31:52 -0400 Subject: [PATCH 4/5] Fix exception in LastfmBaseProvider.cs --- MediaBrowser.Controller/Providers/Music/LastfmBaseProvider.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MediaBrowser.Controller/Providers/Music/LastfmBaseProvider.cs b/MediaBrowser.Controller/Providers/Music/LastfmBaseProvider.cs index 97bfa45703..ff4e66da0f 100644 --- a/MediaBrowser.Controller/Providers/Music/LastfmBaseProvider.cs +++ b/MediaBrowser.Controller/Providers/Music/LastfmBaseProvider.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Net; using MediaBrowser.Common.Net; +using MediaBrowser.Common.Extensions; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Entities; @@ -228,7 +229,8 @@ namespace MediaBrowser.Controller.Providers.Music cancellationToken.ThrowIfCancellationRequested(); - if (!ConfigurationManager.Configuration.SaveLocalMeta || !HasLocalMeta(item) || (force && !HasLocalMeta(item)) || (RefreshOnVersionChange && item.ProviderData[Id].ProviderVersion != ProviderVersion)) + var providerData = item.ProviderData.GetValueOrDefault(Id, new BaseProviderInfo { ProviderId = Id }); + if (!ConfigurationManager.Configuration.SaveLocalMeta || !HasLocalMeta(item) || (force && !HasLocalMeta(item)) || (RefreshOnVersionChange && providerData.ProviderVersion != ProviderVersion)) { try { From 0ce5fc7799cd4d234d953243d664cc35e7c65eab Mon Sep 17 00:00:00 2001 From: Eric Reed Date: Thu, 14 Mar 2013 15:44:08 -0400 Subject: [PATCH 5/5] Try not saving virtual folders in repository --- MediaBrowser.Controller/Entities/Folder.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index ef34742df4..b46447f5a6 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -699,9 +699,9 @@ namespace MediaBrowser.Controller.Entities await Task.WhenAll(saveTasks).ConfigureAwait(false); - //and save children in repo... + //and save children in repo... but never save virtual plugin folders as they will always be re-created by the plugin Logger.Info("*** Saving " + newChildren.Count + " children for " + Name); - await Kernel.Instance.ItemRepository.SaveChildren(Id, newChildren, CancellationToken.None).ConfigureAwait(false); + await Kernel.Instance.ItemRepository.SaveChildren(Id, newChildren.Where(c => !(c is BasePluginFolder)), CancellationToken.None).ConfigureAwait(false); } if (changedArgs.HasChange)