mirror of
https://github.com/Radarr/Radarr
synced 2025-03-10 06:03:14 +00:00
added some custom cells for resources.
This commit is contained in:
parent
c93548c9f6
commit
bf499ed98a
5 changed files with 76 additions and 17 deletions
|
@ -13,6 +13,7 @@ namespace NzbDrone.Api.Indexers
|
||||||
private readonly IFetchAndParseRss _rssFetcherAndParser;
|
private readonly IFetchAndParseRss _rssFetcherAndParser;
|
||||||
private readonly ISearchForNzb _nzbSearchService;
|
private readonly ISearchForNzb _nzbSearchService;
|
||||||
private readonly IMakeDownloadDecision _downloadDecisionMaker;
|
private readonly IMakeDownloadDecision _downloadDecisionMaker;
|
||||||
|
private static List<DownloadDecision> results;
|
||||||
|
|
||||||
public ReleaseModule(IFetchAndParseRss rssFetcherAndParser, ISearchForNzb nzbSearchService, IMakeDownloadDecision downloadDecisionMaker)
|
public ReleaseModule(IFetchAndParseRss rssFetcherAndParser, ISearchForNzb nzbSearchService, IMakeDownloadDecision downloadDecisionMaker)
|
||||||
{
|
{
|
||||||
|
@ -41,10 +42,14 @@ namespace NzbDrone.Api.Indexers
|
||||||
|
|
||||||
private List<ReleaseResource> GetRss()
|
private List<ReleaseResource> GetRss()
|
||||||
{
|
{
|
||||||
var reports = _rssFetcherAndParser.Fetch();
|
if (results == null)
|
||||||
var decisions = _downloadDecisionMaker.GetRssDecision(reports);
|
{
|
||||||
|
var reports = _rssFetcherAndParser.Fetch();
|
||||||
|
var decisions = _downloadDecisionMaker.GetRssDecision(reports);
|
||||||
|
results = decisions;
|
||||||
|
}
|
||||||
|
|
||||||
return MapDecisions(decisions);
|
return MapDecisions(results);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<ReleaseResource> MapDecisions(IEnumerable<DownloadDecision> decisions)
|
private static List<ReleaseResource> MapDecisions(IEnumerable<DownloadDecision> decisions)
|
||||||
|
|
|
@ -340,6 +340,7 @@ Global
|
||||||
{F6FC6BE7-0847-4817-A1ED-223DC647C3D7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
{F6FC6BE7-0847-4817-A1ED-223DC647C3D7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||||
{F6FC6BE7-0847-4817-A1ED-223DC647C3D7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
{F6FC6BE7-0847-4817-A1ED-223DC647C3D7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||||
{F6FC6BE7-0847-4817-A1ED-223DC647C3D7}.Debug|x86.ActiveCfg = Debug|Any CPU
|
{F6FC6BE7-0847-4817-A1ED-223DC647C3D7}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{F6FC6BE7-0847-4817-A1ED-223DC647C3D7}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
{F6FC6BE7-0847-4817-A1ED-223DC647C3D7}.Pilot|Any CPU.ActiveCfg = Release|Any CPU
|
{F6FC6BE7-0847-4817-A1ED-223DC647C3D7}.Pilot|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{F6FC6BE7-0847-4817-A1ED-223DC647C3D7}.Pilot|Any CPU.Build.0 = Release|Any CPU
|
{F6FC6BE7-0847-4817-A1ED-223DC647C3D7}.Pilot|Any CPU.Build.0 = Release|Any CPU
|
||||||
{F6FC6BE7-0847-4817-A1ED-223DC647C3D7}.Pilot|Mixed Platforms.ActiveCfg = Release|Any CPU
|
{F6FC6BE7-0847-4817-A1ED-223DC647C3D7}.Pilot|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
@ -356,6 +357,7 @@ Global
|
||||||
{CBF6B8B0-A015-413A-8C86-01238BB45770}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
{CBF6B8B0-A015-413A-8C86-01238BB45770}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||||
{CBF6B8B0-A015-413A-8C86-01238BB45770}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
{CBF6B8B0-A015-413A-8C86-01238BB45770}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||||
{CBF6B8B0-A015-413A-8C86-01238BB45770}.Debug|x86.ActiveCfg = Debug|Any CPU
|
{CBF6B8B0-A015-413A-8C86-01238BB45770}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{CBF6B8B0-A015-413A-8C86-01238BB45770}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
{CBF6B8B0-A015-413A-8C86-01238BB45770}.Pilot|Any CPU.ActiveCfg = Release|Any CPU
|
{CBF6B8B0-A015-413A-8C86-01238BB45770}.Pilot|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{CBF6B8B0-A015-413A-8C86-01238BB45770}.Pilot|Any CPU.Build.0 = Release|Any CPU
|
{CBF6B8B0-A015-413A-8C86-01238BB45770}.Pilot|Any CPU.Build.0 = Release|Any CPU
|
||||||
{CBF6B8B0-A015-413A-8C86-01238BB45770}.Pilot|Mixed Platforms.ActiveCfg = Release|Any CPU
|
{CBF6B8B0-A015-413A-8C86-01238BB45770}.Pilot|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
@ -372,6 +374,7 @@ Global
|
||||||
{8CEFECD0-A6C2-498F-98B1-3FBE5820F9AB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
{8CEFECD0-A6C2-498F-98B1-3FBE5820F9AB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||||
{8CEFECD0-A6C2-498F-98B1-3FBE5820F9AB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
{8CEFECD0-A6C2-498F-98B1-3FBE5820F9AB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||||
{8CEFECD0-A6C2-498F-98B1-3FBE5820F9AB}.Debug|x86.ActiveCfg = Debug|Any CPU
|
{8CEFECD0-A6C2-498F-98B1-3FBE5820F9AB}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{8CEFECD0-A6C2-498F-98B1-3FBE5820F9AB}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
{8CEFECD0-A6C2-498F-98B1-3FBE5820F9AB}.Pilot|Any CPU.ActiveCfg = Release|Any CPU
|
{8CEFECD0-A6C2-498F-98B1-3FBE5820F9AB}.Pilot|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{8CEFECD0-A6C2-498F-98B1-3FBE5820F9AB}.Pilot|Any CPU.Build.0 = Release|Any CPU
|
{8CEFECD0-A6C2-498F-98B1-3FBE5820F9AB}.Pilot|Any CPU.Build.0 = Release|Any CPU
|
||||||
{8CEFECD0-A6C2-498F-98B1-3FBE5820F9AB}.Pilot|Mixed Platforms.ActiveCfg = Release|Any CPU
|
{8CEFECD0-A6C2-498F-98B1-3FBE5820F9AB}.Pilot|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
@ -388,6 +391,7 @@ Global
|
||||||
{B1784698-592E-4132-BDFA-9817409E3A96}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
{B1784698-592E-4132-BDFA-9817409E3A96}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||||
{B1784698-592E-4132-BDFA-9817409E3A96}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
{B1784698-592E-4132-BDFA-9817409E3A96}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||||
{B1784698-592E-4132-BDFA-9817409E3A96}.Debug|x86.ActiveCfg = Debug|Any CPU
|
{B1784698-592E-4132-BDFA-9817409E3A96}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{B1784698-592E-4132-BDFA-9817409E3A96}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
{B1784698-592E-4132-BDFA-9817409E3A96}.Pilot|Any CPU.ActiveCfg = Pilot|Any CPU
|
{B1784698-592E-4132-BDFA-9817409E3A96}.Pilot|Any CPU.ActiveCfg = Pilot|Any CPU
|
||||||
{B1784698-592E-4132-BDFA-9817409E3A96}.Pilot|Any CPU.Build.0 = Pilot|Any CPU
|
{B1784698-592E-4132-BDFA-9817409E3A96}.Pilot|Any CPU.Build.0 = Pilot|Any CPU
|
||||||
{B1784698-592E-4132-BDFA-9817409E3A96}.Pilot|Mixed Platforms.ActiveCfg = Pilot|Any CPU
|
{B1784698-592E-4132-BDFA-9817409E3A96}.Pilot|Mixed Platforms.ActiveCfg = Pilot|Any CPU
|
||||||
|
|
|
@ -3,7 +3,10 @@ define([
|
||||||
'app',
|
'app',
|
||||||
'Release/Collection',
|
'Release/Collection',
|
||||||
'Shared/SpinnerView',
|
'Shared/SpinnerView',
|
||||||
'Shared/Toolbar/ToolbarLayout'
|
'Shared/Toolbar/ToolbarLayout',
|
||||||
|
'Shared/Cells/EpisodeNumberCell',
|
||||||
|
'Shared/Cells/FileSizeCell',
|
||||||
|
'Shared/Cells/ApprovalStatusCell'
|
||||||
],
|
],
|
||||||
function () {
|
function () {
|
||||||
NzbDrone.Release.Layout = Backbone.Marionette.Layout.extend({
|
NzbDrone.Release.Layout = Backbone.Marionette.Layout.extend({
|
||||||
|
@ -25,7 +28,7 @@ define([
|
||||||
name : 'size',
|
name : 'size',
|
||||||
label : 'Size',
|
label : 'Size',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
cell : Backgrid.IntegerCell
|
cell : NzbDrone.Shared.Cells.FileSizeCell
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name : 'title',
|
name : 'title',
|
||||||
|
@ -34,24 +37,22 @@ define([
|
||||||
cell : Backgrid.StringCell
|
cell : Backgrid.StringCell
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name : 'seasonNumber',
|
name : 'episodeNumbers',
|
||||||
label: 'season',
|
season : 'seasonNumber',
|
||||||
cell : Backgrid.IntegerCell
|
airDate : 'airDate',
|
||||||
|
episodes: 'episodeNumbers',
|
||||||
|
label : 'season',
|
||||||
|
cell : NzbDrone.Shared.Cells.EpisodeNumberCell
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name : 'episodeNumber',
|
name : 'rejections',
|
||||||
label: 'episode',
|
label: 'decision',
|
||||||
cell : Backgrid.StringCell
|
cell : NzbDrone.Shared.Cells.ApprovalStatusCell
|
||||||
},
|
|
||||||
{
|
|
||||||
name : 'approved',
|
|
||||||
label: 'Approved',
|
|
||||||
cell : Backgrid.BooleanCell
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
showTable: function () {
|
showTable: function () {
|
||||||
if (!this.isClosed) {
|
if (!this.isClosed) {
|
||||||
this.grid.show(new Backgrid.Grid(
|
this.grid.show(new Backgrid.Grid(
|
||||||
{
|
{
|
||||||
row : Backgrid.Row,
|
row : Backgrid.Row,
|
||||||
|
|
19
UI/Shared/Cells/ApprovalStatusCell.js
Normal file
19
UI/Shared/Cells/ApprovalStatusCell.js
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
"use strict";
|
||||||
|
NzbDrone.Shared.Cells.ApprovalStatusCell = Backgrid.Cell.extend({
|
||||||
|
|
||||||
|
className: "approval-status-cell",
|
||||||
|
|
||||||
|
render: function () {
|
||||||
|
var rejections = this.model.get(this.column.get("name"));
|
||||||
|
|
||||||
|
var result = '';
|
||||||
|
|
||||||
|
_.each(rejections, function (reason) {
|
||||||
|
result += reason + ' ';
|
||||||
|
});
|
||||||
|
|
||||||
|
this.$el.html(result);
|
||||||
|
this.delegateEvents();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
});
|
30
UI/Shared/Cells/EpisodeNumberCell.js
Normal file
30
UI/Shared/Cells/EpisodeNumberCell.js
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
"use strict";
|
||||||
|
NzbDrone.Shared.Cells.EpisodeNumberCell = Backgrid.Cell.extend({
|
||||||
|
|
||||||
|
className: "episode-number-cell",
|
||||||
|
|
||||||
|
render: function () {
|
||||||
|
|
||||||
|
var airDate = this.model.get(this.column.get("airDate"));
|
||||||
|
|
||||||
|
var result = 'Unknown';
|
||||||
|
|
||||||
|
if (airDate) {
|
||||||
|
|
||||||
|
result = new Date(airDate).toLocaleDateString();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var season = this.model.get(this.column.get("season")).pad(2);
|
||||||
|
|
||||||
|
var episodes = _.map(this.model.get(this.column.get("episodes")), function (episodeNumber) {
|
||||||
|
return episodeNumber.pad(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
result = 'S{0}-E{1}'.format(season, episodes.join());
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$el.html(result);
|
||||||
|
this.delegateEvents();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
});
|
Loading…
Add table
Reference in a new issue