From bc23c6920f9ed3610f28f47bfcb62d021ae494ec Mon Sep 17 00:00:00 2001 From: RudolfRendier Date: Thu, 18 Aug 2011 10:32:54 +0200 Subject: [PATCH] Another attempt to integrate headphones into the SABnzbd-suite --- packages/3rdparty/download/Headphones/meta | 38 +++++++++++++++ .../downloadmanager/SABnzbd-Suite/addon | 3 ++ .../downloadmanager/SABnzbd-Suite/meta | 6 +-- .../source/bin/SABnzbd-Suite.service | 48 +++++++++++++++++++ tools/mkpkg/mkpkg_headphones | 43 +++++++++++++++++ 5 files changed, 135 insertions(+), 3 deletions(-) create mode 100644 packages/3rdparty/download/Headphones/meta create mode 100755 tools/mkpkg/mkpkg_headphones diff --git a/packages/3rdparty/download/Headphones/meta b/packages/3rdparty/download/Headphones/meta new file mode 100644 index 0000000000..361330c3e3 --- /dev/null +++ b/packages/3rdparty/download/Headphones/meta @@ -0,0 +1,38 @@ +################################################################################ +# 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="Headphones" +PKG_VERSION="b9dc074" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="OSS" +PKG_SITE="http://github.com/rembo10/headphones" +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="Headphones: Automatic music downloader for SABnzbd." +PKG_LONGDESC="Headphones: This a pretty early release of a third-party add-on for SABnzbd." + +PKG_IS_ADDON="no" + +PKG_AUTORECONF="no" diff --git a/packages/addons/service/downloadmanager/SABnzbd-Suite/addon b/packages/addons/service/downloadmanager/SABnzbd-Suite/addon index 130b18661e..9e3d829f0a 100755 --- a/packages/addons/service/downloadmanager/SABnzbd-Suite/addon +++ b/packages/addons/service/downloadmanager/SABnzbd-Suite/addon @@ -43,3 +43,6 @@ 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/Headphones + cp -PR $BUILD/Headphones-*/* $ADDON_BUILD/$PKG_ADDON_ID/Headphones diff --git a/packages/addons/service/downloadmanager/SABnzbd-Suite/meta b/packages/addons/service/downloadmanager/SABnzbd-Suite/meta index fece62edaa..127b3a546b 100644 --- a/packages/addons/service/downloadmanager/SABnzbd-Suite/meta +++ b/packages/addons/service/downloadmanager/SABnzbd-Suite/meta @@ -20,16 +20,16 @@ PKG_NAME="SABnzbd-Suite" PKG_VERSION="0.99" -PKG_REV="2" +PKG_REV="3" 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_BUILD_DEPENDS="toolchain Python SABnzbd SickBeard CouchPotato Headphones" PKG_PRIORITY="optional" PKG_SECTION="service/downloadmanager" -PKG_SHORTDESC="SABnzbd-Suite is a Metapackage which combines SABnzbd, SickBeard and Couchpotato in one Addon" +PKG_SHORTDESC="SABnzbd-Suite is a Metapackage which combines SABnzbd, SickBeard, Couchpotato and Headphones 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" diff --git a/packages/addons/service/downloadmanager/SABnzbd-Suite/source/bin/SABnzbd-Suite.service b/packages/addons/service/downloadmanager/SABnzbd-Suite/source/bin/SABnzbd-Suite.service index b42eee7418..2619e28bbe 100755 --- a/packages/addons/service/downloadmanager/SABnzbd-Suite/source/bin/SABnzbd-Suite.service +++ b/packages/addons/service/downloadmanager/SABnzbd-Suite/source/bin/SABnzbd-Suite.service @@ -28,6 +28,7 @@ SABNZBD_SETTINGS="$ADDON_HOME/sabnzbd.ini" SICKBEARD_SETTINGS="$ADDON_HOME/config.ini" COUCHPOTATO_SETTINGS="$ADDON_HOME/couchpotato.ini" + HEADPHONES_SETTINGS="$ADDON_HOME/headphones.ini" XBMC_SETTINGS="$HOME/.xbmc/userdata/guisettings.xml" export PYTHONPATH="$PYTHONPATH:$ADDON_DIR/pylib" @@ -82,6 +83,18 @@ COUCHPOTATO_PORT="8083" COUCHPOTATO_USEXBMC="True" COUCHPOTATO_UPDATEXBMC="True" + +################################################################################ +# default headphones values +################################################################################ + + HEADPHONES_PORT="8084" + HEADPHONES_LAUNCHBROWSER="0" + HEADPHONES_MUSICDIR="/storage/music" + HEADPHONES_DESTDIR="/storage/music" + HEADPHONES_DOWNLOADDIR="/storage/music" + HEADPHONES_SABHOST="$SABNZBD_HOST:$SABNZBD_PORT" + HEADPHONES_SABCATEGORY="music" ################################################################################ # setup functions @@ -108,6 +121,13 @@ python $ADDON_DIR/bin/ini_tool --action=write \ --value="$3" } +write_headphones_ini() { +python $ADDON_DIR/bin/ini_tool --action=write \ + --file=$HEADPHONES_SETTINGS \ + --option="$1:$2" \ + --value="$3" +} + read_sabconfig() { python $ADDON_DIR/bin/ini_tool --action=read \ --file=$SABNZBD_SETTINGS \ @@ -152,6 +172,7 @@ python $ADDON_DIR/bin/ini_tool --action=write \ 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" + HEADPHONES_IP="$SABNZBD_IP" ################################################################################ # setup sabnzbd ini file @@ -297,3 +318,30 @@ python $ADDON_DIR/bin/ini_tool --action=write \ # start couchpotato ################################################################################ python $ADDON_DIR/CouchPotato/CouchPotato.py -d --datadir $ADDON_HOME --config $COUCHPOTATO_SETTINGS + +################################################################################ +# setup headphones ini file +################################################################################ + + if [ -z "$HEADPHONES_IP" ]; then + HEADPHONES_IP="0.0.0.0" + fi + + if [ "$HEADPHONES_FIRSTRUN" = "yes" ]; then + write_headphones_ini General http_port $HEADPHONES_PORT + write_headphones_ini General http_host $HEADPHONES_IP + write_headphones_ini General launch_browser $HEADPHONES_LAUNCHBROWSER + write_headphones_ini General music_dir $HEADPHONES_MUSICDIR + write_headphones_ini General destination_dir $HEADPHONES_DESTDIR + write_headphones_ini General download_dir $HEADPHONES_DOWNLOADDIR + + write_headphones_ini SABnzbd sab_host $HEADPHONES_SABHOST + write_headphones_ini SABnzbd sab_apikey $SABNZBD_APIKEY + write_headphones_ini SABnzbd sab_category $HEADPHONES_SABCATEGORY + fi + + +################################################################################ +# start headphones +################################################################################ + python $ADDON_DIR/Headphones/Headphones.py -d --datadir $ADDON_HOME--config $HEADPHONES_SETTINGS diff --git a/tools/mkpkg/mkpkg_headphones b/tools/mkpkg/mkpkg_headphones new file mode 100755 index 0000000000..9cea4396ff --- /dev/null +++ b/tools/mkpkg/mkpkg_headphones @@ -0,0 +1,43 @@ +#!/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 +################################################################################ + +echo "getting sources..." + if [ ! -d Headphones.git ]; then + git clone git://github.com/rembo10/headphones.gitt Headphones.git + fi + + cd Headphones.git + git pull + GIT_REV=`git log -n1 --format=%h` + cd .. + +echo "copying sources..." + rm -rf Headphones-$GIT_REV + cp -R Headphones.git Headphones-$GIT_REV + +echo "cleaning sources..." + rm -rf Headphones-$GIT_REV/.git + +echo "packing sources..." + tar cvJf Headphones-$GIT_REV.tar.xz Headphones-$GIT_REV + +echo "remove temporary sourcedir..." + rm -rf Headphones-$GIT_REV