Commit graph

101 commits

Author SHA1 Message Date
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
Adrian Sampson
af2a329477 handle user-visible exceptions at top level
This makes error messages more friendly (i.e., traceback-free) when exceptions
occur during UI setup -- e.g., unopenable database.
2012-08-27 22:45:28 -07:00
Jakob Borg
21cff66d08 Handle unicode in replacement config
The 'decode' call fails in what is already a unicode string. I'm not
sure under what circumstances the string is or isn't unicode (apparently
it varies), so I added a check. The test passes with the patch, at
least.
2012-07-05 23:12:36 +02:00
Adrian Sampson
ce166004cb use AlbumMatch/TrackMatch objects everywhere
This allows matches to indicate both missing and unmatched tracks in their
candidates and solves some of the spaghetti tuples that were passed around
during autotagging.
2012-07-01 16:33:48 -07:00
Adrian Sampson
7464b138cf fix tests broken by TrackInfo.index 2012-07-01 14:16:22 -07:00
Adrian Sampson
11d4fb1abb move album art fetching to a plugin (fetchart) 2012-06-24 00:34:50 -07:00
Adrian Sampson
d88afbad11 library maintains per-thread DB conns. (GC-399) 2012-06-08 10:49:47 -07:00
Adrian Sampson
2b000c47a2 per_disc_numbering config option (GC-335) 2012-05-17 12:44:48 -07:00
Adrian Sampson
387a2dbc3c fix tests for GC-362 2012-05-16 17:13:01 -07:00
Adrian Sampson
b68e87b92c The Great Trailing Whitespace Purge of 2012
What can I say? I used to use TextMate!
2012-05-13 20:22:17 -07:00
Adrian Sampson
a28f930c52 transaction objects to control DB access
In an attempt to finally address the longstanding SQLite locking issues, I'm
introducing a way to explicitly, lexically scope transactions. The Transaction
class is a context manager that always fully fetches after SELECTs and
automatically commits on exit. No direct access to the library is allowed, so
all changes will eventually be committed and all queries will be completed. This
will also provide a debugging mechanism to show where concurrent transactions
are beginning and ending.

To support composition (transaction reentrancy), an internal, per-Library stack
of transactions is maintained. Commits only happen when the outermost
transaction exits. This means that, while it's possible to introduce atomicity
bugs by invoking Library methods outside of a transaction, you can conveniently
call them *without* a currently-active transaction to get a single atomic
action.

Note that this "transaction stack" concepts assumes a single Library object per
thread. Because we need to duplicate Library objects for concurrent access due
to sqlite3 limitation already, this is fine for now. Later, the interface should
provide one transaction stack per thread for shared Library objects.
2012-05-06 23:24:05 -07:00
Adrian Sampson
d042bed27c pre-parse path format templates
Instead of parsing the template at each call to destination(), it's now possible
to parse them *once*, a priori, and re-use the resulting template object. This
is analogous to the re module's compiled expressions.
2012-04-29 15:30:43 -07:00
Domen Kožar
1af4f86c17 support move action when importing 2012-04-05 01:14:17 +02:00
Adrian Sampson
ffa2402ff4 revamp default character substitutions
There's no longer a distinction between Unix and Windows substitutions. Enough
users reported problems with Windows-forbidden characters on Samba shares that
it seems appropriate to make all filenames Windows-safe, even on Unix. Users who
really want those additional characters (<>:"?*|\) can re-enable them via the
"replace" option. Nobody has complained about beets being *too* conservative.

This also adds sanitization of control characters, which is an all-around good
idea, and the substitution now runs in the Unicode (rather than byte) domain.
2012-04-03 14:22:38 -07:00
Philippe Mongeau
200a98d4df add format option to list_items command
you can provide a custom format option to the list
command.
Example: $ beet ls -f '$title - $album'
2012-02-29 19:14:56 -05:00
Adrian Sampson
5a0105b12c fall back to unittest2 (#275) 2012-01-31 15:25:09 -08:00
Adrian Sampson
d73c133a53 query-conditioned path formats (#210)
Also, Library.path_formats is now a list of pairs instead of a dictionary. (I
would have used an OrderedDict, but that was added in 2.7.)
2011-12-28 19:01:13 -08:00
Adrian Sampson
b493bc7004 configurable pathname substitution (#115) 2011-12-19 18:37:35 -08:00