Added initial models.

This commit is contained in:
2025-02-16 15:27:21 -05:00
parent 3369b2a86a
commit 8f3b07543f
6 changed files with 59 additions and 7 deletions

View File

@@ -0,0 +1,6 @@
namespace Harmonia.Core.Models;
public class GroupOption(string fieldName)
{
public string FieldName { get; init; } = fieldName;
}

View File

@@ -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<PlaylistSong> Songs { get; set; } = [];
public List<GroupOption> GroupOptions { get; set; } = [];
public List<SortOption> SortOptions { get; set; } = [];
public bool IsLocked { get; set; }
}

View File

@@ -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;
}

View File

@@ -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<string> Artists { get; set; } = [];
public List<string> 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);
}

View File

@@ -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;
}