Commit graph

12907 commits

Author SHA1 Message Date
Adrian Sampson
f0ae35bc4a Python 2.6 on TravisCI 2012-05-08 11:59:10 -07:00
Adrian Sampson
8b25a86ee3 use 2.6-compatible format strings 2012-05-08 11:46:08 -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
5a9cc6a2d9 fix crash on 0 chroma matches for singleton 2012-05-06 21:19:13 -07:00
Adrian Sampson
1baf49b333 fix still more documentation typos 2012-05-03 17:43:58 -07:00
Adrian Sampson
76af1924ea fix ReST markup error in changelog 2012-05-03 17:24:33 -07:00
Adrian Sampson
a2c12dc78f -c CLI option overrides import_move config option 2012-05-03 17:19:28 -07:00
Adrian Sampson
a2f4940c39 factor out ImportTask.prune() utility function 2012-05-03 17:13:30 -07:00
Adrian Sampson
5ebb61bab7 moving import (#266): move album art files 2012-05-03 17:08:52 -07:00
Adrian Sampson
b327455fac prune empty directories when moving (#266) 2012-05-03 16:59:56 -07:00
Adrian Sampson
953e23cb51 use compiled template by default
The substitute() function now tries to use a pre-compiled template first. If
this raises an exception, it falls back to the slow path (interpretation).
2012-05-03 15:24:12 -07:00
Adrian Sampson
f6e06813ca fix Unicode identifiers; add performance test 2012-05-03 15:16:28 -07:00
Adrian Sampson
a8338b6676 compile template function calls 2012-05-03 15:02:42 -07:00
Adrian Sampson
cdf40bbfc6 generate expressions instead of statements 2012-05-03 14:48:23 -07:00
Adrian Sampson
953dcbbf8c first attempt at AST-generating template compiler 2012-05-03 14:40:15 -07:00
Adrian Sampson
4225c3d395 Merge pull request #34 from KraYmer/master
Fix truncation of m3u file
2012-05-02 13:51:54 -07:00
kraymer
f92d5d5e29 change m3u open mode to 'a' so file content is not reseted at each import when in 'm3u' mode 2012-05-02 21:51:37 +02:00
Adrian Sampson
104aec3c2f cleanup and docs for regular expression queries 2012-05-01 20:03:01 -07:00
Adrian Sampson
a6e6da245a Merge branch 'upstream' of https://github.com/djrtl/beets-dj
Conflicts:
	beets/library.py
2012-05-01 19:17:05 -07:00
Adrian Sampson
1ee07e116e flexible -f templates for album listings (and rdm) 2012-04-30 22:59:17 -07:00
Adrian Sampson
ef45461cf9 evaluate_template is now a method on Item 2012-04-30 21:40:02 -07:00
Adrian Sampson
792c5b5e5d cleanup and docs for -f option flexibility 2012-04-30 21:26:49 -07:00
Adrian Sampson
928730e0ed merge GH-33: more flexibility for -f arguments 2012-04-30 21:17:20 -07:00
Adrian Sampson
fa3e41c86a BPD: print messages reflecting tree (re)build 2012-04-30 12:02:00 -07:00
Adrian Sampson
6d7cbd6d2f get list of tmpl_* functions only once 2012-04-29 19:55:34 -07:00
Adrian Sampson
e85fe2d834 fix memoization presence check 2012-04-29 18:20:37 -07:00
Adrian Sampson
de87fb7489 memoize %aunique results (share among tracks) 2012-04-29 18:07:29 -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
Adrian Sampson
c4f9b452da docs for %aunique (#190) 2012-04-29 14:52:03 -07:00
Adrian Sampson
2087ff6e41 add items to DB before moving/copying (#190)
Previously, all files would be moved/copied/deleted before the corresponding
Items and Albums were added to the database. Now, the in-place items are added
to the database; the files are moved; and then the new paths are saved to the
DB. The apply_choices coroutine now executes two database transactions per task.
This has a couple of benefits:
- %aunique{} requires album structures to be in place before the destination()
  call, so this now works as expected.
- As an added bonus, the "in_album" parameter to move() and destination() --
  along with its associated ugly hacks -- is no longer required.
2012-04-29 14:14:11 -07:00
Steve Dougherty
c93e7e443e Run functions and substitute fields in list format strings. 2012-04-29 11:11:57 -04:00
Adrian Sampson
4b253df48c ensure album art path is unique when moving
Avoid filename collisions on cover art when running a "beet move". (This is
already covered for adding new art and for moving audio files.)
2012-04-28 21:14:11 -07:00
Adrian Sampson
ca5af1d62b add featInTitle to "other plugins" list 2012-04-28 21:05:41 -07:00
Matteo Mecucci
f4a0595b32 Fixed the regexp function used with sqlite3. 2012-04-28 15:24:42 +02:00
Matteo Mecucci
46ec5db3fe Added unit tests for regexps in query expressions. 2012-04-28 15:24:42 +02:00
Matteo Mecucci
10a4e14045 Added regexps to queries, use with additional column before pattern eg 'title::^Quiet' or ':^Quiet'. 2012-04-28 15:24:17 +02:00
Adrian Sampson
ffed536d5d add %aunique to default path formats (#190)
At this point, everything's in place except for the import workflow. Album
directory uniquification works if you import two identically-named albums and
then immediately execute "beet move". Currently, however, a couple of things
prevent this from working as expected during the normal import process:
- The tmpl_aunique method expects the item to be associated with an album in the
  database before it is called. This is currently not the case.
- With the multithreaded importer, it's possible for both duplicates to have
  their destinations calculated before either is added to the database. This
  means that neither will detect a duplicate at the time of the move/copy.
- Even if the above issue is resolved, it will be the case that only the second
  album to be imported will have a uniquifying string added. If we want to add
  the string to the old album, we'll need to explicitly move it.
Also, documentation on this feature is still forthcoming.
2012-04-24 21:58:06 -07:00
Adrian Sampson
8f128876e2 %aunique: use a single field instead of a sequence
For a less cumbersome uniquifying string, only a single field value is now used
instead of a prefix of a list of fields. The old semantics had two problems that
made it both unnecessary and insufficient:
- In the vast majority of cases, a single field suffices (year OR label OR
  catalog number, for example) and forcing the string to include many identical
  fields is unnecessary.
- If the albums are very similar, a prefix may be insufficient; a better
  solution may be found with an arbitrary subset. (Of course, we can't afford to
  search the whole power set.)
So we're going with a single field for now. This should cause far less
confusion.
2012-04-24 21:15:50 -07:00
Adrian Sampson
8fe3738710 default arguments to %aunique{} (#190) 2012-04-24 20:34:51 -07:00
Adrian Sampson
938a9b2f96 catalognum is an album-level field 2012-04-24 20:03:11 -07:00
Adrian Sampson
f20fbede5e sanitize output of %unique 2012-04-20 10:17:19 -07:00
Adrian Sampson
2a38fcce6a typo in inline plugin docs 2012-04-20 09:58:02 -07:00
Adrian Sampson
e017a95154 docs: clarify single-quote comment is for Unix 2012-04-19 10:24:30 -07:00
Adrian Sampson
9c10d8163b back out readline addition (#376) 2012-04-19 10:21:39 -07:00
Adrian Sampson
7736e279fe typo in changelog for --noincremental 2012-04-15 21:44:36 -07:00
Adrian Sampson
c98aea9973 Merge pull request #31 from phmongeau/master
importfeeds plugin: use os.path.expanduser
2012-04-15 21:43:24 -07:00
Philippe Mongeau
97e202e015 importfeeds: use expanduser on feeds_dir 2012-04-15 21:18:38 -04:00
Adrian Sampson
a64dea25b2 docs for @djrtl's changes (#30) 2012-04-15 14:24:52 -07:00
Adrian Sampson
d3b9d9eaf8 Merge pull request #30 from djrtl/upstream
changes from @djrtl
2012-04-15 13:45:04 -07:00
Matteo Mecucci
594dca3529 Added the shortcut -I for --no-incremental. 2012-04-15 19:10:52 +02:00