Files
allstarr/allstarr/Models/Settings/SpotifyApiSettings.cs
Josh Patra c9895f6d1a Expand admin UI with full config editing and sp_dc cookie age tracking
- Fix auth status detection to use token validity instead of /me endpoint
- Add SessionCookieSetDate to SpotifyApiSettings for tracking cookie age
- Auto-set cookie date when updating sp_dc via admin UI
- Add edit buttons for all config settings (Spotify, Deezer, Qobuz, SquidWTF, Jellyfin)
- Show cookie age with color-coded expiration warnings (green/yellow/red)
- Display cookie age on both Dashboard and Config tabs
- Add generic edit setting modal supporting text/password/number/toggle/select inputs
- Remove SquidWTF base URL (not configurable)
- Add restart container button with manual restart instructions
2026-02-03 14:52:40 -05:00

73 lines
2.8 KiB
C#

namespace allstarr.Models.Settings;
/// <summary>
/// Configuration for direct Spotify API access.
/// This enables fetching playlist data directly from Spotify rather than relying on the Jellyfin plugin.
///
/// Benefits over Jellyfin plugin approach:
/// - Track ordering is preserved (critical for playlists like Release Radar)
/// - ISRC codes available for exact matching
/// - Real-time data without waiting for plugin sync
/// - Full track metadata (duration, release date, etc.)
/// </summary>
public class SpotifyApiSettings
{
/// <summary>
/// Enable direct Spotify API integration.
/// When enabled, playlists will be fetched directly from Spotify instead of the Jellyfin plugin.
/// </summary>
public bool Enabled { get; set; }
/// <summary>
/// Spotify Client ID from https://developer.spotify.com/dashboard
/// Used for OAuth token refresh and API access.
/// </summary>
public string ClientId { get; set; } = string.Empty;
/// <summary>
/// Spotify Client Secret from https://developer.spotify.com/dashboard
/// Optional - only needed for certain OAuth flows.
/// </summary>
public string ClientSecret { get; set; } = string.Empty;
/// <summary>
/// Spotify session cookie (sp_dc).
/// Required for accessing editorial/personalized playlists like Release Radar and Discover Weekly.
/// These playlists are not available via the official API.
///
/// To get this cookie:
/// 1. Log into open.spotify.com in your browser
/// 2. Open DevTools (F12) > Application > Cookies > https://open.spotify.com
/// 3. Copy the value of the "sp_dc" cookie
///
/// Note: This cookie expires periodically and will need to be refreshed.
/// </summary>
public string SessionCookie { get; set; } = string.Empty;
/// <summary>
/// Cache duration in minutes for playlist data.
/// Playlists like Release Radar only update weekly, so caching is beneficial.
/// Default: 60 minutes
/// </summary>
public int CacheDurationMinutes { get; set; } = 60;
/// <summary>
/// Rate limit delay between Spotify API requests in milliseconds.
/// Default: 100ms (Spotify allows ~100 requests per minute)
/// </summary>
public int RateLimitDelayMs { get; set; } = 100;
/// <summary>
/// Whether to prefer ISRC matching over fuzzy title/artist matching when ISRC is available.
/// ISRC provides exact track identification across services.
/// Default: true
/// </summary>
public bool PreferIsrcMatching { get; set; } = true;
/// <summary>
/// ISO date string of when the session cookie was last set/updated.
/// Used to track cookie age and warn when it's approaching expiration (~1 year).
/// </summary>
public string? SessionCookieSetDate { get; set; }
}