1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

Movies now show up in the Queue.

This commit is contained in:
Leonardo Galli 2017-01-02 22:01:11 +01:00
parent 2eedfca78a
commit cde1217356
9 changed files with 66 additions and 13 deletions

View File

@ -4,6 +4,7 @@
using NzbDrone.Core.Qualities; using NzbDrone.Core.Qualities;
using NzbDrone.Api.Series; using NzbDrone.Api.Series;
using NzbDrone.Api.Episodes; using NzbDrone.Api.Episodes;
using NzbDrone.Api.Movie;
using NzbDrone.Core.Download.TrackedDownloads; using NzbDrone.Core.Download.TrackedDownloads;
using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers;
using System.Linq; using System.Linq;
@ -14,6 +15,7 @@ public class QueueResource : RestResource
{ {
public SeriesResource Series { get; set; } public SeriesResource Series { get; set; }
public EpisodeResource Episode { get; set; } public EpisodeResource Episode { get; set; }
public MovieResource Movie { get; set; }
public QualityModel Quality { get; set; } public QualityModel Quality { get; set; }
public decimal Size { get; set; } public decimal Size { get; set; }
public string Title { get; set; } public string Title { get; set; }
@ -49,7 +51,8 @@ public static QueueResource ToResource(this Core.Queue.Queue model)
TrackedDownloadStatus = model.TrackedDownloadStatus, TrackedDownloadStatus = model.TrackedDownloadStatus,
StatusMessages = model.StatusMessages, StatusMessages = model.StatusMessages,
DownloadId = model.DownloadId, DownloadId = model.DownloadId,
Protocol = model.Protocol Protocol = model.Protocol,
Movie = model.Movie.ToResource()
}; };
} }

View File

@ -33,6 +33,7 @@ public interface IPendingReleaseService
public class PendingReleaseService : IPendingReleaseService, public class PendingReleaseService : IPendingReleaseService,
IHandle<SeriesDeletedEvent>, IHandle<SeriesDeletedEvent>,
IHandle<EpisodeGrabbedEvent>, IHandle<EpisodeGrabbedEvent>,
IHandle<MovieGrabbedEvent>,
IHandle<RssSyncCompleteEvent> IHandle<RssSyncCompleteEvent>
{ {
private readonly IIndexerStatusService _indexerStatusService; private readonly IIndexerStatusService _indexerStatusService;
@ -341,6 +342,11 @@ public void Handle(EpisodeGrabbedEvent message)
RemoveGrabbed(message.Episode); RemoveGrabbed(message.Episode);
} }
public void Handle(MovieGrabbedEvent message)
{
}
public void Handle(RssSyncCompleteEvent message) public void Handle(RssSyncCompleteEvent message)
{ {
RemoveRejected(message.ProcessedDecisions.Rejected); RemoveRejected(message.ProcessedDecisions.Rejected);

View File

@ -10,6 +10,7 @@ public class TrackedDownload
public TrackedDownloadStage State { get; set; } public TrackedDownloadStage State { get; set; }
public TrackedDownloadStatus Status { get; private set; } public TrackedDownloadStatus Status { get; private set; }
public RemoteEpisode RemoteEpisode { get; set; } public RemoteEpisode RemoteEpisode { get; set; }
public RemoteMovie RemoteMovie { get; set; }
public TrackedDownloadStatusMessage[] StatusMessages { get; private set; } public TrackedDownloadStatusMessage[] StatusMessages { get; private set; }
public DownloadProtocol Protocol { get; set; } public DownloadProtocol Protocol { get; set; }

View File

@ -62,6 +62,7 @@ public TrackedDownload TrackDownload(DownloadClientDefinition downloadClient, Do
if (parsedEpisodeInfo != null) if (parsedEpisodeInfo != null)
{ {
trackedDownload.RemoteEpisode = _parsingService.Map(parsedEpisodeInfo, 0, 0); trackedDownload.RemoteEpisode = _parsingService.Map(parsedEpisodeInfo, 0, 0);
trackedDownload.RemoteMovie = _parsingService.Map(parsedEpisodeInfo, "", null);
} }
if (historyItems.Any()) if (historyItems.Any())
@ -69,10 +70,10 @@ public TrackedDownload TrackDownload(DownloadClientDefinition downloadClient, Do
var firstHistoryItem = historyItems.OrderByDescending(h => h.Date).First(); var firstHistoryItem = historyItems.OrderByDescending(h => h.Date).First();
trackedDownload.State = GetStateFromHistory(firstHistoryItem.EventType); trackedDownload.State = GetStateFromHistory(firstHistoryItem.EventType);
if (parsedEpisodeInfo == null || if ((parsedEpisodeInfo == null ||
trackedDownload.RemoteEpisode == null || trackedDownload.RemoteEpisode == null ||
trackedDownload.RemoteEpisode.Series == null || trackedDownload.RemoteEpisode.Series == null ||
trackedDownload.RemoteEpisode.Episodes.Empty()) trackedDownload.RemoteEpisode.Episodes.Empty()) && trackedDownload.RemoteMovie == null)
{ {
// Try parsing the original source title and if that fails, try parsing it as a special // Try parsing the original source title and if that fails, try parsing it as a special
// TODO: Pass the TVDB ID and TVRage IDs in as well so we have a better chance for finding the item // TODO: Pass the TVDB ID and TVRage IDs in as well so we have a better chance for finding the item
@ -85,7 +86,7 @@ public TrackedDownload TrackDownload(DownloadClientDefinition downloadClient, Do
} }
} }
if (trackedDownload.RemoteEpisode == null) if (trackedDownload.RemoteEpisode == null && trackedDownload.RemoteMovie == null)
{ {
return null; return null;
} }

View File

@ -13,6 +13,7 @@ public class Queue : ModelBase
{ {
public Series Series { get; set; } public Series Series { get; set; }
public Episode Episode { get; set; } public Episode Episode { get; set; }
public Movie Movie { get; set; }
public QualityModel Quality { get; set; } public QualityModel Quality { get; set; }
public decimal Size { get; set; } public decimal Size { get; set; }
public string Title { get; set; } public string Title { get; set; }
@ -24,6 +25,7 @@ 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 RemoteMovie RemoteMovie { get; set; }
public DownloadProtocol Protocol { get; set; } public DownloadProtocol Protocol { get; set; }
} }
} }

View File

@ -51,12 +51,42 @@ private IEnumerable<Queue> MapQueue(TrackedDownload trackedDownload)
yield return MapEpisode(trackedDownload, episode); yield return MapEpisode(trackedDownload, episode);
} }
} }
else else if (trackedDownload.RemoteMovie.Movie != null)
{ {
// FIXME: Present queue items with unknown series/episodes yield return MapMovie(trackedDownload, trackedDownload.RemoteMovie.Movie);
} }
} }
private Queue MapMovie(TrackedDownload trackedDownload, Movie movie)
{
var queue = new Queue
{
Id = HashConverter.GetHashInt31(string.Format("trackedDownload-{0}", trackedDownload.DownloadItem.DownloadId)),
Series = null,
Episode = null,
Quality = trackedDownload.RemoteMovie.ParsedEpisodeInfo.Quality,
Title = trackedDownload.DownloadItem.Title,
Size = trackedDownload.DownloadItem.TotalSize,
Sizeleft = trackedDownload.DownloadItem.RemainingSize,
Timeleft = trackedDownload.DownloadItem.RemainingTime,
Status = trackedDownload.DownloadItem.Status.ToString(),
TrackedDownloadStatus = trackedDownload.Status.ToString(),
StatusMessages = trackedDownload.StatusMessages.ToList(),
RemoteEpisode = trackedDownload.RemoteEpisode,
RemoteMovie = trackedDownload.RemoteMovie,
DownloadId = trackedDownload.DownloadItem.DownloadId,
Protocol = trackedDownload.Protocol,
Movie = movie
};
if (queue.Timeleft.HasValue)
{
queue.EstimatedCompletionTime = DateTime.UtcNow.Add(queue.Timeleft.Value);
}
return queue;
}
private Queue MapEpisode(TrackedDownload trackedDownload, Episode episode) private Queue MapEpisode(TrackedDownload trackedDownload, Episode episode)
{ {
var queue = new Queue var queue = new Queue

View File

@ -35,6 +35,14 @@ var QueueCollection = PageableCollection.extend({
} }
}, },
movie : {
sortValue : function(model, attr) {
var movie = model.get(attr);
return movie.get('sortTitle');
}
},
episode : { episode : {
sortValue : function(model, attr) { sortValue : function(model, attr) {
var episode = model.get('episode'); var episode = model.get('episode');
@ -84,4 +92,4 @@ QueueCollection = AsPageableCollection.call(QueueCollection);
var collection = new QueueCollection().bindSignalR(); var collection = new QueueCollection().bindSignalR();
collection.fetch(); collection.fetch();
module.exports = collection; module.exports = collection;

View File

@ -1,7 +1,7 @@
var Marionette = require('marionette'); var Marionette = require('marionette');
var Backgrid = require('backgrid'); var Backgrid = require('backgrid');
var QueueCollection = require('./QueueCollection'); var QueueCollection = require('./QueueCollection');
var SeriesTitleCell = require('../../Cells/SeriesTitleCell'); var SeriesTitleCell = require('../../Cells/MovieTitleCell');
var EpisodeNumberCell = require('../../Cells/EpisodeNumberCell'); var EpisodeNumberCell = require('../../Cells/EpisodeNumberCell');
var EpisodeTitleCell = require('../../Cells/EpisodeTitleCell'); var EpisodeTitleCell = require('../../Cells/EpisodeTitleCell');
var QualityCell = require('../../Cells/QualityCell'); var QualityCell = require('../../Cells/QualityCell');
@ -28,11 +28,11 @@ module.exports = Marionette.Layout.extend({
cellValue : 'this' cellValue : 'this'
}, },
{ {
name : 'series', name : 'movie',
label : 'Series', label : 'Movie',
cell : SeriesTitleCell cell : SeriesTitleCell
}, },
{ /*{
name : 'episode', name : 'episode',
label : 'Episode', label : 'Episode',
cell : EpisodeNumberCell cell : EpisodeNumberCell
@ -42,7 +42,7 @@ module.exports = Marionette.Layout.extend({
label : 'Episode Title', label : 'Episode Title',
cell : EpisodeTitleCell, cell : EpisodeTitleCell,
cellValue : 'episode' cellValue : 'episode'
}, },*/
{ {
name : 'quality', name : 'quality',
label : 'Quality', label : 'Quality',

View File

@ -1,12 +1,14 @@
var Backbone = require('backbone'); var Backbone = require('backbone');
var SeriesModel = require('../../Series/SeriesModel'); var SeriesModel = require('../../Series/SeriesModel');
var EpisodeModel = require('../../Series/EpisodeModel'); var EpisodeModel = require('../../Series/EpisodeModel');
var MovieModel = require('../../Movies/MovieModel');
module.exports = Backbone.Model.extend({ module.exports = Backbone.Model.extend({
parse : function(model) { parse : function(model) {
model.series = new SeriesModel(model.series); model.series = new SeriesModel(model.series);
model.episode = new EpisodeModel(model.episode); model.episode = new EpisodeModel(model.episode);
model.episode.set('series', model.series); model.episode.set('series', model.series);
model.movie = new MovieModel(model.movie);
return model; return model;
} }
}); });