Skip to content

Commit

Permalink
Fallback to default path config
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Scholtes committed Sep 10, 2014
1 parent 6087cb3 commit eda0766
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ build/
coverage/
*.pyc
.tox/
.vimrc
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ env:
# - TOX_ENV=beets-release

install:
- "pip install coveralls tox"
- "pip install tox"
- "[ ! -z $COVERAGE ] && pip install coveralls || true"

script: "tox -e $TOX_ENV"

after_success: "[ ! -z $COVERAGE ] && coveralls || true"
after_success:
- "[ ! -z $COVERAGE ] && coveralls || true"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ line. The values are again dictionaries with the following keys.
configuration.
* `paths` Path templates for audio files under `directory`. Configured
like [global paths option][config-paths].
like and defaults to [global paths option][config-paths].
* `query` A [query string][] that determine which tracks belong to the
collection.
Expand Down
7 changes: 6 additions & 1 deletion beetsplug/alternatives.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from argparse import ArgumentParser
from concurrent import futures

import beets
from beets import util
from beets.plugins import BeetsPlugin
from beets.ui import Subcommand, get_path_formats
Expand Down Expand Up @@ -79,7 +80,11 @@ class External(object):
def __init__(self, name, lib, config):
self.lib = lib
self.path_key = 'alt.{0}'.format(name)
self.path_formats = get_path_formats(config['paths'])
if config['paths'].exists():
path_config = config['paths']
else:
path_config = beets.config['paths']
self.path_formats = get_path_formats(path_config)
self.query, _ = get_query_sort(config['query'].get(unicode), Item)

dir = config['directory'].as_filename()
Expand Down
1 change: 0 additions & 1 deletion test/cli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def setUp(self):
self.config['alternatives']['external'] = {
'myexternal': {
'directory': external_dir,
'paths': {'default': '$artist/$title'},
'query': 'myexternal:true'
}
}
Expand Down

0 comments on commit eda0766

Please sign in to comment.