diff --git a/src/UI/Cells/EpisodeNumberCell.js b/src/UI/Cells/EpisodeNumberCell.js index 41a034ba2..7b83b238d 100644 --- a/src/UI/Cells/EpisodeNumberCell.js +++ b/src/UI/Cells/EpisodeNumberCell.js @@ -17,6 +17,7 @@ define( var airDateField = this.column.get('airDateUtc') || 'airDateUtc'; var seasonField = this.column.get('seasonNumber') || 'seasonNumber'; var episodeField = this.column.get('episodes') || 'episodeNumber'; + var absoluteEpisodeField = 'absoluteEpisodeNumber'; if (this.model) { var result = 'Unknown'; @@ -24,6 +25,7 @@ define( var airDate = this.model.get(airDateField); var seasonNumber = this.model.get(seasonField); var episodes = this.model.get(episodeField); + var absoluteEpisodeNumber = this.model.get(absoluteEpisodeField); if (this.cellValue) { if (!seasonNumber) { @@ -34,6 +36,10 @@ define( episodes = this.cellValue.get(episodeField); } + if (!absoluteEpisodeNumber) { + absoluteEpisodeNumber = this.cellValue.get(absoluteEpisodeField); + } + if (!airDate) { this.model.get(airDateField); } @@ -42,6 +48,7 @@ define( if (episodes) { var paddedEpisodes; + var paddedAbsoluteEpisode; if (episodes.constructor === Array) { paddedEpisodes = _.map(episodes,function (episodeNumber) { @@ -50,9 +57,14 @@ define( } else { paddedEpisodes = FormatHelpers.pad(episodes, 2); + paddedAbsoluteEpisode = FormatHelpers.pad(absoluteEpisodeNumber, 2); } result = '{0}x{1}'.format(seasonNumber, paddedEpisodes); + + if (absoluteEpisodeNumber > 0 && paddedAbsoluteEpisode) { + result += ' ({0})'.format(paddedAbsoluteEpisode); + } } else if (airDate) { result = new Date(airDate).toLocaleDateString(); diff --git a/src/UI/Handlebars/Helpers/Episode.js b/src/UI/Handlebars/Helpers/Episode.js index a24b351f6..0ee706fb4 100644 --- a/src/UI/Handlebars/Helpers/Episode.js +++ b/src/UI/Handlebars/Helpers/Episode.js @@ -11,6 +11,10 @@ define( return moment(this.airDate).format('L'); } + else if (this.series.seriesType === 'anime' && this.absoluteEpisodeNumber > 0) { + return '{0}x{1} ({2})'.format(this.seasonNumber, FormatHelpers.pad(this.episodeNumber, 2), FormatHelpers.pad(this.absoluteEpisodeNumber, 2)); + } + else { return '{0}x{1}'.format(this.seasonNumber, FormatHelpers.pad(this.episodeNumber, 2)); } diff --git a/src/UI/Series/Details/EpisodeNumberCell.js b/src/UI/Series/Details/EpisodeNumberCell.js index da0596a02..7a37d2826 100644 --- a/src/UI/Series/Details/EpisodeNumberCell.js +++ b/src/UI/Series/Details/EpisodeNumberCell.js @@ -4,8 +4,9 @@ define( [ 'marionette', 'Cells/NzbDroneCell', - 'reqres' - ], function (Marionette, NzbDroneCell, reqres) { + 'reqres', + 'Series/SeriesCollection' + ], function (Marionette, NzbDroneCell, reqres, SeriesCollection) { return NzbDroneCell.extend({ className: 'episode-number-cell', @@ -16,6 +17,12 @@ define( this.$el.empty(); this.$el.html(this.model.get('episodeNumber')); + var series = SeriesCollection.get(this.model.get('seriesId')); + + if (series.get('seriesType') === 'anime' && this.model.has('absoluteEpisodeNumber')) { + this.$el.html('{0} ({1})'.format(this.model.get('episodeNumber'), this.model.get('absoluteEpisodeNumber'))); + } + var alternateTitles = []; if (reqres.hasHandler(reqres.Requests.GetAlternateNameBySeasonNumber)) { diff --git a/src/UI/Series/series.less b/src/UI/Series/series.less index d422f6dd7..357db8ab6 100644 --- a/src/UI/Series/series.less +++ b/src/UI/Series/series.less @@ -244,6 +244,7 @@ .episode-number-cell { width : 22px; + white-space: nowrap; } .episode-air-date-cell { width : 150px;