mirror of
https://github.com/rembo10/headphones.git
synced 2026-05-16 00:25:31 +01:00
Merge remote-tracking branch 'michelwilson/master' into develop
This commit is contained in:
@@ -225,6 +225,8 @@ HPPASS = None
|
||||
|
||||
CACHE_SIZEMB = 32
|
||||
|
||||
UMASK = None
|
||||
|
||||
def CheckSection(sec):
|
||||
""" Check if INI section exists, if not create it """
|
||||
try:
|
||||
@@ -291,7 +293,8 @@ def initialize():
|
||||
PROWL_ENABLED, PROWL_PRIORITY, PROWL_KEYS, PROWL_ONSNATCH, PUSHOVER_ENABLED, PUSHOVER_PRIORITY, PUSHOVER_KEYS, PUSHOVER_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, NMA_ONSNATCH, SYNOINDEX_ENABLED, ALBUM_COMPLETION_PCT, PREFERRED_BITRATE_HIGH_BUFFER, \
|
||||
PREFERRED_BITRATE_LOW_BUFFER, PREFERRED_BITRATE_ALLOW_LOSSLESS, CACHE_SIZEMB
|
||||
PREFERRED_BITRATE_LOW_BUFFER, PREFERRED_BITRATE_ALLOW_LOSSLESS, CACHE_SIZEMB, \
|
||||
UMASK
|
||||
|
||||
if __INITIALIZED__:
|
||||
return False
|
||||
@@ -584,6 +587,10 @@ def initialize():
|
||||
else:
|
||||
LATEST_VERSION = CURRENT_VERSION
|
||||
|
||||
# Store the original umask
|
||||
UMASK = os.umask(0)
|
||||
os.umask(UMASK)
|
||||
|
||||
__INITIALIZED__ = True
|
||||
return True
|
||||
|
||||
|
||||
@@ -448,9 +448,11 @@ def addAlbumArt(artwork, albumpath, release):
|
||||
if album_art_name.startswith('.'):
|
||||
album_art_name = album_art_name.replace(0, '_')
|
||||
|
||||
prev = os.umask(headphones.UMASK)
|
||||
file = open(os.path.join(albumpath, album_art_name), 'wb')
|
||||
file.write(artwork)
|
||||
file.close()
|
||||
os.umask(prev)
|
||||
|
||||
def cleanupFiles(albumpath):
|
||||
logger.info('Cleaning up files')
|
||||
|
||||
@@ -553,9 +553,11 @@ def searchNZB(albumid=None, new=False, losslessOnly=False):
|
||||
nzb_name = nzb_folder_name + '.nzb'
|
||||
download_path = os.path.join(headphones.BLACKHOLE_DIR, nzb_name)
|
||||
try:
|
||||
prev = os.umask(headphones.UMASK)
|
||||
f = open(download_path, 'w')
|
||||
f.write(data)
|
||||
f.close()
|
||||
os.umask(prev)
|
||||
logger.info('File saved to: %s' % nzb_name)
|
||||
except Exception, e:
|
||||
logger.error('Couldn\'t write NZB file: %s' % e)
|
||||
@@ -1239,9 +1241,11 @@ def searchTorrent(albumid=None, new=False, losslessOnly=False):
|
||||
break
|
||||
else:
|
||||
#Write the torrent file to a path derived from the TORRENTBLACKHOLE_DIR and file name.
|
||||
prev = os.umask(headphones.UMASK)
|
||||
torrent_file = open(download_path, 'wb')
|
||||
torrent_file.write(data)
|
||||
torrent_file.close()
|
||||
os.umask(prev)
|
||||
|
||||
#Open the fresh torrent file again so we can extract the proper torrent name
|
||||
#Used later in post-processing.
|
||||
|
||||
Reference in New Issue
Block a user