feat: add configuration option to select Activity Name based on currently playing track #11

Merged
OpenSrcerer merged 3 commits from main into main 2026-02-08 10:50:20 -07:00
OpenSrcerer commented 2026-02-08 07:50:59 -07:00 (Migrated from github.com)

Closes #8. The available options are title, album and artist.

Untitled
Closes #8. The available options are `title`, `album` and `artist`. <img width="710" height="340" alt="Untitled" src="https://github.com/user-attachments/assets/ecd6e06f-bdfa-4c3b-9191-a30032d5b1f7" />
gemini-code-assist[bot] commented 2026-02-08 07:51:12 -07:00 (Migrated from github.com)

Summary of Changes

Hello @OpenSrcerer, I'm Gemini Code Assist1 ! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the Discord Rich Presence integration by providing users with the flexibility to choose what information is displayed as the 'Activity Name' when streaming music. This moves beyond a static application name to allow for more contextual and dynamic updates based on the currently playing track's metadata, significantly improving the user experience for Discord users.

Highlights

  • New Configuration Option: Introduced a new configuration option, activityname, allowing users to customize the name displayed in Discord Rich Presence when playing music from Navidrome.
  • Dynamic Activity Names: Users can now choose to display the track's title, artist, or album as the activity name, instead of the static 'Navidrome' default.
  • UI Integration: The new configuration option is integrated into the plugin's settings UI via manifest.json, providing a user-friendly radio button selection.
  • Comprehensive Testing: New unit tests have been added to thoroughly validate the behavior of the activityname configuration across all possible options.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • main.go
    • Added activityNameKey constant for the new configuration.
    • Defined new constants for activityNameDefault, activityNameTitle, activityNameArtist, and activityNameAlbum to represent display options.
    • Modified the NowPlaying function to dynamically resolve the activity name based on the activityname configuration setting.
  • main_test.go
    • Imported the fmt package.
    • Updated existing test mocks to include the activityNameKey configuration.
    • Added a new DescribeTable test suite to verify the correct resolution of the activity name based on different activityname configuration values (default, title, artist, album).
  • manifest.json
    • Added a new activityname property to the plugin's configuration schema.
    • Configured activityname as a string type with enum values ('default', 'title', 'artist', 'album') and a default of 'default'.
    • Added a UI control for activityname with a 'radio' format for easy selection in the plugin settings.
Activity
  • The pull request addresses and closes issue #8.
  • An image demonstrating the new configuration option in the UI was provided in the pull request description.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩︎

## Summary of Changes Hello @OpenSrcerer, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Discord Rich Presence integration by providing users with the flexibility to choose what information is displayed as the 'Activity Name' when streaming music. This moves beyond a static application name to allow for more contextual and dynamic updates based on the currently playing track's metadata, significantly improving the user experience for Discord users. ### Highlights * **New Configuration Option**: Introduced a new configuration option, `activityname`, allowing users to customize the name displayed in Discord Rich Presence when playing music from Navidrome. * **Dynamic Activity Names**: Users can now choose to display the track's title, artist, or album as the activity name, instead of the static 'Navidrome' default. * **UI Integration**: The new configuration option is integrated into the plugin's settings UI via `manifest.json`, providing a user-friendly radio button selection. * **Comprehensive Testing**: New unit tests have been added to thoroughly validate the behavior of the `activityname` configuration across all possible options. 🧠 **New Feature in Public Preview:** You can now enable **Memory** to help **Gemini Code Assist** learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. **Click [here](https://codeassist.google/code-review/login) to enable Memory in your admin console.** <details> <summary><b>Changelog</b></summary> * **main.go** * Added `activityNameKey` constant for the new configuration. * Defined new constants for `activityNameDefault`, `activityNameTitle`, `activityNameArtist`, and `activityNameAlbum` to represent display options. * Modified the `NowPlaying` function to dynamically resolve the activity name based on the `activityname` configuration setting. * **main_test.go** * Imported the `fmt` package. * Updated existing test mocks to include the `activityNameKey` configuration. * Added a new `DescribeTable` test suite to verify the correct resolution of the activity name based on different `activityname` configuration values (default, title, artist, album). * **manifest.json** * Added a new `activityname` property to the plugin's configuration schema. * Configured `activityname` as a string type with `enum` values ('default', 'title', 'artist', 'album') and a default of 'default'. * Added a UI control for `activityname` with a 'radio' format for easy selection in the plugin settings. </details> <details> <summary><b>Activity</b></summary> * The pull request addresses and closes issue #8. * An image demonstrating the new configuration option in the UI was provided in the pull request description. </details> <details> <summary><b>Using Gemini Code Assist</b></summary> <br> The full guide for Gemini Code Assist can be found on our [documentation page](https://developers.google.com/gemini-code-assist/docs/review-github-code), here are some quick tips. <b>Invoking Gemini</b> You can request assistance from Gemini at any point by creating a comment using either `/gemini <command>` or `@gemini-code-assist <command>`. Below is a summary of the supported commands on the current page. Feature | Command | Description --- | --- | --- Code Review | `/gemini review` | Performs a code review for the current pull request in its current state. Pull Request Summary | `/gemini summary` | Provides a summary of the current pull request in its current state. Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in pull request comments and review comments. Help | `/gemini help` | Displays a list of available commands. <b>Customization</b> To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a `.gemini/` folder in the base of the repository. Detailed instructions can be found [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github). <b>Limitations & Feedback</b> Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up [here](https://google.qualtrics.com/jfe/form/SV_2cyuGuTWsEw84yG). <b>You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the [Gemini Code Assist IDE Extension](https://cloud.google.com/products/gemini/code-assist).</b> </details> [^1]: Review the [Privacy Notices](https://policies.google.com/privacy), [Generative AI Prohibited Use Policy](https://policies.google.com/terms/generative-ai/use-policy), [Terms of Service](https://policies.google.com/terms), and learn how to configure Gemini Code Assist in GitHub [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github). Gemini can make mistakes, so double check it and [use code with caution](https://support.google.com/legal/answer/13505487).
gemini-code-assist[bot] (Migrated from github.com) reviewed 2026-02-08 07:52:35 -07:00
gemini-code-assist[bot] (Migrated from github.com) left a comment

Code Review

This pull request introduces a new configuration option to customize the activity name displayed in Discord Rich Presence. The implementation is sound and is accompanied by good test coverage for the new functionality. I've added a couple of suggestions to improve code robustness and test maintainability. Overall, this is a great addition.

## Code Review This pull request introduces a new configuration option to customize the activity name displayed in Discord Rich Presence. The implementation is sound and is accompanied by good test coverage for the new functionality. I've added a couple of suggestions to improve code robustness and test maintainability. Overall, this is a great addition.
gemini-code-assist[bot] (Migrated from github.com) commented 2026-02-08 07:52:36 -07:00

medium

While the current implementation works as confirmed by the tests, ignoring the boolean ok return value from pdk.GetConfig is not a robust practice. It relies on the zero value of the string ("") not matching any of the cases. A better approach is to explicitly check if the configuration key exists before attempting to use its value. This makes the code more readable and less prone to subtle bugs if the constants or config behavior were to change in the future.

	if activityNameOption, ok := pdk.GetConfig(activityNameKey); ok {
		switch activityNameOption {
		case activityNameTitle:
			activityName = input.Track.Title
		case activityNameArtist:
			activityName = input.Track.Artist
		case activityNameAlbum:
			activityName = input.Track.Album
		}
	}
![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg) While the current implementation works as confirmed by the tests, ignoring the boolean `ok` return value from `pdk.GetConfig` is not a robust practice. It relies on the zero value of the string (`""`) not matching any of the cases. A better approach is to explicitly check if the configuration key exists before attempting to use its value. This makes the code more readable and less prone to subtle bugs if the constants or config behavior were to change in the future. ```suggestion if activityNameOption, ok := pdk.GetConfig(activityNameKey); ok { switch activityNameOption { case activityNameTitle: activityName = input.Track.Title case activityNameArtist: activityName = input.Track.Artist case activityNameAlbum: activityName = input.Track.Album } } ```
gemini-code-assist[bot] (Migrated from github.com) commented 2026-02-08 07:52:36 -07:00

medium

There is a significant amount of duplicated test setup code between this DescribeTable and the It("successfully sends now playing update", ...) test case. This harms maintainability, as any change to the mocking logic will need to be updated in multiple places.

To follow the DRY (Don't Repeat Yourself) principle, you could refactor this duplicated logic into a BeforeEach block within the Describe("NowPlaying", ...) suite or into a shared helper function. This would make the tests cleaner and easier to maintain.

For example, you could move the common mock setups to a BeforeEach and only configure the mocks that differ in each test, like this:

// In Describe("NowPlaying", ...)
BeforeEach(func() {
    // ... common mocks
    pdk.PDKMock.On("GetConfig", clientIDKey).Return("test-client-id", true)
    pdk.PDKMock.On("GetConfig", usersKey).Return(`[{"username":"testuser","token":"test-token"}]`, true)
    // ... etc
})

It("successfully sends now playing update", func() {
    pdk.PDKMock.On("GetConfig", activityNameKey).Return("", false)
    // ... rest of test
})

DescribeTable("activity name configuration",
    func(configValue string, configExists bool, expectedName string) {
        pdk.PDKMock.On("GetConfig", activityNameKey).Return(configValue, configExists)
        // ... rest of test
    },
    // ... entries
)
![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg) There is a significant amount of duplicated test setup code between this `DescribeTable` and the `It("successfully sends now playing update", ...)` test case. This harms maintainability, as any change to the mocking logic will need to be updated in multiple places. To follow the DRY (Don't Repeat Yourself) principle, you could refactor this duplicated logic into a `BeforeEach` block within the `Describe("NowPlaying", ...)` suite or into a shared helper function. This would make the tests cleaner and easier to maintain. For example, you could move the common mock setups to a `BeforeEach` and only configure the mocks that differ in each test, like this: ```go // In Describe("NowPlaying", ...) BeforeEach(func() { // ... common mocks pdk.PDKMock.On("GetConfig", clientIDKey).Return("test-client-id", true) pdk.PDKMock.On("GetConfig", usersKey).Return(`[{"username":"testuser","token":"test-token"}]`, true) // ... etc }) It("successfully sends now playing update", func() { pdk.PDKMock.On("GetConfig", activityNameKey).Return("", false) // ... rest of test }) DescribeTable("activity name configuration", func(configValue string, configExists bool, expectedName string) { pdk.PDKMock.On("GetConfig", activityNameKey).Return(configValue, configExists) // ... rest of test }, // ... entries ) ```
hashtrap commented 2026-02-08 07:53:51 -07:00 (Migrated from github.com)

holy peak

holy peak
github-actions[bot] commented 2026-02-08 09:50:48 -07:00 (Migrated from github.com)

Download the plugin for this PR: discord-rich-presence.zip

Built from 2be99c413a on 2026-02-08T17:44:58Z

Download the plugin for this PR: [discord-rich-presence.zip](https://nightly.link/navidrome/discord-rich-presence-plugin/actions/runs/21802473633/discord-rich-presence.zip) Built from 2be99c413a11f0ca5cefb9cd4e8979524f7689a0 on 2026-02-08T17:44:58Z <!-- Sticky Pull Request Comment -->
deluan commented 2026-02-08 09:51:59 -07:00 (Migrated from github.com)

Hey @OpenSrcerer, thanks for the PR. A couple of changes:

  • Can you make the activity name options Title Case? Default, Track (not Title), Album, Artist?
  • Please update the README accordingly.

Thanks!

Hey @OpenSrcerer, thanks for the PR. A couple of changes: - Can you make the activity name options Title Case? Default, Track (not Title), Album, Artist? - Please update the README accordingly. Thanks!
Sign in to join this conversation.