Movies now show up in the Queue.

pull/23/head
Leonardo Galli 8 years ago
parent 2eedfca78a
commit cde1217356

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

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

@ -10,6 +10,7 @@ namespace NzbDrone.Core.Download.TrackedDownloads
public TrackedDownloadStage State { get; set; }
public TrackedDownloadStatus Status { get; private set; }
public RemoteEpisode RemoteEpisode { get; set; }
public RemoteMovie RemoteMovie { get; set; }
public TrackedDownloadStatusMessage[] StatusMessages { get; private set; }
public DownloadProtocol Protocol { get; set; }

@ -62,6 +62,7 @@ namespace NzbDrone.Core.Download.TrackedDownloads
if (parsedEpisodeInfo != null)
{
trackedDownload.RemoteEpisode = _parsingService.Map(parsedEpisodeInfo, 0, 0);
trackedDownload.RemoteMovie = _parsingService.Map(parsedEpisodeInfo, "", null);
}
if (historyItems.Any())
@ -69,10 +70,10 @@ namespace NzbDrone.Core.Download.TrackedDownloads
var firstHistoryItem = historyItems.OrderByDescending(h => h.Date).First();
trackedDownload.State = GetStateFromHistory(firstHistoryItem.EventType);
if (parsedEpisodeInfo == null ||
if ((parsedEpisodeInfo == null ||
trackedDownload.RemoteEpisode == 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
// 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 @@ namespace NzbDrone.Core.Download.TrackedDownloads
}
}
if (trackedDownload.RemoteEpisode == null)
if (trackedDownload.RemoteEpisode == null && trackedDownload.RemoteMovie == null)
{
return null;
}

@ -13,6 +13,7 @@ namespace NzbDrone.Core.Queue
{
public Series Series { get; set; }
public Episode Episode { get; set; }
public Movie Movie { get; set; }
public QualityModel Quality { get; set; }
public decimal Size { get; set; }
public string Title { get; set; }
@ -24,6 +25,7 @@ namespace NzbDrone.Core.Queue
public List<TrackedDownloadStatusMessage> StatusMessages { get; set; }
public string DownloadId { get; set; }
public RemoteEpisode RemoteEpisode { get; set; }
public RemoteMovie RemoteMovie { get; set; }
public DownloadProtocol Protocol { get; set; }
}
}

@ -51,12 +51,42 @@ namespace NzbDrone.Core.Queue
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)
{
var queue = new Queue

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

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

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

Loading…
Cancel
Save