From 1ca3fa2cff460f87c162fe1faaf0c6deaa4d46ac Mon Sep 17 00:00:00 2001 From: Ruud Date: Mon, 27 Feb 2012 22:31:23 +0100 Subject: [PATCH] Proper release deletion and styling --- couchpotato/core/plugins/movie/main.py | 15 ++++++++++ couchpotato/core/plugins/movie/static/movie.css | 37 +++++++++++++++++++++--- couchpotato/core/plugins/movie/static/movie.js | 21 +++++++++----- couchpotato/core/plugins/release/main.py | 24 ++++++++++++++- couchpotato/static/images/icon.undo.png | Bin 0 -> 587 bytes 5 files changed, 85 insertions(+), 12 deletions(-) create mode 100644 couchpotato/static/images/icon.undo.png diff --git a/couchpotato/core/plugins/movie/main.py b/couchpotato/core/plugins/movie/main.py index bfdcb37..295726c 100644 --- a/couchpotato/core/plugins/movie/main.py +++ b/couchpotato/core/plugins/movie/main.py @@ -272,6 +272,13 @@ class MoviePlugin(Plugin): db.commit() + # Remove releases + available_status = fireEvent('status.get', 'available', single = True) + for rel in m.releases: + if rel.status_id is available_status.get('id'): + db.delete(rel) + db.commit() + movie_dict = m.to_dict(self.default_dict) if force_readd or do_search: @@ -297,12 +304,20 @@ class MoviePlugin(Plugin): params = getParams() db = get_session() + available_status = fireEvent('status.get', 'available', single = True) + ids = params.get('id').split(',') for movie_id in ids: m = db.query(Movie).filter_by(id = movie_id).first() m.profile_id = params.get('profile_id') + # Remove releases + for rel in m.releases: + if rel.status_id is available_status.get('id'): + db.delete(rel) + db.commit() + # Default title if params.get('default_title'): for title in m.library.titles: diff --git a/couchpotato/core/plugins/movie/static/movie.css b/couchpotato/core/plugins/movie/static/movie.css index 3188caa..4cf9a7b 100644 --- a/couchpotato/core/plugins/movie/static/movie.css +++ b/couchpotato/core/plugins/movie/static/movie.css @@ -133,18 +133,38 @@ } .movies .data .quality span { - padding: 0 5px; + padding: 2px 3px; font-weight: bold; + opacity: 0.5; + font-size: 10px; + text-transform: uppercase; + text-shadow: none; + font-weight: normal; + margin: 0 2px; + border-radius: 2px; + background-color: rgba(255,255,255,0.1); } - .movies .data .quality span:first-child {padding-left: 0;} .movies .list_view .data .quality, .movies .mass_edit_view .data .quality { text-align: right; float: right; width: 35%; } + + .movies .data .quality .available, .movies .data .quality .snatched { + opacity: 1; + box-shadow: 1px 1px 0 rgba(0,0,0,0.2); + cursor: pointer; + } - .movies .data .quality .available { color: orange; } - .movies .data .quality .snatched { color: lightgreen; } + .movies .data .quality .available { background-color: #578bc3; } + .movies .data .quality .snatched { background-color: #369545; } + .movies .data .quality .finish { + background-image: url('../images/sprite.png'); + background-repeat: no-repeat; + background-position: 0 2px; + padding-left: 14px; + background-size: 14px + } .movies .data .actions { line-height: 0; @@ -218,6 +238,15 @@ .movies .options .table .item { border-bottom: 1px solid rgba(255,255,255,0.1); } + .movies .options .table .item.ignored span { + text-decoration: line-through; + color: rgba(255,255,255,0.4); + text-shadow: none; + } + .movies .options .table .item.ignored .delete { + background-image: url('../images/icon.undo.png'); + } + .movies .options .table .item:last-child { border: 0; } .movies .options .table .item:nth-child(even) { background: rgba(255,255,255,0.05); diff --git a/couchpotato/core/plugins/movie/static/movie.js b/couchpotato/core/plugins/movie/static/movie.js index d728f57..67fcb3c 100644 --- a/couchpotato/core/plugins/movie/static/movie.js +++ b/couchpotato/core/plugins/movie/static/movie.js @@ -46,7 +46,13 @@ var Movie = new Class({ self.description = new Element('div.description', { 'text': self.data.library.plot }), - self.quality = new Element('div.quality') + self.quality = new Element('div.quality', { + 'events': { + 'click': function(e){ + self.el.getElement('.actions .releases').fireEvent('click', [e]) + } + } + }) ), self.actions = new Element('div.actions') ) @@ -69,10 +75,11 @@ var Movie = new Class({ Array.each(self.data.releases, function(release){ var q = self.quality.getElement('.q_'+ release.quality.identifier); - if(!q) + if(!q && release.status.identifier == 'snatched') var q = self.addQuality(release.quality_id) - q.addClass(release.status.identifier); + if (q) + q.addClass(release.status.identifier); }); @@ -283,8 +290,8 @@ var ReleaseAction = new Class({ 'events': { 'click': function(e){ (e).stop(); - self.del(release); - this.getParent('.item').destroy(); + self.ignore(release); + this.getParent('.item').toggleClass('ignored') } } }) @@ -314,10 +321,10 @@ var ReleaseAction = new Class({ }); }, - del: function(release){ + ignore: function(release){ var self = this; - Api.request('release.delete', { + Api.request('release.ignore', { 'data': { 'id': release.id } diff --git a/couchpotato/core/plugins/release/main.py b/couchpotato/core/plugins/release/main.py index 01e7f60..f83b322 100644 --- a/couchpotato/core/plugins/release/main.py +++ b/couchpotato/core/plugins/release/main.py @@ -23,7 +23,13 @@ class Release(Plugin): } }) addApiView('release.delete', self.delete, docs = { - 'desc': 'Check for available update', + 'desc': 'Delete releases', + 'params': { + 'id': {'type': 'id', 'desc': 'ID of the release object in release-table'} + } + }) + addApiView('release.ignore', self.ignore, docs = { + 'desc': 'Toggle ignore, for bad or wrong releases', 'params': { 'id': {'type': 'id', 'desc': 'ID of the release object in release-table'} } @@ -105,6 +111,22 @@ class Release(Plugin): 'success': True }) + def ignore(self): + + db = get_session() + id = getParam('id') + + rel = db.query(Relea).filter_by(id = id).first() + if rel: + ignored_status = fireEvent('status.get', 'ignored', single = True) + available_status = fireEvent('status.get', 'available', single = True) + rel.status_id = available_status.get('id') if rel.status_id is ignored_status.get('id') else ignored_status.get('id') + db.commit() + + return jsonified({ + 'success': True + }) + def download(self): db = get_session() diff --git a/couchpotato/static/images/icon.undo.png b/couchpotato/static/images/icon.undo.png new file mode 100644 index 0000000000000000000000000000000000000000..07f907dce23158b507d874de9cd9fc9339ea43db GIT binary patch literal 587 zcmV-R0<`^!P)aNs?80P-y3nq1b> zaC%Rg%_JVCvHDEA=}XV}VQ?)-_5T@gZbX%`hHSL*YL?xL z+3|dN1TQ~^;hX6KXLYLrTHJdj`DC;B)wn*b$HaVBmb;4%%)~t4T!J>q0s6kGbafQJ z9MZxyaRkPJ17h_*IwMRjSP*#71I{?*0G+)eQwc4#d6eL~lb)J~R2aN}LI}-WlKOAu zfJXE7TnZ?dtc#C3cAcm1P!nT4+$4;D5dkipP*_{c&>(85&dvS))z3Kp|f0&>XC=tI6u5!IN4hTzGIUE z4(c~5C~?YNiFWTE!5cB+@tc4k)yBbULGRiD&c>-o4ye(sm*_O@rD%3+Me9ICPR)*T zaBhX_R$Zihjq6gB^h4dDK$Ei!diOS=$x#M%rvf~SQ*G8&u5KtyS4cK`MM#R0iHb6R Zra!M#EiisO%cTGS002ovPDHLkV1fjJ5as{? literal 0 HcmV?d00001