feat: persist and expose plugin playlist ValidUntil in Subsonic API

Add a ValidUntil field to the Playlist model and persist it from the
plugin's GetPlaylistResponse during sync. This allows clients to know
when a plugin playlist's data will be refreshed. The value is exposed
in the OpenSubsonic playlist response alongside the existing
smart playlist ValidUntil calculation. The migration is consolidated
into a single multi-statement ExecContext call.
This commit is contained in:
Deluan 2026-03-05 19:00:43 -05:00
commit 9ddbcbf6b4
6 changed files with 33 additions and 22 deletions

View file

@ -200,6 +200,10 @@ func (p *playlistSyncer) syncPlaylist(info capabilities.PlaylistInfo, dbID strin
PluginID: p.pluginName,
PluginPlaylistID: info.ID,
}
if resp.ValidUntil > 0 {
t := time.Unix(resp.ValidUntil, 0)
pls.ValidUntil = &t
}
// Set tracks from matched media files
pls.AddMediaFiles(matched)

View file

@ -75,6 +75,7 @@ var _ = Describe("PlaylistProvider", Ordered, func() {
Expect(dailyMix1.PluginID).To(Equal("test-playlist-provider"))
Expect(dailyMix1.PluginPlaylistID).To(Equal("daily-mix-1"))
Expect(dailyMix1.Public).To(BeFalse())
Expect(dailyMix1.ValidUntil).To(BeNil())
})
It("generates deterministic playlist IDs", func() {