Remove image move code

This commit is contained in:
Zoe Roux 2024-04-21 13:41:25 +02:00
parent d872e66f7d
commit b904f25d33
No known key found for this signature in database

View File

@ -17,7 +17,6 @@
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
using System;
using System.IO;
using Kyoo.Authentication;
using Kyoo.Core;
using Kyoo.Core.Extensions;
@ -93,42 +92,6 @@ app.UseRouting();
app.UseAuthentication();
app.MapControllers();
// TODO: wait 4.5.0 and delete this
static void MoveAll(DirectoryInfo source, DirectoryInfo target)
{
if (source.FullName == target.FullName)
return;
Directory.CreateDirectory(target.FullName);
foreach (FileInfo fi in source.GetFiles())
fi.MoveTo(Path.Combine(target.ToString(), fi.Name), true);
foreach (DirectoryInfo diSourceSubDir in source.GetDirectories())
{
DirectoryInfo nextTargetSubDir = target.CreateSubdirectory(diSourceSubDir.Name);
MoveAll(diSourceSubDir, nextTargetSubDir);
}
Directory.Delete(source.FullName);
}
try
{
string oldDir = "/kyoo/kyoo_datadir/metadata";
if (Path.Exists(oldDir))
{
MoveAll(new DirectoryInfo(oldDir), new DirectoryInfo("/metadata"));
Log.Warning("Old metadata directory migrated.");
}
}
catch (Exception ex)
{
Log.Fatal(
ex,
"Unhandled error while trying to migrate old metadata images to new directory. Giving up and continuing normal startup."
);
}
// Activate services that always run in the background
app.Services.GetRequiredService<MeiliSync>();
app.Services.GetRequiredService<RabbitProducer>();