1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

New: Reload fanart and poster on series details after images are downloaded

This commit is contained in:
Mark McDowall 2015-06-07 09:51:29 -07:00
parent 4c3c705517
commit 3c52a9066c
2 changed files with 37 additions and 15 deletions

View File

@ -25,7 +25,8 @@ public class SeriesModule : NzbDroneRestModuleWithSignalR<SeriesResource, Core.T
IHandle<SeriesUpdatedEvent>,
IHandle<SeriesEditedEvent>,
IHandle<SeriesDeletedEvent>,
IHandle<SeriesRenamedEvent>
IHandle<SeriesRenamedEvent>,
IHandle<MediaCoversUpdatedEvent>
{
private readonly ISeriesService _seriesService;
@ -224,5 +225,10 @@ public void Handle(SeriesRenamedEvent message)
{
BroadcastResourceChange(ModelAction.Updated, message.Series.Id);
}
public void Handle(MediaCoversUpdatedEvent message)
{
BroadcastResourceChange(ModelAction.Updated, message.Series.Id);
}
}
}

View File

@ -31,7 +31,8 @@ module.exports = Marionette.Layout.extend({
edit : '.x-edit',
refresh : '.x-refresh',
rename : '.x-rename',
search : '.x-search'
search : '.x-search',
poster : '.x-series-poster'
},
events : {
@ -56,18 +57,12 @@ module.exports = Marionette.Layout.extend({
this._refresh();
}
});
this.listenTo(this.model, 'change:images', this._updateImages);
},
onShow : function() {
$('body').addClass('backdrop');
var fanArt = this._getFanArt();
if (fanArt) {
this._backstrech = $.backstretch(fanArt);
} else {
$('body').removeClass('backdrop');
}
this._showBackdrop();
this._showSeasons();
this._setMonitoredState();
this._showInfo();
@ -107,11 +102,11 @@ module.exports = Marionette.Layout.extend({
reqres.removeHandler(reqres.Requests.GetEpisodeFileById);
},
_getFanArt : function() {
var fanArt = _.where(this.model.get('images'), { coverType : 'fanart' });
_getImage : function(type) {
var image = _.where(this.model.get('images'), { coverType : type });
if (fanArt && fanArt[0]) {
return fanArt[0].url;
if (image && image[0]) {
return image[0].url;
}
return undefined;
@ -231,5 +226,26 @@ module.exports = Marionette.Layout.extend({
});
vent.trigger(vent.Commands.OpenModalCommand, view);
},
_updateImages : function () {
var poster = this._getImage('poster');
if (poster) {
this.ui.poster.attr('src', poster);
}
this._showBackdrop();
},
_showBackdrop : function () {
$('body').addClass('backdrop');
var fanArt = this._getImage('fanart');
if (fanArt) {
this._backstrech = $.backstretch(fanArt);
} else {
$('body').removeClass('backdrop');
}
}
});