aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.ServerApplication
diff options
context:
space:
mode:
authorStephen <snazy2000@btinternet.com>2014-06-30 06:20:24 +0100
committerStephen <snazy2000@btinternet.com>2014-06-30 06:20:24 +0100
commit2a9e4778124de3103bd4a50f806a3694b57d3c6a (patch)
tree0275788f3b9706b26441edf48a0b4975cc02ee5d /MediaBrowser.ServerApplication
parent608ebf4829e7e394170bb2dec8a33c83600e9c08 (diff)
parent62d98551edf421ba50f2eadf95d6c3d1fb1d20ae (diff)
Merge pull request #1 from MediaBrowser/master
update
Diffstat (limited to 'MediaBrowser.ServerApplication')
-rw-r--r--MediaBrowser.ServerApplication/ApplicationHost.cs125
-rw-r--r--MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj8
2 files changed, 129 insertions, 4 deletions
diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs
index d03c5fe3dc..5c84b92af5 100644
--- a/MediaBrowser.ServerApplication/ApplicationHost.cs
+++ b/MediaBrowser.ServerApplication/ApplicationHost.cs
@@ -17,6 +17,9 @@ using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities.Audio;
+using MediaBrowser.Controller.Entities.Movies;
+using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.FileOrganization;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.LiveTv;
@@ -38,9 +41,11 @@ using MediaBrowser.Dlna;
using MediaBrowser.Dlna.ConnectionManager;
using MediaBrowser.Dlna.ContentDirectory;
using MediaBrowser.Dlna.Main;
+using MediaBrowser.LocalMetadata.Providers;
using MediaBrowser.MediaEncoding.BdInfo;
using MediaBrowser.MediaEncoding.Encoder;
using MediaBrowser.MediaEncoding.Subtitles;
+using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.System;
@@ -75,6 +80,7 @@ using MediaBrowser.ServerApplication.IO;
using MediaBrowser.ServerApplication.Native;
using MediaBrowser.ServerApplication.Networking;
using MediaBrowser.WebDashboard.Api;
+using MediaBrowser.XbmcMetadata.Providers;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -273,11 +279,105 @@ namespace MediaBrowser.ServerApplication
public override Task Init(IProgress<double> progress)
{
- DeleteDeprecatedModules();
+ PerformVersionMigration();
return base.Init(progress);
}
+ private void PerformVersionMigration()
+ {
+ DeleteDeprecatedModules();
+
+ MigrateModularConfigurations();
+ ApplyDefaultMetadataSettings();
+ }
+
+ private void MigrateModularConfigurations()
+ {
+ var saveConfig = false;
+
+ if (ServerConfigurationManager.Configuration.DlnaOptions != null)
+ {
+ ServerConfigurationManager.SaveConfiguration("dlna", ServerConfigurationManager.Configuration.DlnaOptions);
+ ServerConfigurationManager.Configuration.DlnaOptions = null;
+ saveConfig = true;
+ }
+
+ if (ServerConfigurationManager.Configuration.ChapterOptions != null)
+ {
+ ServerConfigurationManager.SaveConfiguration("chapters", ServerConfigurationManager.Configuration.ChapterOptions);
+ ServerConfigurationManager.Configuration.ChapterOptions = null;
+ saveConfig = true;
+ }
+
+ if (saveConfig)
+ {
+ ServerConfigurationManager.SaveConfiguration();
+ }
+ }
+
+ private void ApplyDefaultMetadataSettings()
+ {
+ if (!ServerConfigurationManager.Configuration.DefaultMetadataSettingsApplied)
+ {
+ // Make sure xbmc metadata is disabled for existing users.
+ // New users can just take the defaults.
+ var service = ServerConfigurationManager.Configuration.IsStartupWizardCompleted
+ ? "Xbmc Nfo"
+ : "Media Browser Xml";
+
+ DisableMetadataService(typeof(Movie), ServerConfigurationManager.Configuration, service);
+ DisableMetadataService(typeof(MusicAlbum), ServerConfigurationManager.Configuration, service);
+ DisableMetadataService(typeof(MusicArtist), ServerConfigurationManager.Configuration, service);
+ DisableMetadataService(typeof(Episode), ServerConfigurationManager.Configuration, service);
+ DisableMetadataService(typeof(Season), ServerConfigurationManager.Configuration, service);
+ DisableMetadataService(typeof(Series), ServerConfigurationManager.Configuration, service);
+ DisableMetadataService(typeof(MusicVideo), ServerConfigurationManager.Configuration, service);
+ DisableMetadataService(typeof(Trailer), ServerConfigurationManager.Configuration, service);
+ DisableMetadataService(typeof(AdultVideo), ServerConfigurationManager.Configuration, service);
+ DisableMetadataService(typeof(Video), ServerConfigurationManager.Configuration, service);
+ }
+
+ ServerConfigurationManager.Configuration.DefaultMetadataSettingsApplied = true;
+ ServerConfigurationManager.SaveConfiguration();
+ }
+
+ private void DisableMetadataService(Type type, ServerConfiguration config, string service)
+ {
+ var options = GetMetadataOptions(type, config);
+
+ if (!options.DisabledMetadataSavers.Contains(service, StringComparer.OrdinalIgnoreCase))
+ {
+ var list = options.DisabledMetadataSavers.ToList();
+
+ list.Add(service);
+
+ options.DisabledMetadataSavers = list.ToArray();
+ }
+ }
+
+ private MetadataOptions GetMetadataOptions(Type type, ServerConfiguration config)
+ {
+ var options = config.MetadataOptions
+ .FirstOrDefault(i => string.Equals(i.ItemType, type.Name, StringComparison.OrdinalIgnoreCase));
+
+ if (options == null)
+ {
+ var list = config.MetadataOptions.ToList();
+
+ options = new MetadataOptions
+ {
+ ItemType = type.Name
+ };
+
+ list.Add(options);
+
+ config.MetadataOptions = list.ToArray();
+ }
+
+ return options;
+ }
+
private void DeleteDeprecatedModules()
{
try
@@ -297,6 +397,15 @@ namespace MediaBrowser.ServerApplication
// Not there, no big deal
}
+ try
+ {
+ File.Delete(Path.Combine(ApplicationPaths.PluginsPath, "MediaBrowser.Plugins.XbmcMetadata.dll"));
+ }
+ catch (IOException)
+ {
+ // Not there, no big deal
+ }
+
Task.Run(() =>
{
try
@@ -881,6 +990,12 @@ namespace MediaBrowser.ServerApplication
// Dlna
list.Add(typeof(DlnaEntryPoint).Assembly);
+ // Local metadata
+ list.Add(typeof(AlbumXmlProvider).Assembly);
+
+ // Xbmc
+ list.Add(typeof(ArtistNfoProvider).Assembly);
+
list.AddRange(Assemblies.GetAssembliesWithParts());
// Include composable parts in the running assembly
@@ -1063,10 +1178,12 @@ namespace MediaBrowser.ServerApplication
var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, "MBServer", null, ApplicationVersion,
ConfigurationManager.CommonConfiguration.SystemUpdateLevel);
- HasUpdateAvailable = version != null && version.version >= ApplicationVersion;
+ var versionObject = version == null || string.IsNullOrWhiteSpace(version.versionStr) ? null : new Version(version.versionStr);
+
+ HasUpdateAvailable = versionObject != null && versionObject >= ApplicationVersion;
- return version != null ? new CheckForUpdateResult { AvailableVersion = version.version, IsUpdateAvailable = version.version > ApplicationVersion, Package = version } :
- new CheckForUpdateResult { AvailableVersion = ApplicationVersion, IsUpdateAvailable = false };
+ return versionObject != null ? new CheckForUpdateResult { AvailableVersion = versionObject.ToString(), IsUpdateAvailable = versionObject > ApplicationVersion, Package = version } :
+ new CheckForUpdateResult { AvailableVersion = ApplicationVersion.ToString(), IsUpdateAvailable = false };
}
/// <summary>
diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
index 7657fc091e..fee2081cf5 100644
--- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
+++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj
@@ -198,6 +198,10 @@
<Project>{734098eb-6dc1-4dd0-a1ca-3140dcd2737c}</Project>
<Name>MediaBrowser.Dlna</Name>
</ProjectReference>
+ <ProjectReference Include="..\MediaBrowser.LocalMetadata\MediaBrowser.LocalMetadata.csproj">
+ <Project>{7ef9f3e0-697d-42f3-a08f-19deb5f84392}</Project>
+ <Name>MediaBrowser.LocalMetadata</Name>
+ </ProjectReference>
<ProjectReference Include="..\MediaBrowser.MediaEncoding\MediaBrowser.MediaEncoding.csproj">
<Project>{0bd82fa6-eb8a-4452-8af5-74f9c3849451}</Project>
<Name>MediaBrowser.MediaEncoding</Name>
@@ -218,6 +222,10 @@
<Project>{5624b7b5-b5a7-41d8-9f10-cc5611109619}</Project>
<Name>MediaBrowser.WebDashboard</Name>
</ProjectReference>
+ <ProjectReference Include="..\MediaBrowser.XbmcMetadata\MediaBrowser.XbmcMetadata.csproj">
+ <Project>{23499896-b135-4527-8574-c26e926ea99e}</Project>
+ <Name>MediaBrowser.XbmcMetadata</Name>
+ </ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />