Spotify Link-Through & Navidrome Logo Overlay #15

Merged
Woahai321 merged 19 commits from main into main 2026-03-04 10:04:03 -07:00
2 changed files with 11 additions and 7 deletions
Showing only changes of commit 49caff0cb7 - Show all commits
+4 -1
View File
1
@@ -152,6 +152,7 @@ func (p *discordPlugin) NowPlaying(input scrobbler.NowPlayingRequest) error {
// Resolve the activity name based on configuration // Resolve the activity name based on configuration
activityName := "Navidrome" activityName := "Navidrome"
statusDisplayType := 0
activityNameOption, _ := pdk.GetConfig(activityNameKey) activityNameOption, _ := pdk.GetConfig(activityNameKey)
switch activityNameOption { switch activityNameOption {
case activityNameTrack: case activityNameTrack:
@@ -160,6 +161,8 @@ func (p *discordPlugin) NowPlaying(input scrobbler.NowPlayingRequest) error {
activityName = input.Track.Album activityName = input.Track.Album
case activityNameArtist: case activityNameArtist:
activityName = input.Track.Artist activityName = input.Track.Artist
default:
statusDisplayType = 2
} }
// Resolve Spotify URLs if enabled // Resolve Spotify URLs if enabled
@@ -179,7 +182,7 @@ func (p *discordPlugin) NowPlaying(input scrobbler.NowPlayingRequest) error {
DetailsURL: spotifyURL, DetailsURL: spotifyURL,
State: input.Track.Artist, State: input.Track.Artist,
StateURL: artistSearchURL, StateURL: artistSearchURL,
StatusDisplayType: 2, StatusDisplayType: statusDisplayType,
Timestamps: activityTimestamps{ Timestamps: activityTimestamps{
Start: startTime, Start: startTime,
End: endTime, End: endTime,
+7 -6
View File
@@ -170,7 +170,7 @@ var _ = Describe("discordPlugin", func() {
}) })
DescribeTable("activity name configuration", DescribeTable("activity name configuration",
func(configValue string, configExists bool, expectedName string) { func(configValue string, configExists bool, expectedName string, expectedDisplayType int) {
pdk.PDKMock.On("GetConfig", clientIDKey).Return("test-client-id", true) pdk.PDKMock.On("GetConfig", clientIDKey).Return("test-client-id", true)
pdk.PDKMock.On("GetConfig", usersKey).Return(`[{"username":"testuser","token":"test-token"}]`, true) pdk.PDKMock.On("GetConfig", usersKey).Return(`[{"username":"testuser","token":"test-token"}]`, true)
pdk.PDKMock.On("GetConfig", uguuEnabledKey).Return("", false) pdk.PDKMock.On("GetConfig", uguuEnabledKey).Return("", false)
@@ -217,12 +217,13 @@ var _ = Describe("discordPlugin", func() {
}) })
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(sentPayload).To(ContainSubstring(fmt.Sprintf(`"name":"%s"`, expectedName))) Expect(sentPayload).To(ContainSubstring(fmt.Sprintf(`"name":"%s"`, expectedName)))
Expect(sentPayload).To(ContainSubstring(fmt.Sprintf(`"status_display_type":%d`, expectedDisplayType)))
}, },
Entry("defaults to Navidrome when not configured", "", false, "Navidrome"), Entry("defaults to Navidrome when not configured", "", false, "Navidrome", 2),
Entry("defaults to Navidrome with explicit default value", "Default", true, "Navidrome"), Entry("defaults to Navidrome with explicit default value", "Default", true, "Navidrome", 2),
Entry("uses track title when configured", "Track", true, "Test Song"), Entry("uses track title when configured", "Track", true, "Test Song", 0),
Entry("uses track album when configured", "Album", true, "Test Album"), Entry("uses track album when configured", "Album", true, "Test Album", 0),
Entry("uses track artist when configured", "Artist", true, "Test Artist"), Entry("uses track artist when configured", "Artist", true, "Test Artist", 0),
) )
}) })