AHD, PTP and HDB support the new indexer flags too now! Indexer flags can be preferred over other releases.

This commit is contained in:
Leonardo Galli
2017-04-17 17:12:09 +02:00
committed by GitHub
parent 10091b9454
commit 433ae019de
21 changed files with 424 additions and 132 deletions

View File

@@ -0,0 +1,58 @@
var Backgrid = require('backgrid');
var Marionette = require('marionette');
require('bootstrap');
module.exports = Backgrid.Cell.extend({
className : 'edition-cell',
//template : 'Cells/EditionCellTemplate',
render : function() {
var flags = this.model.get("indexerFlags");
if (!flags) {
return this;
}
var html = "";
if (flags) {
_.each(flags, function(flag){
var addon = "";
var title = "";
switch (flag) {
case "G_Freeleech":
addon = "⬇";
title = "Freeleech";
break;
case "G_Halfleech":
addon = "⇩";
title = "50% Freeleech";
break;
case "G_DoubleUpload":
addon = "⬆";
title = "Double upload";
break;
case "PTP_Golden":
addon = "🍿";
title = "Golden";
break;
case "PTP_Approved":
addon = "✔";
title = "Approved by PTP"
case "HDB_Internal":
addon = "⭐️";
title = "HDBits Internal";
break;
}
if (addon != "") {
html += "<span title='{0}'>{1}</span> ".format(title, addon);
}
});
}
this.$el.html(html);
return this;
}
});

View File

@@ -10,22 +10,7 @@ module.exports = NzbDroneCell.extend({
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));

View File

@@ -9,6 +9,7 @@ var AgeCell = require('../../Release/AgeCell');
var ProtocolCell = require('../../Release/ProtocolCell');
var PeersCell = require('../../Release/PeersCell');
var EditionCell = require('../../Cells/EditionCell');
var IndexerFlagsCell = require('../../Cells/IndexerFlagsCell');
module.exports = Marionette.Layout.extend({
template : 'Movies/Search/ManualLayoutTemplate',
@@ -39,6 +40,11 @@ module.exports = Marionette.Layout.extend({
cell : EditionCell,
title : "Edition",
},
{
name : 'flags',
label : 'Flags',
cell : IndexerFlagsCell,
},
{
name : 'indexer',
label : 'Indexer',

View File

@@ -33,6 +33,33 @@ var Collection = PagableCollection.extend({
"edition" : {
sortKey : "edition"
},
"flags" : {
sortValue : function(model) {
var flags = model.get("indexerFlags");
var weight = 0;
if (flags) {
_.each(flags, function(flag){
var addon = "";
var title = "";
switch (flag) {
case "G_Halfleech":
weight += 1;
break;
case "G_Freeleech":
case "G_DoubleUpload":
case "PTP_Approved":
case "PTP_Golden":
case "HDB_Internal":
weight += 2;
break;
}
});
}
return weight;
}
},
'download' : {
sortKey : 'releaseWeight'
},

View File

@@ -8,7 +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");
var ReleaseTitleCell = require("../Cells/ReleaseTitleCell");
module.exports = Marionette.Layout.extend({
template : 'Release/ReleaseLayoutTemplate',

View File

@@ -1,33 +0,0 @@
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;
}
});

View File

@@ -25,6 +25,27 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Prefer Special Indexer Flags</label>
<div class="col-sm-1 col-sm-push-2 help-inline">
<i class="icon-sonarr-form-info" title="If set to yes, the more indexer flags (such as Golden, Approved, Internal, Freeleech, Double upload, etc.) a release has the more priorized it will be. Quality and Preferred words would still come first."/>
</div>
<div class="col-sm-2 col-sm-pull-1">
<div class="input-group">
<label class="checkbox toggle well">
<input type="checkbox" name="preferIndexerFlags" class="x-completed-download-handling"/>
<p>
<span>Yes</span>
<span>No</span>
</p>
<div class="btn btn-primary slide-button"/>
</label>
</div>
</div>
</div>
<div class="form-group advanced-setting">
<label class="col-sm-3 control-label">RSS Sync Interval</label>