Updates to SABnzbd-suite

This commit is contained in:
lsellens 2012-06-03 02:37:53 -05:00 committed by Stefan Saraev
parent 57ff06b161
commit e4f664e3d6
9 changed files with 211 additions and 42 deletions

View File

@ -20,7 +20,7 @@
################################################################################ ################################################################################
PKG_NAME="CouchPotato" PKG_NAME="CouchPotato"
PKG_VERSION="46dbb59" PKG_VERSION="33a99b4"
PKG_REV="1" PKG_REV="1"
PKG_ARCH="any" PKG_ARCH="any"
PKG_LICENSE="OSS" PKG_LICENSE="OSS"

View File

@ -0,0 +1,38 @@
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2011 Anthony Nash (nash.ant@gmail.com)
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC.tv; see the file COPYING. If not, write to
# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
PKG_NAME="CouchPotatoServer"
PKG_VERSION="7367f7d"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="OSS"
PKG_SITE="https://github.com/RuudBurger/CouchPotatoServer"
PKG_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz"
PKG_DEPENDS="Python SABnzbd"
PKG_BUILD_DEPENDS="toolchain Python"
PKG_PRIORITY="optional"
PKG_SECTION="service/downloadmanager"
PKG_SHORTDESC="CouchPotatoServer: automated movie downloading."
PKG_LONGDESC="CouchPotatoServer: automated movie downloading."
PKG_IS_ADDON="no"
PKG_AUTORECONF="no"

View File

@ -20,7 +20,7 @@
################################################################################ ################################################################################
PKG_NAME="Headphones" PKG_NAME="Headphones"
PKG_VERSION="298463a" PKG_VERSION="f9f129b"
PKG_REV="1" PKG_REV="1"
PKG_ARCH="any" PKG_ARCH="any"
PKG_LICENSE="OSS" PKG_LICENSE="OSS"

View File

@ -44,5 +44,8 @@ mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/SickBeard
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/CouchPotato mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/CouchPotato
cp -PR $BUILD/CouchPotato-*/* $ADDON_BUILD/$PKG_ADDON_ID/CouchPotato cp -PR $BUILD/CouchPotato-*/* $ADDON_BUILD/$PKG_ADDON_ID/CouchPotato
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/CouchPotatoServer
cp -PR $BUILD/CouchPotatoServer-*/* $ADDON_BUILD/$PKG_ADDON_ID/CouchPotatoServer
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/Headphones mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/Headphones
cp -PR $BUILD/Headphones-*/* $ADDON_BUILD/$PKG_ADDON_ID/Headphones cp -PR $BUILD/Headphones-*/* $ADDON_BUILD/$PKG_ADDON_ID/Headphones

View File

@ -5,4 +5,9 @@
<setting id="SABNZBD_KEEP_AWAKE" value="false" /> <setting id="SABNZBD_KEEP_AWAKE" value="false" />
<setting id="SABNZBD_PERIODIC_WAKE" value="false" /> <setting id="SABNZBD_PERIODIC_WAKE" value="false" />
<setting id="SABNZBD_WAKE_AT" value="1" /> <setting id="SABNZBD_WAKE_AT" value="1" />
<setting id="SABNZBD_LAUNCH" value="true" />
<setting id="SICKBEARD_LAUNCH" value="true" />
<setting id="COUCHPOTATO_LAUNCH" value="true" />
<setting id="COUCHPOTATO_VERSION" value="0" />
<setting id="HEADPHONES_LAUNCH" value="true" />
</settings> </settings>

View File

@ -26,6 +26,7 @@ import xbmc
import signal import signal
import subprocess import subprocess
import urllib2 import urllib2
import hashlib
from configobj import ConfigObj from configobj import ConfigObj
from xml.dom.minidom import parseString from xml.dom.minidom import parseString
import logging import logging
@ -68,8 +69,9 @@ pDefaultSuiteSettings = os.path.join(pAddon, 'settings-default.xml')
pSuiteSettings = os.path.join(pAddonHome, 'settings.xml') pSuiteSettings = os.path.join(pAddonHome, 'settings.xml')
pXbmcSettings = '/storage/.xbmc/userdata/guisettings.xml' pXbmcSettings = '/storage/.xbmc/userdata/guisettings.xml'
pSabNzbdSettings = os.path.join(pAddonHome, 'sabnzbd.ini') pSabNzbdSettings = os.path.join(pAddonHome, 'sabnzbd.ini')
pSickBeardSettings = os.path.join(pAddonHome, 'config.ini') pSickBeardSettings = os.path.join(pAddonHome, 'sickbeard.ini')
pCouchPotatoSettings = os.path.join(pAddonHome, 'couchpotato.ini') pCouchPotatoSettings = os.path.join(pAddonHome, 'couchpotato.ini')
pCouchPotatoServerSettings = os.path.join(pAddonHome, 'couchpotatoserver.ini')
pHeadphonesSettings = os.path.join(pAddonHome, 'headphones.ini') pHeadphonesSettings = os.path.join(pAddonHome, 'headphones.ini')
# directories # directories
@ -87,9 +89,11 @@ pPylib = os.path.join(pAddon, 'pylib')
sabnzbd = ['python', os.path.join(pAddon, 'SABnzbd/SABnzbd.py'), sabnzbd = ['python', os.path.join(pAddon, 'SABnzbd/SABnzbd.py'),
'-d', '-f', pSabNzbdSettings, '-l 0'] '-d', '-f', pSabNzbdSettings, '-l 0']
sickBeard = ['python', os.path.join(pAddon, 'SickBeard/SickBeard.py'), sickBeard = ['python', os.path.join(pAddon, 'SickBeard/SickBeard.py'),
'--daemon', '--datadir', pAddonHome] '--daemon', '--datadir', pAddonHome, '--config', pSickBeardSettings]
couchPotato = ['python', os.path.join(pAddon, 'CouchPotato/CouchPotato.py'), couchPotato = ['python', os.path.join(pAddon, 'CouchPotato/CouchPotato.py'),
'-d', '--datadir', pAddonHome, '--config', pCouchPotatoSettings] '-d', '--datadir', pAddonHome, '--config', pCouchPotatoSettings]
couchPotatoServer = ['python', os.path.join(pAddon, 'CouchPotatoServer/CouchPotato.py'),
'--daemon', '--pid_file', os.path.join(pAddonHome, 'couchpotato.pid'), '--config_file', pCouchPotatoServerSettings]
headphones = ['python', os.path.join(pAddon, 'Headphones/Headphones.py'), headphones = ['python', os.path.join(pAddon, 'Headphones/Headphones.py'),
'-d', '--datadir', pAddonHome, '--config', pHeadphonesSettings] '-d', '--datadir', pAddonHome, '--config', pHeadphonesSettings]
@ -127,10 +131,15 @@ fSuiteSettings = open(pSuiteSettings, 'r')
data = fSuiteSettings.read() data = fSuiteSettings.read()
fSuiteSettings.close fSuiteSettings.close
suiteSettings = parseString(data) suiteSettings = parseString(data)
user = getAddonSetting(suiteSettings, 'SABNZBD_USER') user = getAddonSetting(suiteSettings, 'SABNZBD_USER')
pwd = getAddonSetting(suiteSettings, 'SABNZBD_PWD') pwd = getAddonSetting(suiteSettings, 'SABNZBD_PWD')
host = getAddonSetting(suiteSettings, 'SABNZBD_IP') host = getAddonSetting(suiteSettings, 'SABNZBD_IP')
sabNzbdKeepAwake = getAddonSetting(suiteSettings, 'SABNZBD_KEEP_AWAKE') sabNzbdKeepAwake = getAddonSetting(suiteSettings, 'SABNZBD_KEEP_AWAKE')
sabnzbd_launch = getAddonSetting(suiteSettings, 'SABNZBD_LAUNCH')
sickbeard_launch = getAddonSetting(suiteSettings, 'SICKBEARD_LAUNCH')
couchpotato_launch = getAddonSetting(suiteSettings, 'COUCHPOTATO_LAUNCH')
couchpotato_version = getAddonSetting(suiteSettings, 'COUCHPOTATO_VERSION')
headphones_launch = getAddonSetting(suiteSettings, 'HEADPHONES_LAUNCH')
# XBMC # XBMC
fXbmcSettings = open(pXbmcSettings, 'r') fXbmcSettings = open(pXbmcSettings, 'r')
@ -219,17 +228,17 @@ autoProcessConfig.write()
# launch SABnzbd and get the API key # launch SABnzbd and get the API key
# ---------------------------------- # ----------------------------------
if "true" in sabnzbd_launch:
logging.debug('Launching SABnzbd...') logging.debug('Launching SABnzbd...')
subprocess.call(sabnzbd,close_fds=True) subprocess.call(sabnzbd,close_fds=True)
logging.debug('...done') logging.debug('...done')
# SABnzbd will only complete the .ini file when we first access the web interface # SABnzbd will only complete the .ini file when we first access the web interface
if firstLaunch: if firstLaunch:
loadWebInterface('http://' + sabNzbdHost,user,pwd) loadWebInterface('http://' + sabNzbdHost,user,pwd)
sabNzbdConfig.reload() sabNzbdConfig.reload()
sabNzbdApiKey = sabNzbdConfig['misc']['api_key'] sabNzbdApiKey = sabNzbdConfig['misc']['api_key']
logging.debug('SABnzbd api key: ' + sabNzbdApiKey) logging.debug('SABnzbd api key: ' + sabNzbdApiKey)
# write SickBeard settings # write SickBeard settings
# ------------------------ # ------------------------
@ -244,11 +253,12 @@ defaultConfig['General']['web_port'] = '8082'
defaultConfig['General']['web_host'] = host defaultConfig['General']['web_host'] = host
defaultConfig['General']['web_username'] = user defaultConfig['General']['web_username'] = user
defaultConfig['General']['web_password'] = pwd defaultConfig['General']['web_password'] = pwd
defaultConfig['SABnzbd'] = {} if "true" in sabnzbd_launch:
defaultConfig['SABnzbd']['sab_username'] = user defaultConfig['SABnzbd'] = {}
defaultConfig['SABnzbd']['sab_password'] = pwd defaultConfig['SABnzbd']['sab_username'] = user
defaultConfig['SABnzbd']['sab_apikey'] = sabNzbdApiKey defaultConfig['SABnzbd']['sab_password'] = pwd
defaultConfig['SABnzbd']['sab_host'] = 'http://' + sabNzbdHost + '/' defaultConfig['SABnzbd']['sab_apikey'] = sabNzbdApiKey
defaultConfig['SABnzbd']['sab_host'] = 'http://' + sabNzbdHost + '/'
defaultConfig['XBMC'] = {} defaultConfig['XBMC'] = {}
defaultConfig['XBMC']['use_xbmc'] = '1' defaultConfig['XBMC']['use_xbmc'] = '1'
defaultConfig['XBMC']['xbmc_host'] = '127.0.0.1:' + xbmcPort defaultConfig['XBMC']['xbmc_host'] = '127.0.0.1:' + xbmcPort
@ -278,9 +288,10 @@ sickBeardConfig.write()
# launch SickBeard # launch SickBeard
# ---------------- # ----------------
logging.debug('Launching SickBeard...') if "true" in sickbeard_launch:
subprocess.call(sickBeard,close_fds=True) logging.debug('Launching SickBeard...')
logging.debug('...done') subprocess.call(sickBeard,close_fds=True)
logging.debug('...done')
# write CouchPotato settings # write CouchPotato settings
# -------------------------- # --------------------------
@ -294,11 +305,12 @@ defaultConfig['global']['password'] = pwd
defaultConfig['global']['username'] = user defaultConfig['global']['username'] = user
defaultConfig['global']['port'] = '8083' defaultConfig['global']['port'] = '8083'
defaultConfig['global']['host'] = host defaultConfig['global']['host'] = host
defaultConfig['Sabnzbd'] = {} if "true" in sabnzbd_launch:
defaultConfig['Sabnzbd']['username'] = user defaultConfig['Sabnzbd'] = {}
defaultConfig['Sabnzbd']['password'] = pwd defaultConfig['Sabnzbd']['username'] = user
defaultConfig['Sabnzbd']['apikey'] = sabNzbdApiKey defaultConfig['Sabnzbd']['password'] = pwd
defaultConfig['Sabnzbd']['host'] = sabNzbdHost defaultConfig['Sabnzbd']['apikey'] = sabNzbdApiKey
defaultConfig['Sabnzbd']['host'] = sabNzbdHost
defaultConfig['XBMC'] = {} defaultConfig['XBMC'] = {}
defaultConfig['XBMC']['enabled'] = 'True' defaultConfig['XBMC']['enabled'] = 'True'
defaultConfig['XBMC']['host'] = '127.0.0.1:' + xbmcPort defaultConfig['XBMC']['host'] = '127.0.0.1:' + xbmcPort
@ -320,10 +332,66 @@ couchPotatoConfig.write()
# launch CouchPotato # launch CouchPotato
# ------------------ # ------------------
if "true" in couchpotato_launch and "0" in couchpotato_version:
logging.debug('Launching CouchPotato...')
subprocess.call(couchPotato,close_fds=True)
logging.debug('...done')
logging.debug('Launching CouchPotato...') #convert password to md5
subprocess.call(couchPotato,close_fds=True) md5pwd = hashlib.md5(pwd).hexdigest()
logging.debug('...done')
# write CouchPotatoServer settings
# --------------------------
couchPotatoServerConfig = ConfigObj(pCouchPotatoServerSettings,create_empty=True)
defaultConfig = ConfigObj()
defaultConfig['core'] = {}
defaultConfig['core']['username'] = user
defaultConfig['core']['password'] = md5pwd
defaultConfig['core']['port'] = '8083'
defaultConfig['core']['launchbrowser'] = '0'
defaultConfig['core']['host'] = host
defaultConfig['core']['data_dir'] = pAddonHome
defaultConfig['core']['permission_folder'] = '0644'
defaultConfig['core']['permission_file'] = '0644'
defaultConfig['core']['show_wizard'] = '0'
defaultConfig['core']['debug'] = '0'
defaultConfig['core']['development'] = '0'
defaultConfig['updater'] = {}
defaultConfig['updater']['enabled'] = '0'
defaultConfig['updater']['notification'] = '0'
defaultConfig['updater']['automatic'] = '0'
if "true" in sabnzbd_launch:
defaultConfig['Sabnzbd'] = {}
defaultConfig['Sabnzbd']['username'] = user
defaultConfig['Sabnzbd']['password'] = pwd
defaultConfig['Sabnzbd']['api_key'] = sabNzbdApiKey
defaultConfig['Sabnzbd']['host'] = sabNzbdHost
defaultConfig['xbmc'] = {}
defaultConfig['xbmc']['enabled'] = '1'
defaultConfig['xbmc']['host'] = '127.0.0.1:' + xbmcPort
defaultConfig['xbmc']['username'] = xbmcUser
defaultConfig['xbmc']['password'] = xbmcPwd
if firstLaunch:
defaultConfig['Sabnzbd']['category'] = 'movies'
defaultConfig['Sabnzbd']['pp_directory'] = pSabNzbdCompleteMov
defaultConfig['Renamer'] = {}
defaultConfig['Renamer']['enabled'] = 'True'
defaultConfig['Renamer']['download'] = pSabNzbdCompleteMov
defaultConfig['Renamer']['destination'] = '/storage/videos'
defaultConfig['Renamer']['separator'] = '.'
defaultConfig['Renamer']['cleanup'] = 'False'
couchPotatoServerConfig.merge(defaultConfig)
couchPotatoServerConfig.write()
# launch CouchPotatoServer
# ------------------
if "true" in couchpotato_launch and "1" in couchpotato_version:
logging.debug('Launching CouchPotatoServer...')
subprocess.call(couchPotatoServer,close_fds=True)
logging.debug('...done')
# write Headphones settings # write Headphones settings
# ------------------------- # -------------------------
@ -336,11 +404,12 @@ defaultConfig['General']['http_port'] = '8084'
defaultConfig['General']['http_host'] = host defaultConfig['General']['http_host'] = host
defaultConfig['General']['http_username'] = user defaultConfig['General']['http_username'] = user
defaultConfig['General']['http_password'] = pwd defaultConfig['General']['http_password'] = pwd
defaultConfig['SABnzbd'] = {} if "true" in sabnzbd_launch:
defaultConfig['SABnzbd']['sab_apikey'] = sabNzbdApiKey defaultConfig['SABnzbd'] = {}
defaultConfig['SABnzbd']['sab_host'] = sabNzbdHost defaultConfig['SABnzbd']['sab_apikey'] = sabNzbdApiKey
defaultConfig['SABnzbd']['sab_username'] = user defaultConfig['SABnzbd']['sab_host'] = sabNzbdHost
defaultConfig['SABnzbd']['sab_password'] = pwd defaultConfig['SABnzbd']['sab_username'] = user
defaultConfig['SABnzbd']['sab_password'] = pwd
if firstLaunch: if firstLaunch:
defaultConfig['SABnzbd']['sab_category'] = 'music' defaultConfig['SABnzbd']['sab_category'] = 'music'
@ -355,7 +424,7 @@ headphonesConfig.write()
# launch Headphones # launch Headphones
# ----------------- # -----------------
if "true" in headphones_launch:
logging.debug('Launching Headphones...') logging.debug('Launching Headphones...')
subprocess.call(headphones,close_fds=True) subprocess.call(headphones,close_fds=True)
logging.debug('...done') logging.debug('...done')

View File

@ -6,6 +6,11 @@
<string id="1010">User Settings</string> <string id="1010">User Settings</string>
<string id="1022">Username</string> <string id="1022">Username</string>
<string id="1023">Password</string> <string id="1023">Password</string>
<string id="1024">Enable SABnzbd</string>>
<string id="1025">Enable Sickbeard</string>
<string id="1026">Enable Coutchpotato</string>
<string id="1027">Couchpotato Version</string>
<string id="1028">Enable Headphones</string>
<string id="2010">Network Settings</string> <string id="2010">Network Settings</string>
<string id="2021">Allowed IP addresses</string> <string id="2021">Allowed IP addresses</string>
<string id="3010">Sleep</string> <string id="3010">Sleep</string>

View File

@ -7,6 +7,11 @@
<setting type="sep" /> <setting type="sep" />
<setting id="SABNZBD_USER" type="text" label="1022" default="openelec"/> <setting id="SABNZBD_USER" type="text" label="1022" default="openelec"/>
<setting id="SABNZBD_PWD" type="text" label="1023" default="openelec"/> <setting id="SABNZBD_PWD" type="text" label="1023" default="openelec"/>
<setting id="SABNZBD_LAUNCH" type="bool" label="1024" default="true" />
<setting id="SICKBEARD_LAUNCH" type="bool" label="1025" default="true" />
<setting id="COUCHPOTATO_LAUNCH" type="bool" label="1026" default="true" />
<setting id="COUCHPOTATO_VERSION" type="enum" label="1027" default="0" values="Version 1|Version 2" enable="eq(-1,true)" />
<setting id="HEADPHONES_LAUNCH" type="bool" label="1028" default="true" />
<setting label="2010" type="lsep"/> <setting label="2010" type="lsep"/>
<setting type="sep" /> <setting type="sep" />

View File

@ -0,0 +1,44 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC.tv; see the file COPYING. If not, write to
# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
echo "getting sources..."
if [ ! -d CouchPotatoServer.git ]; then
git clone git://github.com/RuudBurger/CouchPotatoServer.git CouchPotatoServer.git
fi
cd CouchPotatoServer.git
git pull
GIT_REV=`git log -n1 --format=%h`
rm -rf .git
cd ..
echo "copying sources..."
rm -rf CouchPotatoServer-$GIT_REV
cp -R CouchPotatoServer.git CouchPotatoServer-$GIT_REV
echo "cleaning sources..."
rm -rf CouchPotatoServer-$GIT_REV/.git
echo "packing sources..."
tar cvJf CouchPotatoServer-$GIT_REV.tar.xz CouchPotatoServer-$GIT_REV
echo "remove temporary sourcedir..."
rm -rf CouchPotatoServer-$GIT_REV