mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-05 02:22:31 +01:00
fixed posters for add series search
This commit is contained in:
parent
9ed187202a
commit
2a89897a99
@ -1,12 +1,14 @@
|
||||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
using Nancy;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using System.Linq;
|
||||
using NzbDrone.Api.Mapping;
|
||||
|
||||
namespace NzbDrone.Api.Series
|
||||
{
|
||||
public class SeriesLookupModule : NzbDroneApiModule
|
||||
public class SeriesLookupModule : NzbDroneRestModule<SeriesResource>
|
||||
{
|
||||
private readonly ISearchForNewSeries _searchProxy;
|
||||
|
||||
@ -14,14 +16,30 @@ public SeriesLookupModule(ISearchForNewSeries searchProxy)
|
||||
: base("/Series/lookup")
|
||||
{
|
||||
_searchProxy = searchProxy;
|
||||
Get["/"] = x => GetQualityType();
|
||||
Get["/"] = x => Search();
|
||||
}
|
||||
|
||||
|
||||
private Response GetQualityType()
|
||||
private Response Search()
|
||||
{
|
||||
var tvDbResults = _searchProxy.SearchForNewSeries((string)Request.Query.term);
|
||||
return tvDbResults.FirstOrDefault().AsResponse();
|
||||
return MapToResource(tvDbResults).FirstOrDefault().AsResponse();
|
||||
}
|
||||
|
||||
|
||||
private static IEnumerable<SeriesResource> MapToResource(IEnumerable<Core.Tv.Series> series)
|
||||
{
|
||||
foreach (var currentSeries in series)
|
||||
{
|
||||
var resource = currentSeries.InjectTo<SeriesResource>();
|
||||
var poster = currentSeries.Images.FirstOrDefault(c => c.CoverType == MediaCoverTypes.Poster);
|
||||
if (poster != null)
|
||||
{
|
||||
resource.RemotePoster = poster.Url;
|
||||
}
|
||||
|
||||
yield return resource;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -26,6 +26,9 @@ public class SeriesResource : RestResource
|
||||
public Int32 UtcOffset { get; set; }
|
||||
public List<Core.MediaCover.MediaCover> Images { get; set; }
|
||||
|
||||
public String RemotePoster { get; set; }
|
||||
|
||||
|
||||
//View & Edit
|
||||
public String Path { get; set; }
|
||||
public Int32 QualityProfileId { get; set; }
|
||||
|
@ -5,7 +5,9 @@ define(['app', 'Series/SeriesModel'], function () {
|
||||
model: NzbDrone.Series.SeriesModel,
|
||||
|
||||
parse: function (response) {
|
||||
if (response) {
|
||||
response.id = undefined;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
});
|
||||
|
@ -18,6 +18,10 @@ define([
|
||||
'click .x-add': 'addSeries'
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
this.model.set('isExisting', true);
|
||||
},
|
||||
|
||||
addSeries: function () {
|
||||
var icon = this.ui.addButton.find('icon');
|
||||
icon.removeClass('icon-plus').addClass('icon-spin icon-spinner disabled');
|
||||
|
@ -1,5 +1,8 @@
|
||||
<div class="unmapped-folder-view">
|
||||
<div class="row">
|
||||
<div class="x-folder-name-match-results folder-name-matches"/>
|
||||
</div>
|
||||
<div class="row" style="visibility: collapse;">
|
||||
<div class="folder-header span11">
|
||||
<div class="input-prepend">
|
||||
<i class="add-on icon-search"></i>
|
||||
@ -11,7 +14,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="x-folder-name-match-results folder-name-matches"/>
|
||||
<div class="row text-center">
|
||||
load more
|
||||
</div>
|
||||
|
||||
</div>
|
@ -2,7 +2,7 @@
|
||||
<div class="row">
|
||||
<div class="span2">
|
||||
<a href="{{traktUrl}}" target="_blank">
|
||||
<img class="series-poster img-polaroid" src="{{poster}}">
|
||||
<img class="series-poster img-polaroid" src="{{remotePoster}}">
|
||||
</a>
|
||||
</div>
|
||||
<div class="span9">
|
||||
|
Loading…
Reference in New Issue
Block a user