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]
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Setlist</RootNamespace>
|
||||
<AssemblyName>Setlist</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>portable</DebugType>
|
||||
@@ -89,6 +89,10 @@
|
||||
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.VRModule.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="BeatSaberPlaylistsLib">
|
||||
<HintPath>$(BeatSaberDir)\Libs\BeatSaberPlaylistsLib.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Plugin.cs" />
|
||||
@@ -107,7 +111,7 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net472">
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net48">
|
||||
<Version>1.0.3</Version>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"description": "Syncs playlists with external sources.",
|
||||
"gameVersion": "1.40.8",
|
||||
"dependsOn": {
|
||||
"BSIPA": "^4.3.0"
|
||||
"BSIPA": "^4.3.0",
|
||||
"BeatSaberPlaylistsLib": "^1.7.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user