From 4bd2ba2b8dc733870117241dc59b42fa67580f08 Mon Sep 17 00:00:00 2001 From: Ruud Date: Thu, 31 May 2012 20:11:34 +0200 Subject: [PATCH 1/4] Decode html tags in log. fix #386 --- couchpotato/core/plugins/log/static/log.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/plugins/log/static/log.js b/couchpotato/core/plugins/log/static/log.js index 1668ded..7a91d4c 100644 --- a/couchpotato/core/plugins/log/static/log.js +++ b/couchpotato/core/plugins/log/static/log.js @@ -45,7 +45,7 @@ Page.Log = new Class({ new Fx.Scroll(window, {'duration': 0}).toBottom(); var nav = new Element('ul.nav').inject(self.log, 'top'); - for (var i = 0; i < json.total; i++) { + for (var i = 0; i <= json.total; i++) { new Element('li', { 'text': i+1, 'class': nr == i ? 'active': '', @@ -78,6 +78,10 @@ Page.Log = new Class({ addColors: function(text){ var self = this; + var text = new Element('div', { + 'html': text + }).get('text') + text = text.replace(/\u001b\[31m/gi, '') text = text.replace(/\u001b\[36m/gi, '') text = text.replace(/\u001b\[33m/gi, '') From 3790b04de4860118934d9d46c0cd6c8ecf8177b1 Mon Sep 17 00:00:00 2001 From: Ruud Date: Thu, 31 May 2012 20:24:07 +0200 Subject: [PATCH 2/4] FreeBSD init commit 0bd182ebb5d9da183d7d3950c77418cf02dd8706 Merge: 5fac3d7 dadbd0f Author: Ruud Date: Thu May 31 20:21:17 2012 +0200 Merge branch 'master' of https://github.com/jallakim/CouchPotatoServer into jallakim-master Conflicts: init/freebsd commit 5fac3d708d2af21e5834aea9bb7224139beb75f0 Merge: 0ba2e57 95e5282 Author: Ruud Date: Thu May 31 19:30:18 2012 +0200 Merge branch 'refs/heads/develop' commit dadbd0f1fd61fe6c8a233b823bbf4ed29a9032f0 Author: Joachim Tingvold Date: Wed May 30 22:35:27 2012 +0200 Useless Use of Cat Award (-: commit 9fe11355a9671a1f38a6b982b50034f075c34b8d Author: Joachim Tingvold Date: Wed May 30 22:30:26 2012 +0200 Ooops. PORT and CPAPI got mixed around in FreeBSD init-script. commit e39be8970ca0a4365ff15e6d8b3d64864c2bbdc4 Author: Joachim Tingvold Date: Wed May 30 22:25:46 2012 +0200 Cosmetics again. commit 5cca98db31caaf6ca7032a3d948c4feb6ca30e2e Author: Joachim Tingvold Date: Wed May 30 22:22:54 2012 +0200 Check that settings.conf exists in FreeBSD init-script commit d1e98602d8d86200431ff1d109d89853fb6ea243 Author: Joachim Tingvold Date: Wed May 30 22:16:47 2012 +0200 FreeBSD init-script fetches variables from CP's settings.conf commit 42dbe607cfeca13efc76e6db7c5df4907bf7fc80 Author: Joachim Tingvold Date: Wed May 30 16:02:46 2012 +0200 Should work for all FreeBSD versions now. commit f0bcf6a0f5c401a1f96f98ef35b82c3e45f05e11 Author: Joachim Tingvold Date: Wed May 30 15:17:53 2012 +0200 Don't 'import sys' before we need it commit 8e13fcd0d137e304b5c49aaec4397ca58c2ef431 Author: Joachim Tingvold Date: Wed May 30 15:09:58 2012 +0200 Cosmetics! (-: commit 04af454c0362dcabb1cec06863f1defabf7a3736 Author: Joachim Tingvold Date: Wed May 30 15:05:32 2012 +0200 Added /data/ to .gitignore Used as data-dir if CouchPotato is installed on FreeBSD. commit 055d47d7b4a9401fcab1e4cdb319c3e95a91e1ca Author: Joachim Tingvold Date: Wed May 30 15:04:36 2012 +0200 Fixed getDataDir so that it works for FreeBSD9. Assumes that '/usr/local/couchpotato/' is where CouchPotato resides. commit 4859f1b9f23e1d994e7fca24e25bae0226717006 Author: Joachim Tingvold Date: Wed May 30 15:03:26 2012 +0200 Fixed the FreeBSD init-script. commit 0ba2e579f9658dfbf7ab65245bee9a04d1c09473 Merge: fdf0d2d a2a3896 Author: Ruud Date: Sun May 20 23:50:54 2012 +0200 Merge branch 'master' of github.com:RuudBurger/CouchPotatoServer commit fdf0d2d5b403bad860a06475b1dafce7c28e2da5 Author: Ruud Burger Date: Thu Apr 26 10:57:34 2012 +0300 Use master branch to update master.. commit a2a3896b1fe16bdc4d7d32af330a123645e93dba Merge: 5017b01 19640a9 Author: Ruud Date: Sun May 20 19:57:05 2012 +0200 Merge branch 'refs/heads/develop' commit 5017b019344b19a2e7dafe7c3114d01306166722 Merge: d4a5483 f2f524c Author: Ruud Date: Tue May 15 23:23:25 2012 +0200 Merge branch 'master' of github.com:RuudBurger/CouchPotatoServer commit d4a5483fa034d960bb7160a076ee11507e3bdc78 Author: Ruud Burger Date: Thu Apr 26 10:57:34 2012 +0300 Use master branch to update master.. commit f2f524c4e446814448a4a1a3c8e385b8beb1e5c6 Merge: 577aed3 edbeb02 Author: Ruud Date: Tue May 15 23:16:12 2012 +0200 Merge branch 'refs/heads/develop' commit 577aed3a754ae783c3224bbc8e051164f981309f Merge: cb975f6 176f4b0 Author: Ruud Date: Mon May 14 23:36:53 2012 +0200 Merge branch 'refs/heads/develop' commit cb975f61801f83cc8b16f3785195eb23cc967aff Merge: 3e369c5 a71fb1a Author: Ruud Date: Mon May 14 20:23:05 2012 +0200 Merge branch 'refs/heads/develop' commit 3e369c583851d14fe5d6cd292c63a4c1e603f634 Merge: d89130d 0847ffd Author: Ruud Date: Sun May 13 12:56:37 2012 +0200 Merge branch 'refs/heads/develop' commit d89130dc308a1017b6d9bb0038d0d615a333ad8f Merge: ee5e1d1 c34f392 Author: Ruud Date: Sat May 12 00:36:03 2012 +0200 Merge branch 'refs/heads/develop' commit ee5e1d19d1e19f7ad4b3cc33e8642f606b3f4043 Merge: 7d2eb23 b2be9ef Author: Ruud Date: Wed May 9 22:19:29 2012 +0200 Merge branch 'refs/heads/develop' commit 7d2eb2376f55cec38b1fd581b1df74e97d6e75f6 Merge: 40ff984 ba8fef3 Author: Ruud Burger Date: Mon May 7 13:35:13 2012 -0700 Merge pull request #228 from sirchia/twitterDirectMessage Added support for direct messages in twitter notifications commit 40ff984e192a4d7d7dcf177d009960073ea49346 Merge: 1f3e22c 7ca509c Author: Ruud Date: Mon May 7 22:26:55 2012 +0200 Merge branch 'refs/heads/develop' commit ba8fef3c87484e4898a196ef9b25c69be68f9825 Author: Riccardo Sirchia Date: Sun May 6 18:02:51 2012 +0200 Added support for direct messages in twitter notifications commit 1f3e22c4ed4e36c809045beae404cdc0a941fda9 Merge: 89315cb 74226f0 Author: Ruud Date: Fri May 4 17:27:36 2012 +0200 Merge branch 'refs/heads/develop' commit 89315cb2912bcdf4d8ac4f375a562f7d8966acd5 Merge: 829b3cf f6de117 Author: Ruud Date: Fri May 4 17:27:12 2012 +0200 Merge branch 'refs/heads/develop' commit 829b3cfb3bd7d9a8d4b6d4ac09231b4c735fc1d1 Merge: e3cc15d 1345e98 Author: Ruud Date: Wed May 2 21:40:01 2012 +0200 Merge branch 'refs/heads/develop' commit e3cc15d2b638ed88404f3f1902361249fb306245 Merge: ca87f2c c161bdd Author: Ruud Date: Sun Apr 29 00:00:14 2012 +0200 Merge branch 'refs/heads/develop' commit ca87f2c231eb5095efba749c39a221e274c238fb Merge: e929af7 c7bc0f4 Author: Ruud Date: Sat Apr 28 23:14:18 2012 +0200 Merge branch 'refs/heads/develop' commit e929af76d056af7210d09e807ce8a17305003407 Merge: b22763b d1c2869 Author: Ruud Burger Date: Fri Apr 27 02:04:35 2012 -0700 Merge pull request #152 from garlandkr/master Removed group setting for init commit d1c2869f2cb4b3fac555cce732e92bb8fec97363 Author: Ken Garland Date: Thu Apr 26 23:30:33 2012 -0300 Removed RUN_AS for group, don't assume the default group is the same as the username. Specifying group is not needed anyways. commit b22763b37d7780140698725a0ed2632e2eb7a7c2 Author: Ruud Burger Date: Thu Apr 26 10:57:34 2012 +0300 Use master branch to update master.. --- .gitignore | 3 ++- couchpotato/core/helpers/variable.py | 5 +++++ init/freebsd | 29 +++++++++++++++++++++-------- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index f903669..bd4bca0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -/_source/ \ No newline at end of file +/_source/ +/data/ diff --git a/couchpotato/core/helpers/variable.py b/couchpotato/core/helpers/variable.py index 9a4bdc1..493ac79 100644 --- a/couchpotato/core/helpers/variable.py +++ b/couchpotato/core/helpers/variable.py @@ -5,6 +5,7 @@ import platform import random import re import string +import sys log = CPLog(__name__) @@ -22,6 +23,10 @@ def getDataDir(): if 'darwin' in platform.platform().lower(): return os.path.join(user_dir, 'Library', 'Application Support', 'CouchPotato') + # FreeBSD + if 'freebsd' in sys.platform: + return os.path.join('/usr/local/', 'couchpotato', 'data') + # Linux return os.path.join(user_dir, '.couchpotato') diff --git a/init/freebsd b/init/freebsd index e3cf408..eeba51d 100644 --- a/init/freebsd +++ b/init/freebsd @@ -31,14 +31,27 @@ load_rc_config ${name} : ${couchpotato_user:="_sabnzbd"} : ${couchpotato_dir:="/usr/local/couchpotato"} : ${couchpotato_chdir:="${couchpotato_dir}"} -: ${couchpotato_pid:="/var/run/couchpotato.pid"} +: ${couchpotato_pid:="${couchpotato_dir}/couchpotato.pid"} +: ${couchpotato_conf:="${couchpotato_dir}/data/settings.conf"} + +WGET="/usr/local/bin/wget" # You need wget for this script to safely shutdown CouchPotato. +if [ -e "${couchpotato_conf}" ]; then + HOST=`grep -A14 "\[core\]" "${couchpotato_conf}"|egrep "^host"|perl -wple 's/^host = (.*)$/$1/'` + PORT=`grep -A14 "\[core\]" "${couchpotato_conf}"|egrep "^port"|perl -wple 's/^port = (.*)$/$1/'` + CPAPI=`grep -A14 "\[core\]" "${couchpotato_conf}"|egrep "^api_key"|perl -wple 's/^api_key = (.*)$/$1/'` +fi -pidfile="${couchpotato_pid}" status_cmd="${name}_status" stop_cmd="${name}_stop" command="/usr/sbin/daemon" -command_args="-f -p ${couchpotato_pid} python ${couchpotato_dir}/CouchPotato.py ${couchpotato_flags} --pid_file=${couchpotato_pid}" +command_args="-f -p ${couchpotato_pid} python ${couchpotato_dir}/CouchPotato.py ${couchpotato_flags}" + +# Check for wget and refuse to start without it. +if [ ! -x "${WGET}" ]; then + warn "couchpotato not started: You need wget to safely shut down CouchPotato." + exit 1 +fi # Ensure user is root when running this script. if [ `id -u` != "0" ]; then @@ -55,17 +68,17 @@ verify_couchpotato_pid() { # Try to stop CouchPotato cleanly by calling shutdown over http. couchpotato_stop() { - + if [ ! -e "${couchpotato_conf}" ]; then + echo "CouchPotato's settings file does not exist. Try starting CouchPotato, as this should create the file." + exit 1 + fi echo "Stopping $name" verify_couchpotato_pid - + ${WGET} -O - -q "http://${HOST}:${PORT}/api/${CPAPI}/app.shutdown/" >/dev/null if [ -n "${pid}" ]; then - kill -SIGTERM ${pid} 2> /dev/null wait_for_pids ${pid} - kill -9 ${pid} 2> /dev/null echo "Stopped" fi - } couchpotato_status() { From 5fb0dbf5d99b8a5af3c78340073265fabd66149c Mon Sep 17 00:00:00 2001 From: Ruud Date: Thu, 31 May 2012 22:09:42 +0200 Subject: [PATCH 3/4] Show active page. fix #373 --- couchpotato/static/scripts/block/navigation.js | 12 ++++++++++-- couchpotato/static/scripts/page.js | 3 ++- couchpotato/static/scripts/page/settings.js | 2 ++ couchpotato/static/style/main.css | 27 ++++++++++++++++---------- 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/couchpotato/static/scripts/block/navigation.js b/couchpotato/static/scripts/block/navigation.js index b6886f8..85f20c4 100644 --- a/couchpotato/static/scripts/block/navigation.js +++ b/couchpotato/static/scripts/block/navigation.js @@ -32,13 +32,21 @@ Block.Navigation = new Class({ }, - addTab: function(tab){ + addTab: function(name, tab){ var self = this - return new Element('li.tab_'+(tab.text.toLowerCase() || 'unknown')).adopt( + return new Element('li.tab_'+(name || 'unknown')).adopt( new Element('a', tab) ).inject(self.nav) + }, + + activate: function(name){ + var self = this; + + self.nav.getElements('.active').removeClass('active'); + self.nav.getElements('.tab_'+name).addClass('active'); + } }); \ No newline at end of file diff --git a/couchpotato/static/scripts/page.js b/couchpotato/static/scripts/page.js index 589fa3e..1af800e 100644 --- a/couchpotato/static/scripts/page.js +++ b/couchpotato/static/scripts/page.js @@ -20,7 +20,7 @@ var PageBase = new Class({ // Create tab for page if(self.has_tab){ var nav = App.getBlock('navigation'); - self.tab = nav.addTab({ + self.tab = nav.addTab(self.name, { 'href': App.createUrl(self.name), 'title': self.title, 'text': self.name.capitalize() @@ -39,6 +39,7 @@ var PageBase = new Class({ self.el.adopt(elements); } + App.getBlock('navigation').activate(self.name); self.fireEvent('opened'); } catch (e){ diff --git a/couchpotato/static/scripts/page/settings.js b/couchpotato/static/scripts/page/settings.js index 8bf0405..9184855 100644 --- a/couchpotato/static/scripts/page/settings.js +++ b/couchpotato/static/scripts/page/settings.js @@ -34,6 +34,8 @@ Page.Settings = new Class({ else { self.openTab(action); } + + App.getBlock('navigation').activate(self.name); }, openTab: function(action){ diff --git a/couchpotato/static/style/main.css b/couchpotato/static/style/main.css index 884d872..679748b 100644 --- a/couchpotato/static/style/main.css +++ b/couchpotato/static/style/main.css @@ -203,18 +203,25 @@ body > .spinner, .mask{ display: block; margin-top: 5px; } - - .header .navigation li.disabled { - color: #e5e5e5; - } - - .header .navigation li a:link, .header .navigation li a:visited { - color: #fff; + + .header .navigation li a:after { + content: ''; + display: inline-block; + height: 2px; + width: 100%; + position: relative; + top: -20px; + background-color: #46505e; + outline: none; + box-shadow: inset 0 1px 8px rgba(0,0,0,0.05), 0 1px 0px rgba(255,255,255,0.15); + transition: all .4s cubic-bezier(0.9,0,0.1,1); } + + .header .navigation li:hover a:after { background-color: #047792; } + .header .navigation li.active a:after { background-color: #04bce6; } - .header .navigation li a:hover, .header .navigation li a:active { - color: #b1d8dc; - } + .header .navigation li.disabled { color: #e5e5e5; } + .header .navigation li a { color: #fff; } .header .navigation .backtotop { opacity: 0; From 136bc30d928158b4be39698b98e388aa57dea173 Mon Sep 17 00:00:00 2001 From: Ruud Date: Thu, 31 May 2012 22:40:17 +0200 Subject: [PATCH 4/4] Broken updater --- couchpotato/core/_base/updater/main.py | 2 +- couchpotato/static/scripts/couchpotato.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/_base/updater/main.py b/couchpotato/core/_base/updater/main.py index 5d2e7e2..0b03b4c 100644 --- a/couchpotato/core/_base/updater/main.py +++ b/couchpotato/core/_base/updater/main.py @@ -78,7 +78,7 @@ class Updater(Plugin): def doUpdateView(self): self.check() - if not self.update_version: + if not self.updater.update_version: log.error('Trying to update when no update is available.') success = False else: diff --git a/couchpotato/static/scripts/couchpotato.js b/couchpotato/static/scripts/couchpotato.js index b983fb5..9a15bba 100644 --- a/couchpotato/static/scripts/couchpotato.js +++ b/couchpotato/static/scripts/couchpotato.js @@ -82,7 +82,7 @@ var CouchPotato = new Class({ new Element('a', { 'text': 'Check for updates', 'events': { - 'click': self.checkForUpdate.bind(self) + 'click': self.checkForUpdate.bind(self, null) } }), new Element('a', {