feat: make setup wizard copy a generic album image to music library path

This commit is contained in:
2026-01-27 06:50:32 +01:00
parent 0083539bac
commit 17b8bafccd
2 changed files with 26 additions and 3 deletions

BIN
Assets/vinyl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View File

@@ -154,7 +154,8 @@ public class Cli
{ {
Name = username!, Name = username!,
NormalizedName = username!.ToLower(), NormalizedName = username!.ToLower(),
Password = password Password = password,
Role = isUserAdmin ? 0 : 1 // 0 = admin
}; };
db.Users.Add(newUser); db.Users.Add(newUser);
@@ -218,9 +219,9 @@ public class Cli
Console.WriteLine($"[Shadow] Remove user"); Console.WriteLine($"[Shadow] Remove user");
if (args.Length == 2) if (args.Length == 2)
Console.WriteLine($" You will be promped to enter the password."); Console.WriteLine($" You will be prompted to enter the password.");
else else
Console.WriteLine($" You will be promped to enter the username and password."); Console.WriteLine($" You will be prompted to enter the username and password.");
string? username = null; string? username = null;
if (args.Length != 2) if (args.Length != 2)
@@ -339,6 +340,28 @@ public class Cli
System.IO.Directory.CreateDirectory(newMusicLibraryPath); System.IO.Directory.CreateDirectory(newMusicLibraryPath);
System.IO.Directory.CreateDirectory(newMusicThumbnailPath); System.IO.Directory.CreateDirectory(newMusicThumbnailPath);
// Try to find the Assets directory automatically
string currentPath = AppContext.BaseDirectory;
for (int i = 0; i < 5; i++)
{
if (Directory.GetFiles(currentPath, "Shadow.slnx")
.FirstOrDefault() != null)
{
File.Copy(
Path.Combine(currentPath, "Assets", "vinyl.png"),
Path.Combine(newMusicThumbnailPath, "default.png")
);
break;
}
currentPath = Path.Combine(currentPath, "..");
if (i == 5) Console.WriteLine("\n" +
"Error: Could not determine content root path. \n" +
"Please place Assets/vinyl.png in your thumbnail path directory manually\n" +
"and rename it to default.png.");
}
// UpdateRange can both Add and Update rows. // UpdateRange can both Add and Update rows.
db.Globals.UpdateRange(musicLibraryPath, musicThumbnailPath); db.Globals.UpdateRange(musicLibraryPath, musicThumbnailPath);
db.SaveChanges(); db.SaveChanges();