diff --git a/couchpotato/core/media/show/_base/static/episode.js b/couchpotato/core/media/show/_base/static/episode.js index 2ba18a9..37d2f16 100755 --- a/couchpotato/core/media/show/_base/static/episode.js +++ b/couchpotato/core/media/show/_base/static/episode.js @@ -10,8 +10,10 @@ var Episode = new Class({ self.show = show; self.data = data; - self.el = new Element('div.item'); - self.el_actions = new Element('div.actions'); + self.profile = self.show.profile; + + self.el = new Element('div.item.data'); + self.el_actions = new Element('div.episode-actions'); self.create(); }, @@ -24,11 +26,14 @@ var Episode = new Class({ self.el.adopt( new Element('span.episode', {'text': (self.data.info.number || 0)}), new Element('span.name', {'text': self.getTitle()}), - new Element('span.firstaired', {'text': self.data.info.firstaired}) + new Element('span.firstaired', {'text': self.data.info.firstaired}), + + self.quality = new Element('span.quality') ); self.el_actions.inject(self.el); + // imdb if(self.data.identifiers && self.data.identifiers.imdb) { new Element('a.imdb.icon2', { 'title': 'Go to the IMDB page of ' + self.show.getTitle(), @@ -37,12 +42,59 @@ var Episode = new Class({ }).inject(self.el_actions); } + // refresh new Element('a.refresh.icon2', { 'title': 'Refresh the episode info and do a forced search', 'events': { 'click': self.doRefresh.bind(self) } }).inject(self.el_actions); + + // Add profile + if(self.profile.data) { + self.profile.getTypes().each(function(type){ + var q = self.addQuality(type.get('quality'), type.get('3d')); + + if((type.finish == true || type.get('finish')) && !q.hasClass('finish')){ + q.addClass('finish'); + q.set('title', q.get('title') + ' Will finish searching for this movie if this quality is found.') + } + }); + } + + // Add releases + self.updateReleases(); + }, + + updateReleases: function(){ + var self = this; + if(!self.data.releases || self.data.releases.length == 0) return; + + self.data.releases.each(function(release){ + + var q = self.quality.getElement('.q_'+ release.quality+(release.is_3d ? '.is_3d' : ':not(.is_3d)')), + status = release.status; + + if(!q && (status == 'snatched' || status == 'seeding' || status == 'done')) + q = self.addQuality(release.quality, release.is_3d || false); + + if (q && !q.hasClass(status)){ + q.addClass(status); + q.set('title', (q.get('title') ? q.get('title') : '') + ' status: '+ status) + } + + }); + }, + + addQuality: function(quality, is_3d){ + var self = this, + q = Quality.getQuality(quality); + + return new Element('span', { + 'text': q.label + (is_3d ? ' 3D' : ''), + 'class': 'q_'+q.identifier + (is_3d ? ' is_3d' : ''), + 'title': '' + }).inject(self.quality); }, getTitle: function(){ diff --git a/couchpotato/core/media/show/_base/static/show.css b/couchpotato/core/media/show/_base/static/show.css index 0f83a47..5c4c9fb 100755 --- a/couchpotato/core/media/show/_base/static/show.css +++ b/couchpotato/core/media/show/_base/static/show.css @@ -680,22 +680,38 @@ .hide_trailer.hide { top: -30px; } - - .shows .list .show .episodes .item { + .shows .list .episodes .item { position: relative; + width: auto; + height: auto; + padding: 0; } - .shows .list .show .episodes .actions { + .shows .list .episodes .item span.episode { + width: 40px; + padding: 0 10px; + } + + .shows .list .episodes .item span.name { + width: 280px; + } + + .shows .list .episodes .item span.firstaired { + width: 80px; + } + + .shows .list .show .episodes .episode-actions { position: absolute; width: auto; right: 0; + top: 0; border-left: none; } - .shows .list .show .episodes .actions .refresh { - color: #cbeecc; - } + .shows .list .show .episodes .episode-actions .refresh { + color: #cbeecc; + } .shows .list .show .try_container { padding: 5px 10px;