Skip to content

feat(agents): Add Deezer API artist image provider agent #4180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 28, 2025

Conversation

bplaat
Copy link
Contributor

@bplaat bplaat commented Jun 6, 2025

This pr adds a Deezer API artist image metadata provider agent.

As discussed in #4178, looking forward to feedback :^)

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @bplaat, 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!

Summary of Changes

Hello! Gemini or gemini-code-assist here, providing a summary of this pull request. This PR introduces a new feature to Navidrome: an agent that can fetch artist images from the Deezer API. This fulfills the request discussed in the linked GitHub discussion, adding another source for metadata within the application. The changes involve creating a new package for the Deezer agent, implementing a client to interact with the Deezer API, defining the necessary data structures for API responses, and integrating the new agent into Navidrome's external provider system.

Highlights

  • New Feature: Deezer Agent: Adds a new metadata provider agent specifically for fetching artist images using the Deezer API.
  • Deezer API Client: Includes a new Go client implementation (core/agents/deezer/client.go) for making requests to the Dee Deezer API, specifically the artist search endpoint.
  • Artist Image Fetching: The new agent implements the GetArtistImages method from the agents.Interface, using the Deezer client to search for an artist by name and returning the URL of the largest available picture (PictureXl).
  • Agent Registration: The new Deezer agent is registered with Navidrome's agent system via an init() function and a blank import in core/external/provider.go.

Changelog

Click here to see the changelog
  • .github/copilot-instructions.md
    • Updated instructions to include Deezer in the list of external services.
    • Added a newline at the end of the file.
  • core/agents/deezer/client.go
    • Added a new file implementing the Deezer API client.
    • Includes functions for making HTTP requests (makeRequest) and searching for artists (searchArtists).
    • Defines an ErrNotFound error for cases where no results are returned.
    • Includes basic error parsing for non-200 responses.
  • core/agents/deezer/deezer.go
    • Added a new file implementing the agents.Interface for the Deezer agent.
    • Implements AgentName() and GetArtistImages().
    • Uses the Deezer client to search for artists and returns the PictureXl URL if a name match is found.
    • Registers the agent using conf.AddHook and agents.Register.
  • core/agents/deezer/responses.go
    • Added a new file defining Go structs (SearchArtistResults, Artist, Error) to unmarshal JSON responses from the Deezer API.
  • core/external/provider.go
    • Added a blank import (_) for the new github.com/navidrome/navidrome/core/agents/deezer package to ensure the agent's init() function runs and registers it.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 is currently in preview and 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 to provide feedback.

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.

Footnotes

  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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new Deezer API agent for fetching artist images, which is a valuable addition to Navidrome's metadata capabilities. The implementation is generally solid and follows the existing patterns for agents.

I've identified a couple of areas for improvement related to error handling and maximizing the use of the Deezer API's image offerings. Additionally, there are some minor stylistic points (like variable naming) that fall under 'low' severity and haven't been commented on directly due to the review settings, but are noted in the summary for completeness.

Overall, good work on integrating this new provider!

Summary of Findings

  • Error Handling: In core/agents/deezer/client.go, the error from http.NewRequestWithContext is not handled. This should be addressed to prevent potential issues. (Severity: medium, commented)
  • Image Variety: The Deezer agent in core/agents/deezer/deezer.go currently only returns the largest artist image (PictureXl). It would be beneficial to return all available image sizes provided by the Deezer API for greater flexibility. (Severity: medium, commented)
  • Go Naming Conventions: Some variable and struct field names use snake_case (e.g., data_store, http_client) instead of camelCase (e.g., dataStore, httpClient) which is more idiomatic in Go. Also, apiBaseUrl could be apiBaseURL. (Severity: low, not commented due to review settings)
  • Typo: There's a typo in a variable name: chached_http_client should be cachedHTTPClient in core/agents/deezer/deezer.go. (Severity: low, not commented due to review settings)
  • Unused Parameters: The id and mbid parameters in GetArtistImages within core/agents/deezer/deezer.go are unused. This is acceptable if the interface signature mandates them and the Deezer API doesn't require them for this specific lookup. (Severity: low, not commented due to review settings)

Merge Readiness

The pull request is a good step towards integrating Deezer as a metadata provider. However, there are a couple of medium-severity issues related to error handling and the completeness of image data retrieval that should be addressed before merging. Addressing these will improve the robustness and utility of the new agent.

As an AI, I am not authorized to approve pull requests. Please ensure these changes are reviewed and approved by a repository maintainer before merging.

Copy link
Member

@deluan deluan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start! I tried it locally and it is working as expected. Good job!

What is missing:

@bplaat
Copy link
Contributor Author

bplaat commented Jun 10, 2025

@deluan thanks for the review, I've amended the required changes to the commit

Copy link
Member

@deluan deluan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I'll take a look later. Next time you change, it please don't amend, as it makes it harder for me as I have to review all files again, not only the new changes. So it will take more time to do a full review.

Just saw a small issue with naming, but I still have to do a full review later.

@deluan
Copy link
Member

deluan commented Jun 15, 2025

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new metadata provider agent for fetching artist images from the Deezer API. The changes include adding the Deezer client, the agent implementation, corresponding tests, and configuration updates.

Overall, the implementation is straightforward. Key feedback points include handling potentially empty image URLs from the API, improving error checking in tests, addressing unused parameters with comments or by ignoring them, and adhering more closely to Go's idiomatic constant naming conventions. Additionally, a hardcoded API limit could be made a constant, and a test fixture file is missing a final newline.

@bplaat
Copy link
Contributor Author

bplaat commented Jun 16, 2025

Next time you change, it please don't amend, as it makes it harder for me as I have to review all files again, not only the new changes.

Sorry I didn't now the way of working on this project yet. Did I miss some documentation or is this not written down somewhere? And I have fixed your remarks.

Copy link
Member

@deluan deluan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have any proper documentation about this, it is just my personal preference (a nitpick, if you will :) )

@deluan
Copy link
Member

deluan commented Jun 28, 2025

Thanks! I added configuration to disable it, and will merge it for next release.

@deluan deluan merged commit 93040b3 into navidrome:master Jun 28, 2025
31 checks passed
@bplaat bplaat deleted the deezer-agent branch June 29, 2025 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants