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();
}
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() {
$('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 = $('<select><option value=""></option></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 = $('<select><option value=""></option></select>')
.appendTo($(column.footer()).empty())

View File

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

View File

@ -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
};
}

View File

@ -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)
)
)
)