Add missing torznab attributes files, grabs, downloadvolumefactor, uploadvolumefactor (#565)

* Add missing torznap attributes files, grabs, downloadvolumefactor, uploadvolumefactor

* Fix typo
This commit is contained in:
kaso17 2016-10-25 18:40:46 +02:00 committed by JigSaw
parent 5abdd35e1f
commit 2a020f691c
4 changed files with 78 additions and 10 deletions

View File

@ -345,6 +345,32 @@ function clearNotifications() {
$('[data-notify="container"]').remove(); $('[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('\n<span class="label label-success">FREELEECH</span>');
} else if (DownloadVolumeFactor < 1) {
labels.append('\n<span class="label label-primary">' + DownloadVolumeFactor * 100 + '%DL</span>');
} else if (DownloadVolumeFactor > 1) {
labels.append('\n<span class="label label-danger">' + DownloadVolumeFactor * 100 + '%DL</span>');
}
}
if (!isNaN(UploadVolumeFactor)) {
if (UploadVolumeFactor == 0) {
labels.append('\n<span class="label label-warning">NO UPLOAD</span>');
} else if (UploadVolumeFactor != 1) {
labels.append('\n<span class="label label-info">' + UploadVolumeFactor * 100 + '%UL</span>');
}
}
}
function bindUIButtons() { function bindUIButtons() {
$('body').on('click', '.downloadlink', function (e, b) { $('body').on('click', '.downloadlink', function (e, b) {
@ -372,6 +398,7 @@ function bindUIButtons() {
var releaseTemplate = Handlebars.compile($("#jackett-releases").html()); var releaseTemplate = Handlebars.compile($("#jackett-releases").html());
var item = { releases: data, Title: 'Releases' }; var item = { releases: data, Title: 'Releases' };
var releaseDialog = $(releaseTemplate(item)); var releaseDialog = $(releaseTemplate(item));
releaseDialog.find('tr.jackett-releases-row').each(function () { updateReleasesRow(this); });
releaseDialog.find('table').DataTable( releaseDialog.find('table').DataTable(
{ {
"pageLength": 20, "pageLength": 20,
@ -419,7 +446,7 @@ function bindUIButtons() {
var count = 0; var count = 0;
this.api().columns().every(function () { this.api().columns().every(function () {
count++; count++;
if (count === 5 || count === 9) { if (count === 5 || count === 10) {
var column = this; var column = this;
var select = $('<select><option value=""></option></select>') var select = $('<select><option value=""></option></select>')
.appendTo($(column.footer()).empty()) .appendTo($(column.footer()).empty())
@ -522,6 +549,7 @@ function bindUIButtons() {
var resultsTemplate = Handlebars.compile($("#jackett-search-results").html()); var resultsTemplate = Handlebars.compile($("#jackett-search-results").html());
var results = $('#searchResults'); var results = $('#searchResults');
results.html($(resultsTemplate(data))); results.html($(resultsTemplate(data)));
results.find('tr.jackett-search-results-row').each(function () { updateReleasesRow(this); });
results.find('table').DataTable( results.find('table').DataTable(
{ {
@ -558,7 +586,7 @@ function bindUIButtons() {
var count = 0; var count = 0;
this.api().columns().every(function () { this.api().columns().every(function () {
count++; count++;
if (count === 3 || count === 7) { if (count === 3 || count === 8) {
var column = this; var column = this;
var select = $('<select><option value=""></option></select>') var select = $('<select><option value=""></option></select>')
.appendTo($(column.footer()).empty()) .appendTo($(column.footer()).empty())

View File

@ -236,26 +236,34 @@
<th>Name</th> <th>Name</th>
<th>Size</th> <th>Size</th>
<th>Size</th> <th>Size</th>
<th>Files</th>
<th>Category</th> <th>Category</th>
<th>Grabs</th>
<th>Seeds</th> <th>Seeds</th>
<th>Leechers</th> <th>Leechers</th>
<th>DL Factor</th>
<th>UL Factor</th>
<th>Download</th> <th>Download</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{#each releases}} {{#each releases}}
<tr> <tr class="jackett-releases-row">
<td>{{PublishDate}}</td> <td>{{PublishDate}}</td>
<td>{{FirstSeen}}</td> <td>{{FirstSeen}}</td>
<td>{{jacketTimespan PublishDate}}</td> <td>{{jacketTimespan PublishDate}}</td>
<td>{{jacketTimespan FirstSeen}}</td> <td>{{jacketTimespan FirstSeen}}</td>
<td>{{Tracker}}</td> <td>{{Tracker}}</td>
<td><a href="{{Comments}}">{{Title}}</a></td> <td><a href="{{Comments}}">{{Title}}</a> <span class="release-labels"></span></td>
<td>{{Size}}</td> <td>{{Size}}</td>
<td>{{jacketSize Size}}</td> <td>{{jacketSize Size}}</td>
<td>{{Files}}</td>
<td>{{CategoryDesc}}</td> <td>{{CategoryDesc}}</td>
<td>{{Grabs}}</td>
<td>{{Seeders}}</td> <td>{{Seeders}}</td>
<td>{{Peers}}</td> <td>{{Peers}}</td>
<td class="DownloadVolumeFactor">{{DownloadVolumeFactor}}</td>
<td class="UploadVolumeFactor">{{UploadVolumeFactor}}</td>
<td class="downloadcolumn"> <td class="downloadcolumn">
<a class="downloadlink" title="Download locally" href="{{Link}}"><i class="fa fa-download"></i></a> <a class="downloadlink" title="Download locally" href="{{Link}}"><i class="fa fa-download"></i></a>
{{#if BlackholeLink}} {{#if BlackholeLink}}
@ -277,6 +285,12 @@
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
@ -334,24 +348,32 @@
<th>Name</th> <th>Name</th>
<th>Size</th> <th>Size</th>
<th>Size</th> <th>Size</th>
<th>Files</th>
<th>Category</th> <th>Category</th>
<th>Grabs</th>
<th>Seeds</th> <th>Seeds</th>
<th>Leechers</th> <th>Leechers</th>
<th>DL Factor</th>
<th>UL Factor</th>
<th>Download</th> <th>Download</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{#each Results}} {{#each Results}}
<tr> <tr class="jackett-search-results-row">
<td>{{PublishDate}}</td> <td>{{PublishDate}}</td>
<td>{{jacketTimespan PublishDate}}</td> <td>{{jacketTimespan PublishDate}}</td>
<td>{{Tracker}}</td> <td>{{Tracker}}</td>
<td><a href="{{Comments}}">{{Title}}</a></td> <td><a href="{{Comments}}">{{Title}}</a> <span class="release-labels"></span></td>
<td>{{Size}}</td> <td>{{Size}}</td>
<td>{{jacketSize Size}}</td> <td>{{jacketSize Size}}</td>
<td>{{Files}}</td>
<td>{{CategoryDesc}}</td> <td>{{CategoryDesc}}</td>
<td>{{Grabs}}</td>
<td>{{Seeders}}</td> <td>{{Seeders}}</td>
<td>{{Peers}}</td> <td>{{Peers}}</td>
<td class="DownloadVolumeFactor">{{DownloadVolumeFactor}}</td>
<td class="UploadVolumeFactor">{{UploadVolumeFactor}}</td>
<td class="downloadcolumn"> <td class="downloadcolumn">
<a class="downloadlink" title="Download locally" href="{{Link}}"><i class="fa fa-download"></i></a> <a class="downloadlink" title="Download locally" href="{{Link}}"><i class="fa fa-download"></i></a>
{{#if BlackholeLink}} {{#if BlackholeLink}}
@ -371,6 +393,12 @@
<td></td> <td></td>
<td></td> <td></td>
<td></td> <td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>

View File

@ -19,6 +19,8 @@ namespace Jackett.Models
public DateTime PublishDate { get; set; } public DateTime PublishDate { get; set; }
public int Category { 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 string Description { get; set; }
public long? RageID { get; set; } public long? RageID { get; set; }
public long? TVDBId { get; set; } public long? TVDBId { get; set; }
@ -30,6 +32,8 @@ namespace Jackett.Models
public Uri MagnetUri { get; set; } public Uri MagnetUri { get; set; }
public double? MinimumRatio { get; set; } public double? MinimumRatio { get; set; }
public long? MinimumSeedTime { get; set; } public long? MinimumSeedTime { get; set; }
public double? DownloadVolumeFactor { get; set; }
public double? UploadVolumeFactor { get; set; }
public object Clone() public object Clone()
{ {
@ -42,6 +46,8 @@ namespace Jackett.Models
PublishDate = PublishDate, PublishDate = PublishDate,
Category = Category, Category = Category,
Size = Size, Size = Size,
Files = Files,
Grabs = Grabs,
Description = Description, Description = Description,
RageID = RageID, RageID = RageID,
Imdb = Imdb, Imdb = Imdb,
@ -51,7 +57,9 @@ namespace Jackett.Models
InfoHash = InfoHash, InfoHash = InfoHash,
MagnetUri = MagnetUri, MagnetUri = MagnetUri,
MinimumRatio = MinimumRatio, MinimumRatio = MinimumRatio,
MinimumSeedTime = MinimumSeedTime MinimumSeedTime = MinimumSeedTime,
DownloadVolumeFactor = DownloadVolumeFactor,
UploadVolumeFactor = UploadVolumeFactor
}; };
} }

View File

@ -70,6 +70,8 @@ namespace Jackett.Models
r.Comments == null ? null : new XElement("comments", r.Comments.ToString()), r.Comments == null ? null : new XElement("comments", r.Comments.ToString()),
r.PublishDate == DateTime.MinValue ? null : new XElement("pubDate", xmlDateFormat(r.PublishDate)), r.PublishDate == DateTime.MinValue ? null : new XElement("pubDate", xmlDateFormat(r.PublishDate)),
r.Size == null ? null : new XElement("size", r.Size), 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("description", r.Description),
new XElement("link", r.Link ?? r.MagnetUri), new XElement("link", r.Link ?? r.MagnetUri),
r.Category == 0 ? null : new XElement("category", r.Category), r.Category == 0 ? null : new XElement("category", r.Category),
@ -87,7 +89,9 @@ namespace Jackett.Models
getTorznabElement("peers", r.Peers), getTorznabElement("peers", r.Peers),
getTorznabElement("infohash", r.InfoHash), getTorznabElement("infohash", r.InfoHash),
getTorznabElement("minimumratio", r.MinimumRatio), getTorznabElement("minimumratio", r.MinimumRatio),
getTorznabElement("minimumseedtime", r.MinimumSeedTime) getTorznabElement("minimumseedtime", r.MinimumSeedTime),
getTorznabElement("downloadvolumefactor", r.DownloadVolumeFactor),
getTorznabElement("uploadvolumefactor", r.UploadVolumeFactor)
) )
) )
) )