mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-16 05:53:03 +03:00
easier user library setup
This commit is contained in:
@@ -252,6 +252,14 @@ namespace MediaBrowser.ServerApplication
|
||||
|
||||
private void DeleteDeprecatedModules()
|
||||
{
|
||||
try
|
||||
{
|
||||
MigrateUserFolders();
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
File.Delete(Path.Combine(ApplicationPaths.PluginsPath, "MBPhoto.dll"));
|
||||
@@ -319,6 +327,35 @@ namespace MediaBrowser.ServerApplication
|
||||
});
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
MigrateUserFolder(folder);
|
||||
}
|
||||
}
|
||||
|
||||
private void MigrateUserFolder(DirectoryInfo folder)
|
||||
{
|
||||
var foldersInDefault = new DirectoryInfo(ApplicationPaths.DefaultUserViewsPath).EnumerateDirectories("*", SearchOption.TopDirectoryOnly).ToList();
|
||||
|
||||
var foldersInUserView = folder.EnumerateDirectories("*", SearchOption.TopDirectoryOnly).ToList();
|
||||
|
||||
var foldersToMove = foldersInUserView.Where(i => !foldersInDefault.Any(f => string.Equals(f.Name, i.Name, StringComparison.OrdinalIgnoreCase))).ToList();
|
||||
|
||||
foreach (var folderToMove in foldersToMove)
|
||||
{
|
||||
folderToMove.MoveTo(Path.Combine(ApplicationPaths.DefaultUserViewsPath, folderToMove.Name));
|
||||
}
|
||||
|
||||
Directory.Delete(folder.FullName, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers resources that classes will depend on
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user