Load user's playlists and print confirmation
This commit is contained in:
+37
-1
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user