From 2a020f691c959e78c49d68281c1164ae3dc9eb37 Mon Sep 17 00:00:00 2001 From: kaso17 Date: Tue, 25 Oct 2016 18:40:46 +0200 Subject: [PATCH] Add missing torznab attributes files, grabs, downloadvolumefactor, uploadvolumefactor (#565) * Add missing torznap attributes files, grabs, downloadvolumefactor, uploadvolumefactor * Fix typo --- src/Jackett/Content/custom.js | 32 +++++++++++++++++++++++++-- src/Jackett/Content/index.html | 36 +++++++++++++++++++++++++++---- src/Jackett/Models/ReleaseInfo.cs | 14 +++++++++--- src/Jackett/Models/ResultPage.cs | 6 +++++- 4 files changed, 78 insertions(+), 10 deletions(-) diff --git a/src/Jackett/Content/custom.js b/src/Jackett/Content/custom.js index 58f38feac..582f90fb3 100644 --- a/src/Jackett/Content/custom.js +++ b/src/Jackett/Content/custom.js @@ -345,6 +345,32 @@ function clearNotifications() { $('[data-notify="container"]').remove(); } +function updateReleasesRow(row) +{ + var labels = $(row).find("span.release-labels"); + var DownloadVolumeFactor = parseFloat($(row).find("td.DownloadVolumeFactor").html()); + var UploadVolumeFactor = parseFloat($(row).find("td.UploadVolumeFactor").html()); + + labels.empty(); + + if (!isNaN(DownloadVolumeFactor)) { + if (DownloadVolumeFactor == 0) { + labels.append('\nFREELEECH'); + } else if (DownloadVolumeFactor < 1) { + labels.append('\n' + DownloadVolumeFactor * 100 + '%DL'); + } else if (DownloadVolumeFactor > 1) { + labels.append('\n' + DownloadVolumeFactor * 100 + '%DL'); + } + } + + if (!isNaN(UploadVolumeFactor)) { + if (UploadVolumeFactor == 0) { + labels.append('\nNO UPLOAD'); + } else if (UploadVolumeFactor != 1) { + labels.append('\n' + UploadVolumeFactor * 100 + '%UL'); + } + } +} function bindUIButtons() { $('body').on('click', '.downloadlink', function (e, b) { @@ -372,6 +398,7 @@ function bindUIButtons() { var releaseTemplate = Handlebars.compile($("#jackett-releases").html()); var item = { releases: data, Title: 'Releases' }; var releaseDialog = $(releaseTemplate(item)); + releaseDialog.find('tr.jackett-releases-row').each(function () { updateReleasesRow(this); }); releaseDialog.find('table').DataTable( { "pageLength": 20, @@ -419,7 +446,7 @@ function bindUIButtons() { var count = 0; this.api().columns().every(function () { count++; - if (count === 5 || count === 9) { + if (count === 5 || count === 10) { var column = this; var select = $('') .appendTo($(column.footer()).empty()) @@ -522,6 +549,7 @@ function bindUIButtons() { var resultsTemplate = Handlebars.compile($("#jackett-search-results").html()); var results = $('#searchResults'); results.html($(resultsTemplate(data))); + results.find('tr.jackett-search-results-row').each(function () { updateReleasesRow(this); }); results.find('table').DataTable( { @@ -558,7 +586,7 @@ function bindUIButtons() { var count = 0; this.api().columns().every(function () { count++; - if (count === 3 || count === 7) { + if (count === 3 || count === 8) { var column = this; var select = $('') .appendTo($(column.footer()).empty()) diff --git a/src/Jackett/Content/index.html b/src/Jackett/Content/index.html index 00fbb4149..ac7f5bb85 100644 --- a/src/Jackett/Content/index.html +++ b/src/Jackett/Content/index.html @@ -236,26 +236,34 @@ Name Size Size + Files Category + Grabs Seeds Leechers + DL Factor + UL Factor Download {{#each releases}} - + {{PublishDate}} {{FirstSeen}} {{jacketTimespan PublishDate}} {{jacketTimespan FirstSeen}} {{Tracker}} - {{Title}} + {{Title}} {{Size}} {{jacketSize Size}} + {{Files}} {{CategoryDesc}} + {{Grabs}} {{Seeders}} {{Peers}} + {{DownloadVolumeFactor}} + {{UploadVolumeFactor}} {{#if BlackholeLink}} @@ -277,6 +285,12 @@ + + + + + + @@ -334,24 +348,32 @@ Name Size Size + Files Category + Grabs Seeds Leechers + DL Factor + UL Factor Download {{#each Results}} - + {{PublishDate}} {{jacketTimespan PublishDate}} {{Tracker}} - {{Title}} + {{Title}} {{Size}} {{jacketSize Size}} + {{Files}} {{CategoryDesc}} + {{Grabs}} {{Seeders}} {{Peers}} + {{DownloadVolumeFactor}} + {{UploadVolumeFactor}} {{#if BlackholeLink}} @@ -371,6 +393,12 @@ + + + + + + diff --git a/src/Jackett/Models/ReleaseInfo.cs b/src/Jackett/Models/ReleaseInfo.cs index 26b49d5a7..15e33803d 100644 --- a/src/Jackett/Models/ReleaseInfo.cs +++ b/src/Jackett/Models/ReleaseInfo.cs @@ -18,7 +18,9 @@ namespace Jackett.Models public Uri Comments { get; set; } public DateTime PublishDate { get; set; } public int Category { get; set; } - public long? Size { get; set; } + public long? Size { get; set; } + public long? Files { get; set; } + public long? Grabs { get; set; } public string Description { get; set; } public long? RageID { get; set; } public long? TVDBId { get; set; } @@ -30,6 +32,8 @@ namespace Jackett.Models public Uri MagnetUri { get; set; } public double? MinimumRatio { get; set; } public long? MinimumSeedTime { get; set; } + public double? DownloadVolumeFactor { get; set; } + public double? UploadVolumeFactor { get; set; } public object Clone() { @@ -41,7 +45,9 @@ namespace Jackett.Models Comments = Comments, PublishDate = PublishDate, Category = Category, - Size = Size, + Size = Size, + Files = Files, + Grabs = Grabs, Description = Description, RageID = RageID, Imdb = Imdb, @@ -51,7 +57,9 @@ namespace Jackett.Models InfoHash = InfoHash, MagnetUri = MagnetUri, MinimumRatio = MinimumRatio, - MinimumSeedTime = MinimumSeedTime + MinimumSeedTime = MinimumSeedTime, + DownloadVolumeFactor = DownloadVolumeFactor, + UploadVolumeFactor = UploadVolumeFactor }; } diff --git a/src/Jackett/Models/ResultPage.cs b/src/Jackett/Models/ResultPage.cs index 7e0de87cd..85bb3187c 100644 --- a/src/Jackett/Models/ResultPage.cs +++ b/src/Jackett/Models/ResultPage.cs @@ -70,6 +70,8 @@ namespace Jackett.Models r.Comments == null ? null : new XElement("comments", r.Comments.ToString()), r.PublishDate == DateTime.MinValue ? null : new XElement("pubDate", xmlDateFormat(r.PublishDate)), r.Size == null ? null : new XElement("size", r.Size), + r.Files == null ? null : new XElement("files", r.Files), + r.Grabs == null ? null : new XElement("grabs", r.Grabs), new XElement("description", r.Description), new XElement("link", r.Link ?? r.MagnetUri), r.Category == 0 ? null : new XElement("category", r.Category), @@ -87,7 +89,9 @@ namespace Jackett.Models getTorznabElement("peers", r.Peers), getTorznabElement("infohash", r.InfoHash), getTorznabElement("minimumratio", r.MinimumRatio), - getTorznabElement("minimumseedtime", r.MinimumSeedTime) + getTorznabElement("minimumseedtime", r.MinimumSeedTime), + getTorznabElement("downloadvolumefactor", r.DownloadVolumeFactor), + getTorznabElement("uploadvolumefactor", r.UploadVolumeFactor) ) ) )