mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 05:36:47 +00:00
new addon: add addon 'SABnzbd-Suite' which merges the old SABnzbd, CouchPotato and SickBeard in one super addon
Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
parent
c2a6f00ea6
commit
8ef1440663
45
packages/addons/service/downloadmanager/SABnzbd-Suite/addon
Executable file
45
packages/addons/service/downloadmanager/SABnzbd-Suite/addon
Executable file
@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2011 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, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
. config/options $1
|
||||
|
||||
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID
|
||||
cp -PR $PKG_DIR/config/settings.xml* $ADDON_BUILD/$PKG_ADDON_ID/settings-default.xml
|
||||
|
||||
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin
|
||||
cp $BUILD/par2cmdline-*/par2 $ADDON_BUILD/$PKG_ADDON_ID/bin
|
||||
cp $BUILD/unrar/unrar $ADDON_BUILD/$PKG_ADDON_ID/bin
|
||||
cp $BUILD/unzip*/unzip $ADDON_BUILD/$PKG_ADDON_ID/bin
|
||||
|
||||
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/pylib
|
||||
cp -R $BUILD/Cheetah*/.install/usr/lib/python*/site-packages/* $ADDON_BUILD/$PKG_ADDON_ID/pylib
|
||||
cp -R $BUILD/pyOpenSSL*/.install/usr/lib/python*/site-packages/* $ADDON_BUILD/$PKG_ADDON_ID/pylib
|
||||
cp -R $BUILD/yenc*/.install/usr/lib/python*/site-packages/* $ADDON_BUILD/$PKG_ADDON_ID/pylib
|
||||
|
||||
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/SABnzbd
|
||||
cp -PR $BUILD/SABnzbd-*/* $ADDON_BUILD/$PKG_ADDON_ID/SABnzbd
|
||||
|
||||
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/SickBeard
|
||||
cp -PR $BUILD/SickBeard-*/* $ADDON_BUILD/$PKG_ADDON_ID/SickBeard
|
||||
|
||||
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/CouchPotato
|
||||
cp -PR $BUILD/CouchPotato-*/* $ADDON_BUILD/$PKG_ADDON_ID/CouchPotato
|
@ -0,0 +1,2 @@
|
||||
0.99.1
|
||||
- initial version SABnzbd-Suite
|
@ -0,0 +1,5 @@
|
||||
<settings>
|
||||
<setting id="SABNZBD_IP" value="0.0.0.0" />
|
||||
<setting id="SABNZBD_PWD" value="" />
|
||||
<setting id="SABNZBD_USER" value="" />
|
||||
</settings>
|
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
38
packages/addons/service/downloadmanager/SABnzbd-Suite/meta
Normal file
38
packages/addons/service/downloadmanager/SABnzbd-Suite/meta
Normal file
@ -0,0 +1,38 @@
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2011 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, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
PKG_NAME="SABnzbd-Suite"
|
||||
PKG_VERSION="0.99"
|
||||
PKG_REV="1"
|
||||
PKG_ARCH="any"
|
||||
PKG_LICENSE="OSS"
|
||||
PKG_SITE="http://www.openelec.tv"
|
||||
PKG_URL=""
|
||||
PKG_DEPENDS="Python"
|
||||
PKG_BUILD_DEPENDS="toolchain Python SABnzbd SickBeard CouchPotato"
|
||||
PKG_PRIORITY="optional"
|
||||
PKG_SECTION="service/downloadmanager"
|
||||
PKG_SHORTDESC="SABnzbd-Suite is a Metapackage which combines SABnzbd, SickBeard and Couchpotato in one Addon"
|
||||
PKG_LONGDESC="SABnzbd-Suite makes Usenet as simple and streamlined as possible by automating everything we can. All you have to do is add a .nzb file. SABnzbd+ takes over from there, where it will be automatically downloaded, verified, repaired, extracted and filed away with zero human interaction."
|
||||
|
||||
PKG_IS_ADDON="yes"
|
||||
PKG_ADDON_TYPE="xbmc.service"
|
||||
|
||||
PKG_AUTORECONF="no"
|
@ -0,0 +1,299 @@
|
||||
#!/bin/sh
|
||||
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2011 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, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
# Addon settings
|
||||
ADDON_DIR="$HOME/.xbmc/addons/service.downloadmanager.SABnzbd-Suite"
|
||||
ADDON_HOME="$HOME/.xbmc/userdata/addon_data/service.downloadmanager.SABnzbd-Suite"
|
||||
|
||||
SABNZBDSUITE_SETTINGS="$ADDON_HOME/settings.xml"
|
||||
SABNZBD_SETTINGS="$ADDON_HOME/sabnzbd.ini"
|
||||
SICKBEARD_SETTINGS="$ADDON_HOME/config.ini"
|
||||
COUCHPOTATO_SETTINGS="$ADDON_HOME/couchpotato.ini"
|
||||
XBMC_SETTINGS="$HOME/.xbmc/userdata/guisettings.xml"
|
||||
|
||||
export PYTHONPATH="$PYTHONPATH:$ADDON_DIR/pylib"
|
||||
|
||||
################################################################################
|
||||
# default sabnzbd values
|
||||
################################################################################
|
||||
SABNZBD_HOST="127.0.0.1"
|
||||
SABNZBD_PORT="8081"
|
||||
SABNZBD_DISABLEAPIKEY="0"
|
||||
SABNZBD_CHECKRELEASE="0"
|
||||
SABNZBD_LAUNCHBROWSER="0"
|
||||
|
||||
SABNZBD_HTTPPORT="8081"
|
||||
SABNZBD_HTTPSPORT="9081"
|
||||
SABNZBD_HTTPSCERT="server.cert"
|
||||
SABNZBD_HTTPSKEY="server.key"
|
||||
|
||||
SABNZBD_SKIN="Plush"
|
||||
SABNZBD_SKIN2="Plush"
|
||||
SABNZBD_WEBCOLOR="gold"
|
||||
SABNZBD_WEBCOLOR2="gold"
|
||||
|
||||
SABNZBD_LOGDIR="logs"
|
||||
SABNZBD_ADMINDIR="admin"
|
||||
SABNZBD_BACKUPDIR="backup"
|
||||
SABNZBD_SCRIPTDIR="scripts"
|
||||
|
||||
SABNZBD_INCOMPLETEDIR="/storage/downloads/incomplete"
|
||||
SABNZBD_COMPLETEDIR="/storage/downloads"
|
||||
SABNZBD_WATCHDIR="/storage/downloads/watch"
|
||||
|
||||
################################################################################
|
||||
# default sickbeard values
|
||||
################################################################################
|
||||
SICKBEARD_LOGDIR="log"
|
||||
SICKBEARD_CACHEDIR="cache"
|
||||
SICKBEARD_PORT="8082"
|
||||
SICKBEARD_LAUNCHBROWSER="0"
|
||||
SICKBEARD_VERSIONCHECK="0"
|
||||
SICKBEARD_USEIPV6="0"
|
||||
SICKBEARD_WEBLOG="0"
|
||||
|
||||
SICKBEARD_USEXBMC="1"
|
||||
SICKBEARD_METADATAXBMC="1|1|1|1|1|1"
|
||||
|
||||
################################################################################
|
||||
# default couchpotato values
|
||||
################################################################################
|
||||
COUCHPOTATO_LAUNCHBROWSER="False"
|
||||
COUCHPOTATO_VERSIONCHECK="False"
|
||||
COUCHPOTATO_PORT="8083"
|
||||
COUCHPOTATO_USEXBMC="True"
|
||||
COUCHPOTATO_UPDATEXBMC="True"
|
||||
|
||||
################################################################################
|
||||
# setup functions
|
||||
################################################################################
|
||||
|
||||
write_sabnzbd_ini() {
|
||||
python $ADDON_DIR/bin/ini_tool --action=write \
|
||||
--file=$SABNZBD_SETTINGS \
|
||||
--option="$1:$2" \
|
||||
--value="$3"
|
||||
}
|
||||
|
||||
write_sickbeard_ini() {
|
||||
python $ADDON_DIR/bin/ini_tool --action=write \
|
||||
--file=$SICKBEARD_SETTINGS \
|
||||
--option="$1:$2" \
|
||||
--value="$3"
|
||||
}
|
||||
|
||||
write_couchpotato_ini() {
|
||||
python $ADDON_DIR/bin/ini_tool --action=write \
|
||||
--file=$COUCHPOTATO_SETTINGS \
|
||||
--option="$1:$2" \
|
||||
--value="$3"
|
||||
}
|
||||
|
||||
read_sabconfig() {
|
||||
python $ADDON_DIR/bin/ini_tool --action=read \
|
||||
--file=$SABNZBD_SETTINGS \
|
||||
--option="$1:$2"
|
||||
}
|
||||
|
||||
|
||||
read_xbmcconfig() {
|
||||
grep "<$1>" $XBMC_SETTINGS | sed -e "s,[[:space:]]*<$1>,," -e "s,</$1>,,"
|
||||
}
|
||||
|
||||
write_ini_postprocess() {
|
||||
python $ADDON_DIR/bin/ini_tool --action=write \
|
||||
--file=$ADDON_HOME/$SABNZBD_SCRIPTDIR/autoProcessTV.cfg \
|
||||
--option="$1:$2" \
|
||||
--value="$3"
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# read xbmc settings
|
||||
################################################################################
|
||||
XBMC_HOST="127.0.0.1"
|
||||
XBMC_PORT=`read_xbmcconfig webserverport`
|
||||
XBMC_USER=`read_xbmcconfig webserverusername`
|
||||
XBMC_PWD=`read_xbmcconfig webserverpassword`
|
||||
|
||||
################################################################################
|
||||
# create default config
|
||||
################################################################################
|
||||
|
||||
mkdir -p $ADDON_HOME
|
||||
|
||||
if [ ! -f "$SABNZBDSUITE_SETTINGS" ]; then
|
||||
cp $ADDON_DIR/settings-default.xml $SABNZBDSUITE_SETTINGS
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
# read settings from xbmc setup dialog
|
||||
################################################################################
|
||||
SABNZBD_USER=`grep SABNZBD_USER $SABNZBD_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"`
|
||||
SABNZBD_PWD=`grep SABNZBD_PWD $SABNZBD_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"`
|
||||
SABNZBD_IP=`grep SABNZBD_IP $SABNZBD_SETTINGS | awk '{print $3 }' | sed -e "s,value=,," -e "s,\",,g"`
|
||||
SICKBEARD_IP="$SABNZBD_IP"
|
||||
COUCHPOTATO_IP="$SABNZBD_IP"
|
||||
|
||||
################################################################################
|
||||
# setup sabnzbd ini file
|
||||
################################################################################
|
||||
if [ -z "$SABNZBD_IP" ]; then
|
||||
SABNZBD_IP="0.0.0.0"
|
||||
fi
|
||||
|
||||
if [ ! -f "$ADDON_HOME/sabnzbd.ini" ]; then
|
||||
SABNZBD_FIRSTRUN="yes"
|
||||
fi
|
||||
|
||||
write_sabnzbd_ini misc disable_api_key $SABNZBD_DISABLEAPIKEY
|
||||
write_sabnzbd_ini misc check_new_rel $SABNZBD_CHECKRELEASE
|
||||
write_sabnzbd_ini misc auto_browser $SABNZBD_LAUNCHBROWSER
|
||||
write_sabnzbd_ini misc username $SABNZBD_USER
|
||||
write_sabnzbd_ini misc password $SABNZBD_PWD
|
||||
write_sabnzbd_ini misc port $SABNZBD_HTTPPORT
|
||||
write_sabnzbd_ini misc https_port $SABNZBD_HTTPSPORT
|
||||
write_sabnzbd_ini misc https_cert $SABNZBD_HTTPSCERT
|
||||
write_sabnzbd_ini misc https_key $SABNZBD_HTTPSKEY
|
||||
write_sabnzbd_ini misc host $SABNZBD_IP
|
||||
write_sabnzbd_ini misc web_dir $SABNZBD_SKIN
|
||||
write_sabnzbd_ini misc web_dir2 $SABNZBD_SKIN2
|
||||
write_sabnzbd_ini misc web_color $SABNZBD_WEBCOLOR
|
||||
write_sabnzbd_ini misc web_color2 $SABNZBD_WEBCOLOR2
|
||||
write_sabnzbd_ini misc log_dir $SABNZBD_LOGDIR
|
||||
write_sabnzbd_ini misc admin_dir $SABNZBD_ADMINDIR
|
||||
write_sabnzbd_ini misc nzb_backup_dir $SABNZBD_BACKUPDIR
|
||||
write_sabnzbd_ini misc script_dir $SABNZBD_SCRIPTDIR
|
||||
|
||||
|
||||
if [ "$SABNZBD_FIRSTRUN" = "yes" ]; then
|
||||
mkdir -p "$SABNZBD_INCOMPLETEDIR"
|
||||
mkdir -p "$SABNZBD_COMPLETEDIR"
|
||||
mkdir -p "$SABNZBD_WATCHDIR"
|
||||
write_sabnzbd_ini misc download_dir $SABNZBD_INCOMPLETEDIR
|
||||
write_sabnzbd_ini misc complete_dir $SABNZBD_COMPLETEDIR
|
||||
write_sabnzbd_ini misc dirscan_dir $SABNZBD_WATCHDIR
|
||||
|
||||
write_sabnzbd_ini servers:localhost name "localhost"
|
||||
write_sabnzbd_ini servers:localhost host "localhost"
|
||||
write_sabnzbd_ini servers:localhost port "119"
|
||||
write_sabnzbd_ini servers:localhost enable "0"
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
# setup postprocessing scripts file
|
||||
################################################################################
|
||||
mkdir -p $ADDON_HOME/$SABNZBD_SCRIPTDIR
|
||||
cp -P $ADDON_DIR/SickBeard/autoProcessTV/*.py $ADDON_HOME/$SABNZBD_SCRIPTDIR
|
||||
chmod +x $ADDON_HOME/$SABNZBD_SCRIPTDIR/*.py
|
||||
|
||||
write_ini_postprocess SickBeard host localhost
|
||||
write_ini_postprocess SickBeard port $SICKBEARD_PORT
|
||||
write_ini_postprocess SickBeard username $SABNZBD_USER
|
||||
write_ini_postprocess SickBeard password $SABNZBD_PWD
|
||||
|
||||
################################################################################
|
||||
# start sabnzbd
|
||||
################################################################################
|
||||
python $ADDON_DIR/SABnzbd/SABnzbd.py -d -f $ADDON_HOME/sabnzbd.ini -l 0
|
||||
|
||||
################################################################################
|
||||
# read sabnzbd settings
|
||||
################################################################################
|
||||
SABNZBD_APIKEY=`read_sabconfig misc api_key`
|
||||
|
||||
################################################################################
|
||||
# setup sickbeard ini file
|
||||
################################################################################
|
||||
if [ -z "$SICKBEARD_IP" ]; then
|
||||
SICKBEARD_IP="0.0.0.0"
|
||||
fi
|
||||
|
||||
if [ ! -f "$ADDON_HOME/config.ini" ]; then
|
||||
SICKBEARD_FIRSTRUN="yes"
|
||||
fi
|
||||
|
||||
write_sickbeard_ini General launch_browser $SICKBEARD_LAUNCHBROWSER
|
||||
write_sickbeard_ini General version_notify $SICKBEARD_VERSIONCHECK
|
||||
write_sickbeard_ini General log_dir $SICKBEARD_LOGDIR
|
||||
write_sickbeard_ini General cache_dir $SICKBEARD_CACHEDIR
|
||||
write_sickbeard_ini General web_port $SICKBEARD_PORT
|
||||
write_sickbeard_ini General web_host $SICKBEARD_IP
|
||||
write_sickbeard_ini General web_ipv6 $SICKBEARD_USEIPV6
|
||||
write_sickbeard_ini General web_log $SICKBEARD_WEBLOG
|
||||
write_sickbeard_ini General web_username $SABNZBD_USER
|
||||
write_sickbeard_ini General web_password $SABNZBD_PWD
|
||||
|
||||
write_sickbeard_ini SABnzbd sab_username $SABNZBD_USER
|
||||
write_sickbeard_ini SABnzbd sab_password $SABNZBD_PWD
|
||||
write_sickbeard_ini SABnzbd sab_apikey $SABNZBD_APIKEY
|
||||
write_sickbeard_ini SABnzbd sab_host "http://$SABNZBD_HOST:$SABNZBD_PORT/"
|
||||
|
||||
write_sickbeard_ini XBMC use_xbmc $SICKBEARD_USEXBMC
|
||||
write_sickbeard_ini XBMC xbmc_host "$XBMC_HOST:$XBMC_PORT"
|
||||
write_sickbeard_ini XBMC xbmc_username $XBMC_USER
|
||||
write_sickbeard_ini XBMC xbmc_password $XBMC_PWD
|
||||
|
||||
if [ "$SICKBEARD_FIRSTRUN" = "yes" ]; then
|
||||
write_sickbeard_ini General metadata_xbmc $SICKBEARD_METADATAXBMC
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
# start sickbeard
|
||||
################################################################################
|
||||
python $ADDON_DIR/SickBeard/SickBeard.py --daemon --datadir $ADDON_HOME
|
||||
|
||||
################################################################################
|
||||
# setup couchpotato ini file
|
||||
################################################################################
|
||||
if [ -z "$COUCHPOTATO_IP" ]; then
|
||||
COUCHPOTATO_IP="0.0.0.0"
|
||||
fi
|
||||
|
||||
if [ ! -f "$ADDON_HOME/couchpotato.ini" ]; then
|
||||
COUCHPOTATO_FIRSTRUN="yes"
|
||||
fi
|
||||
|
||||
write_couchpotato_ini global host $COUCHPOTATO_IP
|
||||
write_couchpotato_ini global port $COUCHPOTATO_PORT
|
||||
write_couchpotato_ini global username $SABNZBD_USER
|
||||
write_couchpotato_ini global password $SABNZBD_PWD
|
||||
write_couchpotato_ini global launchbrowser $COUCHPOTATO_LAUNCHBROWSER
|
||||
write_couchpotato_ini global updater $COUCHPOTATO_VERSIONCHECK
|
||||
|
||||
write_couchpotato_ini Sabnzbd username $SABNZBD_USER
|
||||
write_couchpotato_ini Sabnzbd password $SABNZBD_PWD
|
||||
write_couchpotato_ini Sabnzbd apikey $SABNZBD_APIKEY
|
||||
write_couchpotato_ini Sabnzbd host "$SABNZBD_HOST:$SABNZBD_PORT"
|
||||
|
||||
write_couchpotato_ini XBMC enabled $COUCHPOTATO_USEXBMC
|
||||
write_couchpotato_ini XBMC host "$XBMC_HOST:$XBMC_PORT"
|
||||
write_couchpotato_ini XBMC username $XBMC_USER
|
||||
write_couchpotato_ini XBMC password $XBMC_PWD
|
||||
|
||||
if [ "$COUCHPOTATO_FIRSTRUN" = "yes" ]; then
|
||||
write_couchpotato_ini XBMC updateoneonly $COUCHPOTATO_UPDATEXBMC
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
# start couchpotato
|
||||
################################################################################
|
||||
python $ADDON_DIR/CouchPotato/CouchPotato.py -d --datadir $ADDON_HOME --config $ADDON_HOME/couchpotato.ini
|
117
packages/addons/service/downloadmanager/SABnzbd-Suite/source/bin/ini_tool
Executable file
117
packages/addons/service/downloadmanager/SABnzbd-Suite/source/bin/ini_tool
Executable file
@ -0,0 +1,117 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2011 Travis Glenn Hansen (travisghansen@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, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
from configobj import ConfigObj
|
||||
import sys
|
||||
import os
|
||||
import string
|
||||
|
||||
python_major = sys.version_info[0]
|
||||
python_minor = sys.version_info[1]
|
||||
|
||||
prog="ini_tool"
|
||||
description="""Read/Write config files.
|
||||
|
||||
Examples:
|
||||
%(prog)s --file config.ini --action read --option [section:]username
|
||||
%(prog)s --file config.ini --action write --option [section:]username --value foo""" % {'prog':prog}
|
||||
|
||||
def option_required_error(option):
|
||||
parser.print_usage()
|
||||
print prog + ": error: " + option + " is required"
|
||||
exit(2)
|
||||
|
||||
if python_major > 2 or (python_major == 2 and python_minor >= 7):
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
prog=prog,
|
||||
description=description,
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
)
|
||||
|
||||
parser.add_argument('--file', help='file to read/write to/from', required=True)
|
||||
parser.add_argument('--action', help='read|write', required=True)
|
||||
parser.add_argument('--option', help='the option key', required=True)
|
||||
parser.add_argument('--value', help='value to store in the given option (only for write action)')
|
||||
|
||||
options = parser.parse_args()
|
||||
|
||||
else:
|
||||
import optparse
|
||||
|
||||
parser = optparse.OptionParser(
|
||||
prog=prog,
|
||||
description=description,
|
||||
)
|
||||
|
||||
parser.add_option('--file', help='file to read/write to/from')
|
||||
parser.add_option('--action', help='read|write')
|
||||
parser.add_option('--option', help='the option key')
|
||||
parser.add_option('--value', help='value to store in the given option (only for write action)')
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if not options.file:
|
||||
option_required_error("--file")
|
||||
if not options.action:
|
||||
option_required_error("--action")
|
||||
if not options.option:
|
||||
option_required_error("--option")
|
||||
|
||||
|
||||
if options.action != "read" and options.action != "write":
|
||||
print "'" + options.action + "' is not a valid action"
|
||||
parser.print_help()
|
||||
exit(2)
|
||||
|
||||
if options.action == "read" and not os.path.isfile(options.file):
|
||||
print "'" + options.file + "' is not a file"
|
||||
exit(2)
|
||||
|
||||
config = ConfigObj(options.file)
|
||||
keys = string.split(options.option, ":")
|
||||
key_len = len(keys)
|
||||
current_section = config
|
||||
|
||||
if options.action == 'read':
|
||||
i = 1
|
||||
for key in keys:
|
||||
if i == key_len:
|
||||
print current_section[key]
|
||||
exit(0)
|
||||
else:
|
||||
current_section = current_section[key]
|
||||
i += 1
|
||||
elif options.action == 'write':
|
||||
i = 1
|
||||
for key in keys:
|
||||
if i == key_len:
|
||||
current_section[key] = options.value
|
||||
elif key not in current_section:
|
||||
current_section[key] = {}
|
||||
current_section = current_section[key]
|
||||
i += 1
|
||||
|
||||
config.write()
|
||||
else:
|
||||
exit(1)
|
@ -0,0 +1,23 @@
|
||||
################################################################################
|
||||
# This file is part of OpenELEC - http://www.openelec.tv
|
||||
# Copyright (C) 2009-2011 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, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# http://www.gnu.org/copyleft/gpl.html
|
||||
################################################################################
|
||||
|
||||
import xbmc, time, os, subprocess
|
||||
|
||||
os.system("SABnzbd-Suite.service")
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<strings>
|
||||
|
||||
<!-- SABnzbd-Suite -->
|
||||
<string id="1000">SABnzbd-Suite</string>
|
||||
<string id="1010">Gebruikers instellingen</string>
|
||||
<string id="1022">Gebruikersnaam</string>
|
||||
<string id="1023">Wachtwoord</string>
|
||||
<string id="2010">Netwerk instellingen</string>
|
||||
<string id="2021">Toegestane IP adressen</string>
|
||||
|
||||
</strings>
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<strings>
|
||||
|
||||
<!-- SABnzbd-Suite -->
|
||||
<string id="1000">SABnzbd-Suite</string>
|
||||
<string id="1010">User Settings</string>
|
||||
<string id="1022">Username</string>
|
||||
<string id="1023">Password</string>
|
||||
<string id="2010">Network Settings</string>
|
||||
<string id="2021">Allowed IP addresses</string>
|
||||
|
||||
</strings>
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<strings>
|
||||
|
||||
<!-- SABnzbd-Suite -->
|
||||
<string id="1000">SABnzbd-Suite</string>
|
||||
<string id="1010">Préférences utilisateur</string>
|
||||
<string id="1022">Nom d'utilisateur</string>
|
||||
<string id="1023">Mot de passe</string>
|
||||
<string id="2010">Préférences réseau</string>
|
||||
<string id="2021">Adresses IP autorisées</string>
|
||||
|
||||
</strings>
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<strings>
|
||||
|
||||
<!-- SABnzbd-Suite -->
|
||||
<string id="1000">SABnzbd-Suite</string>
|
||||
<string id="1010">Benutzer Einstellungen</string>
|
||||
<string id="1022">Benutzername</string>
|
||||
<string id="1023">Passwort</string>
|
||||
<string id="2010">Netzwerk Einstellungen</string>
|
||||
<string id="2021">Erlaubte IP Adressen</string>
|
||||
|
||||
</strings>
|
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<strings>
|
||||
|
||||
<!-- SABnzbd-Suite -->
|
||||
<string id="1000">SABnzbd-Suite</string>
|
||||
<string id="1010">Bruker Instillinger</string>
|
||||
<string id="1022">Brukernavn</string>
|
||||
<string id="1023">Passord</string>
|
||||
<string id="2010">Nettverksinstillinger</string>
|
||||
<string id="2021">Tilatte IP addresser</string>
|
||||
|
||||
</strings>
|
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<settings>
|
||||
|
||||
<!-- SABnzbd-Suite -->
|
||||
<category label="1000">
|
||||
<setting label="1010" type="lsep"/>
|
||||
<setting type="sep" />
|
||||
<setting id="SABNZBD_USER" type="text" label="1022" default="openelec"/>
|
||||
<setting id="SABNZBD_PWD" type="text" label="1023" default="openelec"/>
|
||||
|
||||
<setting label="2010" type="lsep"/>
|
||||
<setting type="sep" />
|
||||
<setting id="SABNZBD_IP" type="text" label="2021" default="0.0.0.0"/>
|
||||
</category>
|
||||
</settings>
|
Loading…
x
Reference in New Issue
Block a user