WIP: database class.
- 修正disk拼写 - 为测试项目添加dylib引用 - 修复无法打开数据库的问题 - 为Deepseek TUI更新Agents.md
This commit is contained in:
@@ -139,7 +139,7 @@ public class AudioFileMeta
|
||||
/// <summary>CD标题,原始CD专辑名称</summary>
|
||||
public string? CdTitle { get; set; }
|
||||
|
||||
public int? DiscNumber { get; set; }
|
||||
public int? DiskNumber { get; set; }
|
||||
|
||||
/// <summary>曲目标题,音乐或音轨的标题</summary>
|
||||
public string? TrackTitle { get; set; }
|
||||
|
||||
@@ -54,7 +54,7 @@ public class AudioMetadataReader
|
||||
Composer = track.Composer,
|
||||
Copyright = track.Copyright,
|
||||
Description = track.Comment,
|
||||
DiscNumber = track.DiscNumber,
|
||||
DiskNumber = track.DiscNumber,
|
||||
FxName = GetField(track, "ixml.USER.FXNAME"),
|
||||
Genre = track.Genre,
|
||||
Group = track.Group,
|
||||
|
||||
@@ -22,7 +22,7 @@ public static class Database
|
||||
/// </summary>
|
||||
public static void InitializeDatabase(string databaseName = "default")
|
||||
{
|
||||
using var connection = GetConnection();
|
||||
using var connection = GetConnection(databaseName);
|
||||
connection.Open();
|
||||
|
||||
const string sql = """
|
||||
@@ -143,7 +143,7 @@ public static class Database
|
||||
release_date, track_year, is_edited, is_split, location, [group],
|
||||
markers, comments, notes, copyright, coding_history, microphone,
|
||||
mic_perspective,
|
||||
fx_name, channel_layout, bwf_umid, disc_number, track_number, artwork, waveform,
|
||||
fx_name, channel_layout, bwf_umid, disk_number, track_number, artwork, waveform,
|
||||
user1, user2, user3, user4, user5, user6, user7, user8
|
||||
) VALUES (
|
||||
@UniqueId, @ShortId, @Md5, @Path, @Filename, @Folder, @Directory,
|
||||
@@ -157,7 +157,7 @@ public static class Database
|
||||
@ReleaseDate, @TrackYear, @IsEdited, @IsSplit, @Location, @Group,
|
||||
@Markers, @Comments, @Notes, @Copyright, @BwfCodingHistory, @Microphone,
|
||||
@MicPerspective,
|
||||
@FxName, @ChannelLayout, @BwfUmid, @DiscNumber, @TrackNumber, @Artwork, @Waveform,
|
||||
@FxName, @ChannelLayout, @BwfUmid, @DiskNumber, @TrackNumber, @Artwork, @Waveform,
|
||||
@User1, @User2, @User3, @User4, @User5, @User6, @User7, @User8
|
||||
);
|
||||
";
|
||||
@@ -198,7 +198,7 @@ public static class Database
|
||||
release_date, track_year, is_edited, is_split, location, [group],
|
||||
markers, comments, notes, copyright, coding_history, microphone,
|
||||
mic_perspective,
|
||||
fx_name, channel_layout, bwf_umid, disc_number, track_number, artwork, waveform,
|
||||
fx_name, channel_layout, bwf_umid, disk_number, track_number, artwork, waveform,
|
||||
user1, user2, user3, user4, user5, user6, user7, user8
|
||||
) VALUES (
|
||||
@UniqueId, @ShortId, @Md5, @Path, @Filename, @Folder, @Directory,
|
||||
@@ -212,7 +212,7 @@ public static class Database
|
||||
@ReleaseDate, @TrackYear, @IsEdited, @IsSplit, @Location, @Group,
|
||||
@Markers, @Comments, @Notes, @Copyright, @BwfCodingHistory, @Microphone,
|
||||
@MicPerspective,
|
||||
@FxName, @ChannelLayout, @BwfUmid, @DiscNumber, @TrackNumber, @Artwork, @Waveform,
|
||||
@FxName, @ChannelLayout, @BwfUmid, @DiskNumber, @TrackNumber, @Artwork, @Waveform,
|
||||
@User1, @User2, @User3, @User4, @User5, @User6, @User7, @User8
|
||||
);
|
||||
";
|
||||
|
||||
@@ -51,14 +51,18 @@ public static class PreferencesManager
|
||||
{
|
||||
if (OperatingSystem.IsMacOS())
|
||||
{
|
||||
string library = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||
return Path.Combine(library, "OCES", "Resonance", "Databases");
|
||||
string applicationSupport = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||
DirectoryInfo databasePath = new(Path.Combine(applicationSupport, "OCES", "Resonance", "Databases"));
|
||||
if (!databasePath.Exists) Directory.CreateDirectory(databasePath.FullName);
|
||||
return databasePath.FullName;
|
||||
}
|
||||
|
||||
if (OperatingSystem.IsWindows())
|
||||
{
|
||||
string localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||
return Path.Combine(localAppData, "OCES", "Resonance", "Databases");
|
||||
DirectoryInfo databasePath = new(Path.Combine(localAppData, "OCES", "Resonance", "Databases"));
|
||||
if (!databasePath.Exists) Directory.CreateDirectory(databasePath.FullName);
|
||||
return databasePath.FullName;
|
||||
}
|
||||
|
||||
if (OperatingSystem.IsLinux())
|
||||
@@ -66,7 +70,9 @@ public static class PreferencesManager
|
||||
string home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
string xdgDataHome = Environment.GetEnvironmentVariable("XDG_DATA_HOME")
|
||||
?? Path.Combine(home, ".local", "share");
|
||||
return Path.Combine(xdgDataHome, "Resonance", "Databases");
|
||||
DirectoryInfo databasePath = new(Path.Combine(xdgDataHome, "Resonance", "Databases"));
|
||||
if (!databasePath.Exists) Directory.CreateDirectory(databasePath.FullName);
|
||||
return databasePath.FullName;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
@@ -79,8 +85,8 @@ public static class PreferencesManager
|
||||
{
|
||||
if (OperatingSystem.IsMacOS())
|
||||
{
|
||||
string library = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||
return Path.Combine(library, "Preferences", "com.oces.Resonance.json");
|
||||
string home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
return Path.Combine(home, "Library", "Preferences", "com.oces.Resonance.json");
|
||||
}
|
||||
|
||||
if (OperatingSystem.IsWindows())
|
||||
|
||||
Reference in New Issue
Block a user