mirror of
https://github.com/Radarr/Radarr
synced 2025-12-20 15:24:41 +01:00
* 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
60 lines
No EOL
1.8 KiB
C#
60 lines
No EOL
1.8 KiB
C#
using System.Collections.Generic;
|
|
using Nancy;
|
|
using NzbDrone.Api.Extensions;
|
|
using NzbDrone.Core.MediaCover;
|
|
using NzbDrone.Core.MetadataSource;
|
|
using System.Linq;
|
|
using System;
|
|
using NzbDrone.Api.REST;
|
|
|
|
namespace NzbDrone.Api.Movie
|
|
{
|
|
public class MovieLookupModule : NzbDroneRestModule<MovieResource>
|
|
{
|
|
private readonly ISearchForNewMovie _searchProxy;
|
|
private readonly IProvideMovieInfo _movieInfo;
|
|
|
|
public MovieLookupModule(ISearchForNewMovie searchProxy, IProvideMovieInfo movieInfo)
|
|
: base("/movies/lookup")
|
|
{
|
|
_movieInfo = movieInfo;
|
|
_searchProxy = searchProxy;
|
|
Get["/"] = x => Search();
|
|
Get["/tmdb"] = x => SearchByTmdbId();
|
|
}
|
|
|
|
private Response SearchByTmdbId()
|
|
{
|
|
int tmdbId = -1;
|
|
if(Int32.TryParse(Request.Query.tmdbId, out tmdbId))
|
|
{
|
|
var result = _movieInfo.GetMovieInfo(tmdbId, null);
|
|
return result.ToResource().AsResponse();
|
|
}
|
|
|
|
throw new BadRequestException("Tmdb Id was not valid");
|
|
}
|
|
|
|
|
|
private Response Search()
|
|
{
|
|
var imdbResults = _searchProxy.SearchForNewMovie((string)Request.Query.term);
|
|
return MapToResource(imdbResults).AsResponse();
|
|
}
|
|
|
|
private static IEnumerable<MovieResource> MapToResource(IEnumerable<Core.Tv.Movie> movies)
|
|
{
|
|
foreach (var currentSeries in movies)
|
|
{
|
|
var resource = currentSeries.ToResource();
|
|
var poster = currentSeries.Images.FirstOrDefault(c => c.CoverType == MediaCoverTypes.Poster);
|
|
if (poster != null)
|
|
{
|
|
resource.RemotePoster = poster.Url;
|
|
}
|
|
|
|
yield return resource;
|
|
}
|
|
}
|
|
}
|
|
} |