1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 12:32:31 +01:00

New: Show download protocol in Queue

This commit is contained in:
Mark McDowall 2015-01-31 00:24:09 -08:00
parent cd79826aad
commit e641611662
13 changed files with 42 additions and 10 deletions

View File

@ -142,7 +142,6 @@ private List<ReleaseResource> MapDecisions(IEnumerable<DownloadDecision> decisio
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; var torrentRelease = downloadDecision.RemoteEpisode.Release as TorrentInfo;
if (torrentRelease != null) if (torrentRelease != null)

View File

@ -39,7 +39,6 @@ public class ReleaseResource : RestResource
public String DownloadUrl { get; set; } public String DownloadUrl { get; set; }
public String InfoUrl { get; set; } public String InfoUrl { get; set; }
public Boolean DownloadAllowed { get; set; } public Boolean DownloadAllowed { get; set; }
public DownloadProtocol DownloadProtocol { get; set; }
public Int32 ReleaseWeight { get; set; } public Int32 ReleaseWeight { get; set; }

View File

@ -5,6 +5,7 @@
using NzbDrone.Api.Series; using NzbDrone.Api.Series;
using NzbDrone.Api.Episodes; using NzbDrone.Api.Episodes;
using NzbDrone.Core.Download.TrackedDownloads; using NzbDrone.Core.Download.TrackedDownloads;
using NzbDrone.Core.Indexers;
namespace NzbDrone.Api.Queue namespace NzbDrone.Api.Queue
{ {
@ -22,5 +23,6 @@ public class QueueResource : RestResource
public String TrackedDownloadStatus { get; set; } public String TrackedDownloadStatus { get; set; }
public List<TrackedDownloadStatusMessage> StatusMessages { get; set; } public List<TrackedDownloadStatusMessage> StatusMessages { get; set; }
public String DownloadId { get; set; } public String DownloadId { get; set; }
public DownloadProtocol Protocol { get; set; }
} }
} }

View File

@ -7,6 +7,7 @@
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Validation; using NzbDrone.Core.Validation;
using NzbDrone.Core.RemotePathMappings; using NzbDrone.Core.RemotePathMappings;

View File

@ -27,11 +27,18 @@ public IDownloadClient GetDownloadClient(DownloadProtocol downloadProtocol)
public IEnumerable<IDownloadClient> GetDownloadClients() public IEnumerable<IDownloadClient> GetDownloadClients()
{ {
return _downloadClientFactory.GetAvailableProviders(); return _downloadClientFactory.GetAvailableProviders();//.Select(MapDownloadClient);
} }
public IDownloadClient Get(int id) public IDownloadClient Get(int id)
{ {
return _downloadClientFactory.GetAvailableProviders().Single(d => d.Definition.Id == id); return _downloadClientFactory.GetAvailableProviders().Single(d => d.Definition.Id == id);
} }
public IDownloadClient MapDownloadClient(IDownloadClient downloadClient)
{
downloadClient.Definition = _downloadClientFactory.GetProviderCharacteristics(downloadClient, (DownloadClientDefinition)downloadClient.Definition);
return downloadClient;
}
} }
} }

View File

@ -112,7 +112,8 @@ public List<RemoteEpisode> GetPendingRemoteEpisodes(int seriesId)
RemoteEpisode = pendingRelease.RemoteEpisode, RemoteEpisode = pendingRelease.RemoteEpisode,
Timeleft = ect.Subtract(DateTime.UtcNow), Timeleft = ect.Subtract(DateTime.UtcNow),
EstimatedCompletionTime = ect, EstimatedCompletionTime = ect,
Status = "Pending" Status = "Pending",
Protocol = pendingRelease.RemoteEpisode.Release.DownloadProtocol
}; };
queued.Add(queue); queued.Add(queue);
} }

View File

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using NzbDrone.Core.Datastore; using NzbDrone.Core.Datastore;
using NzbDrone.Core.Download.TrackedDownloads; using NzbDrone.Core.Download.TrackedDownloads;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Qualities; using NzbDrone.Core.Qualities;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
@ -23,5 +24,6 @@ public class Queue : ModelBase
public List<TrackedDownloadStatusMessage> StatusMessages { get; set; } public List<TrackedDownloadStatusMessage> StatusMessages { get; set; }
public String DownloadId { get; set; } public String DownloadId { get; set; }
public RemoteEpisode RemoteEpisode { get; set; } public RemoteEpisode RemoteEpisode { get; set; }
public DownloadProtocol Protocol { get; set; }
} }
} }

View File

@ -59,7 +59,8 @@ private IEnumerable<Queue> MapQueue(TrackedDownload trackedDownload)
TrackedDownloadStatus = trackedDownload.Status.ToString(), TrackedDownloadStatus = trackedDownload.Status.ToString(),
StatusMessages = trackedDownload.StatusMessages.ToList(), StatusMessages = trackedDownload.StatusMessages.ToList(),
RemoteEpisode = trackedDownload.RemoteEpisode, RemoteEpisode = trackedDownload.RemoteEpisode,
DownloadId = trackedDownload.DownloadItem.DownloadId DownloadId = trackedDownload.DownloadItem.DownloadId,
Protocol = trackedDownload.Protocol
}; };
if (queue.Timeleft.HasValue) if (queue.Timeleft.HasValue)

View File

@ -111,7 +111,7 @@ public TProvider GetInstance(TProviderDefinition definition)
{ {
var type = GetImplementation(definition); var type = GetImplementation(definition);
var instance = (TProvider)_container.Resolve(type); var instance = (TProvider)_container.Resolve(type);
instance.Definition = definition; instance.Definition = GetProviderCharacteristics(instance, definition);
return instance; return instance;
} }

View File

@ -16,6 +16,10 @@ define(
'click .x-grab' : '_grab' 'click .x-grab' : '_grab'
}, },
ui: {
'import' : '.x-import'
},
render: function () { render: function () {
this.$el.empty(); this.$el.empty();
@ -69,6 +73,8 @@ define(
data: JSON.stringify(this.model.toJSON()) data: JSON.stringify(this.model.toJSON())
}); });
$(this.ui.import).spinForPromise(promise);
promise.success(function () { promise.success(function () {
//find models that have the same series id and episode ids and remove them //find models that have the same series id and episode ids and remove them
self.model.trigger('destroy', self.model); self.model.trigger('destroy', self.model);

View File

@ -12,6 +12,7 @@ define(
'Activity/Queue/QueueActionsCell', 'Activity/Queue/QueueActionsCell',
'Activity/Queue/TimeleftCell', 'Activity/Queue/TimeleftCell',
'Activity/Queue/ProgressCell', 'Activity/Queue/ProgressCell',
'Release/ProtocolCell',
'Shared/Grid/Pager' 'Shared/Grid/Pager'
], function (Marionette, ], function (Marionette,
Backgrid, Backgrid,
@ -24,6 +25,7 @@ define(
QueueActionsCell, QueueActionsCell,
TimeleftCell, TimeleftCell,
ProgressCell, ProgressCell,
ProtocolCell,
GridPager) { GridPager) {
return Marionette.Layout.extend({ return Marionette.Layout.extend({
template: 'Activity/Queue/QueueLayoutTemplate', template: 'Activity/Queue/QueueLayoutTemplate',
@ -65,6 +67,11 @@ define(
cell : QualityCell, cell : QualityCell,
sortable : false sortable : false
}, },
{
name : 'protocol',
label : 'Protocol',
cell : ProtocolCell
},
{ {
name : 'timeleft', name : 'timeleft',
label : 'Timeleft', label : 'Timeleft',

View File

@ -1,6 +1,6 @@
<div class="row"> <div class="row">
<div class="col-md-12 table-responsive"> <div class="col-md-12 table-responsive">
<div id="x-queue"/> <div id="x-queue" class="queue"/>
</div> </div>
</div> </div>

View File

@ -1,4 +1,11 @@
.queue-status-cell .popover { .queue-status-cell .popover {
max-width: 800px; max-width : 800px;
}
.queue {
.protocol-cell {
text-align : center;
width : 80px;
}
} }