From e4f664e3d67b4b7f713db08c454fe94cd408aff5 Mon Sep 17 00:00:00 2001 From: lsellens Date: Sun, 3 Jun 2012 02:37:53 -0500 Subject: [PATCH] Updates to SABnzbd-suite --- packages/3rdparty/download/CouchPotato/meta | 2 +- .../3rdparty/download/CouchPotatoServer/meta | 38 +++++ packages/3rdparty/download/Headphones/meta | 2 +- .../downloadmanager/SABnzbd-Suite/addon | 3 + .../SABnzbd-Suite/config/settings.xml | 5 + .../SABnzbd-Suite/source/bin/SABnzbd-Suite.py | 149 +++++++++++++----- .../resources/language/English/strings.xml | 5 + .../source/resources/settings.xml | 5 + tools/mkpkg/mkpkg_couchpotatoserver | 44 ++++++ 9 files changed, 211 insertions(+), 42 deletions(-) create mode 100644 packages/3rdparty/download/CouchPotatoServer/meta mode change 100755 => 100644 packages/addons/service/downloadmanager/SABnzbd-Suite/source/resources/settings.xml create mode 100755 tools/mkpkg/mkpkg_couchpotatoserver diff --git a/packages/3rdparty/download/CouchPotato/meta b/packages/3rdparty/download/CouchPotato/meta index b7d0a0717a..a444efdacb 100644 --- a/packages/3rdparty/download/CouchPotato/meta +++ b/packages/3rdparty/download/CouchPotato/meta @@ -20,7 +20,7 @@ ################################################################################ PKG_NAME="CouchPotato" -PKG_VERSION="46dbb59" +PKG_VERSION="33a99b4" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="OSS" diff --git a/packages/3rdparty/download/CouchPotatoServer/meta b/packages/3rdparty/download/CouchPotatoServer/meta new file mode 100644 index 0000000000..964a4eb891 --- /dev/null +++ b/packages/3rdparty/download/CouchPotatoServer/meta @@ -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" diff --git a/packages/3rdparty/download/Headphones/meta b/packages/3rdparty/download/Headphones/meta index 0a97ed6f04..60625ccb09 100644 --- a/packages/3rdparty/download/Headphones/meta +++ b/packages/3rdparty/download/Headphones/meta @@ -20,7 +20,7 @@ ################################################################################ PKG_NAME="Headphones" -PKG_VERSION="298463a" +PKG_VERSION="f9f129b" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="OSS" diff --git a/packages/addons/service/downloadmanager/SABnzbd-Suite/addon b/packages/addons/service/downloadmanager/SABnzbd-Suite/addon index 235fde7c06..0c43ee5b91 100755 --- a/packages/addons/service/downloadmanager/SABnzbd-Suite/addon +++ b/packages/addons/service/downloadmanager/SABnzbd-Suite/addon @@ -44,5 +44,8 @@ mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/SickBeard mkdir -p $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 cp -PR $BUILD/Headphones-*/* $ADDON_BUILD/$PKG_ADDON_ID/Headphones diff --git a/packages/addons/service/downloadmanager/SABnzbd-Suite/config/settings.xml b/packages/addons/service/downloadmanager/SABnzbd-Suite/config/settings.xml index 079c735b3d..fd3d452b30 100644 --- a/packages/addons/service/downloadmanager/SABnzbd-Suite/config/settings.xml +++ b/packages/addons/service/downloadmanager/SABnzbd-Suite/config/settings.xml @@ -5,4 +5,9 @@ + + + + + diff --git a/packages/addons/service/downloadmanager/SABnzbd-Suite/source/bin/SABnzbd-Suite.py b/packages/addons/service/downloadmanager/SABnzbd-Suite/source/bin/SABnzbd-Suite.py index 12b46467b8..7000160edd 100755 --- a/packages/addons/service/downloadmanager/SABnzbd-Suite/source/bin/SABnzbd-Suite.py +++ b/packages/addons/service/downloadmanager/SABnzbd-Suite/source/bin/SABnzbd-Suite.py @@ -26,6 +26,7 @@ import xbmc import signal import subprocess import urllib2 +import hashlib from configobj import ConfigObj from xml.dom.minidom import parseString import logging @@ -68,8 +69,9 @@ pDefaultSuiteSettings = os.path.join(pAddon, 'settings-default.xml') pSuiteSettings = os.path.join(pAddonHome, 'settings.xml') pXbmcSettings = '/storage/.xbmc/userdata/guisettings.xml' 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') +pCouchPotatoServerSettings = os.path.join(pAddonHome, 'couchpotatoserver.ini') pHeadphonesSettings = os.path.join(pAddonHome, 'headphones.ini') # directories @@ -87,9 +89,11 @@ pPylib = os.path.join(pAddon, 'pylib') sabnzbd = ['python', os.path.join(pAddon, 'SABnzbd/SABnzbd.py'), '-d', '-f', pSabNzbdSettings, '-l 0'] 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'), '-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'), '-d', '--datadir', pAddonHome, '--config', pHeadphonesSettings] @@ -127,10 +131,15 @@ fSuiteSettings = open(pSuiteSettings, 'r') data = fSuiteSettings.read() fSuiteSettings.close suiteSettings = parseString(data) -user = getAddonSetting(suiteSettings, 'SABNZBD_USER') -pwd = getAddonSetting(suiteSettings, 'SABNZBD_PWD') -host = getAddonSetting(suiteSettings, 'SABNZBD_IP') -sabNzbdKeepAwake = getAddonSetting(suiteSettings, 'SABNZBD_KEEP_AWAKE') +user = getAddonSetting(suiteSettings, 'SABNZBD_USER') +pwd = getAddonSetting(suiteSettings, 'SABNZBD_PWD') +host = getAddonSetting(suiteSettings, 'SABNZBD_IP') +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 fXbmcSettings = open(pXbmcSettings, 'r') @@ -219,17 +228,17 @@ autoProcessConfig.write() # launch SABnzbd and get the API key # ---------------------------------- - -logging.debug('Launching SABnzbd...') -subprocess.call(sabnzbd,close_fds=True) -logging.debug('...done') +if "true" in sabnzbd_launch: + logging.debug('Launching SABnzbd...') + subprocess.call(sabnzbd,close_fds=True) + logging.debug('...done') # SABnzbd will only complete the .ini file when we first access the web interface -if firstLaunch: - loadWebInterface('http://' + sabNzbdHost,user,pwd) -sabNzbdConfig.reload() -sabNzbdApiKey = sabNzbdConfig['misc']['api_key'] -logging.debug('SABnzbd api key: ' + sabNzbdApiKey) + if firstLaunch: + loadWebInterface('http://' + sabNzbdHost,user,pwd) + sabNzbdConfig.reload() + sabNzbdApiKey = sabNzbdConfig['misc']['api_key'] + logging.debug('SABnzbd api key: ' + sabNzbdApiKey) # write SickBeard settings # ------------------------ @@ -244,11 +253,12 @@ defaultConfig['General']['web_port'] = '8082' defaultConfig['General']['web_host'] = host defaultConfig['General']['web_username'] = user defaultConfig['General']['web_password'] = pwd -defaultConfig['SABnzbd'] = {} -defaultConfig['SABnzbd']['sab_username'] = user -defaultConfig['SABnzbd']['sab_password'] = pwd -defaultConfig['SABnzbd']['sab_apikey'] = sabNzbdApiKey -defaultConfig['SABnzbd']['sab_host'] = 'http://' + sabNzbdHost + '/' +if "true" in sabnzbd_launch: + defaultConfig['SABnzbd'] = {} + defaultConfig['SABnzbd']['sab_username'] = user + defaultConfig['SABnzbd']['sab_password'] = pwd + defaultConfig['SABnzbd']['sab_apikey'] = sabNzbdApiKey + defaultConfig['SABnzbd']['sab_host'] = 'http://' + sabNzbdHost + '/' defaultConfig['XBMC'] = {} defaultConfig['XBMC']['use_xbmc'] = '1' defaultConfig['XBMC']['xbmc_host'] = '127.0.0.1:' + xbmcPort @@ -278,9 +288,10 @@ sickBeardConfig.write() # launch SickBeard # ---------------- -logging.debug('Launching SickBeard...') -subprocess.call(sickBeard,close_fds=True) -logging.debug('...done') +if "true" in sickbeard_launch: + logging.debug('Launching SickBeard...') + subprocess.call(sickBeard,close_fds=True) + logging.debug('...done') # write CouchPotato settings # -------------------------- @@ -294,11 +305,12 @@ defaultConfig['global']['password'] = pwd defaultConfig['global']['username'] = user defaultConfig['global']['port'] = '8083' defaultConfig['global']['host'] = host -defaultConfig['Sabnzbd'] = {} -defaultConfig['Sabnzbd']['username'] = user -defaultConfig['Sabnzbd']['password'] = pwd -defaultConfig['Sabnzbd']['apikey'] = sabNzbdApiKey -defaultConfig['Sabnzbd']['host'] = sabNzbdHost +if "true" in sabnzbd_launch: + defaultConfig['Sabnzbd'] = {} + defaultConfig['Sabnzbd']['username'] = user + defaultConfig['Sabnzbd']['password'] = pwd + defaultConfig['Sabnzbd']['apikey'] = sabNzbdApiKey + defaultConfig['Sabnzbd']['host'] = sabNzbdHost defaultConfig['XBMC'] = {} defaultConfig['XBMC']['enabled'] = 'True' defaultConfig['XBMC']['host'] = '127.0.0.1:' + xbmcPort @@ -320,10 +332,66 @@ couchPotatoConfig.write() # 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...') -subprocess.call(couchPotato,close_fds=True) -logging.debug('...done') +#convert password to md5 +md5pwd = hashlib.md5(pwd).hexdigest() + +# 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 # ------------------------- @@ -336,11 +404,12 @@ defaultConfig['General']['http_port'] = '8084' defaultConfig['General']['http_host'] = host defaultConfig['General']['http_username'] = user defaultConfig['General']['http_password'] = pwd -defaultConfig['SABnzbd'] = {} -defaultConfig['SABnzbd']['sab_apikey'] = sabNzbdApiKey -defaultConfig['SABnzbd']['sab_host'] = sabNzbdHost -defaultConfig['SABnzbd']['sab_username'] = user -defaultConfig['SABnzbd']['sab_password'] = pwd +if "true" in sabnzbd_launch: + defaultConfig['SABnzbd'] = {} + defaultConfig['SABnzbd']['sab_apikey'] = sabNzbdApiKey + defaultConfig['SABnzbd']['sab_host'] = sabNzbdHost + defaultConfig['SABnzbd']['sab_username'] = user + defaultConfig['SABnzbd']['sab_password'] = pwd if firstLaunch: defaultConfig['SABnzbd']['sab_category'] = 'music' @@ -355,7 +424,7 @@ headphonesConfig.write() # launch Headphones # ----------------- - -logging.debug('Launching Headphones...') -subprocess.call(headphones,close_fds=True) -logging.debug('...done') +if "true" in headphones_launch: + logging.debug('Launching Headphones...') + subprocess.call(headphones,close_fds=True) + logging.debug('...done') diff --git a/packages/addons/service/downloadmanager/SABnzbd-Suite/source/resources/language/English/strings.xml b/packages/addons/service/downloadmanager/SABnzbd-Suite/source/resources/language/English/strings.xml index 304ce60eca..273fac30b5 100644 --- a/packages/addons/service/downloadmanager/SABnzbd-Suite/source/resources/language/English/strings.xml +++ b/packages/addons/service/downloadmanager/SABnzbd-Suite/source/resources/language/English/strings.xml @@ -6,6 +6,11 @@ User Settings Username Password + Enable SABnzbd> + Enable Sickbeard + Enable Coutchpotato + Couchpotato Version + Enable Headphones Network Settings Allowed IP addresses Sleep diff --git a/packages/addons/service/downloadmanager/SABnzbd-Suite/source/resources/settings.xml b/packages/addons/service/downloadmanager/SABnzbd-Suite/source/resources/settings.xml old mode 100755 new mode 100644 index 33b9d33e3e..1cd5c2b8b7 --- a/packages/addons/service/downloadmanager/SABnzbd-Suite/source/resources/settings.xml +++ b/packages/addons/service/downloadmanager/SABnzbd-Suite/source/resources/settings.xml @@ -7,6 +7,11 @@ + + + + + diff --git a/tools/mkpkg/mkpkg_couchpotatoserver b/tools/mkpkg/mkpkg_couchpotatoserver new file mode 100755 index 0000000000..df4639abb1 --- /dev/null +++ b/tools/mkpkg/mkpkg_couchpotatoserver @@ -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