Skip to content

Commit

Permalink
Change type for indexer flags in Interactive Search
Browse files Browse the repository at this point in the history
  • Loading branch information
mynameisbogdan committed Feb 21, 2024
1 parent b6b809f commit 3400e3f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
15 changes: 5 additions & 10 deletions frontend/src/InteractiveSearch/InteractiveSearchRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -90,7 +91,7 @@ interface InteractiveSearchRowProps {
customFormats: CustomFormat[];
customFormatScore: number;
mappedMovieId?: number;
indexerFlags: string[];
indexerFlags: 0;
rejections: string[];
downloadAllowed: boolean;
isGrabbing: boolean;
Expand Down Expand Up @@ -125,7 +126,7 @@ function InteractiveSearchRow(props: InteractiveSearchRowProps) {
customFormatScore,
customFormats,
mappedMovieId,
indexerFlags = [],
indexerFlags = 0,
rejections = [],
downloadAllowed,
isGrabbing = false,
Expand Down Expand Up @@ -281,17 +282,11 @@ function InteractiveSearchRow(props: InteractiveSearchRowProps) {
</TableRowCell>

<TableRowCell className={styles.indexerFlags}>
{indexerFlags.length ? (
{indexerFlags ? (
<Popover
anchor={<Icon name={icons.FLAG} kind={kinds.PRIMARY} />}
title={translate('IndexerFlags')}
body={
<ul>
{indexerFlags.map((flag, index) => {
return <li key={index}>{flag}</li>;
})}
</ul>
}
body={<IndexerFlags indexerFlags={indexerFlags} />}
position={tooltipPositions.LEFT}
/>
) : null}
Expand Down
6 changes: 3 additions & 3 deletions src/Radarr.Api.V3/Indexers/ReleaseResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class ReleaseResource : RestResource
public int? Seeders { get; set; }
public int? Leechers { get; set; }
public DownloadProtocol Protocol { get; set; }
public IEnumerable<string> IndexerFlags { get; set; }
public int IndexerFlags { get; set; }

// Sent when queuing an unknown release
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
Expand All @@ -76,7 +76,7 @@ public static ReleaseResource ToResource(this DownloadDecision model)
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
Expand Down Expand Up @@ -118,7 +118,7 @@ public static ReleaseResource ToResource(this DownloadDecision model)
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
};
}

Expand Down

0 comments on commit 3400e3f

Please sign in to comment.