Commit graph

2348 commits

Author SHA1 Message Date
Adrian Sampson
343a85d482 mbsync: use separate structure for old_data
Assigning an attribute on Items doesn't really work here since we try to store
that value to the DB as a flexattr.
2013-08-23 14:01:31 -07:00
Adrian Sampson
5e09c5e473 convert: fix iteration over results 2013-08-22 17:33:56 -07:00
Adrian Sampson
f9f8994d85 flexattr description in changelog 2013-08-21 18:44:14 -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
15cf046285 don't reset mtime on awakening from DB 2013-08-21 11:38:48 -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
Adrian Sampson
0176b9742f tests: unknown fields silently match nothing
Previously, an unknown field would be ignored. Now, they're treated as
flexattrs that just haven't been set yet (and thus always hold None).
2013-08-21 09:46:30 -07:00
Adrian Sampson
9e61e49457 fix NumericQuery constructor 2013-08-21 09:42:16 -07:00
Adrian Sampson
9609e41cf8 store albums after moving art 2013-08-21 09:25:47 -07:00
Adrian Sampson
c2acab510d album.move() now also stores
This lets items see any modifications to the album (when the album's fields
are dirty). It's also symmetric with the same method on items.
2013-08-21 09:07:20 -07:00
Adrian Sampson
8bcbe1dea2 fix outdated SQL query 2013-08-20 16:22:24 -07:00
Adrian Sampson
8bdf2d0efe fix dirtying when unchanged, artpath wrapping
Also some naming mistakes.
2013-08-20 16:05:45 -07:00
Adrian Sampson
238e743b5e add load() method to LibModel 2013-08-20 15:47:28 -07:00
Adrian Sampson
4d20d3b296 album.store() now also affects tracks 2013-08-20 15:32:27 -07:00
Adrian Sampson
50f724186f revamp ResultIterator (now Results)
This new design lets us provide better common functionality. The `get()`
method is a particularly good example: we can now avoid the try/except dance
that was previously necessary to get the only result for a single-result
query. This also lets us continue using `len()` on the result of
`album.items()`, which previously returned a materialized list.
2013-08-20 14:54:24 -07:00
Adrian Sampson
ec10f8c223 remove count() calls
I removed this method in an earlier commit.
2013-08-20 14:28:28 -07:00
Adrian Sampson
276ce14dd2 flexattrs work for Albums
A second base class, LibModel, maintains a reference to the Library and should
take care of database-related tasks like load and store. This is the beginning
of the end of the terrible incongruity between Item and Album objects (only
the latter had a library reference). More refactoring to come.

One large side effect: Album objects no longer automatically store
modifications. You have to call album.store(). Several places in the code
assume otherwise; they need cleaning up.

ResultIterator is now polymorphic (it takes a type parameter, which must be a
subclass of LibModel).
2013-08-16 18:36:30 -07:00
Adrian Sampson
abfad7b2a9 kill BaseAlbum
I added this back when I thought I would implement a different subclass that
represented iPods. That means I wrote this code when I had a lime iPod mini. I
am old.
2013-08-16 17:28:21 -07:00
Adrian Sampson
38f1e6aec2 new FlexModel base class
I intend to use this for both Item and Album to avoid code duplication and
simplify code that uses both entities.
2013-08-16 17:22:17 -07:00
Adrian Sampson
206dee34f8 flexible attributes as slow queries
Queries over flexible attributes now Just Work!
2013-08-16 14:46:46 -07:00
Adrian Sampson
7d9f556cbe introducing "slow queries"
In preparation for enabling queries over flexattrs, this is a new path that
lets queries avoid generating SQLite expressions altogether. Any query that
can be completely evaluated in SQLite will be, but when it can't, we now fall
back to running the entire query in Python by selecting everything from the
database and running the `match` predicate.

To begin with, this mechanism replaces RegisteredFieldQueries, which
previously used Python callbacks for evaluation. Now they just indicate that
they're slow queries and the query system falls back automatically.

This has the great upside that it lets use implement arbitrarily complex
queries without shoehorning everything into SQLite when that (a) is way too
complicated and (b) doesn't buy us much performance anyway. The obvious
drawback is that any code dealing with queries now has to handle two cases
(slow and fast).

In the future, we could optimize this further by combing fast and slow query
styles. For example, if you want to match with a substring *and* a regular
expression, we can do a first pass in SQLite and apply the regex predicate on
the results. Avoided for now because premature optimization, etc., etc.

Next step: implement flexattr matches as slow queries.
2013-08-16 14:28:46 -07:00
Adrian Sampson
1a0d9c507d drop flexattr namespaces
Namespaces were a worthy idea, but they added a lot of complexity to both the
library code itself and every client of the flexattrs interfaces. Getting rid
of them, and having one flat namespace of both traditional fields and
flexattrs, has one huge benefit: we can "promote" flexattrs to real attributes
(and vice versa) without code changes in every client.

This frees us to have a somewhat less efficient implementation of flexattrs
because we have a smooth upgrade path for making attributes more efficient via
promotion.
2013-08-16 11:18:05 -07:00
Adrian Sampson
e91a08099d remove debug print that slipped in 2013-08-15 18:15:24 -07:00
Adrian Sampson
3b9b39e5c9 merge with master 2013-08-15 18:14:33 -07:00
Adrian Sampson
3757aec494 fix homebrew gstreamer instructions 2013-08-15 17:46:03 -07:00
Adrian Sampson
f1c41428e6 changelog/thanks/tweaks for #355
- Remove requests import
- Name change
- Remove some obsolete checks
2013-08-08 16:19:16 -07:00
Filipe Fortes
7c607ebf82 Simplify fetching cover art from release group 2013-08-08 10:02:25 -03:00
Filipe Fortes
a4470ace69 FetchArt plugin: Support grabbing album art from MB release group 2013-08-07 19:21:45 -03:00
Adrian Sampson
bb191e7ced Merge pull request #354 from mineo/docs-fixup-2
Docs fixup
2013-08-06 09:46:14 -07:00
Wieland Hoffmann
e4af04e3be docs/inline.rst: The `[paths] section is now paths:` 2013-08-06 10:41:05 +02:00
Wieland Hoffmann
aafcbdc730 plugins/zero.rst: Add a missing 'a' 2013-08-06 10:41:05 +02:00
Wieland Hoffmann
d6673b7f79 plugins/zero.rst: Add a missing 'the' 2013-08-06 10:41:05 +02:00
Wieland Hoffmann
39d67363b5 ref/cli.rst: Remove a 'd' 2013-08-06 10:40:17 +02:00
Wieland Hoffmann
e0ea009508 ref/cli.rst: Add a missing 'k' 2013-08-06 10:40:17 +02:00
Wieland Hoffmann
ec30e3d377 guides/tagger: Make emailing Adrian less imperative 2013-08-06 10:40:17 +02:00
Adrian Sampson
c1b66105dd fix regex (and other) queries in path field 2013-08-04 13:12:25 -07:00
Adrian Sampson
dfb7509540 Merge pull request #353 from mineo/patch-4
pathformat.rst: Add back "track"
2013-08-03 13:23:15 -07:00
Wieland Hoffmann
0082570e11 pathformat.rst: Add back "track"
This got lost in e0bb3b5cd0 but is really essential enough to appear in that list.
2013-08-03 15:13:29 +02:00
Adrian Sampson
01b4d39bdc Merge pull request #352 from mineo/patch-3
Beets is a music library manager, not a TARDIS
2013-08-02 14:12:47 -07:00
Wieland Hoffmann
d849f37d0a Beets is a music library manager, not a TARDIS 2013-08-02 23:09:31 +02:00
Adrian Sampson
f493156e2d beets is now in the official Arch package repo 2013-07-30 21:59:33 -07:00
Fabrice L.
ed15c18bc8 Update index.rst
`pluginpath` option is described in *config* page, not *cli*
2013-07-27 10:34:49 +02:00
Adrian Sampson
d6432a6c36 Merge pull request #342 from mineo/patch-2
docs/.../cli.rst: Add an `of` to the description of `update -p`
2013-07-12 12:18:55 -07:00
Wieland Hoffmann
cc3d12f218 docs/.../cli.rst: Add an of to the description of update -p
This seems to have been missed when the documentation was added in the first place.
2013-07-12 19:11:47 +02:00
Adrian Sampson
194465e377 travis: don't --use-mirrors with pip
Since the CDN was added to PyPI, --use-mirrors just makes things slower and
less reliable.

http://comments.gmane.org/gmane.comp.python.distutils.devel/18440
2013-07-05 09:36:08 -07:00
Adrian Sampson
a6bed1135e changelog for #340 2013-07-02 20:12:52 -07:00
Adrian Sampson
fc8c4fbafc Merge pull request #340 from laarmen/fix_bpd_search
bpd: Use AnyFieldQuery when searching "any" fields
2013-07-02 20:11:35 -07:00
Simon Chopin
e30f8f8fb9 bpd: Use AnyFieldQuery when searching "any" fields
BPD hadn't been ported when AnySubstringQuery was removed, resulting in
crash, death and horror when using the search function.
2013-07-02 11:00:10 +02:00
Adrian Sampson
214e6f76d9 changelog for #339 2013-06-30 18:34:42 -07:00