|
|
@ -31,38 +31,28 @@ define(
|
|
|
|
var hasAired = Moment(this.model.get('airDateUtc')).isBefore(Moment());
|
|
|
|
var hasAired = Moment(this.model.get('airDateUtc')).isBefore(Moment());
|
|
|
|
var hasFile = this.model.get('hasFile');
|
|
|
|
var hasFile = this.model.get('hasFile');
|
|
|
|
|
|
|
|
|
|
|
|
if (hasFile && reqres.hasHandler(reqres.Requests.GetEpisodeFileById)) {
|
|
|
|
if (hasFile) {
|
|
|
|
var episodeFile = reqres.request(reqres.Requests.GetEpisodeFileById, this.model.get('episodeFileId'));
|
|
|
|
var episodeFile;
|
|
|
|
|
|
|
|
|
|
|
|
this.listenTo(episodeFile, 'change', this._refresh);
|
|
|
|
if (reqres.hasHandler(reqres.Requests.GetEpisodeFileById)) {
|
|
|
|
|
|
|
|
episodeFile = reqres.request(reqres.Requests.GetEpisodeFileById, this.model.get('episodeFileId'));
|
|
|
|
var quality = episodeFile.get('quality');
|
|
|
|
|
|
|
|
var size = FormatHelpers.bytes(episodeFile.get('size'));
|
|
|
|
|
|
|
|
var title = 'Episode downloaded';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (quality.proper) {
|
|
|
|
|
|
|
|
title += ' [PROPER] - {0}'.format(size);
|
|
|
|
|
|
|
|
this.$el.html('<span class="badge badge-info" title="{0}">{1}</span>'.format(title, quality.quality.name));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
title += ' - {0}'.format(size);
|
|
|
|
episodeFile = this.model.get('episodeFile');
|
|
|
|
this.$el.html('<span class="badge badge-inverse" title="{0}">{1}</span>'.format(title, quality.quality.name));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
this.listenTo(episodeFile, 'change', this._refresh);
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (hasFile && this.model.get('episodeFile')) {
|
|
|
|
|
|
|
|
var episodeFile = this.model.get('episodeFile');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var quality = episodeFile.quality;
|
|
|
|
var quality = episodeFile.get('quality');
|
|
|
|
var size = FormatHelpers.bytes(episodeFile.size);
|
|
|
|
var size = FormatHelpers.bytes(episodeFile.get('size'));
|
|
|
|
var title = 'Episode downloaded';
|
|
|
|
var title = 'Episode downloaded';
|
|
|
|
|
|
|
|
|
|
|
|
if (quality.proper) {
|
|
|
|
if (quality.proper) {
|
|
|
|
title += ' [PROPER] - {0}'.format(size);
|
|
|
|
title += ' [PROPER] - {0}'.format(size);
|
|
|
|
this.$el.html('<span class="badge badge-info" title="{0}">{1}</span>'.format(title, quality.quality.name));
|
|
|
|
this.$el.html('<span class="badge badge-info" title="{0}">{1}</span>'.format(title, quality.quality.name));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
title += ' - {0}'.format(size);
|
|
|
|
title += ' - {0}'.format(size);
|
|
|
|
this.$el.html('<span class="badge badge-inverse" title="{0}">{1}</span>'.format(title, quality.quality.name));
|
|
|
|
this.$el.html('<span class="badge badge-inverse" title="{0}">{1}</span>'.format(title, quality.quality.name));
|
|
|
@ -70,6 +60,7 @@ define(
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
var model = this.model;
|
|
|
|
var model = this.model;
|
|
|
|
var downloading = QueueCollection.findEpisode(model.get('id'));
|
|
|
|
var downloading = QueueCollection.findEpisode(model.get('id'));
|
|
|
|