Skip to content

Standardize Trakt Import List Settings#8413

Draft
Andrew-Ukkonen wants to merge 6 commits intoSonarr:v5-developfrom
Andrew-Ukkonen:feature/standardize-trakt-settings
Draft

Standardize Trakt Import List Settings#8413
Andrew-Ukkonen wants to merge 6 commits intoSonarr:v5-developfrom
Andrew-Ukkonen:feature/standardize-trakt-settings

Conversation

@Andrew-Ukkonen
Copy link
Copy Markdown
Contributor

Description

Added rating, genres, and years to all trakt import lists

Screenshots for UI Changes

{54E83ACD-E946-4233-8DFA-33B78C5C4ED3} {11274B7C-97CB-48EC-B6C2-3BD21386C2A5}

@stevietv
Copy link
Copy Markdown
Member

I always understood that filtering was not possible on user lists, only on popular lists. Have you tested this?

@Andrew-Ukkonen
Copy link
Copy Markdown
Contributor Author

Andrew-Ukkonen commented Feb 16, 2026

@stevietv I partially tested this. I never fully created the list, but I did test (you can see the checkmark). I also tested in Trakt's URL by adding genres. I've tried tests that created both positive results and negative results to see if it returns data. I'll create the import list and get back to you.

@markus101
Copy link
Copy Markdown
Member

That just confirms that the request doesn't fail. If they're not outright rejecting invalid parameters that doesn't really test that it works.

Additional parameters was intentionally removed because things didn't work for user lists.
#7575

@Andrew-Ukkonen
Copy link
Copy Markdown
Contributor Author

{A63C9227-87B8-40CF-8F9A-3CD39E2F4916} {637C873E-4116-4CB5-9D84-1573E28D2537}

Seems to be working

{4158EE34-6C3B-4E47-99F8-8740390546E7} {3B4A2A6F-676C-4C37-B177-2103ACAE141C}

@Andrew-Ukkonen
Copy link
Copy Markdown
Contributor Author

That just confirms that the request doesn't fail. If they're not outright rejecting invalid parameters that doesn't really test that it works.

Additional parameters was intentionally removed because things didn't work for user lists. #7575

I think they used the wrong filter. the filter is 'years' not 'year'
{D90D301F-2FB0-4322-B459-89B2A35EE870}
https://trakt.docs.apiary.io/#introduction/filters

Comment thread src/NzbDrone.Core/ImportLists/Trakt/List/TraktListSettings.cs Outdated
Comment thread src/NzbDrone.Core/ImportLists/Trakt/TraktQueryHelper.cs
Comment thread src/NzbDrone.Core/ImportLists/Trakt/TraktQueryHelper.cs Outdated
Comment thread src/NzbDrone.Core/ImportLists/Trakt/User/TraktUserRequestGenerator.cs Outdated
Comment thread src/NzbDrone.Core/ImportLists/Trakt/List/TraktListRequestGenerator.cs Outdated
@Andrew-Ukkonen
Copy link
Copy Markdown
Contributor Author

{6CFEFDBE-5837-4B49-A4B1-B298326B14BA} {9AAA3FBB-88B8-4E8C-BA09-C1049F85B4A7} {2954C1FF-871E-489C-9A47-A29DBE62530D}

Trakt has a different filter for years between popular and user lists. In popular it only takes an exact year or year range. In user lists it takes a minimum year or year range.

* enforce consistency between generators

* separate additional parameters from manually added parameters. update years text between popular and user lists
Copy link
Copy Markdown
Member

@markus101 markus101 left a comment

Choose a reason for hiding this comment

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

Thanks for the fixes, looking better, mostly small clean up and more validation limits.

Comment thread src/NzbDrone.Core/Localization/Core/en.json Outdated
RuleFor(c => c.Listname).NotEmpty();

RuleFor(c => c.Years)
.Matches(@"^\d+(\-\d+)?$", RegexOptions.IgnoreCase)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be further limited to supported year formats, otherwise something like 234923498237423-234723477 would still pass.

RuleFor(c => c.AuthUser).NotEmpty();

RuleFor(c => c.Rating)
.Matches(@"^\d+\-\d+$", RegexOptions.IgnoreCase)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should also be more restrictive, if the range is 0-100, something like this might work better

Suggested change
.Matches(@"^\d+\-\d+$", RegexOptions.IgnoreCase)
.Matches(@"^\d{1,2}\-(?:\d{1-2}|100)$", RegexOptions.IgnoreCase)

Unless 100-100 is valid, then both sides of the - should be the same.

.WithMessage("Not a valid rating");

RuleFor(c => c.Years)
.Matches(@"^\d+(\-\d+)?$", RegexOptions.IgnoreCase)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same for years again.

.WithMessage("Must be integer greater than 0");

RuleFor(c => c.Rating)
.Matches(@"^\d+\-\d+$", RegexOptions.IgnoreCase)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

And for rating here.

var key = parts[0].Trim();

// Skip explicitly handled parameters
if (key.Equals("genres", StringComparison.OrdinalIgnoreCase) ||
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we add validation to prevent this as well as this safety net?

{
var key = parts[0].Trim();

// Skip explicitly handled parameters
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No need for this comment

{
var parameters = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

// Parse additional parameters first (lower priority)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No need for this comment.

@markus101 markus101 marked this pull request as draft April 12, 2026 22:14
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.

3 participants