Load user's playlists and print confirmation

This commit is contained in:
pleb
2026-04-18 15:58:22 -07:00
parent 752419121f
commit 7c3bd4109e
4 changed files with 127 additions and 4 deletions
+37 -1
View File
@@ -1,3 +1,4 @@
using System;
using IPA;
using IPALogger = IPA.Logging.Logger;
@@ -23,7 +24,42 @@ namespace Setlist
[OnStart]
public void OnApplicationStart()
{
Log.Info("Hello World");
try
{
var playlists = BeatSaberPlaylistsLib.PlaylistManager.DefaultManager.GetAllPlaylists(
includeChildren: true,
out AggregateException loadErrors);
if (loadErrors != null)
{
Log.Error(loadErrors.Message);
foreach (var inner in loadErrors.InnerExceptions)
{
Log.Error(inner.ToString());
}
}
if (playlists == null || playlists.Length == 0)
{
Log.Info("No playlists loaded (or playlist library not initialized yet).");
return;
}
foreach (var playlist in playlists)
{
var hasSyncUrl = false;
if (playlist.TryGetCustomData("syncURL", out var syncObj) && syncObj is string url)
{
hasSyncUrl = !string.IsNullOrWhiteSpace(url);
}
Log.Info($"Playlist \"{playlist.Title}\": hasSyncUrl={hasSyncUrl}");
}
}
catch (Exception ex)
{
Log.Error(ex.ToString());
}
}
[OnExit]