diff --git a/src/NzbDrone.Api/Indexers/ReleaseResource.cs b/src/NzbDrone.Api/Indexers/ReleaseResource.cs index 2be0acbb9..ff76fd2a7 100644 --- a/src/NzbDrone.Api/Indexers/ReleaseResource.cs +++ b/src/NzbDrone.Api/Indexers/ReleaseResource.cs @@ -46,6 +46,7 @@ namespace NzbDrone.Api.Indexers public bool DownloadAllowed { get; set; } public int ReleaseWeight { get; set; } + public IEnumerable IndexerFlags { get; set; } public string MagnetUrl { get; set; } public string InfoHash { get; set; } @@ -132,7 +133,7 @@ namespace NzbDrone.Api.Indexers 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, diff --git a/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs b/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs index 03a20e493..ea6dc2794 100644 --- a/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs +++ b/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs @@ -55,15 +55,16 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn { 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 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn 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 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn 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 diff --git a/src/NzbDrone.Core/Parser/Model/ReleaseInfo.cs b/src/NzbDrone.Core/Parser/Model/ReleaseInfo.cs index 6f2812a7c..70be4ff99 100644 --- a/src/NzbDrone.Core/Parser/Model/ReleaseInfo.cs +++ b/src/NzbDrone.Core/Parser/Model/ReleaseInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Text; using NzbDrone.Core.Indexers; @@ -26,6 +26,8 @@ namespace NzbDrone.Core.Parser.Model public string Codec { get; set; } public string Resolution { get; set; } + public IndexerFlags IndexerFlags { get; set; } + public int Age { get @@ -91,4 +93,11 @@ namespace NzbDrone.Core.Parser.Model } } } + + [Flags] + public enum IndexerFlags + { + PTP_Golden = 1, //PTP + PTP_Approved = 2, //PTP + } } \ No newline at end of file diff --git a/src/UI/Cells/ReleaseTitleCell.js b/src/UI/Cells/ReleaseTitleCell.js index 761c642ff..cab9824e1 100644 --- a/src/UI/Cells/ReleaseTitleCell.js +++ b/src/UI/Cells/ReleaseTitleCell.js @@ -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('{1}'.format(infoUrl, title)); } else { diff --git a/src/UI/Release/ReleaseLayout.js b/src/UI/Release/ReleaseLayout.js index 9b1791ff6..7e8f0d7dd 100644 --- a/src/UI/Release/ReleaseLayout.js +++ b/src/UI/Release/ReleaseLayout.js @@ -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', diff --git a/src/UI/Release/ReleaseTitleCell.js b/src/UI/Release/ReleaseTitleCell.js new file mode 100644 index 000000000..c9050b971 --- /dev/null +++ b/src/UI/Release/ReleaseTitleCell.js @@ -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; + } +});