This fixes tracktotal being stored incorrectly for multi-disc releases
where the individual discs have a different number of tracks and
per_disc_numbering is enabled.
Use config.__class__.__name__ instead of "ConfigView" in __repr__().
Before:
>>> from beets import ui
>>> c
<ConfigView: root>
>>> c['foo']
<ConfigView: foo>
After:
>>> from beets import ui
>>> c
<LazyConfig: root>
>>> c['foo']
<Subview: foo>
As per PEP234 (https://www.python.org/dev/peps/pep-0234/) if an object
has __getitem__() but not __iter__() then the former will be used to
build an iterable, invoking it with 0, then 1, ... until a KeyError is
raised. Lazy configuration makes it never happen, and list(config) runs
indefinitely, hogging all memory.
Implement __iter__(), which raises a TypeError, to solve that problem.
I inserted musicbrainz.searchlimit at the wrong place, breaking the
hyperlink target `match-config` - and I also forgot to add a hyperlink
target for `searchlimit`.
This avoids bugs when the filename contains spaces, etc.
Pinging @Kraymer: I gave this a brief test, but can you check whether I messed
anything up more subtly?
Came up when looking at #1241.
It has been a while since I have looked at these, and many of the FIXMEs no
longer make sense to me. Better to open issues if there's really something to
fix.
So far an invalid query won't be applied:
$ beet ls The Beatles year:196a
will be treaded as
$ beet ls The Beatles
With this commit it stops beets, returns 1 and produces
$ invalid query: u'196a' is not an int or a float
This applies to any querying and therefore on many command, plugins and
some configuration options.
Invalid queries exist on numeric fields and on regular expression usage.
Compile regular expression queries upon instantiation instead of upon
each match test.
The reporting can be improved (give more context). Fix#1219.
- better log messages
- more idiomatic code: "X not in Y" instead of "not (X in Y)"
- shorten _items_for_query:
- pre-detect whether it's album_query or query, hiding conf. spec to
the function.
- Let library.{items,album} parse the query string, therefore
falling back to beets-level sort spec. if none is given in the
query