Browse Source

Merge branch 'refs/heads/develop'

pull/475/head
Ruud 13 years ago
parent
commit
7367f7da79
  1. 3
      .gitignore
  2. 2
      couchpotato/core/_base/updater/main.py
  3. 5
      couchpotato/core/helpers/variable.py
  4. 6
      couchpotato/core/plugins/log/static/log.js
  5. 12
      couchpotato/static/scripts/block/navigation.js
  6. 2
      couchpotato/static/scripts/couchpotato.js
  7. 3
      couchpotato/static/scripts/page.js
  8. 2
      couchpotato/static/scripts/page/settings.js
  9. 27
      couchpotato/static/style/main.css
  10. 29
      init/freebsd

3
.gitignore

@ -1 +1,2 @@
/_source/ /_source/
/data/

2
couchpotato/core/_base/updater/main.py

@ -78,7 +78,7 @@ class Updater(Plugin):
def doUpdateView(self): def doUpdateView(self):
self.check() self.check()
if not self.update_version: if not self.updater.update_version:
log.error('Trying to update when no update is available.') log.error('Trying to update when no update is available.')
success = False success = False
else: else:

5
couchpotato/core/helpers/variable.py

@ -5,6 +5,7 @@ import platform
import random import random
import re import re
import string import string
import sys
log = CPLog(__name__) log = CPLog(__name__)
@ -22,6 +23,10 @@ def getDataDir():
if 'darwin' in platform.platform().lower(): if 'darwin' in platform.platform().lower():
return os.path.join(user_dir, 'Library', 'Application Support', 'CouchPotato') 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 # Linux
return os.path.join(user_dir, '.couchpotato') return os.path.join(user_dir, '.couchpotato')

6
couchpotato/core/plugins/log/static/log.js

@ -45,7 +45,7 @@ Page.Log = new Class({
new Fx.Scroll(window, {'duration': 0}).toBottom(); new Fx.Scroll(window, {'duration': 0}).toBottom();
var nav = new Element('ul.nav').inject(self.log, 'top'); 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', { new Element('li', {
'text': i+1, 'text': i+1,
'class': nr == i ? 'active': '', 'class': nr == i ? 'active': '',
@ -78,6 +78,10 @@ Page.Log = new Class({
addColors: function(text){ addColors: function(text){
var self = this; var self = this;
var text = new Element('div', {
'html': text
}).get('text')
text = text.replace(/\u001b\[31m/gi, '</span><span class="error">') text = text.replace(/\u001b\[31m/gi, '</span><span class="error">')
text = text.replace(/\u001b\[36m/gi, '</span><span class="debug">') text = text.replace(/\u001b\[36m/gi, '</span><span class="debug">')
text = text.replace(/\u001b\[33m/gi, '</span><span class="debug">') text = text.replace(/\u001b\[33m/gi, '</span><span class="debug">')

12
couchpotato/static/scripts/block/navigation.js

@ -32,13 +32,21 @@ Block.Navigation = new Class({
}, },
addTab: function(tab){ addTab: function(name, tab){
var self = this 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) new Element('a', tab)
).inject(self.nav) ).inject(self.nav)
},
activate: function(name){
var self = this;
self.nav.getElements('.active').removeClass('active');
self.nav.getElements('.tab_'+name).addClass('active');
} }
}); });

2
couchpotato/static/scripts/couchpotato.js

@ -82,7 +82,7 @@ var CouchPotato = new Class({
new Element('a', { new Element('a', {
'text': 'Check for updates', 'text': 'Check for updates',
'events': { 'events': {
'click': self.checkForUpdate.bind(self) 'click': self.checkForUpdate.bind(self, null)
} }
}), }),
new Element('a', { new Element('a', {

3
couchpotato/static/scripts/page.js

@ -20,7 +20,7 @@ var PageBase = new Class({
// Create tab for page // Create tab for page
if(self.has_tab){ if(self.has_tab){
var nav = App.getBlock('navigation'); var nav = App.getBlock('navigation');
self.tab = nav.addTab({ self.tab = nav.addTab(self.name, {
'href': App.createUrl(self.name), 'href': App.createUrl(self.name),
'title': self.title, 'title': self.title,
'text': self.name.capitalize() 'text': self.name.capitalize()
@ -39,6 +39,7 @@ var PageBase = new Class({
self.el.adopt(elements); self.el.adopt(elements);
} }
App.getBlock('navigation').activate(self.name);
self.fireEvent('opened'); self.fireEvent('opened');
} }
catch (e){ catch (e){

2
couchpotato/static/scripts/page/settings.js

@ -34,6 +34,8 @@ Page.Settings = new Class({
else { else {
self.openTab(action); self.openTab(action);
} }
App.getBlock('navigation').activate(self.name);
}, },
openTab: function(action){ openTab: function(action){

27
couchpotato/static/style/main.css

@ -203,18 +203,25 @@ body > .spinner, .mask{
display: block; display: block;
margin-top: 5px; margin-top: 5px;
} }
.header .navigation li.disabled { .header .navigation li a:after {
color: #e5e5e5; content: '';
} display: inline-block;
height: 2px;
.header .navigation li a:link, .header .navigation li a:visited { width: 100%;
color: #fff; 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 { .header .navigation li.disabled { color: #e5e5e5; }
color: #b1d8dc; .header .navigation li a { color: #fff; }
}
.header .navigation .backtotop { .header .navigation .backtotop {
opacity: 0; opacity: 0;

29
init/freebsd

@ -31,14 +31,27 @@ load_rc_config ${name}
: ${couchpotato_user:="_sabnzbd"} : ${couchpotato_user:="_sabnzbd"}
: ${couchpotato_dir:="/usr/local/couchpotato"} : ${couchpotato_dir:="/usr/local/couchpotato"}
: ${couchpotato_chdir:="${couchpotato_dir}"} : ${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" status_cmd="${name}_status"
stop_cmd="${name}_stop" stop_cmd="${name}_stop"
command="/usr/sbin/daemon" 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. # Ensure user is root when running this script.
if [ `id -u` != "0" ]; then if [ `id -u` != "0" ]; then
@ -55,17 +68,17 @@ verify_couchpotato_pid() {
# Try to stop CouchPotato cleanly by calling shutdown over http. # Try to stop CouchPotato cleanly by calling shutdown over http.
couchpotato_stop() { 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" echo "Stopping $name"
verify_couchpotato_pid verify_couchpotato_pid
${WGET} -O - -q "http://${HOST}:${PORT}/api/${CPAPI}/app.shutdown/" >/dev/null
if [ -n "${pid}" ]; then if [ -n "${pid}" ]; then
kill -SIGTERM ${pid} 2> /dev/null
wait_for_pids ${pid} wait_for_pids ${pid}
kill -9 ${pid} 2> /dev/null
echo "Stopped" echo "Stopped"
fi fi
} }
couchpotato_status() { couchpotato_status() {

Loading…
Cancel
Save