Change type for indexer flags in Interactive Search

Bogdan 3 months ago
parent b6b809f473
commit 3400e3f8e7

@ -11,6 +11,7 @@ import Tooltip from 'Components/Tooltip/Tooltip';
import type DownloadProtocol from 'DownloadClient/DownloadProtocol'; import type DownloadProtocol from 'DownloadClient/DownloadProtocol';
import { icons, kinds, tooltipPositions } from 'Helpers/Props'; import { icons, kinds, tooltipPositions } from 'Helpers/Props';
import Language from 'Language/Language'; import Language from 'Language/Language';
import IndexerFlags from 'Movie/IndexerFlags';
import MovieFormats from 'Movie/MovieFormats'; import MovieFormats from 'Movie/MovieFormats';
import MovieLanguage from 'Movie/MovieLanguage'; import MovieLanguage from 'Movie/MovieLanguage';
import MovieQuality from 'Movie/MovieQuality'; import MovieQuality from 'Movie/MovieQuality';
@ -90,7 +91,7 @@ interface InteractiveSearchRowProps {
customFormats: CustomFormat[]; customFormats: CustomFormat[];
customFormatScore: number; customFormatScore: number;
mappedMovieId?: number; mappedMovieId?: number;
indexerFlags: string[]; indexerFlags: 0;
rejections: string[]; rejections: string[];
downloadAllowed: boolean; downloadAllowed: boolean;
isGrabbing: boolean; isGrabbing: boolean;
@ -125,7 +126,7 @@ function InteractiveSearchRow(props: InteractiveSearchRowProps) {
customFormatScore, customFormatScore,
customFormats, customFormats,
mappedMovieId, mappedMovieId,
indexerFlags = [], indexerFlags = 0,
rejections = [], rejections = [],
downloadAllowed, downloadAllowed,
isGrabbing = false, isGrabbing = false,
@ -281,17 +282,11 @@ function InteractiveSearchRow(props: InteractiveSearchRowProps) {
</TableRowCell> </TableRowCell>
<TableRowCell className={styles.indexerFlags}> <TableRowCell className={styles.indexerFlags}>
{indexerFlags.length ? ( {indexerFlags ? (
<Popover <Popover
anchor={<Icon name={icons.FLAG} kind={kinds.PRIMARY} />} anchor={<Icon name={icons.FLAG} kind={kinds.PRIMARY} />}
title={translate('IndexerFlags')} title={translate('IndexerFlags')}
body={ body={<IndexerFlags indexerFlags={indexerFlags} />}
<ul>
{indexerFlags.map((flag, index) => {
return <li key={index}>{flag}</li>;
})}
</ul>
}
position={tooltipPositions.LEFT} position={tooltipPositions.LEFT}
/> />
) : null} ) : null}

@ -52,7 +52,7 @@ namespace Radarr.Api.V3.Indexers
public int? Seeders { get; set; } public int? Seeders { get; set; }
public int? Leechers { get; set; } public int? Leechers { get; set; }
public DownloadProtocol Protocol { get; set; } public DownloadProtocol Protocol { get; set; }
public IEnumerable<string> IndexerFlags { get; set; } public int IndexerFlags { get; set; }
// Sent when queuing an unknown release // Sent when queuing an unknown release
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
@ -76,7 +76,7 @@ namespace Radarr.Api.V3.Indexers
var parsedMovieInfo = model.RemoteMovie.ParsedMovieInfo; var parsedMovieInfo = model.RemoteMovie.ParsedMovieInfo;
var remoteMovie = model.RemoteMovie; var remoteMovie = model.RemoteMovie;
var torrentInfo = (model.RemoteMovie.Release as TorrentInfo) ?? new TorrentInfo(); 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?) // 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 return new ReleaseResource
@ -118,7 +118,7 @@ namespace Radarr.Api.V3.Indexers
Seeders = torrentInfo.Seeders, Seeders = torrentInfo.Seeders,
Leechers = (torrentInfo.Peers.HasValue && torrentInfo.Seeders.HasValue) ? (torrentInfo.Peers.Value - torrentInfo.Seeders.Value) : (int?)null, Leechers = (torrentInfo.Peers.HasValue && torrentInfo.Seeders.HasValue) ? (torrentInfo.Peers.Value - torrentInfo.Seeders.Value) : (int?)null,
Protocol = releaseInfo.DownloadProtocol, Protocol = releaseInfo.DownloadProtocol,
IndexerFlags = indexerFlags IndexerFlags = (int)indexerFlags
}; };
} }

Loading…
Cancel
Save