Commit graph

118 commits

Author SHA1 Message Date
Thomas Scholtes
165c28e967 Raise configuration error if BEETSDIR is file 2014-03-04 17:29:14 +01:00
Thomas Scholtes
8a5a2fcebf Merge branch 'completion'
Conflicts:
	beets/ui/commands.py
	docs/reference/cli.rst
2014-03-02 23:06:05 +01:00
Thomas Scholtes
44c843793b Add completion of plugin commands 2014-03-02 16:18:16 +01:00
Thomas Scholtes
8450d51bab bash-completion package can be set by environment 2014-02-27 17:57:02 +01:00
Thomas Scholtes
996a1d6c90 Use bash-completion package 2014-02-27 17:52:23 +01:00
Thomas Scholtes
81a28198aa Test completion with clean bash instance 2014-02-27 15:09:02 +01:00
Adrian Sampson
1253cb695d move show_model_changes to ui package
This makes it more naturally reusable for plugins.
2014-02-22 15:06:16 -08:00
Adrian Sampson
b383ce3450 comment out some skipped tests
The *only reason* I'm doing this is so that the unittest output looks
prettier. I am pretty sure I have actual OCD. 😳
2014-02-22 14:59:22 -08:00
Adrian Sampson
645279e022 remove old _showdiff
Totally replaced now, including tests! Woohoo.
2014-02-22 14:52:33 -08:00
Thomas Scholtes
e8e0682aae Add completion support for bash 3.2
Bash 3.2 does not have associative arrays, so we hack around that by using
generic varibale names like `opts__$cmd`. We also don't support the "?" alias
anymore.
2014-02-22 17:59:23 +01:00
Adrian Sampson
0ead6ee8cc don't relativize command-line paths (#513)
Paths given on the command line (e.g., with the --library option) need to be
relative to the working directory, not the config file.
2014-02-21 21:04:03 -05:00
Adrian Sampson
129575178c docstring/style fixups for #513 2014-02-21 20:52:21 -05:00
Thomas Scholtes
14ece207c9 Add completion command
The command prints a shell script that provides completion for the `beet`
command. To test it run `eval "$(beet completion)"` in your shell.

I also included some crude testing for this. The `test/test_completion.sh`
script runs tests in a shell and exit with a non-zero status code if the tests
fail. It assumes that the completion script is already loaded in the executing
shell.

As of now the completion only works for bash 4.1 and newer.
2014-02-20 01:15:03 +01:00
Thomas Scholtes
f1f6adcb0d Implement new configuration behaviour 2014-02-18 16:48:35 +01:00
Thomas Scholtes
d900b594be Specify configuration behaviour with tests
Beets stores all its data in the `BEETSDIR` directory. The default is
determined by the system:

* `%APPDATA%\beets` on Windows. If the `APPDATA` environment variable is
  not set it falls back to `~\AppData\Roaming\beets`.
* `$XDG_CONFIG_DIR/beets` on UNIX. If the `XDG_CONFIG_DIR` environment
  variable is not set it falls back to `~/.config/beets`
* `~/Library/Application Support/beets` on OSX

The default can be overwritten using the `BEETSDIR` environment variable.

The user configuration is read from `$BEETSDIR/config.yaml`. Additional
configuration files that overwrite options from the user configuration may
be specified using the `--config` command line options.

All relative paths in any configuration are resolved relative to `BEETSDIR`.
2014-02-18 16:48:35 +01:00
Adrian Sampson
4bb2622b9b fix testability of main entry point 2014-02-13 13:56:26 -08:00
Thomas Scholtes
a363d9672f Load plugins from cli config 2014-02-10 17:26:26 +01:00
Thomas Scholtes
5f79c54cb3 Rewrite config test to be more transparent 2014-02-10 17:26:26 +01:00
Thomas Scholtes
c133302e20 Fix configuration priorities (see #513) 2014-02-03 01:16:35 +01:00
Thomas Scholtes
d75f6667e1 Add --config cli option 2014-01-29 23:38:05 +01:00
Thomas Scholtes
a4b6976755 Make plugin path configuration useable 2014-01-20 17:39:46 +01:00
Thomas Scholtes
3b39e0f193 Test plugin commands from plugin paths 2014-01-20 17:39:46 +01:00
Adrian Sampson
d6ff4308f9 fix tests for new path formatting
Slowly expunging the terrible idea that was `pathmod`...
2013-12-25 00:28:26 -08:00
Adrian Sampson
22d5e564c6 move move method to model objects 2013-09-16 22:12:26 -07:00
Adrian Sampson
c7fe017752 remove Library.{move,store} methods
These methods are now provided by LibModel, which makes dealing with items and
albums symmetric.
2013-08-21 15:34:45 -07:00
Adrian Sampson
deef7f9d20 a few more necessary album.store()s 2013-08-21 11:23:09 -07:00
Adrian Sampson
6677cea036 fix uses of item.dirty and item.record 2013-08-21 10:57:52 -07:00
Tai Lee
51f40d26dc Rename Distance.penalties to Distance._penalties. It should be private. 2013-06-03 00:04:45 +10:00
Tai Lee
e6ac8e1646 Use a Distance object instead of floats for distance calculations.
The new Distance object knows how to perform various types of distance
calculations (expression, equality, number, priority, string).

It will keep track of each individual penalty that has been applied so
that we can utilise that information in the UI and when making decisions
about the recommendation level.

We now display the top 3 penalties (sorted by weight) on the release
list (and "..." if there are more than 3), and we display all penalties
on the album info line and track change line.

The implementation of the `max_rec` setting has been simplified by
removing duplicate validation and instead looking at the penalties that
have been applied to a distance. As a result, we can now configure a
maximum recommendation for any penalty that might be applied.

We have a few new checks when calculating album distance:

`match: preferred: countries` and `match: preferred: media` can each be
set to a list of countries and media in order of your preference. These
are empty by default. A value that matches the first item will have no
penalty, and a value that doesn't match any item will have an unweighted
penalty of 1.0.

If `match: preferred: original_year` is set to "yes", beets will apply
an unweighted penalty of 1.0 for each year of difference between the
release year and the original year.

We now configure individual weights for `mediums` (disctotal), `label`,
`catalognum`, `country` and `albumdisambig` instead of a single generic
`minor` weight. This gives more control, but more importantly separates
and names the applied penalties so that the UI can convey exactly which
fields have contributed to the overall distance penalty.

Likewise, `missing tracks` and `unmatched tracks` are penalised and
displayed in the UI separately, instead of a combined `partial` penalty.

Display non-MusicBrainz source in the disambiguation string, and
"source" in the list of penalties if a release is penalised for being
a non-MusicBrainz.
2013-06-02 18:25:10 +10:00
Johannes Baiter
ad66b8796a Fix tests for albums from manual ID 2013-05-28 13:50:20 +02:00
Adrian Sampson
42624eb745 use lazy config loader in confit
This lets you, for example, import beets in a library or the REPL and use it
immediately without calling "beets.config.read()" first.
2013-05-17 19:05:16 -07:00
Adrian Sampson
a7f0ad70ae test: move DummyIO initialization to harness
This makes it much harder to accidentally leave this I/O isolator installed.
2013-02-18 18:29:10 -08:00
Adrian Sampson
6c931faf1a tests: remove ad-hoc temporary directories
Now that we have a temporary directory in the shared harness, we can dispense
with the error-prone process of creating them for each test.
2013-02-18 18:23:32 -08:00
Adrian Sampson
151177ab95 recommendation is now a "real" enumeration 2013-02-07 17:26:58 -08:00
Tai Lee
06976bb49d De-duplicate loop functionality. One logic loop and one display loop. 2013-02-02 09:11:12 +11:00
Tai Lee
8afe1c71b1 Improved change alignment. Align "->" when possible, otherwise split across two lines. 2013-02-01 17:29:30 +11:00
Adrian Sampson
486dd210ae trying out a multi-line track display (#78) 2013-01-30 19:23:53 -08:00
Tai Lee
a6ee1f9e80 Fix tests. 2013-01-31 13:02:27 +11:00
Adrian Sampson
7a410f636b happy new year
For future reference, this command did the trick:
ack -l 'Copyright 201' | xargs perl -pi -E 's/Copyright 201./Copyright 2013/'
2013-01-11 10:43:41 -08:00
Adrian Sampson
2c45251db9 clean configuration for testing
This way, unit tests will never see a user's global beets configuration.
2012-12-18 20:27:36 -08:00
Adrian Sampson
55cac36d35 sync with latest confit
This includes Confit's shift to using OrderedDict, which needs some debugging.
2012-12-18 20:03:52 -08:00
Adrian Sampson
85600df2be remove outdated test 2012-12-15 13:22:18 -08:00
Adrian Sampson
cbd538de7b combine TempConfigTestCase and ExtraAsserts 2012-12-15 13:21:09 -08:00
Adrian Sampson
39cd1f6c63 switch from context manager to base class
Replaced temp_config context manager with TempConfigTestCase base class. This
lets us clean up even when a test fails.
2012-12-15 13:15:10 -08:00
Adrian Sampson
3e5ef375c8 confit-ify remaining tests except for ConfigTest 2012-12-14 15:23:47 -08:00
Adrian Sampson
ed3a3d1937 confit-ify a bunch more tests 2012-12-14 14:21:06 -08:00
Adrian Sampson
6f19f466fc tests: temporarily modify global configuration 2012-12-14 13:39:14 -08:00
Adrian Sampson
e84a41b550 start fixing up tests for confit overhaul 2012-12-14 13:18:06 -08:00
Adrian Sampson
0a21d72a79 tolerate non-UTF8 locale in test 2012-11-27 20:38:47 -08:00
Adrian Sampson
1f8fff7445 fix tests for recent API changes in commands 2012-10-20 21:19:50 -07:00