New: Show source/seed info in manual search

pull/2/head
Keivan Beigi 10 years ago
parent 3d1e0e7042
commit d849a4ab48

@ -54,7 +54,7 @@ namespace NzbDrone.Api.Indexers
private Response DownloadRelease(ReleaseResource release) private Response DownloadRelease(ReleaseResource release)
{ {
var remoteEpisode = _remoteEpisodeCache.Find(release.Guid); var remoteEpisode = _remoteEpisodeCache.Find(release.Guid);
if (remoteEpisode == null) if (remoteEpisode == null)
{ {
_logger.Debug("Couldn't find requested release in cache, cache timeout probably expired."); _logger.Debug("Couldn't find requested release in cache, cache timeout probably expired.");
@ -142,6 +142,21 @@ namespace NzbDrone.Api.Indexers
release.QualityWeight += release.Quality.Revision.Real * 10; release.QualityWeight += release.Quality.Revision.Real * 10;
release.QualityWeight += release.Quality.Revision.Version; release.QualityWeight += release.Quality.Revision.Version;
var torrentRelease = downloadDecision.RemoteEpisode.Release as TorrentInfo;
if (torrentRelease != null)
{
release.Protocol = DownloadProtocol.Torrent;
release.Seeders = torrentRelease.Seeders;
//TODO: move this up the chains
release.Leechers = torrentRelease.Peers - torrentRelease.Seeders;
}
else
{
release.Protocol = DownloadProtocol.Usenet;
}
result.Add(release); result.Add(release);
} }

@ -42,6 +42,11 @@ namespace NzbDrone.Api.Indexers
public DownloadProtocol DownloadProtocol { get; set; } public DownloadProtocol DownloadProtocol { get; set; }
public Int32 ReleaseWeight { get; set; } public Int32 ReleaseWeight { get; set; }
public int? Seeders { get; set; }
public int? Leechers { get; set; }
public DownloadProtocol Protocol { get; set; }
public Boolean IsDaily { get; set; } public Boolean IsDaily { get; set; }
public Boolean IsAbsoluteNumbering { get; set; } public Boolean IsAbsoluteNumbering { get; set; }
public Boolean IsPossibleSpecialEpisode { get; set; } public Boolean IsPossibleSpecialEpisode { get; set; }

@ -52,7 +52,7 @@ namespace NzbDrone.Core.Test.IndexerTests.BitMeTvTests
torrentInfo.InfoHash.Should().Be(null); torrentInfo.InfoHash.Should().Be(null);
torrentInfo.MagnetUrl.Should().Be(null); torrentInfo.MagnetUrl.Should().Be(null);
torrentInfo.Peers.Should().Be(null); torrentInfo.Peers.Should().Be(null);
torrentInfo.Seeds.Should().Be(null); torrentInfo.Seeders.Should().Be(null);
} }
} }
} }

@ -54,7 +54,7 @@ namespace NzbDrone.Core.Test.IndexerTests.BroadcastheNetTests
torrentInfo.TvRageId.Should().Be(4055); torrentInfo.TvRageId.Should().Be(4055);
torrentInfo.MagnetUrl.Should().BeNullOrEmpty(); torrentInfo.MagnetUrl.Should().BeNullOrEmpty();
torrentInfo.Peers.Should().Be(9); torrentInfo.Peers.Should().Be(9);
torrentInfo.Seeds.Should().Be(40); torrentInfo.Seeders.Should().Be(40);
} }
private void VerifyBackOff() private void VerifyBackOff()

@ -51,7 +51,7 @@ namespace NzbDrone.Core.Test.IndexerTests.EztvTests
torrentInfo.InfoHash.Should().Be("20FC4FBFA88272274AC671F857CC15144E9AA83E"); torrentInfo.InfoHash.Should().Be("20FC4FBFA88272274AC671F857CC15144E9AA83E");
torrentInfo.MagnetUrl.Should().Be("magnet:?xt=urn:btih:ED6E7P5IQJZCOSWGOH4FPTAVCRHJVKB6&dn=S4C.I.Grombil.Cyfandir.Pell.American.Interior.PDTV.x264-MVGroup"); torrentInfo.MagnetUrl.Should().Be("magnet:?xt=urn:btih:ED6E7P5IQJZCOSWGOH4FPTAVCRHJVKB6&dn=S4C.I.Grombil.Cyfandir.Pell.American.Interior.PDTV.x264-MVGroup");
torrentInfo.Peers.Should().NotHaveValue(); torrentInfo.Peers.Should().NotHaveValue();
torrentInfo.Seeds.Should().NotHaveValue(); torrentInfo.Seeders.Should().NotHaveValue();
} }
} }
} }

@ -51,7 +51,7 @@ namespace NzbDrone.Core.Test.IndexerTests.IPTorrentsTests
torrentInfo.InfoHash.Should().Be(null); torrentInfo.InfoHash.Should().Be(null);
torrentInfo.MagnetUrl.Should().Be(null); torrentInfo.MagnetUrl.Should().Be(null);
torrentInfo.Peers.Should().Be(null); torrentInfo.Peers.Should().Be(null);
torrentInfo.Seeds.Should().Be(null); torrentInfo.Seeders.Should().Be(null);
} }
} }
} }

@ -52,7 +52,7 @@ namespace NzbDrone.Core.Test.IndexerTests.KickassTorrentsTests
torrentInfo.InfoHash.Should().Be("208C4F7866612CC88BFEBC7C496FA72C2368D1C0"); torrentInfo.InfoHash.Should().Be("208C4F7866612CC88BFEBC7C496FA72C2368D1C0");
torrentInfo.MagnetUrl.Should().Be("magnet:?xt=urn:btih:208C4F7866612CC88BFEBC7C496FA72C2368D1C0&dn=doctor+stranger+e03+140512+hdtv+h264+720p+ipop+avi+ctrg&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce"); torrentInfo.MagnetUrl.Should().Be("magnet:?xt=urn:btih:208C4F7866612CC88BFEBC7C496FA72C2368D1C0&dn=doctor+stranger+e03+140512+hdtv+h264+720p+ipop+avi+ctrg&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce");
torrentInfo.Peers.Should().Be(311); torrentInfo.Peers.Should().Be(311);
torrentInfo.Seeds.Should().Be(206); torrentInfo.Seeders.Should().Be(206);
} }
[Test] [Test]

@ -51,7 +51,7 @@ namespace NzbDrone.Core.Test.IndexerTests.NyaaTests
torrentInfo.InfoHash.Should().Be(null); torrentInfo.InfoHash.Should().Be(null);
torrentInfo.MagnetUrl.Should().Be(null); torrentInfo.MagnetUrl.Should().Be(null);
torrentInfo.Peers.Should().Be(2); torrentInfo.Peers.Should().Be(2);
torrentInfo.Seeds.Should().Be(1); torrentInfo.Seeders.Should().Be(1);
} }
} }
} }

@ -51,7 +51,7 @@ namespace NzbDrone.Core.Test.IndexerTests.TorrentleechTests
torrentInfo.InfoHash.Should().Be(null); torrentInfo.InfoHash.Should().Be(null);
torrentInfo.MagnetUrl.Should().Be(null); torrentInfo.MagnetUrl.Should().Be(null);
torrentInfo.Peers.Should().Be(7); torrentInfo.Peers.Should().Be(7);
torrentInfo.Seeds.Should().Be(1); torrentInfo.Seeders.Should().Be(1);
} }
} }
} }

@ -31,10 +31,10 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.Search
return Decision.Accept(); return Decision.Accept();
} }
if (torrentInfo.Seeds != null && torrentInfo.Seeds < 1) if (torrentInfo.Seeders != null && torrentInfo.Seeders < 1)
{ {
_logger.Debug("Not enough seeders. ({0})", torrentInfo.Seeds); _logger.Debug("Not enough seeders. ({0})", torrentInfo.Seeders);
return Decision.Reject("Not enough seeders. ({0})", torrentInfo.Seeds); return Decision.Reject("Not enough seeders. ({0})", torrentInfo.Seeders);
} }
return Decision.Accept(); return Decision.Accept();

@ -58,7 +58,7 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
torrentInfo.PublishDate = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).ToUniversalTime().AddSeconds(torrent.Time); torrentInfo.PublishDate = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).ToUniversalTime().AddSeconds(torrent.Time);
//torrentInfo.MagnetUrl = //torrentInfo.MagnetUrl =
torrentInfo.InfoHash = torrent.InfoHash; torrentInfo.InfoHash = torrent.InfoHash;
torrentInfo.Seeds = torrent.Seeders; torrentInfo.Seeders = torrent.Seeders;
torrentInfo.Peers = torrent.Leechers; torrentInfo.Peers = torrent.Leechers;
results.Add(torrentInfo); results.Add(torrentInfo);

@ -26,7 +26,7 @@ namespace NzbDrone.Core.Indexers
result.InfoHash = GetInfoHash(item); result.InfoHash = GetInfoHash(item);
result.MagnetUrl = GetMagnetUrl(item); result.MagnetUrl = GetMagnetUrl(item);
result.Seeds = GetSeeders(item); result.Seeders = GetSeeders(item);
result.Peers = GetPeers(item); result.Peers = GetPeers(item);
return result; return result;

@ -6,7 +6,7 @@ namespace NzbDrone.Core.Parser.Model
{ {
public string MagnetUrl { get; set; } public string MagnetUrl { get; set; }
public string InfoHash { get; set; } public string InfoHash { get; set; }
public Int32? Seeds { get; set; } public Int32? Seeders { get; set; }
public Int32? Peers { get; set; } public Int32? Peers { get; set; }
public static Int32? GetSeeders(ReleaseInfo release) public static Int32? GetSeeders(ReleaseInfo release)
@ -17,7 +17,7 @@ namespace NzbDrone.Core.Parser.Model
{ {
return null; return null;
} }
return torrentInfo.Seeds; return torrentInfo.Seeders;
} }
} }
} }

@ -19,7 +19,7 @@
@import "../Hotkeys/hotkeys"; @import "../Hotkeys/hotkeys";
.main-region { .main-region {
@media (min-width: @screen-lg-min) { @media (min-width : @screen-lg-min) {
padding-left : 30px; padding-left : 30px;
padding-right : 30px; padding-right : 30px;
} }
@ -28,12 +28,12 @@
.toolbar { .toolbar {
&:after { &:after {
visibility: hidden; visibility : hidden;
display: block; display : block;
font-size: 0; font-size : 0;
content: " "; content : " ";
clear: both; clear : both;
height: 0; height : 0;
} }
.page-toolbar { .page-toolbar {
@ -41,13 +41,13 @@
margin-bottom : 30px; margin-bottom : 30px;
.toolbar-group { .toolbar-group {
display: inline-block; display : inline-block;
} }
.sorting-buttons { .sorting-buttons {
.sorting-title { .sorting-title {
display: inline-block; display : inline-block;
width: 110px; width : 110px;
} }
} }
} }
@ -86,7 +86,7 @@
.control-panel-visible { .control-panel-visible {
#scroll-up { #scroll-up {
bottom: 100px; bottom : 100px;
} }
} }
@ -101,7 +101,7 @@
} }
.label-disabled { .label-disabled {
opacity: 0.5; opacity : 0.5;
} }
th { th {
@ -123,10 +123,9 @@ a, .btn {
} }
body { body {
background: background : url('../Content/Images/background/logo.png') 50px center no-repeat fixed, #272727;
url('../Content/Images/background/logo.png') 50px center no-repeat fixed,#272727;
margin-bottom : 100px; margin-bottom : 100px;
p { p {
font-size : 0.9em; font-size : 0.9em;
} }
@ -163,10 +162,10 @@ body {
.card(#aaaaaa); .card(#aaaaaa);
/* width : 1210px; /* width : 1210px;
min-width : 1210px; */ min-width : 1210px; */
max-width : 1210px; max-width : 1210px;
margin : auto; margin : auto;
// margin-top : -70px; // margin-top : -70px;
padding : 20px 0px; padding : 20px 0px;
.header { .header {
padding-bottom : 10px; padding-bottom : 10px;
@ -203,15 +202,15 @@ body {
} }
.error { .error {
background: #FF0000; background : #FF0000;
} }
#errors{ #errors {
display : none; display : none;
} }
.mono-space { .mono-space {
font-family: "ubuntu mono" font-family : "ubuntu mono"
} }
.file-path { .file-path {
@ -221,26 +220,26 @@ body {
.control-panel { .control-panel {
.card(#333333); .card(#333333);
color: #f5f5f5; color : #f5f5f5;
background-color: #333333; background-color : #333333;
margin: 0px; margin : 0px;
margin-bottom: -100px; margin-bottom : -100px;
position: fixed; position : fixed;
left: 0; left : 0;
bottom: 0; bottom : 0;
width: 100%; width : 100%;
height: 80px; height : 80px;
opacity: 0; opacity : 0;
@media (max-width: @screen-sm-max) { @media (max-width : @screen-sm-max) {
height: initial; height : initial;
position: static; position : static;
} }
} }
.tab-content { .tab-content {
.tab-pane { .tab-pane {
padding-top: 10px; padding-top : 10px;
} }
} }
@ -251,6 +250,17 @@ body {
} }
} }
.modal-body {
table {
font-size : 12px;
font-weight : bold;
i {
font-size : 14px;
}
}
}
.tooltip { .tooltip {
.tooltip-inner { .tooltip-inner {
max-width : 250px; max-width : 250px;
@ -259,6 +269,16 @@ body {
dl.info { dl.info {
dt, dd { dt, dd {
padding-bottom: 5px; padding-bottom : 5px;
} }
} }
.label {
&.protocol-torrent {
background-color : #00853D;
}
&.protocol-usenet {
background-color : #17B1D9;
}
}

@ -8,8 +8,10 @@ define(
'Cells/QualityCell', 'Cells/QualityCell',
'Cells/ApprovalStatusCell', 'Cells/ApprovalStatusCell',
'Release/DownloadReportCell', 'Release/DownloadReportCell',
'Release/AgeCell' 'Release/AgeCell',
], function (Marionette, Backgrid, ReleaseTitleCell, FileSizeCell, QualityCell, ApprovalStatusCell, DownloadReportCell, AgeCell) { 'Release/ProtocolCell',
'Release/PeersCell'
], function (Marionette, Backgrid, ReleaseTitleCell, FileSizeCell, QualityCell, ApprovalStatusCell, DownloadReportCell, AgeCell, ProtocolCell, PeersCell) {
return Marionette.Layout.extend({ return Marionette.Layout.extend({
template: 'Episode/Search/ManualLayoutTemplate', template: 'Episode/Search/ManualLayoutTemplate',
@ -21,6 +23,10 @@ define(
columns: columns:
[ [
{ {
name : 'protocol',
label : 'Source',
cell : ProtocolCell
}, {
name : 'age', name : 'age',
label : 'Age', label : 'Age',
cell : AgeCell cell : AgeCell
@ -40,6 +46,11 @@ define(
label : 'Size', label : 'Size',
cell : FileSizeCell cell : FileSizeCell
}, },
{
name : 'seeders',
label : 'Peers',
cell : PeersCell
},
{ {
name : 'quality', name : 'quality',
label : 'Quality', label : 'Quality',

@ -0,0 +1,34 @@
'use strict';
define(['backgrid'], function (Backgrid) {
return Backgrid.Cell.extend({
className : 'peers-cell',
render : function () {
if (this.model.get('protocol') === 'torrent') {
var seeders = this.model.get('seeders') || 0;
var leechers = this.model.get('leechers') || 0;
var level = 'danger';
if(seeders > 0){
level='warning';
}
if(seeders > 10){
level = 'info';
}
if(seeders > 50){
level = 'primary';
}
this.$el.html('<div class="label label-{2}" title="{0} seeders, {1} leechers">{0} / {1}</div>'.format(seeders, leechers, level));
}
this.delegateEvents();
return this;
}
});
});

@ -0,0 +1,28 @@
'use strict';
define(['backgrid'], function (Backgrid) {
return Backgrid.Cell.extend({
className : 'protocol-cell',
render : function () {
var protocol = this.model.get('protocol') || 'Unknown';
var label = '??';
if (protocol) {
if (protocol === 'torrent') {
label = 'torrent';
}
else if (protocol === 'usenet') {
label = 'nzb';
}
this.$el.html('<div class="label label-default protocol-{0}" title="{0}">{1}</div>'.format(protocol, label));
}
this.delegateEvents();
return this;
}
});
});

@ -1,4 +1,4 @@
'use strict'; 'use strict';
define( define(
[ [
'backbone.pageable', 'backbone.pageable',
@ -19,7 +19,7 @@ define(
sortMappings: { sortMappings: {
'quality' : { sortKey: 'qualityWeight' }, 'quality' : { sortKey: 'qualityWeight' },
'rejections' : { sortValue: function (model, attr) { 'rejections' : { sortValue: function (model) {
var rejections = model.get('rejections'); var rejections = model.get('rejections');
var releaseWeight = model.get('releaseWeight'); var releaseWeight = model.get('releaseWeight');

Loading…
Cancel
Save