feat: make setup wizard copy a generic album image to music library path
This commit is contained in:
29
Tools/Cli.cs
29
Tools/Cli.cs
@@ -154,7 +154,8 @@ public class Cli
|
||||
{
|
||||
Name = username!,
|
||||
NormalizedName = username!.ToLower(),
|
||||
Password = password
|
||||
Password = password,
|
||||
Role = isUserAdmin ? 0 : 1 // 0 = admin
|
||||
};
|
||||
|
||||
db.Users.Add(newUser);
|
||||
@@ -218,9 +219,9 @@ public class Cli
|
||||
|
||||
Console.WriteLine($"[Shadow] Remove user");
|
||||
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
|
||||
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;
|
||||
if (args.Length != 2)
|
||||
@@ -339,6 +340,28 @@ public class Cli
|
||||
System.IO.Directory.CreateDirectory(newMusicLibraryPath);
|
||||
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.
|
||||
db.Globals.UpdateRange(musicLibraryPath, musicThumbnailPath);
|
||||
db.SaveChanges();
|
||||
|
||||
Reference in New Issue
Block a user