Commit graph

90 commits

Author SHA1 Message Date
Adrian Sampson
f4a124e7e2 Fix #1605: parsing bare + and - in queries 2015-09-15 13:53:41 -07:00
Adrian Sampson
0979148866 Slightly more legible tests 2015-04-16 19:31:27 -07:00
Adrian Sampson
7c1cf6632e Add test for leading comma (#1423) 2015-04-16 19:28:03 -07:00
Tom Jaspers
13eabe25dd "or"-operator tests on dbcore:parse_sorted_query 2015-04-16 10:04:32 +02:00
Bruno Cauet
bcd57bd2b5 Test queries building sort management in smartplaylist
Slighly modify Sort parsing: avoid building MultiplSort() instances
comptised of a single sort, but return that sort instead, since it wraps
things with any gain.
2015-03-18 18:53:41 +01:00
Bruno Cauet
9c41c39913 Do __name__ comparison with bytes and not unicode 2015-01-20 12:03:57 +01:00
Bruno Cauet
6fff7a954c Import unicode_literals in beets.dbcore 2015-01-19 17:18:50 +01:00
Bruno Cauet
90b388b775 Use __future__ imports but unicode_literals everywhere
Include import of __future__ features division, absolute_imports and
print_function everywhere. Don't add unicode_literals yet for it is
harder to convert.

Goal is smoothing the transition to python 3.
2015-01-19 12:25:16 +01:00
Bruno Cauet
2902cda036 tests: use absolute imports everywhere 2015-01-19 12:25:15 +01:00
Frederik “Freso” S. Olesen
4b1f0cbf48 Happy 2015. ;)
See 7a410f636b

Command used:

    git grep -l 'Copyright 201'|xargs sed -i -E 's/Copyright 201./Copyright 2015/'`
2015-01-08 21:37:09 +01:00
Adrian Sampson
434280f248 A couple of coverage tweaks 2014-10-11 22:05:22 -07:00
Adrian Sampson
e949fe2d93 A bunch more tests for Results 2014-10-11 20:44:10 -07:00
Adrian Sampson
9d5fdbb37f Fix concurrent iterators in incremental results
Some weird behavior was possible when having two iterators on the same Results
object. May seem far-fetched, but it is possible. As an added bonus, this
saves a little memory by disposing of rows when they have been materialized
into model objects.
2014-10-11 20:30:33 -07:00
Adrian Sampson
f9c6dd6d67 Move SmartArtistSort to library (#953)
Models can now have a dict of special sort classes.
2014-09-15 19:43:22 -07:00
Adrian Sampson
2b921b19fd NullSort instead of None
A more descriptive placeholder for "don't sort".
2014-09-13 20:38:31 -07:00
Adrian Sampson
4870d7e0fa Roll back fast flexible field sorts (#953)
Sad to see them go, but happy be rid of the SQL injection.
2014-09-13 17:16:12 -07:00
Thomas Scholtes
9ee794beb7 Model.load() should remove flexible fields 2014-09-10 17:22:23 +02:00
Thomas Scholtes
429f1c1573 PEP8 Fixes 2014-09-05 19:53:46 +02:00
Thomas Scholtes
68bc77362b Increase test speed by removing unnecessary file operations 2014-09-05 19:49:20 +02:00
Thomas Scholtes
0798af7774 Refactor model formatting
Remove all formatting related code from models. It now lives in the
`FormattedMapping` class. Only API change is from `model.formatted` to
`model.formatted()`.
2014-08-25 14:24:39 +02:00
Pierre Rust
1303a915c1 Sort implementation
* sort can be sepcified using the 'field_name'(+|-) syntax
 * supports fixed fields and flexible attributes
 * includes plugins fix for API changes (might have missed some)
2014-06-15 22:32:25 +02:00
Adrian Sampson
632d3a9612 dbcore: Add shared instances of common types
Following click's example:
https://github.com/mitsuhiko/click/blob/master/click/types.py#L414
2014-05-25 16:38:47 -07:00
Adrian Sampson
394e4e45eb dbcore: Add types for non-fixed fields
The base Type class now serves as the catch-all logic for untyped fields.
2014-05-25 16:23:15 -07:00
Adrian Sampson
70b5a44ef4 Move query parsing to new dbcore.queryparse
Fix #649.
2014-05-24 17:07:18 -07:00
Adrian Sampson
908584bde8 Revamp FormattedItemMapping
This subclass was not cleanly conforming to the Mapping abstract base. Now
we're in business -- the thing looks like a dict. Brought up by #782.
2014-05-20 16:24:40 -07:00
Adrian Sampson
e800b46a5d Make FormattedMapping behave more like a dict
The collections.Mapping abstract base class provides all the nice dict-like
functionality we need.
2014-05-06 11:32:20 -07:00
Adrian Sampson
ed8002bed5 tests: close databases to avoid errors on Windows
Fixes #655 and makes progress on #670.
2014-04-12 15:00:17 -07:00
Adrian Sampson
c09bac603f dbcore: types translate null values on assignment
In preparation for #660, where we will allow MediaFile to expose None values
when tags are missing (and consume None to remove tags). This makes it
possible to hide nullness in the rest of beets by translating None to a
suitable zero-ish value on field assignment.

Types can of course opt out of this to preserve a distinct null value. We do
this now for the album_id field, which needs to be null to indicate
singletons.

Type.normalize() also enables more sophisticated translations (e.g., an
integer field could round off float values assigned into it) in the future.
2014-04-05 16:27:07 -07:00
Adrian Sampson
be31ac683a Model._parse() class method 2014-02-13 21:29:17 -08:00
Adrian Sampson
8556de8d3a dbcore: flexattr deletion (fix #530) 2014-02-08 12:31:50 -08:00
Adrian Sampson
f29fbe47da DBCore types: no functional-style Type constructor
This was getting more and more awkward. Also added a `parse` method (in
progress).
2014-01-26 21:12:48 -08:00
Adrian Sampson
f1a4ba815d fix #503: format untyped fields with bytes values 2014-01-23 15:06:24 -08:00
Adrian Sampson
7aa4d1e5ba begin type-based formatting 2014-01-21 21:02:40 -08:00
Adrian Sampson
1cdb30fd56 remove superfluous py_type field from Type 2014-01-20 18:06:42 -08:00
Adrian Sampson
00829c1a6c use PathQueries declaratively
Now PathQuery is just another type-based query, just like NumericQuery.
2014-01-20 18:01:29 -08:00
Adrian Sampson
4026c4b707 add query field to types
This is starting to get at the heart of the matter: now each type gets to
declare which Query subclass it wants to use, starting with NumericQuery.
2014-01-20 17:47:02 -08:00
Thomas Scholtes
34f113bbcf Running ./setup.py test works again 2014-01-20 14:33:40 +01:00
Adrian Sampson
a0ffde7114 a bit more dbcore testing 2014-01-18 16:49:22 -08:00
Adrian Sampson
dcee7b6219 dbcore: terminology
Replace "library" and "lib" references in dbcore with "database" and "db" for
short.
2014-01-18 16:36:04 -08:00
Adrian Sampson
72a1b9bafb add tests for dbcore
Based on the old migration tests for Library.
2014-01-18 16:27:43 -08:00