Commit graph

76 commits

Author SHA1 Message Date
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