From 60ff3b08d42d264c64857974faaf85b37d423bf8 Mon Sep 17 00:00:00 2001 From: Ruud Date: Fri, 3 May 2013 23:04:52 +0200 Subject: [PATCH 01/10] Last message check 0 after first message --- couchpotato/core/notifications/core/main.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/couchpotato/core/notifications/core/main.py b/couchpotato/core/notifications/core/main.py index a28ccb9..6aacd23 100644 --- a/couchpotato/core/notifications/core/main.py +++ b/couchpotato/core/notifications/core/main.py @@ -118,15 +118,14 @@ class CoreNotifier(Notification): messages = fireEvent('cp.messages', last_check = last_check, single = True) - last_time = 0 for message in messages: if message.get('time') > last_check: fireEvent('core.message', message = message.get('message'), data = message) - if last_time < message.get('time'): - last_time = message.get('time') + if last_check < message.get('time'): + last_check = message.get('time') - Env.prop(prop_name, value = last_time) + Env.prop(prop_name, value = last_check) def notify(self, message = '', data = {}, listener = None): From f5af551325744f663a93892ac4efa94af3954d8e Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 5 May 2013 10:14:10 +0200 Subject: [PATCH 02/10] Extend files, not append --- couchpotato/core/plugins/release/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/plugins/release/main.py b/couchpotato/core/plugins/release/main.py index 4967bce..6618a8b 100644 --- a/couchpotato/core/plugins/release/main.py +++ b/couchpotato/core/plugins/release/main.py @@ -87,7 +87,7 @@ class Release(Plugin): # Add the release files in batch try: added_files = db.query(File).filter(or_(*[File.id == x for x in added_files])).all() - rel.files.append(added_files) + rel.files.extend(added_files) db.commit() except Exception, e: log.debug('Failed to attach "%s" to release: %s', (cur_file, e)) From 6d1297a85f5fd8067a4f2479b32be075e41ce41d Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 5 May 2013 13:31:26 +0200 Subject: [PATCH 03/10] Don't show double message when refreshing movie --- couchpotato/core/plugins/movie/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/plugins/movie/main.py b/couchpotato/core/plugins/movie/main.py index 4b595dc..1ce68f0 100644 --- a/couchpotato/core/plugins/movie/main.py +++ b/couchpotato/core/plugins/movie/main.py @@ -315,7 +315,7 @@ class MoviePlugin(Plugin): for title in movie.library.titles: if title.default: default_title = title.title - fireEvent('notify.frontend', type = 'movie.busy.%s' % id, data = True, message = 'Updating "%s"' % default_title) + fireEvent('notify.frontend', type = 'movie.busy.%s' % id, data = True) fireEventAsync('library.update', identifier = movie.library.identifier, default_title = default_title, force = True, on_complete = self.createOnComplete(id)) From b90861bc6306d324cc0abf632a5426983a735135 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 5 May 2013 13:35:49 +0200 Subject: [PATCH 04/10] Show if movie is in library again on search --- couchpotato/core/plugins/movie/static/search.css | 7 ++++++- couchpotato/core/plugins/movie/static/search.js | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/plugins/movie/static/search.css b/couchpotato/core/plugins/movie/static/search.css index e03c646..fb0cadd 100644 --- a/couchpotato/core/plugins/movie/static/search.css +++ b/couchpotato/core/plugins/movie/static/search.css @@ -143,6 +143,9 @@ border-radius: 0; box-shadow: inset 0 1px 8px rgba(0,0,0,0.25); } + .movie_result .options > .in_library_wanted { + margin-top: -7px; + } .movie_result .options > div { border: 0; @@ -198,7 +201,9 @@ .movie_result .in_wanted, .movie_result .in_library { position: absolute; - margin-top: 105px; + bottom: 2px; + left: 14px; + font-size: 11px; } .movie_result .thumbnail { diff --git a/couchpotato/core/plugins/movie/static/search.js b/couchpotato/core/plugins/movie/static/search.js index 334f855..c61b162 100644 --- a/couchpotato/core/plugins/movie/static/search.js +++ b/couchpotato/core/plugins/movie/static/search.js @@ -309,7 +309,9 @@ Block.Search.Item = new Class({ } self.options_el.grab( - new Element('div').adopt( + new Element('div', { + 'class': self.info.in_wanted && self.info.in_wanted.profile || in_library ? 'in_library_wanted' : '' + }).adopt( self.info.in_wanted && self.info.in_wanted.profile ? new Element('span.in_wanted', { 'text': 'Already in wanted list: ' + self.info.in_wanted.profile.label }) : (in_library ? new Element('span.in_library', { From c4c7b5b1a9b07b700f74d46fdaf7f0f8f144c992 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 5 May 2013 14:09:11 +0200 Subject: [PATCH 05/10] Settings styling issues --- .../core/plugins/profile/static/profile.css | 23 ++++++++++++++++------ couchpotato/static/style/settings.css | 2 +- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/couchpotato/core/plugins/profile/static/profile.css b/couchpotato/core/plugins/profile/static/profile.css index 21abc66..cdb3394 100644 --- a/couchpotato/core/plugins/profile/static/profile.css +++ b/couchpotato/core/plugins/profile/static/profile.css @@ -6,15 +6,25 @@ border-bottom: 1px solid rgba(255,255,255,0.2); } -.profile { border-bottom: 1px solid rgba(255,255,255,0.2) } +.profile { + border-bottom: 1px solid rgba(255,255,255,0.2); + position: relative; +} .profile > .delete { - height: 20px; - width: 20px; position: absolute; - margin-left: 690px; - padding: 14px; + padding: 25px 20px; background-position: center; + right: 0; + cursor: pointer; + opacity: 0.6; + } + .profile > .delete:hover { + opacity: 1; + } + + .profile .ctrlHolder:hover { + background: none; } .profile .qualities { @@ -34,7 +44,8 @@ .profile .wait_for { position: absolute; - margin: -45px 0 0 437px; + right: 60px; + top: 0; } .profile .wait_for input { diff --git a/couchpotato/static/style/settings.css b/couchpotato/static/style/settings.css index bc1b19f..7bfeb3a 100644 --- a/couchpotato/static/style/settings.css +++ b/couchpotato/static/style/settings.css @@ -66,7 +66,7 @@ .page.settings .containers { width: 84%; float: left; - padding: 40px 2%; + padding: 40px 0 40px 2%; min-height: 300px; } From 897330e6468f952ae9c722e251c42e3d4673d352 Mon Sep 17 00:00:00 2001 From: Faryn Date: Wed, 1 May 2013 19:53:50 +0300 Subject: [PATCH 06/10] Include IMDb link to movie in Pushover notifications --- couchpotato/core/notifications/pushover/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/notifications/pushover/main.py b/couchpotato/core/notifications/pushover/main.py index 8df4ed1..c2f845b 100644 --- a/couchpotato/core/notifications/pushover/main.py +++ b/couchpotato/core/notifications/pushover/main.py @@ -18,7 +18,9 @@ class Pushover(Notification): 'user': self.conf('user_key'), 'token': self.app_token, 'message': toUnicode(message), - 'priority': self.conf('priority') + 'priority': self.conf('priority'), + 'url': toUnicode("http://www.imdb.com/title/%s" % data['library']['identifier']) if data else "", + 'url_title': toUnicode("%s on IMDb" % data['library']['titles'][0]['title']) if data else "" } http_handler.request('POST', From 080da48223f293f180413f20d5501677e25dd7cc Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 5 May 2013 17:28:02 +0200 Subject: [PATCH 07/10] Only attach imdb url when available --- couchpotato/core/notifications/pushover/main.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/couchpotato/core/notifications/pushover/main.py b/couchpotato/core/notifications/pushover/main.py index c2f845b..ba7f426 100644 --- a/couchpotato/core/notifications/pushover/main.py +++ b/couchpotato/core/notifications/pushover/main.py @@ -1,4 +1,5 @@ from couchpotato.core.helpers.encoding import toUnicode, tryUrlencode +from couchpotato.core.helpers.variable import getTitle from couchpotato.core.logger import CPLog from couchpotato.core.notifications.base import Notification from httplib import HTTPSConnection @@ -14,19 +15,23 @@ class Pushover(Notification): http_handler = HTTPSConnection("api.pushover.net:443") - data = { + api_data = { 'user': self.conf('user_key'), 'token': self.app_token, 'message': toUnicode(message), 'priority': self.conf('priority'), - 'url': toUnicode("http://www.imdb.com/title/%s" % data['library']['identifier']) if data else "", - 'url_title': toUnicode("%s on IMDb" % data['library']['titles'][0]['title']) if data else "" } + if data and data.get('library'): + api_data.extend({ + 'url': toUnicode('http://www.imdb.com/title/%s/' % data['library']['identifier']), + 'url_title': toUnicode('%s on IMDb' % getTitle(data['library'])), + }) + http_handler.request('POST', "/1/messages.json", headers = {'Content-type': 'application/x-www-form-urlencoded'}, - body = tryUrlencode(data) + body = tryUrlencode(api_data) ) response = http_handler.getresponse() From e814b551b43a497a3a588ea5e163182f521c72da Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 5 May 2013 17:41:16 +0200 Subject: [PATCH 08/10] Delay fade loader after refreshing movie --- couchpotato/core/plugins/movie/static/movie.js | 29 +++++++++++++++----------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/couchpotato/core/plugins/movie/static/movie.js b/couchpotato/core/plugins/movie/static/movie.js index 4f90322..95fd1de 100644 --- a/couchpotato/core/plugins/movie/static/movie.js +++ b/couchpotato/core/plugins/movie/static/movie.js @@ -22,7 +22,10 @@ var Movie = new Class({ addEvents: function(){ var self = this; - App.addEvent('movie.update.'+self.data.id, self.update.bind(self)); + App.addEvent('movie.update.'+self.data.id, function(notification){ + self.busy(false) + self.update.delay(2000, self, notification); + }); ['movie.busy', 'searcher.started'].each(function(listener){ App.addEvent(listener+'.'+self.data.id, function(notification){ @@ -57,17 +60,19 @@ var Movie = new Class({ var self = this; if(!set_busy){ - if(self.spinner){ - self.mask.fade('out'); - setTimeout(function(){ - if(self.mask) - self.mask.destroy(); - if(self.spinner) - self.spinner.el.destroy(); - self.spinner = null; - self.mask = null; - }, 400); - } + setTimeout(function(){ + if(self.spinner){ + self.mask.fade('out'); + setTimeout(function(){ + if(self.mask) + self.mask.destroy(); + if(self.spinner) + self.spinner.el.destroy(); + self.spinner = null; + self.mask = null; + }, 400); + } + }, 1000) } else if(!self.spinner) { self.createMask(); From 9e8d6aaaa1ab35eeee7085efb78bc2cfc5f5144a Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 5 May 2013 20:14:54 +0200 Subject: [PATCH 09/10] Delay notification start more on mobile --- couchpotato/core/notifications/core/static/notification.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchpotato/core/notifications/core/static/notification.js b/couchpotato/core/notifications/core/static/notification.js index 243d561..3a9a9b9 100644 --- a/couchpotato/core/notifications/core/static/notification.js +++ b/couchpotato/core/notifications/core/static/notification.js @@ -31,7 +31,7 @@ var NotificationBase = new Class({ }); window.addEvent('load', function(){ - self.startInterval.delay(2000, self) + self.startInterval.delay($(window).getSize().x <= 480 ? 2000 : 300, self) }); }, From e6db505cf71a3540396da8ceab1bc6c626a841c6 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 5 May 2013 20:15:23 +0200 Subject: [PATCH 10/10] Restart notification request every 2 minutes --- couchpotato/core/notifications/core/static/notification.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/notifications/core/static/notification.js b/couchpotato/core/notifications/core/static/notification.js index 3a9a9b9..2b74364 100644 --- a/couchpotato/core/notifications/core/static/notification.js +++ b/couchpotato/core/notifications/core/static/notification.js @@ -101,11 +101,20 @@ var NotificationBase = new Class({ return; } - Api.request('notification.listener', { + self.request = Api.request('notification.listener', { 'data': {'init':true}, 'onSuccess': self.processData.bind(self) }).send() + setInterval(function(){ + + if(self.request && self.request.isRunning()){ + self.request.cancel(); + self.startPoll() + } + + }, 120000); + }, startPoll: function(){