From 3400e3f8e7310c4cbd85311884f7b97c336c9b88 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Wed, 21 Feb 2024 20:50:03 +0200 Subject: [PATCH] Change type for indexer flags in Interactive Search --- .../InteractiveSearch/InteractiveSearchRow.tsx | 15 +++++---------- src/Radarr.Api.V3/Indexers/ReleaseResource.cs | 6 +++--- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/frontend/src/InteractiveSearch/InteractiveSearchRow.tsx b/frontend/src/InteractiveSearch/InteractiveSearchRow.tsx index 981f69dd5..87b73a368 100644 --- a/frontend/src/InteractiveSearch/InteractiveSearchRow.tsx +++ b/frontend/src/InteractiveSearch/InteractiveSearchRow.tsx @@ -11,6 +11,7 @@ import Tooltip from 'Components/Tooltip/Tooltip'; import type DownloadProtocol from 'DownloadClient/DownloadProtocol'; import { icons, kinds, tooltipPositions } from 'Helpers/Props'; import Language from 'Language/Language'; +import IndexerFlags from 'Movie/IndexerFlags'; import MovieFormats from 'Movie/MovieFormats'; import MovieLanguage from 'Movie/MovieLanguage'; import MovieQuality from 'Movie/MovieQuality'; @@ -90,7 +91,7 @@ interface InteractiveSearchRowProps { customFormats: CustomFormat[]; customFormatScore: number; mappedMovieId?: number; - indexerFlags: string[]; + indexerFlags: 0; rejections: string[]; downloadAllowed: boolean; isGrabbing: boolean; @@ -125,7 +126,7 @@ function InteractiveSearchRow(props: InteractiveSearchRowProps) { customFormatScore, customFormats, mappedMovieId, - indexerFlags = [], + indexerFlags = 0, rejections = [], downloadAllowed, isGrabbing = false, @@ -281,17 +282,11 @@ function InteractiveSearchRow(props: InteractiveSearchRowProps) { - {indexerFlags.length ? ( + {indexerFlags ? ( } title={translate('IndexerFlags')} - body={ -
    - {indexerFlags.map((flag, index) => { - return
  • {flag}
  • ; - })} -
- } + body={} position={tooltipPositions.LEFT} /> ) : null} diff --git a/src/Radarr.Api.V3/Indexers/ReleaseResource.cs b/src/Radarr.Api.V3/Indexers/ReleaseResource.cs index c918ac0a9..fb2807424 100644 --- a/src/Radarr.Api.V3/Indexers/ReleaseResource.cs +++ b/src/Radarr.Api.V3/Indexers/ReleaseResource.cs @@ -52,7 +52,7 @@ namespace Radarr.Api.V3.Indexers public int? Seeders { get; set; } public int? Leechers { get; set; } public DownloadProtocol Protocol { get; set; } - public IEnumerable IndexerFlags { get; set; } + public int IndexerFlags { get; set; } // Sent when queuing an unknown release [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] @@ -76,7 +76,7 @@ namespace Radarr.Api.V3.Indexers var parsedMovieInfo = model.RemoteMovie.ParsedMovieInfo; var remoteMovie = model.RemoteMovie; var torrentInfo = (model.RemoteMovie.Release as TorrentInfo) ?? new TorrentInfo(); - var indexerFlags = torrentInfo.IndexerFlags.ToString().Split(new[] { ", " }, StringSplitOptions.None).Where(x => x != "0"); + var indexerFlags = torrentInfo.IndexerFlags; // TODO: Clean this mess up. don't mix data from multiple classes, use sub-resources instead? (Got a huge Deja Vu, didn't we talk about this already once?) return new ReleaseResource @@ -118,7 +118,7 @@ namespace Radarr.Api.V3.Indexers Seeders = torrentInfo.Seeders, Leechers = (torrentInfo.Peers.HasValue && torrentInfo.Seeders.HasValue) ? (torrentInfo.Peers.Value - torrentInfo.Seeders.Value) : (int?)null, Protocol = releaseInfo.DownloadProtocol, - IndexerFlags = indexerFlags + IndexerFlags = (int)indexerFlags }; }