diff --git a/packages/addons/service/downloadmanager/CouchPotato/addon b/packages/addons/service/downloadmanager/CouchPotato/addon new file mode 100755 index 0000000000..a6d6b3cab7 --- /dev/null +++ b/packages/addons/service/downloadmanager/CouchPotato/addon @@ -0,0 +1,28 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2011 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, 675 Mass Ave, Cambridge, MA 02139, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +. config/options $1 + +mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/$1 + cp -PR $PKG_BUILD/* $ADDON_BUILD/$PKG_ADDON_ID/$1 + diff --git a/packages/addons/service/downloadmanager/CouchPotato/changelog.txt b/packages/addons/service/downloadmanager/CouchPotato/changelog.txt new file mode 100644 index 0000000000..fdb3511d92 --- /dev/null +++ b/packages/addons/service/downloadmanager/CouchPotato/changelog.txt @@ -0,0 +1,5 @@ +0.99.2 +- update to CouchPotato-2504efc + +0.99.1 +- initial version CouchPotato-ded60e1 diff --git a/packages/addons/service/downloadmanager/CouchPotato/icon/icon.png b/packages/addons/service/downloadmanager/CouchPotato/icon/icon.png new file mode 100644 index 0000000000..d189fe8ba2 Binary files /dev/null and b/packages/addons/service/downloadmanager/CouchPotato/icon/icon.png differ diff --git a/packages/addons/service/downloadmanager/CouchPotato/meta b/packages/addons/service/downloadmanager/CouchPotato/meta new file mode 100644 index 0000000000..6ed7f2d818 --- /dev/null +++ b/packages/addons/service/downloadmanager/CouchPotato/meta @@ -0,0 +1,40 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2011 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, 675 Mass Ave, Cambridge, MA 02139, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="CouchPotato" +PKG_VERSION="2504efc" +PKG_REV="2" +PKG_ARCH="any" +PKG_LICENSE="OSS" +PKG_SITE="https://github.com/RuudBurger/CouchPotato" +PKG_URL="$OPENELEC_SRC/$PKG_NAME-$PKG_VERSION.tar.bz2" +PKG_DEPENDS="Python SABnzbd" +PKG_BUILD_DEPENDS="toolchain Python" +PKG_PRIORITY="optional" +PKG_SECTION="service/downloadmanager" +PKG_SHORTDESC="CouchPotato: automated movie downloading." +PKG_LONGDESC="CouchPotato: automated movie downloading." + +PKG_IS_ADDON="yes" +PKG_ADDON_TYPE="xbmc.service" +PKG_ADDON_REQUIRES="addon.downloadmanager.SABnzbd:0.99.1" + +PKG_AUTORECONF="no" diff --git a/packages/addons/service/downloadmanager/CouchPotato/source/bin/CouchPotato.service b/packages/addons/service/downloadmanager/CouchPotato/source/bin/CouchPotato.service new file mode 100755 index 0000000000..6c158809db --- /dev/null +++ b/packages/addons/service/downloadmanager/CouchPotato/source/bin/CouchPotato.service @@ -0,0 +1,100 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2011 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, 675 Mass Ave, Cambridge, MA 02139, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +ADDON_DIR="$HOME/.xbmc/addons/service.downloadmanager.CouchPotato" +ADDON_HOME="$HOME/.xbmc/userdata/addon_data/service.downloadmanager.CouchPotato" +LOG_FILE="$ADDON_HOME/service.log" +SABNZBD_SETTINGS="$HOME/.xbmc/userdata/addon_data/service.downloadmanager.SABnzbd/sabnzbd.ini" +XBMC_SETTINGS="$HOME/.xbmc/userdata/guisettings.xml" + +export PYTHONPATH="$PYTHONPATH:$ADDON_DIR/pylib" + +write_ini() { +python $ADDON_DIR/bin/ini_tool --action=write \ + --file=$ADDON_HOME/config.ini \ + --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,,," +} + +mkdir -p $ADDON_HOME + +if [ ! -f "$ADDON_HOME/config.ini" ]; then + COUCHPOTATO_FIRSTRUN="yes" +fi + +# default values + COUCHPOTATO_LAUNCHBROWSER="False" + COUCHPOTATO_VERSIONCHECK="False" + COUCHPOTATO_PORT="8083" + COUCHPOTATO_USEXBMC="True" + COUCHPOTATO_UPDATEXBMC="True" + +# read xbmc settings + XBMC_HOST="127.0.0.1" + XBMC_PORT=`read_xbmcconfig webserverport` + XBMC_USER=`read_xbmcconfig webserverusername` + XBMC_PWD=`read_xbmcconfig webserverpassword` + +# read sabnzbd settings + SABNZBD_HOST="127.0.0.1" + SABNZBD_PORT="8081" + SABNZBD_APIKEY=`read_sabconfig misc api_key` + SABNZBD_WEBUSERNAME=`read_sabconfig misc username` + SABNZBD_WEBPASSWORD=`read_sabconfig misc password` + +if [ -z "$COUCHPOTATO_HOST" ]; then + COUCHPOTATO_HOST="0.0.0.0" +fi + +write_ini global host $COUCHPOTATO_HOST +write_ini global port $COUCHPOTATO_PORT +write_ini global username $SABNZBD_WEBUSERNAME +write_ini global password $SABNZBD_WEBPASSWORD +write_ini global launchbrowser $COUCHPOTATO_LAUNCHBROWSER +write_ini global updater $COUCHPOTATO_VERSIONCHECK + +write_ini Sabnzbd username $SABNZBD_WEBUSERNAME +write_ini Sabnzbd password $SABNZBD_WEBPASSWORD +write_ini Sabnzbd apikey $SABNZBD_APIKEY +write_ini Sabnzbd host "$SABNZBD_HOST:$SABNZBD_PORT" + +write_ini XBMC enabled $COUCHPOTATO_USEXBMC +write_ini XBMC host "$XBMC_HOST:$XBMC_PORT" +write_ini XBMC username $XBMC_USER +write_ini XBMC password $XBMC_PWD + +if [ "$COUCHPOTATO_FIRSTRUN" = "yes" ]; then + write_ini XBMC updateoneonly $COUCHPOTATO_UPDATEXBMC +fi + +python $ADDON_DIR/CouchPotato/CouchPotato.py -d --datadir $ADDON_HOME --config $ADDON_HOME/config.ini diff --git a/packages/addons/service/downloadmanager/CouchPotato/source/bin/ini_tool b/packages/addons/service/downloadmanager/CouchPotato/source/bin/ini_tool new file mode 100755 index 0000000000..97f7b4c433 --- /dev/null +++ b/packages/addons/service/downloadmanager/CouchPotato/source/bin/ini_tool @@ -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) \ No newline at end of file diff --git a/packages/addons/service/downloadmanager/CouchPotato/source/default.py b/packages/addons/service/downloadmanager/CouchPotato/source/default.py new file mode 100644 index 0000000000..68516442a7 --- /dev/null +++ b/packages/addons/service/downloadmanager/CouchPotato/source/default.py @@ -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("CouchPotato.service")