Generate and Store titleSlug in the Database #9264

Closed
opened 2026-02-20 00:12:14 -05:00 by deekerman · 5 comments
Owner

Originally created by @mbrownnycnyc on GitHub (Sep 2, 2025).

Is there an existing issue for this?

  • I have searched the existing open and closed issues

Description

When adding a movie via the API, Radarr does not consistently generate or return a titleSlug in the response. The titleSlug is a crucial piece of information for third-party applications like Overseerr, which rely on it to create predictable and readable URLs for movies.

Currently, the titleSlug is not stored in the database alongside other movie metadata. This proposal outlines the steps to correctly generate and store the titleSlug in the database, ensuring it is the single source of truth.

Proposed Solution

To resolve this issue, Radarr should be updated to always generate and store a titleSlug when a movie is added or updated. The slug should be generated using the existing Parser.ToUrlSlug method.

Benefits

  • Single Source of Truth: The titleSlug will be stored in the database, making it the single source of truth and readily available to any part of the application.
  • Improved API Consistency: The titleSlug will be a reliable and consistent part of the API, making it easier for developers to build robust integrations.
  • Better Third-Party Integrations: Applications like Overseerr will be able to rely on the titleSlug to create clean and predictable URLs, improving the user experience.
  • Reduced Client-Side Logic: API clients will no longer need to implement their own slug generation logic, simplifying their code and reducing the chances of inconsistencies.

Describe the solution you'd like

Proposed Code Changes

  1. File: src/NzbDrone.Core/Movies/Movie.cs

    Add the TitleSlug property to the Movie class to store the slug in the database.

    public class Movie : ModelBase
    {
        // ... existing properties
    
        public string TitleSlug { get; set; }
    
        // ... existing properties
    }
    
  2. File: src/NzbDrone.Core/Movies/MovieService.cs

    Update the AddMovie, AddMovies, UpdateMovie, and UpdateMovies methods to generate the titleSlug before saving the movie to the database.

    • Add the following using statement at the top of the file:

      using NzbDrone.Core.Parser;
      
    • In the AddMovie method, add the following line before _movieRepository.Insert(newMovie);:

      newMovie.TitleSlug = Parser.ToUrlSlug(newMovie.Title + "-" + newMovie.TmdbId);
      
    • In the AddMovies method, add the following lines before _movieRepository.InsertMany(newMovies);:

      foreach (var movie in newMovies)
      {
          movie.TitleSlug = Parser.ToUrlSlug(movie.Title + "-" + movie.TmdbId);
      }
      
    • In the UpdateMovie method, add the following line before _movieRepository.Update(movie);:

      movie.TitleSlug = Parser.ToUrlSlug(movie.Title + "-" + movie.TmdbId);
      
    • In the UpdateMovie (bulk) method, add the following line inside the foreach loop:

      m.TitleSlug = Parser.ToUrlSlug(m.Title + "-" + m.TmdbId);
      
  3. File: src/Radarr.Api.V3/Movies/MovieResource.cs

    In the ToResource extension method, modify the line that sets the TitleSlug property to use the new property from the Movie model.

    Current Code:

    TitleSlug = model.MovieMetadata.Value.TmdbId.ToString(),
    

    Proposed Change:

    TitleSlug = model.TitleSlug,
    
    
    

Describe alternatives you've considered

None.

Anything else?

None. I will likely use some LLM magic to solve and submit a PR against this issue.

Originally created by @mbrownnycnyc on GitHub (Sep 2, 2025). ### Is there an existing issue for this? - [x] I have searched the existing open and closed issues ### Is your feature request related to a problem? Please describe **Description** When adding a movie via the API, Radarr does not consistently generate or return a `titleSlug` in the response. The `titleSlug` is a crucial piece of information for third-party applications like Overseerr, which rely on it to create predictable and readable URLs for movies. Currently, the `titleSlug` is not stored in the database alongside other movie metadata. This proposal outlines the steps to correctly generate and store the `titleSlug` in the database, ensuring it is the single source of truth. **Proposed Solution** To resolve this issue, Radarr should be updated to always generate and store a `titleSlug` when a movie is added or updated. The slug should be generated using the existing `Parser.ToUrlSlug` method. **Benefits** * **Single Source of Truth:** The `titleSlug` will be stored in the database, making it the single source of truth and readily available to any part of the application. * **Improved API Consistency:** The `titleSlug` will be a reliable and consistent part of the API, making it easier for developers to build robust integrations. * **Better Third-Party Integrations:** Applications like Overseerr will be able to rely on the `titleSlug` to create clean and predictable URLs, improving the user experience. * **Reduced Client-Side Logic:** API clients will no longer need to implement their own slug generation logic, simplifying their code and reducing the chances of inconsistencies. ### Describe the solution you'd like **Proposed Code Changes** 1. **File: `src/NzbDrone.Core/Movies/Movie.cs`** Add the `TitleSlug` property to the `Movie` class to store the slug in the database. ```csharp public class Movie : ModelBase { // ... existing properties public string TitleSlug { get; set; } // ... existing properties } ``` 2. **File: `src/NzbDrone.Core/Movies/MovieService.cs`** Update the `AddMovie`, `AddMovies`, `UpdateMovie`, and `UpdateMovies` methods to generate the `titleSlug` before saving the movie to the database. * Add the following `using` statement at the top of the file: ```csharp using NzbDrone.Core.Parser; ``` * In the `AddMovie` method, add the following line before `_movieRepository.Insert(newMovie);`: ```csharp newMovie.TitleSlug = Parser.ToUrlSlug(newMovie.Title + "-" + newMovie.TmdbId); ``` * In the `AddMovies` method, add the following lines before `_movieRepository.InsertMany(newMovies);`: ```csharp foreach (var movie in newMovies) { movie.TitleSlug = Parser.ToUrlSlug(movie.Title + "-" + movie.TmdbId); } ``` * In the `UpdateMovie` method, add the following line before `_movieRepository.Update(movie);`: ```csharp movie.TitleSlug = Parser.ToUrlSlug(movie.Title + "-" + movie.TmdbId); ``` * In the `UpdateMovie` (bulk) method, add the following line inside the `foreach` loop: ```csharp m.TitleSlug = Parser.ToUrlSlug(m.Title + "-" + m.TmdbId); ``` 3. **File: `src/Radarr.Api.V3/Movies/MovieResource.cs`** In the `ToResource` extension method, modify the line that sets the `TitleSlug` property to use the new property from the `Movie` model. **Current Code:** ```csharp TitleSlug = model.MovieMetadata.Value.TmdbId.ToString(), ``` **Proposed Change:** ```csharp TitleSlug = model.TitleSlug, ### Describe alternatives you've considered None. ### Anything else? None. I will likely use some LLM magic to solve and submit a PR against this issue.
Author
Owner

@bakerboy448 commented on GitHub (Sep 2, 2025):

given tmdb is the metadata source of truth a tmdb id would always exist

changing the slug is not the correct solution here - https://xyproblem.info/

@bakerboy448 commented on GitHub (Sep 2, 2025): given tmdb is the metadata source of truth a tmdb id would always exist changing the slug is not the correct solution here - https://xyproblem.info/
Author
Owner

@mbrownnycnyc commented on GitHub (Sep 2, 2025):

@bakerboy448 Given my specific use case, an overseerr MCP, as per the method of exposing the title in the titleSlug that sonarr does include, the new method described above is a proposed solution. I'll open a new issue with this, and if you wish to discuss further on that issue, I'd appreciate any further input.

The context of why I'm asking for this as a feature is important... I do NOT want my client facing front end's front end to rely on anything outside of what overseerr knows, and overseerr is provided this information via it's integration with sonarr and radarr.

Thank you!

@mbrownnycnyc commented on GitHub (Sep 2, 2025): @bakerboy448 Given my specific use case, an overseerr MCP, as per the method of exposing the title in the titleSlug that sonarr does include, the new method described above is a proposed solution. I'll open a new issue with this, and if you wish to discuss further on that issue, I'd appreciate any further input. The context of why I'm asking for this as a feature is important... I do NOT want my client facing front end's front end to rely on anything outside of what overseerr knows, and overseerr is provided this information via it's integration with sonarr and radarr. Thank you!
Author
Owner

@bakerboy448 commented on GitHub (Sep 2, 2025):

No plans to change the titleSlug

overseerr has it's own metadata source from tmdb.

this seems to be an overseerr FR / problem to solve not a radarr one

radarr uses the tmdbid for the slug; sonarr uses a title based slug

predictable urls are already possible

@bakerboy448 commented on GitHub (Sep 2, 2025): No plans to change the titleSlug overseerr has it's own metadata source from tmdb. this seems to be an overseerr FR / problem to solve not a radarr one radarr uses the tmdbid for the slug; sonarr uses a title based slug predictable urls are already possible
Author
Owner

@mbrownnycnyc commented on GitHub (Sep 2, 2025):

@bakerboy448 got it, thank you for the feedback.

@mbrownnycnyc commented on GitHub (Sep 2, 2025): @bakerboy448 got it, thank you for the feedback.
Author
Owner

@mbrownnycnyc commented on GitHub (Sep 2, 2025):

For point of reference: https://github.com/sct/overseerr/issues/4234

@mbrownnycnyc commented on GitHub (Sep 2, 2025): For point of reference: https://github.com/sct/overseerr/issues/4234
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Radarr#9264
No description provided.