From bc23c6920f9ed3610f28f47bfcb62d021ae494ec Mon Sep 17 00:00:00 2001 From: RudolfRendier Date: Thu, 18 Aug 2011 10:32:54 +0200 Subject: [PATCH 1/6] 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 From fbd0def457ea60c125dd11f79abd8eed92fbbb56 Mon Sep 17 00:00:00 2001 From: RudolfRendier Date: Thu, 18 Aug 2011 10:53:36 +0200 Subject: [PATCH 2/6] Fixed typo in git repository url --- tools/mkpkg/mkpkg_headphones | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mkpkg/mkpkg_headphones b/tools/mkpkg/mkpkg_headphones index 9cea4396ff..3e54d3410c 100755 --- a/tools/mkpkg/mkpkg_headphones +++ b/tools/mkpkg/mkpkg_headphones @@ -21,7 +21,7 @@ echo "getting sources..." if [ ! -d Headphones.git ]; then - git clone git://github.com/rembo10/headphones.gitt Headphones.git + git clone git://github.com/rembo10/headphones.git Headphones.git fi cd Headphones.git From a7e6cc93f357927f2be7590f6748e3a275e4139a Mon Sep 17 00:00:00 2001 From: RudolfRendier Date: Thu, 18 Aug 2011 16:29:35 +0200 Subject: [PATCH 3/6] Fixed missing space in commandline arguments for Headphones --- .../SABnzbd-Suite/source/bin/SABnzbd-Suite.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 2619e28bbe..a7c017a89b 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 @@ -344,4 +344,4 @@ python $ADDON_DIR/bin/ini_tool --action=write \ ################################################################################ # start headphones ################################################################################ - python $ADDON_DIR/Headphones/Headphones.py -d --datadir $ADDON_HOME--config $HEADPHONES_SETTINGS + python $ADDON_DIR/Headphones/Headphones.py -d --datadir $ADDON_HOME --config $HEADPHONES_SETTINGS From 2f7af5df540671462bb71251ca5edea95d4bca43 Mon Sep 17 00:00:00 2001 From: RudolfRendier Date: Thu, 18 Aug 2011 16:32:37 +0200 Subject: [PATCH 4/6] Build Headphones package from httpsource on localhost --- packages/3rdparty/download/Headphones/meta | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/3rdparty/download/Headphones/meta b/packages/3rdparty/download/Headphones/meta index 361330c3e3..e041ff7a18 100644 --- a/packages/3rdparty/download/Headphones/meta +++ b/packages/3rdparty/download/Headphones/meta @@ -25,7 +25,8 @@ 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_URL="$DISTRO_SRC/$PKG_NAME-$PKG_VERSION.tar.xz" +PKG_URL="http://localhost/Headphones-b9dc074.tar.xz" PKG_DEPENDS="Python SABnzbd" PKG_BUILD_DEPENDS="toolchain Python" PKG_PRIORITY="optional" From ec8521b2bd35e833b1dbb9acf68b693d509ee151 Mon Sep 17 00:00:00 2001 From: RudolfRendier Date: Thu, 18 Aug 2011 16:33:39 +0200 Subject: [PATCH 5/6] Build the SABnzbd-Suite as 99.x --- packages/addons/service/downloadmanager/SABnzbd-Suite/meta | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/addons/service/downloadmanager/SABnzbd-Suite/meta b/packages/addons/service/downloadmanager/SABnzbd-Suite/meta index 127b3a546b..b11c077685 100644 --- a/packages/addons/service/downloadmanager/SABnzbd-Suite/meta +++ b/packages/addons/service/downloadmanager/SABnzbd-Suite/meta @@ -20,7 +20,7 @@ PKG_NAME="SABnzbd-Suite" PKG_VERSION="0.99" -PKG_REV="3" +PKG_REV="x" PKG_ARCH="any" PKG_LICENSE="OSS" PKG_SITE="http://www.openelec.tv" From 4c9c4c6de43e5bb40f3af312131698e0ceb31970 Mon Sep 17 00:00:00 2001 From: RudolfRendier Date: Thu, 18 Aug 2011 21:37:19 +0200 Subject: [PATCH 6/6] Set HEADPHONES_FIRSTRUN to true if config is not found, to trigger it's creation --- .../SABnzbd-Suite/source/bin/SABnzbd-Suite.service | 4 ++++ 1 file changed, 4 insertions(+) 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 a7c017a89b..115c1e2cee 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 @@ -326,6 +326,10 @@ python $ADDON_DIR/bin/ini_tool --action=write \ if [ -z "$HEADPHONES_IP" ]; then HEADPHONES_IP="0.0.0.0" fi + + if [ ! -f "$HEADPHONES_SETTINGS" ]; then + HEADPHONES_FIRSTRUN="yes" + fi if [ "$HEADPHONES_FIRSTRUN" = "yes" ]; then write_headphones_ini General http_port $HEADPHONES_PORT