mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
SABnzbd-Suite: update addon version, remove trailing whitespaces
Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
parent
7696d7c099
commit
4fb33be0f7
@ -1,3 +1,6 @@
|
|||||||
|
2.1.2
|
||||||
|
- improve startup script
|
||||||
|
|
||||||
2.1.1
|
2.1.1
|
||||||
- update to addon version 2.1
|
- update to addon version 2.1
|
||||||
- update to SABnzbd-0.6.15
|
- update to SABnzbd-0.6.15
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
PKG_NAME="SABnzbd-Suite"
|
PKG_NAME="SABnzbd-Suite"
|
||||||
PKG_VERSION="2.1"
|
PKG_VERSION="2.1"
|
||||||
PKG_REV="1"
|
PKG_REV="2"
|
||||||
PKG_ARCH="any"
|
PKG_ARCH="any"
|
||||||
PKG_LICENSE="OSS"
|
PKG_LICENSE="OSS"
|
||||||
PKG_SITE="http://www.openelec.tv"
|
PKG_SITE="http://www.openelec.tv"
|
||||||
|
@ -1,23 +1,22 @@
|
|||||||
################################################################################
|
|
||||||
# This file is part of OpenELEC - http://www.openelec.tv
|
|
||||||
# Copyright (C) 2012 Lukas Heiniger
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
# This file is part of OpenELEC - http://www.openelec.tv
|
||||||
|
# Copyright (C) 2012 Lukas Heiniger
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
################################################################################
|
||||||
|
|
||||||
# Initializes and launches SABnzbd, Couchpotato, Sickbeard and Headphones
|
# Initializes and launches SABnzbd, Couchpotato, Sickbeard and Headphones
|
||||||
|
|
||||||
@ -33,24 +32,21 @@ import logging
|
|||||||
|
|
||||||
logging.basicConfig(filename='/var/log/sabnzbd-suite.log',
|
logging.basicConfig(filename='/var/log/sabnzbd-suite.log',
|
||||||
filemode='w',
|
filemode='w',
|
||||||
format='%(asctime)s SABnzbd-Suite: %(message)s',
|
format='%(asctime)s SABnzbd-Suite: %(message)s',
|
||||||
level=logging.WARNING)
|
level=logging.WARNING)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# helper functions
|
# helper functions
|
||||||
# ----------------
|
# ----------------
|
||||||
|
|
||||||
def createDir(dir):
|
def createDir(dir):
|
||||||
if not os.path.isdir(dir):
|
if not os.path.isdir(dir):
|
||||||
os.makedirs(dir)
|
os.makedirs(dir)
|
||||||
|
|
||||||
def getAddonSetting(doc,id):
|
def getAddonSetting(doc,id):
|
||||||
for element in doc.getElementsByTagName('setting'):
|
for element in doc.getElementsByTagName('setting'):
|
||||||
if element.getAttribute('id')==id:
|
if element.getAttribute('id')==id:
|
||||||
return element.getAttribute('value')
|
return element.getAttribute('value')
|
||||||
|
|
||||||
def loadWebInterface(url,user,pwd):
|
def loadWebInterface(url,user,pwd):
|
||||||
passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
|
passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
|
||||||
passman.add_password(None, url, user, pwd)
|
passman.add_password(None, url, user, pwd)
|
||||||
@ -59,9 +55,6 @@ def loadWebInterface(url,user,pwd):
|
|||||||
urllib2.install_opener(opener)
|
urllib2.install_opener(opener)
|
||||||
pagehandle = urllib2.urlopen(url)
|
pagehandle = urllib2.urlopen(url)
|
||||||
return pagehandle.read()
|
return pagehandle.read()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# define some things that we're gonna need, mainly paths
|
# define some things that we're gonna need, mainly paths
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
@ -87,27 +80,23 @@ pSabNzbdIncomplete = '/storage/downloads/incomplete'
|
|||||||
pSickBeardTvScripts = os.path.join(pAddon, 'SickBeard/autoProcessTV')
|
pSickBeardTvScripts = os.path.join(pAddon, 'SickBeard/autoProcessTV')
|
||||||
pSabNzbdScripts = os.path.join(pAddonHome, 'scripts')
|
pSabNzbdScripts = os.path.join(pAddonHome, 'scripts')
|
||||||
|
|
||||||
|
|
||||||
# pylib
|
# pylib
|
||||||
pPylib = os.path.join(pAddon, 'pylib')
|
pPylib = os.path.join(pAddon, 'pylib')
|
||||||
|
|
||||||
# service commands
|
# service commands
|
||||||
sabnzbd = ['python', os.path.join(pAddon, 'SABnzbd/SABnzbd.py'),
|
sabnzbd = ['python', os.path.join(pAddon, 'SABnzbd/SABnzbd.py'),
|
||||||
'-d', '-f', pSabNzbdSettings, '-l 0']
|
'-d', '-f', pSabNzbdSettings, '-l 0']
|
||||||
sickBeard = ['python', os.path.join(pAddon, 'SickBeard/SickBeard.py'),
|
sickBeard = ['python', os.path.join(pAddon, 'SickBeard/SickBeard.py'),
|
||||||
'--daemon', '--datadir', pAddonHome]
|
'--daemon', '--datadir', pAddonHome]
|
||||||
couchPotato = ['python', os.path.join(pAddon, 'CouchPotato/CouchPotato.py'),
|
couchPotato = ['python', os.path.join(pAddon, 'CouchPotato/CouchPotato.py'),
|
||||||
'-d', '--datadir', pAddonHome, '--config', pCouchPotatoSettings]
|
'-d', '--datadir', pAddonHome, '--config', pCouchPotatoSettings]
|
||||||
headphones = ['python', os.path.join(pAddon, 'Headphones/Headphones.py'),
|
headphones = ['python', os.path.join(pAddon, 'Headphones/Headphones.py'),
|
||||||
'-d', '--datadir', pAddonHome, '--config', pHeadphonesSettings]
|
'-d', '--datadir', pAddonHome, '--config', pHeadphonesSettings]
|
||||||
|
|
||||||
# Other stuff
|
# Other stuff
|
||||||
sabNzbdHost = '127.0.0.1:8081'
|
sabNzbdHost = '127.0.0.1:8081'
|
||||||
addonId = 'service.downloadmanager.SABnzbd-Suite'
|
addonId = 'service.downloadmanager.SABnzbd-Suite'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# create directories and settings on first launch
|
# create directories and settings on first launch
|
||||||
# -----------------------------------------------
|
# -----------------------------------------------
|
||||||
|
|
||||||
@ -130,9 +119,6 @@ if firstLaunch:
|
|||||||
for utility in {'par2','unrar','unzip'}:
|
for utility in {'par2','unrar','unzip'}:
|
||||||
os.chmod(os.path.join(pAddon, 'bin', utility), 0755)
|
os.chmod(os.path.join(pAddon, 'bin', utility), 0755)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# read addon and xbmc settings
|
# read addon and xbmc settings
|
||||||
# ----------------------------
|
# ----------------------------
|
||||||
|
|
||||||
@ -162,17 +148,12 @@ try:
|
|||||||
except:
|
except:
|
||||||
xbmcPwd = ''
|
xbmcPwd = ''
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# prepare execution environment
|
# prepare execution environment
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
|
|
||||||
signal.signal(signal.SIGCHLD, signal.SIG_DFL)
|
signal.signal(signal.SIGCHLD, signal.SIG_DFL)
|
||||||
os.environ['PYTHONPATH'] = str(os.environ.get('PYTHONPATH')) + ':' + pPylib
|
os.environ['PYTHONPATH'] = str(os.environ.get('PYTHONPATH')) + ':' + pPylib
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# write SABnzbd settings
|
# write SABnzbd settings
|
||||||
# ----------------------
|
# ----------------------
|
||||||
|
|
||||||
@ -207,7 +188,7 @@ if firstLaunch:
|
|||||||
servers['localhost']['port'] = '119'
|
servers['localhost']['port'] = '119'
|
||||||
servers['localhost']['enable'] = '0'
|
servers['localhost']['enable'] = '0'
|
||||||
categories = {}
|
categories = {}
|
||||||
categories['tv'] = {}
|
categories['tv'] = {}
|
||||||
categories['tv']['name'] = 'tv'
|
categories['tv']['name'] = 'tv'
|
||||||
categories['tv']['script'] = 'sabToSickBeard.py'
|
categories['tv']['script'] = 'sabToSickBeard.py'
|
||||||
categories['tv']['priority'] = '-100'
|
categories['tv']['priority'] = '-100'
|
||||||
@ -221,7 +202,7 @@ if firstLaunch:
|
|||||||
categories['music']['priority'] = '-100'
|
categories['music']['priority'] = '-100'
|
||||||
defaultConfig['servers'] = servers
|
defaultConfig['servers'] = servers
|
||||||
defaultConfig['categories'] = categories
|
defaultConfig['categories'] = categories
|
||||||
|
|
||||||
sabNzbdConfig.merge(defaultConfig)
|
sabNzbdConfig.merge(defaultConfig)
|
||||||
sabNzbdConfig.write()
|
sabNzbdConfig.write()
|
||||||
|
|
||||||
@ -236,9 +217,6 @@ defaultConfig['SickBeard']['password'] = pwd
|
|||||||
autoProcessConfig.merge(defaultConfig)
|
autoProcessConfig.merge(defaultConfig)
|
||||||
autoProcessConfig.write()
|
autoProcessConfig.write()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# launch SABnzbd and get the API key
|
# launch SABnzbd and get the API key
|
||||||
# ----------------------------------
|
# ----------------------------------
|
||||||
|
|
||||||
@ -253,9 +231,6 @@ sabNzbdConfig.reload()
|
|||||||
sabNzbdApiKey = sabNzbdConfig['misc']['api_key']
|
sabNzbdApiKey = sabNzbdConfig['misc']['api_key']
|
||||||
logging.debug('SABnzbd api key: ' + sabNzbdApiKey)
|
logging.debug('SABnzbd api key: ' + sabNzbdApiKey)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# write SickBeard settings
|
# write SickBeard settings
|
||||||
# ------------------------
|
# ------------------------
|
||||||
|
|
||||||
@ -297,22 +272,16 @@ if firstLaunch:
|
|||||||
defaultConfig['SABnzbd']['sab_host'] = sabNzbdHost
|
defaultConfig['SABnzbd']['sab_host'] = sabNzbdHost
|
||||||
defaultConfig['XBMC']['xbmc_notify_ondownload'] = '1'
|
defaultConfig['XBMC']['xbmc_notify_ondownload'] = '1'
|
||||||
defaultConfig['XBMC']['xbmc_update_library'] = '1'
|
defaultConfig['XBMC']['xbmc_update_library'] = '1'
|
||||||
|
|
||||||
sickBeardConfig.merge(defaultConfig)
|
sickBeardConfig.merge(defaultConfig)
|
||||||
sickBeardConfig.write()
|
sickBeardConfig.write()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# launch SickBeard
|
# launch SickBeard
|
||||||
# ----------------
|
# ----------------
|
||||||
logging.debug('Launching SickBeard...')
|
logging.debug('Launching SickBeard...')
|
||||||
subprocess.call(sickBeard)
|
subprocess.call(sickBeard)
|
||||||
logging.debug('...done')
|
logging.debug('...done')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# write CouchPotato settings
|
# write CouchPotato settings
|
||||||
# --------------------------
|
# --------------------------
|
||||||
|
|
||||||
@ -345,13 +314,10 @@ if firstLaunch:
|
|||||||
defaultConfig['Renamer']['destination'] = '/storage/videos'
|
defaultConfig['Renamer']['destination'] = '/storage/videos'
|
||||||
defaultConfig['Renamer']['separator'] = '.'
|
defaultConfig['Renamer']['separator'] = '.'
|
||||||
defaultConfig['Renamer']['cleanup'] = 'True'
|
defaultConfig['Renamer']['cleanup'] = 'True'
|
||||||
|
|
||||||
couchPotatoConfig.merge(defaultConfig)
|
couchPotatoConfig.merge(defaultConfig)
|
||||||
couchPotatoConfig.write()
|
couchPotatoConfig.write()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# launch CouchPotato
|
# launch CouchPotato
|
||||||
# ------------------
|
# ------------------
|
||||||
|
|
||||||
@ -359,9 +325,6 @@ logging.debug('Launching CouchPotato...')
|
|||||||
subprocess.call(couchPotato)
|
subprocess.call(couchPotato)
|
||||||
logging.debug('...done')
|
logging.debug('...done')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# write Headphones settings
|
# write Headphones settings
|
||||||
# -------------------------
|
# -------------------------
|
||||||
|
|
||||||
@ -383,16 +346,13 @@ if firstLaunch:
|
|||||||
defaultConfig['SABnzbd']['sab_category'] = 'music'
|
defaultConfig['SABnzbd']['sab_category'] = 'music'
|
||||||
defaultConfig['General']['music_dir'] = '/storage/music'
|
defaultConfig['General']['music_dir'] = '/storage/music'
|
||||||
defaultConfig['General']['destination_dir'] = '/storage/music'
|
defaultConfig['General']['destination_dir'] = '/storage/music'
|
||||||
defaultConfig['General']['download_dir'] = '/storage/downloads/music'
|
defaultConfig['General']['download_dir'] = '/storage/downloads/music'
|
||||||
defaultConfig['General']['move_files'] = '1'
|
defaultConfig['General']['move_files'] = '1'
|
||||||
defaultConfig['General']['rename_files'] = '1'
|
defaultConfig['General']['rename_files'] = '1'
|
||||||
|
|
||||||
headphonesConfig.merge(defaultConfig)
|
headphonesConfig.merge(defaultConfig)
|
||||||
headphonesConfig.write()
|
headphonesConfig.write()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# launch Headphones
|
# launch Headphones
|
||||||
# -----------------
|
# -----------------
|
||||||
|
|
||||||
|
@ -60,10 +60,10 @@ if shouldKeepAwake:
|
|||||||
xbmc.log('SABnzbd-Suite: will prevent idle sleep/shutdown while downloading')
|
xbmc.log('SABnzbd-Suite: will prevent idle sleep/shutdown while downloading')
|
||||||
|
|
||||||
while (not xbmc.abortRequested):
|
while (not xbmc.abortRequested):
|
||||||
|
|
||||||
# reread setting in case it has changed
|
# reread setting in case it has changed
|
||||||
shouldKeepAwake = __settings__.getSetting('SABNZBD_KEEP_AWAKE')
|
shouldKeepAwake = __settings__.getSetting('SABNZBD_KEEP_AWAKE')
|
||||||
|
|
||||||
# check if SABnzbd is downloading
|
# check if SABnzbd is downloading
|
||||||
sabIsActive = False
|
sabIsActive = False
|
||||||
req = urllib2.Request(sabNzbdQueue)
|
req = urllib2.Request(sabNzbdQueue)
|
||||||
@ -74,16 +74,16 @@ while (not xbmc.abortRequested):
|
|||||||
queue = handle.read()
|
queue = handle.read()
|
||||||
handle.close()
|
handle.close()
|
||||||
sabIsActive = (queue.find('<status>Downloading</status>') >= 0)
|
sabIsActive = (queue.find('<status>Downloading</status>') >= 0)
|
||||||
|
|
||||||
# reset idle timer when we're close to idle sleep/shutdown
|
# reset idle timer when we're close to idle sleep/shutdown
|
||||||
if (shouldKeepAwake and sabIsActive):
|
if (shouldKeepAwake and sabIsActive):
|
||||||
response = xbmc.executehttpapi("GetGUISetting(0;powermanagement.shutdowntime)").replace('<li>','')
|
response = xbmc.executehttpapi("GetGUISetting(0;powermanagement.shutdowntime)").replace('<li>','')
|
||||||
shutdownTime = int(response) * 60
|
shutdownTime = int(response) * 60
|
||||||
idleTime = xbmc.getGlobalIdleTime()
|
idleTime = xbmc.getGlobalIdleTime()
|
||||||
timeToShutdown = shutdownTime - idleTime
|
timeToShutdown = shutdownTime - idleTime
|
||||||
|
|
||||||
if (sabIsActive and timeToShutdown <= checkInterval - timeout):
|
if (sabIsActive and timeToShutdown <= checkInterval - timeout):
|
||||||
xbmc.log('SABnzbd-Suite: still downloading. Resetting XBMC idle timer.')
|
xbmc.log('SABnzbd-Suite: still downloading. Resetting XBMC idle timer.')
|
||||||
xbmc.executehttpapi("SendKey(0xF000)")
|
xbmc.executehttpapi("SendKey(0xF000)")
|
||||||
|
|
||||||
xbmc.sleep(checkInterval * 1000)
|
xbmc.sleep(checkInterval * 1000)
|
Loading…
x
Reference in New Issue
Block a user