|
|
@ -22,6 +22,11 @@ define(
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
_renderCell: function () {
|
|
|
|
_renderCell: function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.episodeFile) {
|
|
|
|
|
|
|
|
this.stopListening(this.episodeFile, 'change', this._refresh);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.$el.empty();
|
|
|
|
this.$el.empty();
|
|
|
|
|
|
|
|
|
|
|
|
if (this.model) {
|
|
|
|
if (this.model) {
|
|
|
@ -30,23 +35,13 @@ define(
|
|
|
|
var tooltip;
|
|
|
|
var tooltip;
|
|
|
|
|
|
|
|
|
|
|
|
var hasAired = moment(this.model.get('airDateUtc')).isBefore(moment());
|
|
|
|
var hasAired = moment(this.model.get('airDateUtc')).isBefore(moment());
|
|
|
|
var hasFile = this.model.get('hasFile');
|
|
|
|
this.episodeFile = this._getFile();
|
|
|
|
|
|
|
|
|
|
|
|
if (hasFile) {
|
|
|
|
if (this.episodeFile) {
|
|
|
|
var episodeFile;
|
|
|
|
this.listenTo(this.episodeFile, 'change', this._refresh);
|
|
|
|
|
|
|
|
|
|
|
|
if (reqres.hasHandler(reqres.Requests.GetEpisodeFileById)) {
|
|
|
|
var quality = this.episodeFile.get('quality');
|
|
|
|
episodeFile = reqres.request(reqres.Requests.GetEpisodeFileById, this.model.get('episodeFileId'));
|
|
|
|
var size = FormatHelpers.bytes(this.episodeFile.get('size'));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
episodeFile = new Backbone.Model(this.model.get('episodeFile'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.listenTo(episodeFile, 'change', this._refresh);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var quality = episodeFile.get('quality');
|
|
|
|
|
|
|
|
var size = FormatHelpers.bytes(episodeFile.get('size'));
|
|
|
|
|
|
|
|
var title = 'Episode downloaded';
|
|
|
|
var title = 'Episode downloaded';
|
|
|
|
|
|
|
|
|
|
|
|
if (quality.proper) {
|
|
|
|
if (quality.proper) {
|
|
|
@ -103,6 +98,28 @@ define(
|
|
|
|
|
|
|
|
|
|
|
|
this.$el.html('<i class="{0}" title="{1}"/>'.format(icon, tooltip));
|
|
|
|
this.$el.html('<i class="{0}" title="{1}"/>'.format(icon, tooltip));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_getFile: function () {
|
|
|
|
|
|
|
|
var hasFile = this.model.get('hasFile');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (hasFile) {
|
|
|
|
|
|
|
|
var episodeFile;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (reqres.hasHandler(reqres.Requests.GetEpisodeFileById)) {
|
|
|
|
|
|
|
|
episodeFile = reqres.request(reqres.Requests.GetEpisodeFileById, this.model.get('episodeFileId'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
episodeFile = new Backbone.Model(this.model.get('episodeFile'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (episodeFile) {
|
|
|
|
|
|
|
|
return episodeFile;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|