Commit graph

207 commits

Author SHA1 Message Date
Adrian Sampson
cbd538de7b combine TempConfigTestCase and ExtraAsserts 2012-12-15 13:21:09 -08:00
Adrian Sampson
39cd1f6c63 switch from context manager to base class
Replaced temp_config context manager with TempConfigTestCase base class. This
lets us clean up even when a test fails.
2012-12-15 13:15:10 -08:00
Adrian Sampson
ed3a3d1937 confit-ify a bunch more tests 2012-12-14 14:21:06 -08:00
Adrian Sampson
ce166004cb use AlbumMatch/TrackMatch objects everywhere
This allows matches to indicate both missing and unmatched tracks in their
candidates and solves some of the spaghetti tuples that were passed around
during autotagging.
2012-07-01 16:33:48 -07:00
Adrian Sampson
11d4fb1abb move album art fetching to a plugin (fetchart) 2012-06-24 00:34:50 -07:00
Adrian Sampson
d88afbad11 library maintains per-thread DB conns. (GC-399) 2012-06-08 10:49:47 -07:00
Adrian Sampson
e00f15175a prune is a no-op when file exists
i.e., when moving a file that's already at its destination.
2012-05-30 16:39:47 -07:00
Adrian Sampson
86f513d4ab split apply_choice coroutine
This essential import pipeline stage is now two: one that applies metadata
changes and one that manipulates the filesystem. This will eventually allow
lastgenere to apply its changes before destinations are calculated.
2012-05-22 23:22:34 -07:00
Adrian Sampson
2b000c47a2 per_disc_numbering config option (GC-335) 2012-05-17 12:44:48 -07:00
Adrian Sampson
a6c1ad2235 reimporting with copying: copy external files 2012-05-17 11:42:58 -07:00
Adrian Sampson
429af42e14 use print_function __future__ import
All code should now use Python 3-style "print"s.
2012-05-13 21:08:27 -07:00
Adrian Sampson
b68e87b92c The Great Trailing Whitespace Purge of 2012
What can I say? I used to use TextMate!
2012-05-13 20:22:17 -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
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
6b696c842f cleanup and docs for import_move (GH-26, GC-266)
- Copying and moving are mutually exclusive. Moving overrides copying so the
  user only has to add one line ("import_move: true") to disable copying and
  enable moving in its place.
- Deleting is only possible when copying.
- Deprecating the "delete" option (moving is almost always better).
- Removed command-line switch for moving. It's somewhat "unsafe", so this
  removes some potential for accidental irreversible changes.
- Changelog & thanks.
- Update docs to refer to import_move instead of import_delete as the
  correct solution for ending up with only one copy of the file.
2012-04-10 13:41:24 -07:00
Domen Kožar
1af4f86c17 support move action when importing 2012-04-05 01:14:17 +02:00
Adrian Sampson
24cdf2a72e duplicate trumping: remove items & delete files
Based on the "remove_duplicates" flag on ImportTask, the apply_choices coroutine
now looks for duplicates (using an extended version of the _duplicate_check
functions) and removes items from the library. It also *deletes* files
associated with those items when they are located inside the beets library
directory. Files outside of the directory are left on disk (but their DB entry
is still removed). This should "do the right thing" in most cases -- again, this
is something we can add a config option for if it comes up.
2012-03-20 14:23:44 -07:00
Adrian Sampson
19b08f8e99 duplicate resolution callback function (#164) 2012-03-19 15:32:53 -07:00
Adrian Sampson
6d2df0e4bf import_delete: delete local album art (#242) 2012-02-15 16:46:23 -08:00
Adrian Sampson
ea95fa1373 album art fetcher tests 2012-02-15 16:35:28 -08:00
Adrian Sampson
153f52a6eb import_delete prunes empty imported directories (#243) 2012-02-09 15:06:33 -08:00
Adrian Sampson
5a0105b12c fall back to unittest2 (#275) 2012-01-31 15:25:09 -08:00
Adrian Sampson
c40081808a fix double-removal when re-importing with deletion
With import_delete enabled and performing a re-import (which moves files), the
former location of the file would be "deleted". This would lead to a "file does
not exist" error.
2012-01-06 21:58:17 -08:00
Adrian Sampson
d73c133a53 query-conditioned path formats (#210)
Also, Library.path_formats is now a list of pairs instead of a dictionary. (I
would have used an OrderedDict, but that was added in 2.7.)
2011-12-28 19:01:13 -08:00
Adrian Sampson
08b539a80e fix field inference w/ null first item (closes #14 on GitHub)
When a partial match is found, its first item (task.items[0]) may be None, and
_infer_album_fields would crash in this case. This solution walks through the
items list and finds the first non-None item.
2011-12-16 16:45:50 -08:00
Adrian Sampson
5965b37f51 skip (configurable) clutter filenames when importing 2011-11-13 17:14:40 -08:00
Adrian Sampson
95f38dbe52 "info dictionaries" replaced with AlbumInfo and TrackInfo 2011-10-23 14:12:13 -07:00
Adrian Sampson
607757edf1 -i/import_incremental to only import new directories (#99) 2011-08-09 12:09:36 -07:00
Adrian Sampson
2c56fd22f2 fix replacement of in-library items 2011-08-04 16:14:07 -07:00
Adrian Sampson
3efeb9a133 -L flag to import lets you re-import items matching query (#69) 2011-08-04 15:29:59 -07:00
Adrian Sampson
248bccf951 move, rather than copying, when re-importing 2011-08-04 14:08:11 -07:00
Adrian Sampson
3e75d262a8 correctly detect item existence when copying 2011-08-04 13:35:44 -07:00
Adrian Sampson
f3130152b1 don't count existing items/albums as duplicates (allowing update) 2011-08-04 12:04:22 -07:00
Adrian Sampson
58fb4392ee refactor duplicate tests to take the whole task as an argument 2011-08-04 11:51:17 -07:00
Adrian Sampson
7f4f477c32 remove old items/albums from database when re-importing items 2011-08-04 11:16:12 -07:00
Adrian Sampson
951e4eec86 fix VA inference for small (1-track) albums 2011-07-07 09:19:33 -07:00
Adrian Sampson
45383eced2 fix VA inference (needs to run before move step in "apply") 2011-07-07 09:13:37 -07:00
Adrian Sampson
a448879ca9 infer album artist or VA for as-is imports (#161) 2011-06-29 10:36:07 -07:00
Adrian Sampson
da6ee13159 fix singleton quiet imports 2011-05-21 16:53:01 -07:00
Adrian Sampson
a0ef39aba5 duplicate detection on adjacent albums/items now works (#156) 2011-05-05 10:20:23 -07:00
Adrian Sampson
65dac30e4d break album art and finalization into new stages (#168) 2011-05-03 13:12:23 -07:00
Adrian Sampson
7e89282053 duplicate detection for items 2011-04-19 16:40:40 -07:00
Adrian Sampson
df6b1abfd8 clean up vestiges of TRACKS choice for album tasks 2011-04-19 13:21:27 -07:00
Adrian Sampson
db6eb60e23 update tests for timid mode 2011-04-19 13:13:16 -07:00
Adrian Sampson
d1b7c8dc55 display track changes; some scaffolding for user query 2011-04-14 09:07:06 -07:00
Adrian Sampson
45eef6e876 rename -i flag to -s ("singletons") and fix behavior 2011-04-12 23:31:44 -07:00
Adrian Sampson
12854ad2ff very first stab at a working individual-item importer flow
"beet import -i" now tags items instead of albums. There are many loose ends to
tie up (marked with TODOs in the source):
- What to do about applying non-track metadata to matched tracks? Currently it's
  just left in place.
- Plugin autotag candidates for tracks.
- No user querying yet.
- Non-autotagged -i import are unimplemented.
And, on top of those:
- Need to remove the action.TRACKS workflow and replace it with an option that
  lets you jump over to the individual-track interface from the album tagger.
2011-04-12 23:22:03 -07:00
Adrian Sampson
a39a5b5d66 extremely preliminary item importer skeleton
(I shouldn't have started on this yet; the autotagger functionality isn't in
place yet. Going back and doing that now...)
2011-04-12 20:52:39 -07:00
Adrian Sampson
6f9c460837 slight tweaks to tests to let them run under nose 2011-04-12 15:06:27 -07:00
Adrian Sampson
85ddfa4381 relocatable test rsrc directory 2011-04-12 14:26:48 -07:00
Adrian Sampson
c03ec1ee1c add a multithreaded import test case 2011-04-12 14:11:43 -07:00
Adrian Sampson
89f33466e0 move non-autotagged import test (wasn't testing UI) 2011-04-12 14:09:17 -07:00
Adrian Sampson
584cc74a5c fix bug when "applying" sentinel 2011-04-11 08:21:36 -07:00
Adrian Sampson
a675988eb2 add and use fancy enumeration module 2011-04-10 22:10:33 -07:00
Adrian Sampson
c0467c3724 encapsulate importer configuration in an object 2011-04-10 18:56:42 -07:00
Adrian Sampson
23392525ec The Great Importer Refactoring
I'm shuffling around the feature-creeping importer code to keep it as
interface-agnostic as possible. The "importer" module now takes care of the
basic, increasingly complicated workflow while the ui.commands module is
relegated to containing actual user-interface stuff.
2011-04-10 18:12:47 -07:00