From 8f3b07543f9d191ff600cbd0a1605d7661788e6b Mon Sep 17 00:00:00 2001 From: Brian Bicknell Date: Sun, 16 Feb 2025 15:27:21 -0500 Subject: [PATCH] Added initial models. --- Harmonia.Core/Class1.cs | 7 ------- Harmonia.Core/Models/GroupOption.cs | 6 ++++++ Harmonia.Core/Models/Playlist.cs | 11 +++++++++++ Harmonia.Core/Models/PlaylistSong.cs | 7 +++++++ Harmonia.Core/Models/Song.cs | 26 ++++++++++++++++++++++++++ Harmonia.Core/Models/SortOption.cs | 9 +++++++++ 6 files changed, 59 insertions(+), 7 deletions(-) delete mode 100644 Harmonia.Core/Class1.cs create mode 100644 Harmonia.Core/Models/GroupOption.cs create mode 100644 Harmonia.Core/Models/Playlist.cs create mode 100644 Harmonia.Core/Models/PlaylistSong.cs create mode 100644 Harmonia.Core/Models/Song.cs create mode 100644 Harmonia.Core/Models/SortOption.cs diff --git a/Harmonia.Core/Class1.cs b/Harmonia.Core/Class1.cs deleted file mode 100644 index 425f032..0000000 --- a/Harmonia.Core/Class1.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Harmonia.Core -{ - public class Class1 - { - - } -} diff --git a/Harmonia.Core/Models/GroupOption.cs b/Harmonia.Core/Models/GroupOption.cs new file mode 100644 index 0000000..4f313ac --- /dev/null +++ b/Harmonia.Core/Models/GroupOption.cs @@ -0,0 +1,6 @@ +namespace Harmonia.Core.Models; + +public class GroupOption(string fieldName) +{ + public string FieldName { get; init; } = fieldName; +} \ No newline at end of file diff --git a/Harmonia.Core/Models/Playlist.cs b/Harmonia.Core/Models/Playlist.cs new file mode 100644 index 0000000..a886b4f --- /dev/null +++ b/Harmonia.Core/Models/Playlist.cs @@ -0,0 +1,11 @@ +namespace Harmonia.Core.Models; + +public class Playlist(string name) +{ + public string UID { get; set; } = Guid.NewGuid().ToString(); + public string Name { get; set; } = name; + public List Songs { get; set; } = []; + public List GroupOptions { get; set; } = []; + public List SortOptions { get; set; } = []; + public bool IsLocked { get; set; } +} \ No newline at end of file diff --git a/Harmonia.Core/Models/PlaylistSong.cs b/Harmonia.Core/Models/PlaylistSong.cs new file mode 100644 index 0000000..361db92 --- /dev/null +++ b/Harmonia.Core/Models/PlaylistSong.cs @@ -0,0 +1,7 @@ +namespace Harmonia.Core.Models; + +public class PlaylistSong(Song song) +{ + public string UID { get; } = Guid.NewGuid().ToString(); + public Song Song { get; } = song; +} \ No newline at end of file diff --git a/Harmonia.Core/Models/Song.cs b/Harmonia.Core/Models/Song.cs new file mode 100644 index 0000000..50b5efd --- /dev/null +++ b/Harmonia.Core/Models/Song.cs @@ -0,0 +1,26 @@ +namespace Harmonia.Core.Models; + +public class Song +{ + public required string FileName { get; set; } + public ulong Size { get; set; } + public DateTime? LastModified { get; set; } + public string? Title { get; set; } + public string? Album { get; set; } + public string? ImageName { get; set; } + public string? ImageHash { get; set; } + public List Artists { get; set; } = []; + public List AlbumArtists { get; set; } = []; + public byte? TrackNumber { get; set; } + public byte? DiscNumber { get; set; } + public TimeSpan Length { get; set; } + public ushort? Year { get; set; } + public string? Genre { get; set; } + public uint BitRate { get; set; } + public uint SampleRate { get; set; } + + public string? FilePath => Path.GetDirectoryName(FileName); + public string? FileDirectory => Directory.GetParent(FileName)?.Name; + public string? FileType => Path.GetExtension(FileName)?.Replace(".", "").ToUpper(); + public string ShortFileName => Path.GetFileNameWithoutExtension(FileName); +} \ No newline at end of file diff --git a/Harmonia.Core/Models/SortOption.cs b/Harmonia.Core/Models/SortOption.cs new file mode 100644 index 0000000..169d81f --- /dev/null +++ b/Harmonia.Core/Models/SortOption.cs @@ -0,0 +1,9 @@ +using System.ComponentModel; + +namespace Harmonia.Core.Models; + +public class SortOption(string fieldName, ListSortDirection direction) +{ + public string FieldName { get; init; } = fieldName; + public ListSortDirection Direction { get; init; } = direction; +} \ No newline at end of file