mirror of
https://github.com/rembo10/headphones.git
synced 2026-05-16 00:25:31 +01:00
Merge remote-tracking branch 'satreix/pep-e502' into develop
This commit is contained in:
3
.pep8
3
.pep8
@@ -10,6 +10,5 @@
|
||||
# E262 inline comment should start with '# '
|
||||
# E265 block comment should start with '# '
|
||||
# E501 line too long (312 > 160 characters)
|
||||
# E502 the backslash is redundant between brackets
|
||||
ignore = E121,E122,E123,E124,E125,E126,E127,E128,E261,E262,E265,E501,E502
|
||||
ignore = E121,E122,E123,E124,E125,E126,E127,E128,E261,E262,E265,E501
|
||||
max-line-length = 160
|
||||
|
||||
@@ -132,7 +132,7 @@ def initialize(config_file):
|
||||
CONFIG.LOG_DIR = None
|
||||
|
||||
if not QUIET:
|
||||
sys.stderr.write("Unable to create the log directory. " \
|
||||
sys.stderr.write("Unable to create the log directory. "
|
||||
"Logging to screen only.\n")
|
||||
|
||||
# Start the logger, disable console if needed
|
||||
|
||||
@@ -538,8 +538,8 @@ def preserve_torrent_directory(albumpath):
|
||||
shutil.copytree(albumpath, new_folder)
|
||||
return new_folder
|
||||
except Exception as e:
|
||||
logger.warn("Cannot copy/move files to temp folder: " + \
|
||||
new_folder.decode(headphones.SYS_ENCODING, 'replace') + \
|
||||
logger.warn("Cannot copy/move files to temp folder: " +
|
||||
new_folder.decode(headphones.SYS_ENCODING, 'replace') +
|
||||
". Not continuing. Error: " + str(e))
|
||||
return None
|
||||
|
||||
@@ -684,7 +684,7 @@ def walk_directory(basedir, followlinks=True):
|
||||
real_path = os.path.abspath(os.readlink(path))
|
||||
|
||||
if real_path in traversed:
|
||||
logger.debug("Skipping '%s' since it is a symlink to " \
|
||||
logger.debug("Skipping '%s' since it is a symlink to "
|
||||
"'%s', which is already visited.", path, real_path)
|
||||
else:
|
||||
traversed.append(real_path)
|
||||
|
||||
@@ -72,7 +72,7 @@ def listener():
|
||||
# http://stackoverflow.com/questions/2009278 for more information.
|
||||
if e.errno == errno.EACCES:
|
||||
logger.warning("Multiprocess logging disabled, because "
|
||||
"current user cannot map shared memory. You won't see any" \
|
||||
"current user cannot map shared memory. You won't see any"
|
||||
"logging generated by the worker processed.")
|
||||
|
||||
# Multiprocess logging may be disabled.
|
||||
|
||||
@@ -108,8 +108,8 @@ def verify(albumid, albumpath, Kind=None, forced=False, keep_original_folder=Fal
|
||||
[release_dict['artist_id'], release_dict['artist_name']])
|
||||
|
||||
if not artist:
|
||||
logger.warn("Continuing would add new artist '%s' (ID %s), " \
|
||||
"but database is frozen. Will skip postprocessing for " \
|
||||
logger.warn("Continuing would add new artist '%s' (ID %s), "
|
||||
"but database is frozen. Will skip postprocessing for "
|
||||
"album with rgid: %s", release_dict['artist_name'],
|
||||
release_dict['artist_id'], albumid)
|
||||
|
||||
@@ -348,7 +348,7 @@ def doPostProcessing(albumid, albumpath, release, tracks, downloaded_track_list,
|
||||
# this test is just to keep pyflakes from complaining about an unused variable
|
||||
return
|
||||
except (FileTypeError, UnreadableFileError):
|
||||
logger.error("Track file is not a valid media file: %s. Not " \
|
||||
logger.error("Track file is not a valid media file: %s. Not "
|
||||
"continuing.", downloaded_track.decode(
|
||||
headphones.SYS_ENCODING, "replace"))
|
||||
return
|
||||
@@ -371,7 +371,7 @@ def doPostProcessing(albumid, albumpath, release, tracks, downloaded_track_list,
|
||||
fp.seek(0)
|
||||
except IOError as e:
|
||||
logger.debug("Write check exact error: %s", e)
|
||||
logger.error("Track file is not writable. This is required " \
|
||||
logger.error("Track file is not writable. This is required "
|
||||
"for some post processing steps: %s. Not continuing.",
|
||||
downloaded_track.decode(headphones.SYS_ENCODING, "replace"))
|
||||
if new_folder:
|
||||
@@ -1436,7 +1436,7 @@ def forcePostProcess(dir=None, expand_subfolders=True, album_dir=None, keep_orig
|
||||
logger.info('No match found on MusicBrainz for: %s - %s', name, album)
|
||||
|
||||
# Fail here
|
||||
logger.info("Couldn't parse '%s' into any valid format. If adding " \
|
||||
"albums from another source, they must be in an 'Artist - Album " \
|
||||
logger.info("Couldn't parse '%s' into any valid format. If adding "
|
||||
"albums from another source, they must be in an 'Artist - Album "
|
||||
"[Year]' format, or end with the musicbrainz release group id.",
|
||||
folder_basename)
|
||||
|
||||
@@ -119,10 +119,10 @@ def read_torrent_name(torrent_file, default_name=None):
|
||||
return torrent_info["info"]["name"]
|
||||
except KeyError:
|
||||
if default_name:
|
||||
logger.warning("Couldn't get name from torrent file: %s. " \
|
||||
logger.warning("Couldn't get name from torrent file: %s. "
|
||||
"Defaulting to '%s'", e, default_name)
|
||||
else:
|
||||
logger.warning("Couldn't get name from torrent file: %s. No " \
|
||||
logger.warning("Couldn't get name from torrent file: %s. No "
|
||||
"default given", e)
|
||||
|
||||
# Return default
|
||||
@@ -143,7 +143,7 @@ def calculate_torrent_hash(link, data=None):
|
||||
info = bdecode(data)["info"]
|
||||
torrent_hash = sha1(bencode(info)).hexdigest()
|
||||
else:
|
||||
raise ValueError("Cannot calculate torrent hash without magnet link " \
|
||||
raise ValueError("Cannot calculate torrent hash without magnet link "
|
||||
"or data")
|
||||
|
||||
return torrent_hash.upper()
|
||||
@@ -842,16 +842,16 @@ def send_to_downloader(data, bestqual, album):
|
||||
break
|
||||
else:
|
||||
# No service succeeded
|
||||
logger.warning("Unable to convert magnet with hash " \
|
||||
logger.warning("Unable to convert magnet with hash "
|
||||
"'%s' into a torrent file.", torrent_hash)
|
||||
return
|
||||
elif headphones.CONFIG.MAGNET_LINKS == 3:
|
||||
torrent_to_file(download_path, data)
|
||||
return
|
||||
else:
|
||||
logger.error("Cannot save magnet link in blackhole. " \
|
||||
"Please switch your torrent downloader to " \
|
||||
"Transmission, uTorrent or Deluge, or allow Headphones " \
|
||||
logger.error("Cannot save magnet link in blackhole. "
|
||||
"Please switch your torrent downloader to "
|
||||
"Transmission, uTorrent or Deluge, or allow Headphones "
|
||||
"to open or convert magnet links")
|
||||
return
|
||||
else:
|
||||
|
||||
@@ -164,7 +164,7 @@ def torrentAction(method, arguments):
|
||||
whitelist_status_code=[401, 409])
|
||||
if response.status_code == 401:
|
||||
if auth:
|
||||
logger.error("Username and/or password not accepted by " \
|
||||
logger.error("Username and/or password not accepted by "
|
||||
"Transmission")
|
||||
else:
|
||||
logger.error("Transmission authorization required")
|
||||
|
||||
@@ -35,12 +35,12 @@ def initialize(options):
|
||||
if not (https_cert and os.path.exists(https_cert)) or not (
|
||||
https_key and os.path.exists(https_key)):
|
||||
if not create_https_certificates(https_cert, https_key):
|
||||
logger.warn("Unable to create certificate and key. Disabling " \
|
||||
logger.warn("Unable to create certificate and key. Disabling "
|
||||
"HTTPS")
|
||||
enable_https = False
|
||||
|
||||
if not (os.path.exists(https_cert) and os.path.exists(https_key)):
|
||||
logger.warn("Disabled HTTPS because of missing certificate and " \
|
||||
logger.warn("Disabled HTTPS because of missing certificate and "
|
||||
"key.")
|
||||
enable_https = False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user