mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-13 19:20:23 +01:00
fixes #945 - Add genre views to dlna
This commit is contained in:
@@ -82,6 +82,7 @@ using MediaBrowser.Server.Implementations.Sync;
|
||||
using MediaBrowser.Server.Implementations.Themes;
|
||||
using MediaBrowser.Server.Implementations.TV;
|
||||
using MediaBrowser.Server.Startup.Common.FFMpeg;
|
||||
using MediaBrowser.Server.Startup.Common.Migrations;
|
||||
using MediaBrowser.WebDashboard.Api;
|
||||
using MediaBrowser.XbmcMetadata.Providers;
|
||||
using System;
|
||||
@@ -322,84 +323,10 @@ namespace MediaBrowser.Server.Startup.Common
|
||||
|
||||
private void PerformVersionMigration()
|
||||
{
|
||||
DeleteDeprecatedModules();
|
||||
|
||||
if (!ServerConfigurationManager.Configuration.PlaylistImagesDeleted)
|
||||
{
|
||||
DeletePlaylistImages();
|
||||
ServerConfigurationManager.Configuration.PlaylistImagesDeleted = true;
|
||||
ServerConfigurationManager.SaveConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
private void DeletePlaylistImages()
|
||||
{
|
||||
try
|
||||
{
|
||||
var path = Path.Combine(ApplicationPaths.DataPath, "playlists");
|
||||
|
||||
var files = Directory.GetFiles(path, "*", SearchOption.AllDirectories)
|
||||
.Where(i => BaseItem.SupportedImageExtensions.Contains(Path.GetExtension(i) ?? string.Empty))
|
||||
.ToList();
|
||||
|
||||
foreach (var file in files)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(file);
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteDeprecatedModules()
|
||||
{
|
||||
try
|
||||
{
|
||||
MigrateUserFolders();
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
File.Delete(Path.Combine(ApplicationPaths.PluginsPath, "MBPhoto.dll"));
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
// Not there, no big deal
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
File.Delete(Path.Combine(ApplicationPaths.PluginsPath, "MediaBrowser.Plugins.XbmcMetadata.dll"));
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
// Not there, no big deal
|
||||
}
|
||||
}
|
||||
|
||||
private void MigrateUserFolders()
|
||||
{
|
||||
var rootPath = ApplicationPaths.RootFolderPath;
|
||||
|
||||
var folders = new DirectoryInfo(rootPath).EnumerateDirectories("*", SearchOption.TopDirectoryOnly).Where(i => !string.Equals(i.Name, "default", StringComparison.OrdinalIgnoreCase))
|
||||
.ToList();
|
||||
|
||||
foreach (var folder in folders)
|
||||
{
|
||||
Directory.Delete(folder.FullName, true);
|
||||
}
|
||||
new MigrateUserFolders(ApplicationPaths).Run();
|
||||
new PlaylistImages(ServerConfigurationManager).Run();
|
||||
new RenameXbmcOptions(ServerConfigurationManager).Run();
|
||||
new RenameXmlOptions(ServerConfigurationManager).Run();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -60,6 +60,11 @@
|
||||
<Compile Include="FFMpeg\FFMpegDownloadInfo.cs" />
|
||||
<Compile Include="FFMpeg\FFMpegInfo.cs" />
|
||||
<Compile Include="INativeApp.cs" />
|
||||
<Compile Include="Migrations\IVersionMigration.cs" />
|
||||
<Compile Include="Migrations\MigrateUserFolders.cs" />
|
||||
<Compile Include="Migrations\PlaylistImages.cs" />
|
||||
<Compile Include="Migrations\RenameXbmcOptions.cs" />
|
||||
<Compile Include="Migrations\RenameXmlOptions.cs" />
|
||||
<Compile Include="NativeEnvironment.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="StartupOptions.cs" />
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
namespace MediaBrowser.Server.Startup.Common.Migrations
|
||||
{
|
||||
public interface IVersionMigration
|
||||
{
|
||||
void Run();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using MediaBrowser.Controller;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Server.Startup.Common.Migrations
|
||||
{
|
||||
public class MigrateUserFolders : IVersionMigration
|
||||
{
|
||||
private readonly IServerApplicationPaths _appPaths;
|
||||
|
||||
public MigrateUserFolders(IServerApplicationPaths appPaths)
|
||||
{
|
||||
_appPaths = appPaths;
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
try
|
||||
{
|
||||
var rootPath = _appPaths.RootFolderPath;
|
||||
|
||||
var folders = new DirectoryInfo(rootPath).EnumerateDirectories("*", SearchOption.TopDirectoryOnly).Where(i => !string.Equals(i.Name, "default", StringComparison.OrdinalIgnoreCase))
|
||||
.ToList();
|
||||
|
||||
foreach (var folder in folders)
|
||||
{
|
||||
Directory.Delete(folder.FullName, true);
|
||||
}
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Server.Startup.Common.Migrations
|
||||
{
|
||||
public class PlaylistImages : IVersionMigration
|
||||
{
|
||||
private readonly IServerConfigurationManager _config;
|
||||
|
||||
public PlaylistImages(IServerConfigurationManager config)
|
||||
{
|
||||
_config = config;
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
if (!_config.Configuration.PlaylistImagesDeleted)
|
||||
{
|
||||
DeletePlaylistImages();
|
||||
_config.Configuration.PlaylistImagesDeleted = true;
|
||||
_config.SaveConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
private void DeletePlaylistImages()
|
||||
{
|
||||
try
|
||||
{
|
||||
var path = Path.Combine(_config.ApplicationPaths.DataPath, "playlists");
|
||||
|
||||
var files = Directory.GetFiles(path, "*", SearchOption.AllDirectories)
|
||||
.Where(i => BaseItem.SupportedImageExtensions.Contains(Path.GetExtension(i) ?? string.Empty))
|
||||
.ToList();
|
||||
|
||||
foreach (var file in files)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(file);
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Server.Startup.Common.Migrations
|
||||
{
|
||||
public class RenameXbmcOptions
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Server.Startup.Common.Migrations
|
||||
{
|
||||
public class RenameXmlOptions
|
||||
{
|
||||
private readonly IServerConfigurationManager _config;
|
||||
|
||||
public RenameXmlOptions(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], "Media Browser Xml", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
options[i] = "Media Browser Legacy Xml";
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user