add configurable playlist names env var

This commit is contained in:
2026-01-31 19:37:10 -05:00
parent bc4faead74
commit 3f3e1b708d
3 changed files with 20 additions and 12 deletions

View File

@@ -120,3 +120,9 @@ SPOTIFY_IMPORT_SYNC_WINDOW_HOURS=2
# Get IDs from Jellyfin playlist URLs: https://jellyfin.example.com/web/#/details?id=PLAYLIST_ID
# Example: SPOTIFY_IMPORT_PLAYLIST_IDS=4383a46d8bcac3be2ef9385053ea18df,ba50e26c867ec9d57ab2f7bf24cfd6b0
SPOTIFY_IMPORT_PLAYLIST_IDS=
# Playlist names (comma-separated, must match Spotify Import plugin format)
# IMPORTANT: Plugin replaces spaces with underscores in filenames
# Must be in same order as SPOTIFY_IMPORT_PLAYLIST_IDS
# Example: SPOTIFY_IMPORT_PLAYLIST_NAMES=Discover_Weekly,Release_Radar
SPOTIFY_IMPORT_PLAYLIST_NAMES=

View File

@@ -1993,21 +1993,15 @@ public class JellyfinController : ControllerBase
var results = new Dictionary<string, object>();
// Hardcoded playlist names that match the Spotify Import plugin format
// Note: Plugin replaces spaces with underscores in filenames
var playlistNames = new Dictionary<string, string>
{
{ "4383a46d8bcac3be2ef9385053ea18df", "Discover_Weekly" },
{ "ba50e26c867ec9d57ab2f7bf24cfd6b0", "Release_Radar" }
};
foreach (var playlistId in _spotifySettings.PlaylistIds)
for (int i = 0; i < _spotifySettings.PlaylistIds.Count; i++)
{
var playlistId = _spotifySettings.PlaylistIds[i];
try
{
// Use hardcoded name or fall back to ID
var playlistName = playlistNames.ContainsKey(playlistId)
? playlistNames[playlistId]
// Use configured name if available, otherwise use ID
var playlistName = i < _spotifySettings.PlaylistNames.Count
? _spotifySettings.PlaylistNames[i]
: playlistId;
_logger.LogInformation("Fetching missing tracks for {Playlist} (ID: {Id})", playlistName, playlistId);

View File

@@ -36,4 +36,12 @@ public class SpotifyImportSettings
/// Get IDs from Jellyfin playlist URLs
/// </summary>
public List<string> PlaylistIds { get; set; } = new();
/// <summary>
/// Comma-separated list of playlist names (must match Spotify Import plugin format)
/// Example: "Discover_Weekly,Release_Radar"
/// Must be in same order as PlaylistIds
/// Plugin replaces spaces with underscores in filenames
/// </summary>
public List<string> PlaylistNames { get; set; } = new();
}