mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-09 23:55:10 -05:00
refactor: reorganize Models into subdirectories by context
Split monolithic MusicModels.cs (177 lines) into separate files: - Models/Settings/ (DeezerSettings, QobuzSettings, SubsonicSettings) - Models/Domain/ (Song, Album, Artist) - Models/Search/ (SearchResult) - Models/Download/ (DownloadInfo, DownloadStatus) - Models/Subsonic/ (ScanStatus) Updated namespaces and imports across 22 files. Improves navigation and separates models by business context.
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
using octo_fiesta.Services;
|
||||
using octo_fiesta.Services.Deezer;
|
||||
using octo_fiesta.Services.Local;
|
||||
using octo_fiesta.Models;
|
||||
using octo_fiesta.Models.Domain;
|
||||
using octo_fiesta.Models.Settings;
|
||||
using octo_fiesta.Models.Download;
|
||||
using octo_fiesta.Models.Search;
|
||||
using octo_fiesta.Models.Subsonic;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
using octo_fiesta.Services.Deezer;
|
||||
using octo_fiesta.Models;
|
||||
using octo_fiesta.Models.Domain;
|
||||
using octo_fiesta.Models.Settings;
|
||||
using octo_fiesta.Models.Download;
|
||||
using octo_fiesta.Models.Search;
|
||||
using octo_fiesta.Models.Subsonic;
|
||||
using Moq;
|
||||
using Moq.Protected;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
using octo_fiesta.Services.Local;
|
||||
using octo_fiesta.Models;
|
||||
using octo_fiesta.Models.Domain;
|
||||
using octo_fiesta.Models.Settings;
|
||||
using octo_fiesta.Models.Download;
|
||||
using octo_fiesta.Models.Search;
|
||||
using octo_fiesta.Models.Subsonic;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
@@ -3,7 +3,11 @@ using System.Xml.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using Microsoft.Extensions.Options;
|
||||
using octo_fiesta.Models;
|
||||
using octo_fiesta.Models.Domain;
|
||||
using octo_fiesta.Models.Settings;
|
||||
using octo_fiesta.Models.Download;
|
||||
using octo_fiesta.Models.Search;
|
||||
using octo_fiesta.Models.Subsonic;
|
||||
using octo_fiesta.Services;
|
||||
using octo_fiesta.Services.Local;
|
||||
|
||||
|
||||
20
octo-fiesta/Models/Domain/Album.cs
Normal file
20
octo-fiesta/Models/Domain/Album.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace octo_fiesta.Models.Domain;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an album
|
||||
/// </summary>
|
||||
public class Album
|
||||
{
|
||||
public string Id { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Artist { get; set; } = string.Empty;
|
||||
public string? ArtistId { get; set; }
|
||||
public int? Year { get; set; }
|
||||
public int? SongCount { get; set; }
|
||||
public string? CoverArtUrl { get; set; }
|
||||
public string? Genre { get; set; }
|
||||
public bool IsLocal { get; set; }
|
||||
public string? ExternalProvider { get; set; }
|
||||
public string? ExternalId { get; set; }
|
||||
public List<Song> Songs { get; set; } = new();
|
||||
}
|
||||
15
octo-fiesta/Models/Domain/Artist.cs
Normal file
15
octo-fiesta/Models/Domain/Artist.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace octo_fiesta.Models.Domain;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an artist
|
||||
/// </summary>
|
||||
public class Artist
|
||||
{
|
||||
public string Id { get; set; } = string.Empty;
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string? ImageUrl { get; set; }
|
||||
public int? AlbumCount { get; set; }
|
||||
public bool IsLocal { get; set; }
|
||||
public string? ExternalProvider { get; set; }
|
||||
public string? ExternalId { get; set; }
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace octo_fiesta.Models;
|
||||
namespace octo_fiesta.Models.Domain;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a song (local or external)
|
||||
@@ -95,82 +95,3 @@ public class Song
|
||||
/// </summary>
|
||||
public int? ExplicitContentLyrics { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents an artist
|
||||
/// </summary>
|
||||
public class Artist
|
||||
{
|
||||
public string Id { get; set; } = string.Empty;
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string? ImageUrl { get; set; }
|
||||
public int? AlbumCount { get; set; }
|
||||
public bool IsLocal { get; set; }
|
||||
public string? ExternalProvider { get; set; }
|
||||
public string? ExternalId { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents an album
|
||||
/// </summary>
|
||||
public class Album
|
||||
{
|
||||
public string Id { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Artist { get; set; } = string.Empty;
|
||||
public string? ArtistId { get; set; }
|
||||
public int? Year { get; set; }
|
||||
public int? SongCount { get; set; }
|
||||
public string? CoverArtUrl { get; set; }
|
||||
public string? Genre { get; set; }
|
||||
public bool IsLocal { get; set; }
|
||||
public string? ExternalProvider { get; set; }
|
||||
public string? ExternalId { get; set; }
|
||||
public List<Song> Songs { get; set; } = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Search result combining local and external results
|
||||
/// </summary>
|
||||
public class SearchResult
|
||||
{
|
||||
public List<Song> Songs { get; set; } = new();
|
||||
public List<Album> Albums { get; set; } = new();
|
||||
public List<Artist> Artists { get; set; } = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Download status of a song
|
||||
/// </summary>
|
||||
public enum DownloadStatus
|
||||
{
|
||||
NotStarted,
|
||||
InProgress,
|
||||
Completed,
|
||||
Failed
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Information about an ongoing or completed download
|
||||
/// </summary>
|
||||
public class DownloadInfo
|
||||
{
|
||||
public string SongId { get; set; } = string.Empty;
|
||||
public string ExternalId { get; set; } = string.Empty;
|
||||
public string ExternalProvider { get; set; } = string.Empty;
|
||||
public DownloadStatus Status { get; set; }
|
||||
public double Progress { get; set; } // 0.0 to 1.0
|
||||
public string? LocalPath { get; set; }
|
||||
public string? ErrorMessage { get; set; }
|
||||
public DateTime StartedAt { get; set; }
|
||||
public DateTime? CompletedAt { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Subsonic library scan status
|
||||
/// </summary>
|
||||
public class ScanStatus
|
||||
{
|
||||
public bool Scanning { get; set; }
|
||||
public int? Count { get; set; }
|
||||
}
|
||||
17
octo-fiesta/Models/Download/DownloadInfo.cs
Normal file
17
octo-fiesta/Models/Download/DownloadInfo.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace octo_fiesta.Models.Download;
|
||||
|
||||
/// <summary>
|
||||
/// Information about an ongoing or completed download
|
||||
/// </summary>
|
||||
public class DownloadInfo
|
||||
{
|
||||
public string SongId { get; set; } = string.Empty;
|
||||
public string ExternalId { get; set; } = string.Empty;
|
||||
public string ExternalProvider { get; set; } = string.Empty;
|
||||
public DownloadStatus Status { get; set; }
|
||||
public double Progress { get; set; } // 0.0 to 1.0
|
||||
public string? LocalPath { get; set; }
|
||||
public string? ErrorMessage { get; set; }
|
||||
public DateTime StartedAt { get; set; }
|
||||
public DateTime? CompletedAt { get; set; }
|
||||
}
|
||||
12
octo-fiesta/Models/Download/DownloadStatus.cs
Normal file
12
octo-fiesta/Models/Download/DownloadStatus.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace octo_fiesta.Models.Download;
|
||||
|
||||
/// <summary>
|
||||
/// Download status of a song
|
||||
/// </summary>
|
||||
public enum DownloadStatus
|
||||
{
|
||||
NotStarted,
|
||||
InProgress,
|
||||
Completed,
|
||||
Failed
|
||||
}
|
||||
13
octo-fiesta/Models/Search/SearchResult.cs
Normal file
13
octo-fiesta/Models/Search/SearchResult.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace octo_fiesta.Models.Search;
|
||||
|
||||
using octo_fiesta.Models.Domain;
|
||||
|
||||
/// <summary>
|
||||
/// Search result combining local and external results
|
||||
/// </summary>
|
||||
public class SearchResult
|
||||
{
|
||||
public List<Song> Songs { get; set; } = new();
|
||||
public List<Album> Albums { get; set; } = new();
|
||||
public List<Artist> Artists { get; set; } = new();
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace octo_fiesta.Models;
|
||||
namespace octo_fiesta.Models.Settings;
|
||||
|
||||
/// <summary>
|
||||
/// Configuration for the Deezer downloader and metadata service
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace octo_fiesta.Models;
|
||||
namespace octo_fiesta.Models.Settings;
|
||||
|
||||
/// <summary>
|
||||
/// Configuration for the Qobuz downloader and metadata service
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace octo_fiesta.Models;
|
||||
namespace octo_fiesta.Models.Settings;
|
||||
|
||||
/// <summary>
|
||||
/// Download mode for tracks
|
||||
10
octo-fiesta/Models/Subsonic/ScanStatus.cs
Normal file
10
octo-fiesta/Models/Subsonic/ScanStatus.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace octo_fiesta.Models.Subsonic;
|
||||
|
||||
/// <summary>
|
||||
/// Subsonic library scan status
|
||||
/// </summary>
|
||||
public class ScanStatus
|
||||
{
|
||||
public bool Scanning { get; set; }
|
||||
public int? Count { get; set; }
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using octo_fiesta.Models;
|
||||
using octo_fiesta.Models.Settings;
|
||||
using octo_fiesta.Services;
|
||||
using octo_fiesta.Services.Deezer;
|
||||
using octo_fiesta.Services.Qobuz;
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
using octo_fiesta.Models;
|
||||
using octo_fiesta.Models.Domain;
|
||||
using octo_fiesta.Models.Settings;
|
||||
using octo_fiesta.Models.Download;
|
||||
using octo_fiesta.Models.Search;
|
||||
using octo_fiesta.Models.Subsonic;
|
||||
using octo_fiesta.Services.Local;
|
||||
using octo_fiesta.Services.Deezer;
|
||||
using TagLib;
|
||||
|
||||
@@ -4,7 +4,11 @@ using System.Text.Json;
|
||||
using Org.BouncyCastle.Crypto.Engines;
|
||||
using Org.BouncyCastle.Crypto.Modes;
|
||||
using Org.BouncyCastle.Crypto.Parameters;
|
||||
using octo_fiesta.Models;
|
||||
using octo_fiesta.Models.Domain;
|
||||
using octo_fiesta.Models.Settings;
|
||||
using octo_fiesta.Models.Download;
|
||||
using octo_fiesta.Models.Search;
|
||||
using octo_fiesta.Models.Subsonic;
|
||||
using octo_fiesta.Services.Local;
|
||||
using octo_fiesta.Services.Common;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
using octo_fiesta.Models;
|
||||
using octo_fiesta.Models.Domain;
|
||||
using octo_fiesta.Models.Settings;
|
||||
using octo_fiesta.Models.Download;
|
||||
using octo_fiesta.Models.Search;
|
||||
using octo_fiesta.Models.Subsonic;
|
||||
using System.Text.Json;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using Microsoft.Extensions.Options;
|
||||
using octo_fiesta.Models;
|
||||
using octo_fiesta.Models.Settings;
|
||||
using octo_fiesta.Services.Validation;
|
||||
|
||||
namespace octo_fiesta.Services.Deezer;
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
using octo_fiesta.Models;
|
||||
using octo_fiesta.Models.Domain;
|
||||
using octo_fiesta.Models.Settings;
|
||||
using octo_fiesta.Models.Download;
|
||||
using octo_fiesta.Models.Search;
|
||||
using octo_fiesta.Models.Subsonic;
|
||||
|
||||
namespace octo_fiesta.Services;
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
using octo_fiesta.Models;
|
||||
using octo_fiesta.Models.Domain;
|
||||
using octo_fiesta.Models.Settings;
|
||||
using octo_fiesta.Models.Download;
|
||||
using octo_fiesta.Models.Search;
|
||||
using octo_fiesta.Models.Subsonic;
|
||||
|
||||
namespace octo_fiesta.Services;
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
using octo_fiesta.Models;
|
||||
using octo_fiesta.Models.Domain;
|
||||
using octo_fiesta.Models.Settings;
|
||||
using octo_fiesta.Models.Download;
|
||||
using octo_fiesta.Models.Search;
|
||||
using octo_fiesta.Models.Subsonic;
|
||||
|
||||
namespace octo_fiesta.Services.Local;
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
using System.Text.Json;
|
||||
using Microsoft.Extensions.Options;
|
||||
using octo_fiesta.Models;
|
||||
using octo_fiesta.Models.Domain;
|
||||
using octo_fiesta.Models.Settings;
|
||||
using octo_fiesta.Models.Download;
|
||||
using octo_fiesta.Models.Search;
|
||||
using octo_fiesta.Models.Subsonic;
|
||||
using octo_fiesta.Services;
|
||||
|
||||
namespace octo_fiesta.Services.Local;
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using octo_fiesta.Models;
|
||||
using octo_fiesta.Models.Domain;
|
||||
using octo_fiesta.Models.Settings;
|
||||
using octo_fiesta.Models.Download;
|
||||
using octo_fiesta.Models.Search;
|
||||
using octo_fiesta.Models.Subsonic;
|
||||
using octo_fiesta.Services.Local;
|
||||
using octo_fiesta.Services.Common;
|
||||
using octo_fiesta.Services.Deezer;
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
using octo_fiesta.Models;
|
||||
using octo_fiesta.Models.Domain;
|
||||
using octo_fiesta.Models.Settings;
|
||||
using octo_fiesta.Models.Download;
|
||||
using octo_fiesta.Models.Search;
|
||||
using octo_fiesta.Models.Subsonic;
|
||||
using System.Text.Json;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
using octo_fiesta.Models;
|
||||
using octo_fiesta.Models.Settings;
|
||||
using octo_fiesta.Services.Validation;
|
||||
|
||||
namespace octo_fiesta.Services.Qobuz;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
using octo_fiesta.Models;
|
||||
using octo_fiesta.Models.Settings;
|
||||
using octo_fiesta.Services.Deezer;
|
||||
using octo_fiesta.Services.Qobuz;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
using octo_fiesta.Models;
|
||||
using octo_fiesta.Models.Settings;
|
||||
|
||||
namespace octo_fiesta.Services.Validation;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
using octo_fiesta.Models;
|
||||
using octo_fiesta.Models.Settings;
|
||||
|
||||
namespace octo_fiesta.Services.Validation;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user