mirror of
https://github.com/rembo10/headphones.git
synced 2026-05-20 18:45:32 +01:00
Merge pull request #2020 from jmullan/feature/travis
Add mention of travis to contributing doc and fix some lint stuff
This commit is contained in:
@@ -8,9 +8,10 @@ language: python
|
||||
python:
|
||||
- "2.6"
|
||||
- "2.7"
|
||||
# pylint 1.4 does not run under python 2.6
|
||||
install:
|
||||
- pip install pyOpenSSL
|
||||
- pip install pylint
|
||||
- pip install pylint==1.3.1
|
||||
- pip install pyflakes
|
||||
- pip install pep8
|
||||
script:
|
||||
|
||||
@@ -20,7 +20,7 @@ The code should work with Python 2.6 and 2.7. Note that Headphones runs on diffe
|
||||
Re-use existing code. Do not hesitate to add logging in your code. You can the logger module `headphones.logger.*` for this. Web requests are invoked via `headphones.request.*` and derived ones. Use these methods to automatically add proper and meaningful error handling.
|
||||
|
||||
### Code conventions
|
||||
Altough Headphones did not adapt a code convention in the past, we try to follow the [PEP8](http://legacy.python.org/dev/peps/pep-0008/) conventions for future code. A short summary to remind you (copied from http://wiki.ros.org/PyStyleGuide):
|
||||
Although Headphones did not adapt a code convention in the past, we try to follow the [PEP8](http://legacy.python.org/dev/peps/pep-0008/) conventions for future code. A short summary to remind you (copied from http://wiki.ros.org/PyStyleGuide):
|
||||
|
||||
* 4 space indentation
|
||||
* 80 characters per line
|
||||
@@ -32,4 +32,7 @@ Altough Headphones did not adapt a code convention in the past, we try to follow
|
||||
* `self.__really_private_field`
|
||||
* `_global`
|
||||
|
||||
Document your code!
|
||||
Document your code!
|
||||
|
||||
### Continuous Integration
|
||||
Headphones has a configuration file for [travis-ci](https://travis-ci.org/). You can add your forked repo to travis to have it check your code against pep8, pylint, and pyflakes for you. Your pull request will show a green check mark or a red x on each tested commit, depending on if linting passes.
|
||||
|
||||
@@ -546,8 +546,8 @@ def split(albumpath):
|
||||
for _cue in base_dir.filter('CueFile'):
|
||||
for _wave in base_dir.filter('WaveFile'):
|
||||
if _cue.header['file'] == _wave.name:
|
||||
logger.info('CUE Sheet found: {0}'.format(_cue.name))
|
||||
logger.info('Music file found: {0}'.format(_wave.name))
|
||||
logger.info('CUE Sheet found: %s', _cue.name)
|
||||
logger.info('Music file found: %s', _wave.name)
|
||||
cue = _cue
|
||||
wave = _wave
|
||||
# if no perfect match found then try without extensions
|
||||
@@ -556,9 +556,9 @@ def split(albumpath):
|
||||
for _cue in base_dir.filter('CueFile'):
|
||||
for _wave in base_dir.filter('WaveFile'):
|
||||
if ''.join(os.path.splitext(_cue.header['file'])[:-1]) == _wave.name_name:
|
||||
logger.info('Possible CUE Sheet found: {0}'.format(_cue.name))
|
||||
logger.info('CUE Sheet refers music file: {0}'.format(_cue.header['file']))
|
||||
logger.info('Possible Music file found: {0}'.format(_wave.name))
|
||||
logger.info('Possible CUE Sheet found: %s', _cue.name)
|
||||
logger.info('CUE Sheet refers music file: %s', _cue.header['file'])
|
||||
logger.info('Possible Music file found: %s', _wave.name)
|
||||
cue = _cue
|
||||
wave = _wave
|
||||
cue.header['file'] = wave.name
|
||||
@@ -641,14 +641,14 @@ def split(albumpath):
|
||||
# tag FLAC files
|
||||
if split and CUE_META.count_tracks() == len(base_dir.tracks(ext='.flac', split=True)):
|
||||
for t in base_dir.tracks(ext='.flac', split=True):
|
||||
logger.info('Tagging {0}...'.format(t.name))
|
||||
logger.info('Tagging %s...', t.name)
|
||||
t.tag()
|
||||
|
||||
# rename FLAC files
|
||||
if split and CUE_META.count_tracks() == len(base_dir.tracks(ext='.flac', split=True)):
|
||||
for t in base_dir.tracks(ext='.flac', split=True):
|
||||
if t.name != t.filename():
|
||||
logger.info('Renaming {0} to {1}...'.format(t.name, t.filename()))
|
||||
logger.info('Renaming %s to %s...', t.name, t.filename())
|
||||
os.rename(t.name, t.filename())
|
||||
|
||||
os.remove(ALBUM_META_FILE_NAME)
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import os.path
|
||||
from biplist import *
|
||||
import biplist
|
||||
from headphones import logger
|
||||
|
||||
|
||||
def getXldProfile(xldProfile):
|
||||
|
||||
xldProfileNotFound = xldProfile
|
||||
|
||||
expanded = os.path.expanduser('~/Library/Preferences/jp.tmkk.XLD.plist')
|
||||
if not os.path.isfile(expanded):
|
||||
logger.warn("Could not find xld preferences at: %s", expanded)
|
||||
@@ -13,14 +14,18 @@ def getXldProfile(xldProfile):
|
||||
|
||||
# Get xld preferences plist
|
||||
try:
|
||||
preferences = readPlist(expanded)
|
||||
except (InvalidPlistException, NotBinaryPlistException), e:
|
||||
preferences = biplist.readPlist(expanded)
|
||||
except (biplist.InvalidPlistException, biplist.NotBinaryPlistException), e:
|
||||
logger.error("Error reading xld preferences plist: %s", e)
|
||||
return(xldProfileNotFound, None, None)
|
||||
|
||||
xldProfile = xldProfile.lower()
|
||||
profiles = preferences.get('Profiles')
|
||||
if not isinstance(preferences, dict):
|
||||
logger.error("Error reading xld preferences plist, not a dict: %r", preferences)
|
||||
return(xldProfileNotFound, None, None)
|
||||
|
||||
profiles = preferences.get('Profiles', []) # pylint:disable=E1103
|
||||
|
||||
xldProfile = xldProfile.lower()
|
||||
for profile in profiles:
|
||||
|
||||
profilename = profile.get('XLDProfileManager_ProfileName')
|
||||
|
||||
@@ -1221,4 +1221,4 @@ def forcePostProcess(dir=None, expand_subfolders=True, album_dir=None):
|
||||
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)
|
||||
folder_basename)
|
||||
|
||||
@@ -184,4 +184,4 @@ def torrentAction(method, arguments):
|
||||
logger.error("Error sending torrent to Transmission")
|
||||
return
|
||||
|
||||
return response
|
||||
return response
|
||||
|
||||
Reference in New Issue
Block a user