Custom Activity Name Templates #23

Merged
atridadl merged 4 commits from atridadl/main into main 2026-04-02 15:48:21 -06:00
atridadl commented 2026-03-09 18:18:16 -06:00 (Migrated from github.com)

Closes #22

This would implement custom activity names using a simple template format in the plugin settings.

{track}, {artist}, {album} are the placeholders in the custom text that will sub in the actual track info.

Screenshot of the settings with this built out:
Screenshot 2026-03-09 at 6 12 37 PM

I built this for 0.3.0 (since 1.0.0 does not run on my navidrome instance, but made the same set of changes off of main. tests are implemented and pass.

Closes #22 This would implement custom activity names using a simple template format in the plugin settings. {track}, {artist}, {album} are the placeholders in the custom text that will sub in the actual track info. Screenshot of the settings with this built out: <img width="886" height="188" alt="Screenshot 2026-03-09 at 6 12 37 PM" src="https://github.com/user-attachments/assets/842f8947-ee46-4c1b-98f5-75a49d6958bc" /> I built this for 0.3.0 (since 1.0.0 does not run on my navidrome instance, but made the same set of changes off of main. tests are implemented and pass.
gemini-code-assist[bot] commented 2026-03-09 18:18:30 -06:00 (Migrated from github.com)

Summary of Changes

Hello, 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 significantly enhances the Discord Rich Presence integration by allowing users to define custom activity names using a templating system. This provides greater flexibility and personalization for how music playback information is displayed on Discord, moving beyond the previously fixed options. The changes include new configuration options, core logic for template processing, and corresponding UI updates.

Highlights

  • Custom Activity Name Templates: Introduced the ability for users to define custom activity names for Discord Rich Presence using a templating system.
  • Placeholder Support: Enabled the use of {track}, {artist}, and {album} placeholders within custom templates, which are dynamically replaced with actual track information.
  • New Configuration Option: Added a 'Custom' option to the activity name settings and a dedicated input field for the custom template, which is conditionally displayed in the UI.
  • Comprehensive Testing: Included new tests to ensure the custom activity name template functionality works correctly across various scenarios, including different placeholder combinations and fallback behavior.

🧠 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
  • .gitignore
    • Added .DS_Store to the ignore list.
  • main.go
    • Defined activityNameTemplateKey for configuration.
    • Added activityNameCustom constant to represent the new custom option.
    • Implemented logic in NowPlaying to retrieve and process custom templates, replacing placeholders with actual track, artist, and album information.
  • main_test.go
    • Added comprehensive tests for the custom activity name template functionality, covering various placeholder combinations and fallback scenarios.
  • manifest.json
    • Extended the activityname enum with a 'Custom' option.
    • Introduced a new activitynametemplate configuration property, including its title, description, and a default value.
    • Added a UI schema rule to conditionally display the activitynametemplate input field when activityname is set to 'Custom'.
Activity
  • No human activity has been recorded on this pull request yet.
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, 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 significantly enhances the Discord Rich Presence integration by allowing users to define custom activity names using a templating system. This provides greater flexibility and personalization for how music playback information is displayed on Discord, moving beyond the previously fixed options. The changes include new configuration options, core logic for template processing, and corresponding UI updates. ### Highlights * **Custom Activity Name Templates**: Introduced the ability for users to define custom activity names for Discord Rich Presence using a templating system. * **Placeholder Support**: Enabled the use of `{track}`, `{artist}`, and `{album}` placeholders within custom templates, which are dynamically replaced with actual track information. * **New Configuration Option**: Added a 'Custom' option to the activity name settings and a dedicated input field for the custom template, which is conditionally displayed in the UI. * **Comprehensive Testing**: Included new tests to ensure the custom activity name template functionality works correctly across various scenarios, including different placeholder combinations and fallback behavior. 🧠 **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> * **.gitignore** * Added `.DS_Store` to the ignore list. * **main.go** * Defined `activityNameTemplateKey` for configuration. * Added `activityNameCustom` constant to represent the new custom option. * Implemented logic in `NowPlaying` to retrieve and process custom templates, replacing placeholders with actual track, artist, and album information. * **main_test.go** * Added comprehensive tests for the custom activity name template functionality, covering various placeholder combinations and fallback scenarios. * **manifest.json** * Extended the `activityname` enum with a 'Custom' option. * Introduced a new `activitynametemplate` configuration property, including its title, description, and a default value. * Added a UI schema rule to conditionally display the `activitynametemplate` input field when `activityname` is set to 'Custom'. </details> <details> <summary><b>Activity</b></summary> * No human activity has been recorded on this pull request yet. </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-03-09 18:20:10 -06:00
gemini-code-assist[bot] (Migrated from github.com) left a comment

Code Review

This pull request introduces a new feature allowing users to define custom templates for Discord activity names. The implementation is solid, with changes correctly applied to the plugin logic, configuration manifest, and with comprehensive tests added to validate the new functionality. My review includes one suggestion to improve the performance and readability of the string replacement logic.

## Code Review This pull request introduces a new feature allowing users to define custom templates for Discord activity names. The implementation is solid, with changes correctly applied to the plugin logic, configuration manifest, and with comprehensive tests added to validate the new functionality. My review includes one suggestion to improve the performance and readability of the string replacement logic.
main.go Outdated
gemini-code-assist[bot] (Migrated from github.com) commented 2026-03-09 18:20:10 -06:00

medium

The current implementation uses multiple strings.ReplaceAll calls to substitute placeholders in the template. This can be inefficient as it creates a new string for each replacement. For better performance and cleaner code, you can use strings.NewReplacer. It builds a more efficient replacer and performs all substitutions in a single pass. This is a common Go idiom for multiple replacements.

			r := strings.NewReplacer(
				"{track}", input.Track.Title,
				"{artist}", input.Track.Artist,
				"{album}", input.Track.Album,
			)
			activityName = r.Replace(template)
![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg) The current implementation uses multiple `strings.ReplaceAll` calls to substitute placeholders in the template. This can be inefficient as it creates a new string for each replacement. For better performance and cleaner code, you can use `strings.NewReplacer`. It builds a more efficient replacer and performs all substitutions in a single pass. This is a common Go idiom for multiple replacements. ```go r := strings.NewReplacer( "{track}", input.Track.Title, "{artist}", input.Track.Artist, "{album}", input.Track.Album, ) activityName = r.Replace(template) ```
github-actions[bot] commented 2026-03-09 19:15:50 -06:00 (Migrated from github.com)

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

Built from 414021f471 on 2026-03-10T12:18:56Z

Download the plugin for this PR: [discord-rich-presence.zip](https://nightly.link/navidrome/discord-rich-presence-plugin/actions/runs/22888585915/discord-rich-presence.zip) Built from 414021f471287a5944487d8425e5237c8edf3e80 on 2026-03-10T12:18:56Z <!-- Sticky Pull Request Comment -->
atridadl (Migrated from github.com) reviewed 2026-03-09 23:28:19 -06:00
main.go Outdated
atridadl (Migrated from github.com) commented 2026-03-09 23:28:19 -06:00

Sure thing clanker

Sure thing clanker
atridadl commented 2026-03-09 23:38:19 -06:00 (Migrated from github.com)

Hopefully this is a bit better! Was just messing around with the options in the plugin and thought this could be useful.

Hopefully this is a bit better! Was just messing around with the options in the plugin and thought this could be useful.
atridadl commented 2026-03-22 13:08:22 -06:00 (Migrated from github.com)

Resolved merge conflicts as best I could.

Resolved merge conflicts as best I could.
atridadl commented 2026-04-02 01:06:42 -06:00 (Migrated from github.com)

Resolved even more conflicts :)

Resolved even more conflicts :)
atridadl commented 2026-04-02 09:40:58 -06:00 (Migrated from github.com)

Even more conflict resolution. Let me know if theres anything else needed for this PR @deluan

Even more conflict resolution. Let me know if theres anything else needed for this PR @deluan
atridad added 1 commit 2026-04-02 15:47:08 -06:00
Merge
Test / Test (pull_request) Has been cancelled
fa381fbc83
atridad merged commit a903d6cdea into main 2026-04-02 15:48:21 -06:00
atridad deleted branch atridadl/main 2026-04-02 15:48:21 -06:00
Sign in to join this conversation.