mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 20:12:41 +02:00
Indexer flags implementation. (#1377) Will be further finalized over the next few weeks with Freelech, preferring of certain flags, etc
This commit is contained in:
parent
3790dc9109
commit
33b48eec95
@ -46,6 +46,7 @@ public class ReleaseResource : RestResource
|
||||
public bool DownloadAllowed { get; set; }
|
||||
public int ReleaseWeight { get; set; }
|
||||
|
||||
public IEnumerable<string> IndexerFlags { get; set; }
|
||||
|
||||
public string MagnetUrl { get; set; }
|
||||
public string InfoHash { get; set; }
|
||||
@ -132,7 +133,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 = torrentInfo.IndexerFlags.ToString().Split(new string[] { ", " }, StringSplitOptions.None),
|
||||
Edition = parsedMovieInfo.Edition,
|
||||
|
||||
IsDaily = false,
|
||||
|
@ -55,15 +55,16 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
||||
{
|
||||
var id = torrent.Id;
|
||||
var title = torrent.ReleaseName;
|
||||
IndexerFlags flags = 0;
|
||||
|
||||
if (torrent.GoldenPopcorn)
|
||||
{
|
||||
title = $"{title} 🍿";
|
||||
flags |= IndexerFlags.PTP_Golden;//title = $"{title} 🍿";
|
||||
}
|
||||
|
||||
if (torrent.Checked)
|
||||
{
|
||||
title = $"{title} ✔";
|
||||
flags |= IndexerFlags.PTP_Approved;//title = $"{title} ✔";
|
||||
}
|
||||
|
||||
// Only add approved torrents
|
||||
@ -82,9 +83,11 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
||||
Golden = torrent.GoldenPopcorn,
|
||||
Scene = torrent.Scene,
|
||||
Approved = torrent.Checked,
|
||||
ImdbId = (result.ImdbId.IsNotNullOrWhiteSpace() ? int.Parse(result.ImdbId) : 0)
|
||||
ImdbId = (result.ImdbId.IsNotNullOrWhiteSpace() ? int.Parse(result.ImdbId) : 0),
|
||||
IndexerFlags = flags
|
||||
});
|
||||
}
|
||||
|
||||
// Add all torrents
|
||||
else if (!_settings.RequireApproved)
|
||||
{
|
||||
@ -101,7 +104,8 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
||||
Golden = torrent.GoldenPopcorn,
|
||||
Scene = torrent.Scene,
|
||||
Approved = torrent.Checked,
|
||||
ImdbId = (result.ImdbId.IsNotNullOrWhiteSpace() ? int.Parse(result.ImdbId) : 0)
|
||||
ImdbId = (result.ImdbId.IsNotNullOrWhiteSpace() ? int.Parse(result.ImdbId) : 0),
|
||||
IndexerFlags = flags
|
||||
});
|
||||
}
|
||||
// Don't add any torrents
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Text;
|
||||
using NzbDrone.Core.Indexers;
|
||||
|
||||
@ -26,6 +26,8 @@ public class ReleaseInfo
|
||||
public string Codec { get; set; }
|
||||
public string Resolution { get; set; }
|
||||
|
||||
public IndexerFlags IndexerFlags { get; set; }
|
||||
|
||||
public int Age
|
||||
{
|
||||
get
|
||||
@ -91,4 +93,11 @@ public virtual string ToString(string format)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum IndexerFlags
|
||||
{
|
||||
PTP_Golden = 1, //PTP
|
||||
PTP_Approved = 2, //PTP
|
||||
}
|
||||
}
|
@ -9,6 +9,24 @@ module.exports = NzbDroneCell.extend({
|
||||
var title = this.model.get('title');
|
||||
var infoUrl = this.model.get('infoUrl');
|
||||
|
||||
var flags = this.model.get("indexerFlags");
|
||||
if (flags) {
|
||||
_.each(flags, function(flag){
|
||||
var addon = "";
|
||||
|
||||
switch (flag) {
|
||||
case "PTP_Golden":
|
||||
addon = "🍿";
|
||||
break;
|
||||
case "PTP_Approved":
|
||||
addon = "✔";
|
||||
break;
|
||||
}
|
||||
|
||||
title += addon;
|
||||
});
|
||||
}
|
||||
|
||||
if (infoUrl) {
|
||||
this.$el.html('<a href="{0}">{1}</a>'.format(infoUrl, title));
|
||||
} else {
|
||||
|
@ -8,6 +8,7 @@ var QualityCell = require('../Cells/QualityCell');
|
||||
var ApprovalStatusCell = require('../Cells/ApprovalStatusCell');
|
||||
var LoadingView = require('../Shared/LoadingView');
|
||||
var EditionCell = require('../Cells/EditionCell');
|
||||
var ReleaseTitleCell = require("./ReleaseTitleCell");
|
||||
|
||||
module.exports = Marionette.Layout.extend({
|
||||
template : 'Release/ReleaseLayoutTemplate',
|
||||
@ -34,7 +35,7 @@ module.exports = Marionette.Layout.extend({
|
||||
name : 'title',
|
||||
label : 'Title',
|
||||
sortable : true,
|
||||
cell : Backgrid.StringCell
|
||||
cell : ReleaseTitleCell
|
||||
},
|
||||
/*{
|
||||
name : 'episodeNumbers',
|
||||
|
33
src/UI/Release/ReleaseTitleCell.js
Normal file
33
src/UI/Release/ReleaseTitleCell.js
Normal file
@ -0,0 +1,33 @@
|
||||
var _ = require('underscore');
|
||||
var Backgrid = require('backgrid');
|
||||
|
||||
var FormatHelpers = require('../Shared/FormatHelpers');
|
||||
|
||||
module.exports = Backgrid.Cell.extend({
|
||||
className : 'title-cell',
|
||||
|
||||
render : function() {
|
||||
debugger;
|
||||
var title = this.model.get('title');
|
||||
var flags = this.model.get("indexerFlags");
|
||||
if (flags) {
|
||||
_.each(flags, function(flag){
|
||||
var addon = "";
|
||||
debugger;
|
||||
switch (flag) {
|
||||
case "PTP_Golden":
|
||||
addon = "🍿";
|
||||
break;
|
||||
case "PTP_Approved":
|
||||
addon = "✔";
|
||||
break;
|
||||
}
|
||||
|
||||
title += addon;
|
||||
});
|
||||
}
|
||||
this.$el.html(title);
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue
Block a user