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); public void Update(Song song) { if (string.Equals(song.FileName, FileName, StringComparison.OrdinalIgnoreCase) == false) return; Size = song.Size; LastModified = song.LastModified; Title = song.Title; Album = song.Album; Artists = song.Artists; AlbumArtists = song.AlbumArtists; DiscNumber = song.DiscNumber; TrackNumber = song.TrackNumber; Length = song.Length; Year = song.Year; Genre = song.Genre; BitRate = song.BitRate; SampleRate = song.SampleRate; ImageName = song?.ImageName; ImageHash = song?.ImageHash; } }