mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-09 23:55:10 -05:00
add configurable playlist names env var
This commit is contained in:
@@ -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=
|
||||
|
||||
@@ -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>
|
||||
for (int i = 0; i < _spotifySettings.PlaylistIds.Count; i++)
|
||||
{
|
||||
{ "4383a46d8bcac3be2ef9385053ea18df", "Discover_Weekly" },
|
||||
{ "ba50e26c867ec9d57ab2f7bf24cfd6b0", "Release_Radar" }
|
||||
};
|
||||
var playlistId = _spotifySettings.PlaylistIds[i];
|
||||
|
||||
foreach (var playlistId in _spotifySettings.PlaylistIds)
|
||||
{
|
||||
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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user