From dda68e9a35b994643bbd7a133a92ddd053045c4c Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 22 Oct 2011 22:01:31 +0200 Subject: [PATCH] Fetch remotes before checking for updates --- couchpotato/core/_base/_core/__init__.py | 11 ++++++----- couchpotato/core/plugins/updater/main.py | 9 ++++++++- couchpotato/core/plugins/updater/static/updater.js | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/couchpotato/core/_base/_core/__init__.py b/couchpotato/core/_base/_core/__init__.py index 4e14d69e..139c283d 100644 --- a/couchpotato/core/_base/_core/__init__.py +++ b/couchpotato/core/_base/_core/__init__.py @@ -38,7 +38,6 @@ config = [{ 'name': 'launch_browser', 'default': 1, 'type': 'bool', - 'label': 'Launch Browser', 'description': 'Launch the browser when I start.', }, ], @@ -53,26 +52,28 @@ config = [{ 'name': 'api_key', 'default': uuid4().hex, 'readonly': 1, - 'label': 'Api Key', 'description': "This is top-secret! Don't share this!", }, { 'name': 'debug', 'default': 0, 'type': 'bool', - 'label': 'Debug', 'description': 'Enable debugging.', }, + { + 'name': 'development', + 'default': 0, + 'type': 'bool', + 'description': 'Disables some checks/downloads for faster reloading.', + }, { 'name': 'data_dir', - 'label': 'Data dir', 'type': 'directory', 'description': 'Where cache/logs/etc are stored. Keep empty for ./_data.', }, { 'name': 'url_base', 'default': '', - 'label': 'Url Base', 'description': 'When using mod_proxy use this to append the url with this.', }, { diff --git a/couchpotato/core/plugins/updater/main.py b/couchpotato/core/plugins/updater/main.py index 2d6af113..285a1fe0 100644 --- a/couchpotato/core/plugins/updater/main.py +++ b/couchpotato/core/plugins/updater/main.py @@ -63,6 +63,10 @@ class Updater(Plugin): if self.update_version or self.isDisabled(): return + log.info('Checking for new version on github for %s' % self.repo_name) + if not Env.setting('development'): + self.repo.fetch() + current_branch = self.repo.getCurrentBranch().name for branch in self.repo.getRemoteByName('origin').getBranches(): @@ -77,7 +81,10 @@ class Updater(Plugin): if self.conf('automatic') and not self.update_failed: self.doUpdate() else: - self.update_version = remote.hash + self.update_version = { + 'hash': remote.hash[:8], + 'date': remote.getDate(), + } if self.conf('notification'): fireEvent('updater.available', message = 'A new update is available', data = self.getVersion()) diff --git a/couchpotato/core/plugins/updater/static/updater.js b/couchpotato/core/plugins/updater/static/updater.js index 056627b7..b453ed35 100644 --- a/couchpotato/core/plugins/updater/static/updater.js +++ b/couchpotato/core/plugins/updater/static/updater.js @@ -48,7 +48,7 @@ var UpdaterBase = new Class({ 'text': 'A new version is available' }), new Element('a', { - 'href': 'https://github.com/'+data.repo_name+'/compare/'+data.version.substr(0, 7)+'...'+data.update_version.substr(0, 7), + 'href': 'https://github.com/'+data.repo_name+'/compare/'+data.version.hash+'...'+data.update_version.hash, 'text': 'see what has changed', 'target': '_blank' }),