From aa5dbc91c1610e6e0da5f52b9f1a701f399799cb Mon Sep 17 00:00:00 2001 From: TheRealNoob Date: Sat, 8 Aug 2026 22:39:06 -0500 Subject: [PATCH] fix: use MaM's tor[searchType] parameter for filter options All filter options (Active, Freeleech, FreeleechOrVip, Vip, NotVip) were sending unrecognised boolean parameters that MaM silently ignores, causing filters to have no effect on search results. MaM's API uses a single tor[searchType] parameter with specific string values. Replace the five separate boolean parameters with the correct tor[searchType] values matching Prowlarr's working implementation: Active -> tor[searchType]=active Freeleech -> tor[searchType]=fl FreeleechOrVip -> tor[searchType]=fl-VIP Vip -> tor[searchType]=VIP NotVip -> tor[searchType]=nVIP Empirically confirmed: Not VIP filter now returns 1 result instead of 5 (including 3 VIP torrents) for the same query. Fixes #805 --- .../MyAnonamouseRequestFactory.cs | 32 ++++++++----------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/listenarr.infrastructure/Search/Providers/MyAnonamouse/MyAnonamouseRequestFactory.cs b/listenarr.infrastructure/Search/Providers/MyAnonamouse/MyAnonamouseRequestFactory.cs index beae91a9e..30b9a7c9e 100644 --- a/listenarr.infrastructure/Search/Providers/MyAnonamouse/MyAnonamouseRequestFactory.cs +++ b/listenarr.infrastructure/Search/Providers/MyAnonamouse/MyAnonamouseRequestFactory.cs @@ -82,26 +82,20 @@ public static Uri BuildSearchUri(Indexer indexer, string query, SearchRequest? r queryParameters.Add(new($"tor[srchIn][{field.Key}]", field.Value ? "true" : "false")); } - queryParameters.Add(new("tor[searchType]", searchType)); - - switch (request?.MyAnonamouse?.Filter) + // MaM uses tor[searchType] for both text-search mode (title/author/all) and + // content filters (active, fl, nVIP, etc.). A filter takes precedence over the + // text-search mode value, so resolve the final value once and add it once. + var filterValue = request?.MyAnonamouse?.Filter switch { - case MamTorrentFilter.Active: - queryParameters.Add(new("tor[onlyActive]", "1")); - break; - case MamTorrentFilter.Freeleech: - queryParameters.Add(new("tor[onlyFreeleech]", "1")); - break; - case MamTorrentFilter.FreeleechOrVip: - queryParameters.Add(new("tor[freeleechOrVip]", "1")); - break; - case MamTorrentFilter.Vip: - queryParameters.Add(new("tor[onlyVip]", "1")); - break; - case MamTorrentFilter.NotVip: - queryParameters.Add(new("tor[notVip]", "1")); - break; - } + MamTorrentFilter.Active => "active", + MamTorrentFilter.Freeleech => "fl", + MamTorrentFilter.FreeleechOrVip => "fl-VIP", + MamTorrentFilter.Vip => "VIP", + MamTorrentFilter.NotVip => "nVIP", + _ => null + }; + + queryParameters.Add(new("tor[searchType]", filterValue ?? searchType)); if (request?.MyAnonamouse?.FreeleechWedge is { } freeleechWedge) {