Prowlarr/src/NzbDrone.Api/Calendar/CalendarModule.cs
Leonardo Galli 35b384439f Bulk Import. (#583)
* First pass at bulk import.

* First pass at paging implementation for bulk import.

* Another pass at UI for bulk import

WHY WON'T THE ROWS SELECT?!?!

* Paging mostly done. UI needs to show loading still.

* Fix for selection

* fixes.

* Add caching to bulk import

* Tried to fix paging.

* Fix has next

* Fix link error.

* Pageable now works almost perfectly.

Collection now works really nicely when paged. Also movies from different pages can be added no problemo.

* /bulk-import: ProfileCell

Various other QoL changes

* Profile selection works now

Still kinda hacky

* Default monitored to true.

* Add Monitor Cell

Update styling, added path tooltip as well

* Update model when changing tmdbId

Ensure monitor status doesn't change as well

* Added spinner feedback for tmdbid cell.

* /bulk-import: Add page-size selector
2017-02-07 19:09:36 -05:00

57 lines
2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using Nancy;
using NzbDrone.Api.Episodes;
using NzbDrone.Api.Movie;
using NzbDrone.Api.Series;
using NzbDrone.Core.Datastore.Events;
using NzbDrone.Core.MediaCover;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.MovieStats;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Tv.Events;
using NzbDrone.Core.Validation.Paths;
using NzbDrone.Core.DataAugmentation.Scene;
using NzbDrone.Core.Validation;
using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Tv;
using NzbDrone.SignalR;
namespace NzbDrone.Api.Calendar
{
public class CalendarModule : MovieModule
{
public CalendarModule(IBroadcastSignalRMessage signalR,
IMovieService moviesService,
IMovieStatisticsService moviesStatisticsService,
ISceneMappingService sceneMappingService,
IMapCoversToLocal coverMapper)
: base(signalR, moviesService, moviesStatisticsService, sceneMappingService, coverMapper, "calendar")
{
GetResourceAll = GetCalendar;
}
private List<MovieResource> GetCalendar()
{
var start = DateTime.Today;
var end = DateTime.Today.AddDays(2);
var includeUnmonitored = false;
var queryStart = Request.Query.Start;
var queryEnd = Request.Query.End;
var queryIncludeUnmonitored = Request.Query.Unmonitored;
if (queryStart.HasValue) start = DateTime.Parse(queryStart.Value);
if (queryEnd.HasValue) end = DateTime.Parse(queryEnd.Value);
if (queryIncludeUnmonitored.HasValue) includeUnmonitored = Convert.ToBoolean(queryIncludeUnmonitored.Value);
var resources = _moviesService.GetMoviesBetweenDates(start, end, includeUnmonitored).Select(MapToResource);
return resources.OrderBy(e => e.InCinemas).ToList();
}
}
}