mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-21 00:14:02 +01:00
Merge remote-tracking branch 'cohena/synology' into develop
This commit is contained in:
@@ -578,7 +578,14 @@ m<%inherit file="base.html"/>
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<h3>Synology NAS</h3>
|
||||||
|
<div class="checkbox row">
|
||||||
|
<input type="checkbox" name="synoindex_enabled" id="synoindex" value="1" ${config['synoindex_enabled']} /><label>Enable Synoindex</label>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Musicbrainz</legend>
|
<legend>Musicbrainz</legend>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
@@ -173,6 +173,7 @@ XBMC_NOTIFY = False
|
|||||||
NMA_ENABLED = False
|
NMA_ENABLED = False
|
||||||
NMA_APIKEY = None
|
NMA_APIKEY = None
|
||||||
NMA_PRIORITY = None
|
NMA_PRIORITY = None
|
||||||
|
SYNOINDEX_ENABLED = False
|
||||||
MIRRORLIST = ["musicbrainz.org","headphones","custom"]
|
MIRRORLIST = ["musicbrainz.org","headphones","custom"]
|
||||||
MIRROR = None
|
MIRROR = None
|
||||||
CUSTOMHOST = None
|
CUSTOMHOST = None
|
||||||
@@ -242,7 +243,7 @@ def initialize():
|
|||||||
NZBSORG, NZBSORG_UID, NZBSORG_HASH, NEWZBIN, NEWZBIN_UID, NEWZBIN_PASSWORD, LASTFM_USERNAME, INTERFACE, FOLDER_PERMISSIONS, \
|
NZBSORG, NZBSORG_UID, NZBSORG_HASH, NEWZBIN, NEWZBIN_UID, NEWZBIN_PASSWORD, LASTFM_USERNAME, INTERFACE, FOLDER_PERMISSIONS, \
|
||||||
ENCODERFOLDER, ENCODER, BITRATE, SAMPLINGFREQUENCY, MUSIC_ENCODER, ADVANCEDENCODER, ENCODEROUTPUTFORMAT, ENCODERQUALITY, ENCODERVBRCBR, \
|
ENCODERFOLDER, ENCODER, BITRATE, SAMPLINGFREQUENCY, MUSIC_ENCODER, ADVANCEDENCODER, ENCODEROUTPUTFORMAT, ENCODERQUALITY, ENCODERVBRCBR, \
|
||||||
ENCODERLOSSLESS, PROWL_ENABLED, PROWL_PRIORITY, PROWL_KEYS, PROWL_ONSNATCH, MIRRORLIST, MIRROR, CUSTOMHOST, CUSTOMPORT, \
|
ENCODERLOSSLESS, PROWL_ENABLED, PROWL_PRIORITY, PROWL_KEYS, PROWL_ONSNATCH, MIRRORLIST, MIRROR, CUSTOMHOST, CUSTOMPORT, \
|
||||||
CUSTOMSLEEP, HPUSER, HPPASS, XBMC_ENABLED, XBMC_HOST, XBMC_USERNAME, XBMC_PASSWORD, XBMC_UPDATE, XBMC_NOTIFY, NMA_ENABLED, NMA_APIKEY, NMA_PRIORITY
|
CUSTOMSLEEP, HPUSER, HPPASS, XBMC_ENABLED, XBMC_HOST, XBMC_USERNAME, XBMC_PASSWORD, XBMC_UPDATE, XBMC_NOTIFY, NMA_ENABLED, NMA_APIKEY, NMA_PRIORITY, SYNOINDEX_ENABLED
|
||||||
|
|
||||||
if __INITIALIZED__:
|
if __INITIALIZED__:
|
||||||
return False
|
return False
|
||||||
@@ -258,6 +259,7 @@ def initialize():
|
|||||||
CheckSection('Prowl')
|
CheckSection('Prowl')
|
||||||
CheckSection('XBMC')
|
CheckSection('XBMC')
|
||||||
CheckSection('NMA')
|
CheckSection('NMA')
|
||||||
|
CheckSection('Synoindex')
|
||||||
|
|
||||||
# Set global variables based on config file or use defaults
|
# Set global variables based on config file or use defaults
|
||||||
CONFIG_VERSION = check_setting_str(CFG, 'General', 'config_version', '0')
|
CONFIG_VERSION = check_setting_str(CFG, 'General', 'config_version', '0')
|
||||||
@@ -633,6 +635,9 @@ def config_write():
|
|||||||
new_config['NMA']['nma_enabled'] = int(NMA_ENABLED)
|
new_config['NMA']['nma_enabled'] = int(NMA_ENABLED)
|
||||||
new_config['NMA']['nma_apikey'] = NMA_APIKEY
|
new_config['NMA']['nma_apikey'] = NMA_APIKEY
|
||||||
new_config['NMA']['nma_priority'] = NMA_PRIORITY
|
new_config['NMA']['nma_priority'] = NMA_PRIORITY
|
||||||
|
|
||||||
|
new_config['Synoindex'] = {}
|
||||||
|
new_config['Synoindex']['synoindex_enabled'] = int(SYNOINDEX_ENABLED)
|
||||||
|
|
||||||
new_config['General']['lastfm_username'] = LASTFM_USERNAME
|
new_config['General']['lastfm_username'] = LASTFM_USERNAME
|
||||||
new_config['General']['interface'] = INTERFACE
|
new_config['General']['interface'] = INTERFACE
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ import urllib2
|
|||||||
import headphones
|
import headphones
|
||||||
from httplib import HTTPSConnection
|
from httplib import HTTPSConnection
|
||||||
from urllib import urlencode
|
from urllib import urlencode
|
||||||
|
import os.path
|
||||||
|
import subprocess
|
||||||
|
|
||||||
class PROWL:
|
class PROWL:
|
||||||
|
|
||||||
@@ -186,3 +188,37 @@ class NMA:
|
|||||||
if not request:
|
if not request:
|
||||||
logger.warn('Error sending notification request to NotifyMyAndroid')
|
logger.warn('Error sending notification request to NotifyMyAndroid')
|
||||||
|
|
||||||
|
|
||||||
|
class Synoindex:
|
||||||
|
def __init__(self, util_loc='/usr/syno/bin/synoindex'):
|
||||||
|
self.util_loc = util_loc
|
||||||
|
|
||||||
|
def util_exists(self):
|
||||||
|
return os.path.exists(self.util_loc)
|
||||||
|
|
||||||
|
def notify(self, path):
|
||||||
|
if not self.util_exists():
|
||||||
|
logger.warn("Error sending notification: synoindex utility not found at %s" % self.util_loc)
|
||||||
|
return
|
||||||
|
|
||||||
|
if os.path.isfile(path):
|
||||||
|
cmd_arg = '-a'
|
||||||
|
elif os.path.isdir(path):
|
||||||
|
cmd_arg = '-A'
|
||||||
|
else:
|
||||||
|
logger.warn("Error sending notification: Path passed to synoindex was not a file or folder.")
|
||||||
|
return
|
||||||
|
|
||||||
|
cmd = [self.util_loc, cmd_arg, '\"%s\"' % os.path.abspath(path)]
|
||||||
|
logger.debug("Calling synoindex command: %s" % str(cmd))
|
||||||
|
try:
|
||||||
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=headphones.PROG_DIR)
|
||||||
|
out, error = p.communicate()
|
||||||
|
logger.debug("Synoindex result: %s" % str(out))
|
||||||
|
except OSError, e:
|
||||||
|
logger.warn("Error sending notification: %s" % str(e))
|
||||||
|
|
||||||
|
def notify_multiple(self, path_list):
|
||||||
|
if isinstance(path_list, list):
|
||||||
|
for path in path_list:
|
||||||
|
self.notify(path)
|
||||||
@@ -294,6 +294,10 @@ def doPostProcessing(albumid, albumpath, release, tracks, downloaded_track_list)
|
|||||||
if headphones.NMA_ENABLED:
|
if headphones.NMA_ENABLED:
|
||||||
nma = notifiers.NMA()
|
nma = notifiers.NMA()
|
||||||
nma.notify(release['ArtistName'], release['AlbumTitle'])
|
nma.notify(release['ArtistName'], release['AlbumTitle'])
|
||||||
|
|
||||||
|
if headphones.SYNOINDEX_ENABLED:
|
||||||
|
syno = notifiers.Synoindex()
|
||||||
|
syno.notify(albumpath)
|
||||||
|
|
||||||
def embedAlbumArt(artwork, downloaded_track_list):
|
def embedAlbumArt(artwork, downloaded_track_list):
|
||||||
logger.info('Embedding album art')
|
logger.info('Embedding album art')
|
||||||
|
|||||||
@@ -441,6 +441,7 @@ class WebInterface(object):
|
|||||||
"nma_enabled": checked(headphones.NMA_ENABLED),
|
"nma_enabled": checked(headphones.NMA_ENABLED),
|
||||||
"nma_apikey": headphones.NMA_APIKEY,
|
"nma_apikey": headphones.NMA_APIKEY,
|
||||||
"nma_priority": int(headphones.NMA_PRIORITY),
|
"nma_priority": int(headphones.NMA_PRIORITY),
|
||||||
|
"synoindex_enabled": checked(headphones.SYNOINDEX_ENABLED),
|
||||||
"mirror_list": headphones.MIRRORLIST,
|
"mirror_list": headphones.MIRRORLIST,
|
||||||
"mirror": headphones.MIRROR,
|
"mirror": headphones.MIRROR,
|
||||||
"customhost": headphones.CUSTOMHOST,
|
"customhost": headphones.CUSTOMHOST,
|
||||||
@@ -461,7 +462,7 @@ class WebInterface(object):
|
|||||||
rename_files=0, correct_metadata=0, cleanup_files=0, add_album_art=0, embed_album_art=0, embed_lyrics=0, destination_dir=None, folder_format=None, file_format=None, include_extras=0, autowant_upcoming=False, autowant_all=False, interface=None, log_dir=None,
|
rename_files=0, correct_metadata=0, cleanup_files=0, add_album_art=0, embed_album_art=0, embed_lyrics=0, destination_dir=None, folder_format=None, file_format=None, include_extras=0, autowant_upcoming=False, autowant_all=False, interface=None, log_dir=None,
|
||||||
music_encoder=0, encoder=None, bitrate=None, samplingfrequency=None, encoderfolder=None, advancedencoder=None, encoderoutputformat=None, encodervbrcbr=None, encoderquality=None, encoderlossless=0,
|
music_encoder=0, encoder=None, bitrate=None, samplingfrequency=None, encoderfolder=None, advancedencoder=None, encoderoutputformat=None, encodervbrcbr=None, encoderquality=None, encoderlossless=0,
|
||||||
prowl_enabled=0, prowl_onsnatch=0, prowl_keys=None, prowl_priority=0, xbmc_enabled=0, xbmc_host=None, xbmc_username=None, xbmc_password=None, xbmc_update=0, xbmc_notify=0,
|
prowl_enabled=0, prowl_onsnatch=0, prowl_keys=None, prowl_priority=0, xbmc_enabled=0, xbmc_host=None, xbmc_username=None, xbmc_password=None, xbmc_update=0, xbmc_notify=0,
|
||||||
nma_enabled=False, nma_apikey=None, nma_priority=0, mirror=None, customhost=None, customport=None, customsleep=None, hpuser=None, hppass=None):
|
nma_enabled=False, nma_apikey=None, nma_priority=0, synoindex_enabled=False, mirror=None, customhost=None, customport=None, customsleep=None, hpuser=None, hppass=None):
|
||||||
|
|
||||||
headphones.HTTP_HOST = http_host
|
headphones.HTTP_HOST = http_host
|
||||||
headphones.HTTP_PORT = http_port
|
headphones.HTTP_PORT = http_port
|
||||||
@@ -544,6 +545,7 @@ class WebInterface(object):
|
|||||||
headphones.NMA_ENABLED = nma_enabled
|
headphones.NMA_ENABLED = nma_enabled
|
||||||
headphones.NMA_APIKEY = nma_apikey
|
headphones.NMA_APIKEY = nma_apikey
|
||||||
headphones.NMA_PRIORITY = nma_priority
|
headphones.NMA_PRIORITY = nma_priority
|
||||||
|
headphones.SYNOINDEX_ENABLED = synoindex_enabled
|
||||||
headphones.MIRROR = mirror
|
headphones.MIRROR = mirror
|
||||||
headphones.CUSTOMHOST = customhost
|
headphones.CUSTOMHOST = customhost
|
||||||
headphones.CUSTOMPORT = customport
|
headphones.CUSTOMPORT = customport
|
||||||
|
|||||||
Reference in New Issue
Block a user