New: Show IndexerFlags on Interactive Search

pull/2/head
Qstick 5 years ago
parent f02fa629cc
commit fa2c4725be

@ -58,6 +58,7 @@ import {
faFileInvoice as farFileInvoice, faFileInvoice as farFileInvoice,
faFilm as fasFilm, faFilm as fasFilm,
faFilter as fasFilter, faFilter as fasFilter,
faFlag as fasFlag,
faFolderOpen as fasFolderOpen, faFolderOpen as fasFolderOpen,
faForward as fasForward, faForward as fasForward,
faHeart as fasHeart, faHeart as fasHeart,
@ -144,6 +145,7 @@ export const EXTERNAL_LINK = fasExternalLinkAlt;
export const FATAL = fasTimesCircle; export const FATAL = fasTimesCircle;
export const FILE = farFile; export const FILE = farFile;
export const FILTER = fasFilter; export const FILTER = fasFilter;
export const FLAG = fasFlag;
export const FOLDER = farFolder; export const FOLDER = farFolder;
export const FOLDER_OPEN = fasFolderOpen; export const FOLDER_OPEN = fasFolderOpen;
export const GROUP = farObjectGroup; export const GROUP = farObjectGroup;

@ -63,6 +63,12 @@ const columns = [
isSortable: true, isSortable: true,
isVisible: true isVisible: true
}, },
{
name: 'indexerFlags',
label: React.createElement(Icon, { name: icons.FLAG }),
isSortable: true,
isVisible: true
},
{ {
name: 'rejections', name: 'rejections',
label: React.createElement(Icon, { name: icons.DANGER }), label: React.createElement(Icon, { name: icons.DANGER }),

@ -21,6 +21,7 @@
} }
.rejected, .rejected,
.indexerFlags,
.download { .download {
composes: cell from '~Components/Table/Cells/TableRowCell.css'; composes: cell from '~Components/Table/Cells/TableRowCell.css';

@ -114,6 +114,7 @@ class InteractiveSearchRow extends Component {
leechers, leechers,
quality, quality,
languages, languages,
indexerFlags,
rejections, rejections,
downloadAllowed, downloadAllowed,
isGrabbing, isGrabbing,
@ -180,6 +181,35 @@ class InteractiveSearchRow extends Component {
/> />
</TableRowCell> </TableRowCell>
<TableRowCell className={styles.indexerFlags}>
{
!!indexerFlags.length &&
<Popover
anchor={
<Icon
name={icons.FLAG}
kind={kinds.PRIMARY}
/>
}
title="Indexer Flags"
body={
<ul>
{
indexerFlags.map((flag, index) => {
return (
<li key={index}>
{flag}
</li>
);
})
}
</ul>
}
position={tooltipPositions.LEFT}
/>
}
</TableRowCell>
<TableRowCell className={styles.rejected}> <TableRowCell className={styles.rejected}>
{ {
!!rejections.length && !!rejections.length &&
@ -251,6 +281,7 @@ InteractiveSearchRow.propTypes = {
quality: PropTypes.object.isRequired, quality: PropTypes.object.isRequired,
languages: PropTypes.arrayOf(PropTypes.object).isRequired, languages: PropTypes.arrayOf(PropTypes.object).isRequired,
rejections: PropTypes.arrayOf(PropTypes.string).isRequired, rejections: PropTypes.arrayOf(PropTypes.string).isRequired,
indexerFlags: PropTypes.arrayOf(PropTypes.string).isRequired,
downloadAllowed: PropTypes.bool.isRequired, downloadAllowed: PropTypes.bool.isRequired,
isGrabbing: PropTypes.bool.isRequired, isGrabbing: PropTypes.bool.isRequired,
isGrabbed: PropTypes.bool.isRequired, isGrabbed: PropTypes.bool.isRequired,

@ -35,6 +35,17 @@ export const defaultState = {
return seeders * 1000000 + leechers; return seeders * 1000000 + leechers;
}, },
indexerFlags: function(item, direction) {
const indexerFlags = item.indexerFlags;
const releaseWeight = item.releaseWeight;
if (indexerFlags.length === 0) {
return releaseWeight + 1000000;
}
return releaseWeight;
},
rejections: function(item, direction) { rejections: function(item, direction) {
const rejections = item.rejections; const rejections = item.rejections;
const releaseWeight = item.releaseWeight; const releaseWeight = item.releaseWeight;

@ -40,6 +40,7 @@ namespace Radarr.Api.V3.Indexers
public string InfoUrl { get; set; } public string InfoUrl { get; set; }
public bool DownloadAllowed { get; set; } public bool DownloadAllowed { get; set; }
public int ReleaseWeight { get; set; } public int ReleaseWeight { get; set; }
public IEnumerable<string> IndexerFlags { get; set; }
public string MagnetUrl { get; set; } public string MagnetUrl { get; set; }
public string InfoHash { get; set; } public string InfoHash { get; set; }
@ -47,11 +48,6 @@ namespace Radarr.Api.V3.Indexers
public int? Leechers { get; set; } public int? Leechers { get; set; }
public DownloadProtocol Protocol { get; set; } public DownloadProtocol Protocol { get; set; }
public bool IsDaily { get; set; }
public bool IsAbsoluteNumbering { get; set; }
public bool IsPossibleSpecialEpisode { get; set; }
public bool Special { get; set; }
// Sent when queuing an unknown release // Sent when queuing an unknown release
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public int? MovieId { get; set; } public int? MovieId { get; set; }
@ -65,6 +61,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 string[] { ", " }, StringSplitOptions.None).Where(x => x != "0");
// 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
@ -100,7 +97,8 @@ namespace Radarr.Api.V3.Indexers
InfoHash = torrentInfo.InfoHash, InfoHash = torrentInfo.InfoHash,
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
}; };
} }

Loading…
Cancel
Save