update chapters

This commit is contained in:
Luke Pulverenti
2015-10-13 12:52:27 -04:00
parent 61e6dd9b2f
commit 21c9f6e75e
10 changed files with 204 additions and 509 deletions

View File

@@ -351,11 +351,7 @@ namespace MediaBrowser.Server.Startup.Common
{
var migrations = new List<IVersionMigration>
{
new MigrateUserFolders(ApplicationPaths, FileSystemManager),
new RenameXbmcOptions(ServerConfigurationManager),
new RenameXmlOptions(ServerConfigurationManager),
new DeprecatePlugins(ApplicationPaths, FileSystemManager),
new DeleteDlnaProfiles(ApplicationPaths, FileSystemManager)
new RenameXmlOptions(ServerConfigurationManager)
};
foreach (var task in migrations)

View File

@@ -71,11 +71,7 @@
<Compile Include="FFMpeg\FFmpegValidator.cs" />
<Compile Include="INativeApp.cs" />
<Compile Include="MbLinkShortcutHandler.cs" />
<Compile Include="Migrations\DeleteDlnaProfiles.cs" />
<Compile Include="Migrations\DeprecatePlugins.cs" />
<Compile Include="Migrations\IVersionMigration.cs" />
<Compile Include="Migrations\MigrateUserFolders.cs" />
<Compile Include="Migrations\RenameXbmcOptions.cs" />
<Compile Include="Migrations\RenameXmlOptions.cs" />
<Compile Include="NativeEnvironment.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />

View File

@@ -1,46 +0,0 @@
using MediaBrowser.Common.IO;
using MediaBrowser.Controller;
using System.IO;
using CommonIO;
namespace MediaBrowser.Server.Startup.Common.Migrations
{
public class DeleteDlnaProfiles : IVersionMigration
{
private readonly IServerApplicationPaths _appPaths;
private readonly IFileSystem _fileSystem;
public DeleteDlnaProfiles(IServerApplicationPaths appPaths, IFileSystem fileSystem)
{
_appPaths = appPaths;
_fileSystem = fileSystem;
}
public void Run()
{
RemoveProfile("Android");
RemoveProfile("Windows Phone");
RemoveProfile("Windows 8 RT");
}
private void RemoveProfile(string filename)
{
try
{
_fileSystem.DeleteFile(Path.Combine(_appPaths.ConfigurationDirectoryPath, "dlna", "system", filename + ".xml"));
}
catch
{
}
try
{
_fileSystem.DeleteFile(Path.Combine(_appPaths.ConfigurationDirectoryPath, "dlna", "user", filename + ".xml"));
}
catch
{
}
}
}
}

View File

@@ -1,36 +0,0 @@
using MediaBrowser.Common.IO;
using MediaBrowser.Controller;
using System.IO;
using CommonIO;
namespace MediaBrowser.Server.Startup.Common.Migrations
{
public class DeprecatePlugins : IVersionMigration
{
private readonly IServerApplicationPaths _appPaths;
private readonly IFileSystem _fileSystem;
public DeprecatePlugins(IServerApplicationPaths appPaths, IFileSystem fileSystem)
{
_appPaths = appPaths;
_fileSystem = fileSystem;
}
public void Run()
{
RemovePlugin("MediaBrowser.Plugins.LocalTrailers.dll");
}
private void RemovePlugin(string filename)
{
try
{
_fileSystem.DeleteFile(Path.Combine(_appPaths.PluginsPath, filename));
}
catch
{
}
}
}
}

View File

@@ -1,41 +0,0 @@
using MediaBrowser.Common.IO;
using MediaBrowser.Controller;
using System;
using System.IO;
using System.Linq;
using CommonIO;
namespace MediaBrowser.Server.Startup.Common.Migrations
{
public class MigrateUserFolders : IVersionMigration
{
private readonly IServerApplicationPaths _appPaths;
private readonly IFileSystem _fileSystem;
public MigrateUserFolders(IServerApplicationPaths appPaths, IFileSystem fileSystem)
{
_appPaths = appPaths;
_fileSystem = fileSystem;
}
public void Run()
{
try
{
var rootPath = _appPaths.RootFolderPath;
var folders = _fileSystem.GetDirectories(rootPath)
.Where(i => !string.Equals(i.Name, "default", StringComparison.OrdinalIgnoreCase))
.ToList();
foreach (var folder in folders)
{
_fileSystem.DeleteDirectory(folder.FullName, true);
}
}
catch (IOException)
{
}
}
}
}

View File

@@ -1,56 +0,0 @@
using MediaBrowser.Controller.Configuration;
using System;
namespace MediaBrowser.Server.Startup.Common.Migrations
{
public class RenameXbmcOptions : IVersionMigration
{
private readonly IServerConfigurationManager _config;
public RenameXbmcOptions(IServerConfigurationManager config)
{
_config = config;
}
public void Run()
{
var changed = false;
foreach (var option in _config.Configuration.MetadataOptions)
{
if (Migrate(option.DisabledMetadataSavers))
{
changed = true;
}
if (Migrate(option.LocalMetadataReaderOrder))
{
changed = true;
}
}
if (changed)
{
_config.SaveConfiguration();
}
}
private bool Migrate(string[] options)
{
var changed = false;
if (options != null)
{
for (var i = 0; i < options.Length; i++)
{
if (string.Equals(options[i], "Xbmc Nfo", StringComparison.OrdinalIgnoreCase))
{
options[i] = "Nfo";
changed = true;
}
}
}
return changed;
}
}
}