Commit graph

418 commits

Author SHA1 Message Date
Adrian Sampson
0d762cd269 first half-attempt at a flexible attribute schema
This uses two tables, item_attributes and album_attributes, as key/value
tables for the respective entities. Plugins register fields, at which point
they are magically materialized as properties on Items (Albums are not done).
This currently supports adding and modifying these fields but not retrieving
them (which will need some sort of join).
2013-02-26 13:35:26 -08:00
Adrian Sampson
e0bb3b5cd0 original_{year,month,day,date} fields (GC-441) 2013-02-08 13:28:51 -08:00
Adrian Sampson
d4ddfd1091 look up max filename length automatically 2013-02-08 11:02:29 -08:00
Adrian Sampson
f652662d5b configurable max filename length 2013-02-08 10:54:19 -08:00
Adrian Sampson
b9cb3980c2 path_sep_replace config option
I also took this opportunity to move and rename util.santize_for_path to
library.format_for_path, which was long overdue.
2013-02-08 10:51:33 -08:00
Adrian Sampson
1fe36057b0 Python style and legibility cleanup for #92 2013-02-05 11:34:17 -08:00
root
e730e18b62 reverted de-couling of album.genre and item.genre 2013-02-05 08:30:10 +01:00
Peter Schnebel
bd7303459e removed debug messages (i should really use git more) 2013-02-04 21:47:09 +01:00
Peter Schnebel
4df9521007 experimental track / album / artist based genre stuff per item 2013-02-04 20:24:22 +01:00
Dang Mai
5debf9f1f4 Add lib param to database_change event 2013-01-29 22:06:54 -05:00
Dang Mai
afae030477 Add database_change event 2013-01-29 20:49:57 -05:00
Adrian Sampson
7a410f636b happy new year
For future reference, this command did the trick:
ack -l 'Copyright 201' | xargs perl -pi -E 's/Copyright 201./Copyright 2013/'
2013-01-11 10:43:41 -08:00
Adrian Sampson
e17cd6beba merge lots of work on the stable branch 2012-12-12 19:14:30 -08:00
Adrian Sampson
128a881bb4 GH-69/GC-450: docs, changelog, simplification 2012-12-05 09:10:07 -08:00
jizz
fe1b40f7d2 minor tweak 2012-12-05 11:58:10 +11:00
jizz
12aaa2ee34 updated art_destination
art_filename now acceptable as a string or a Template
2012-12-05 11:05:12 +11:00
jizz
6b7b54062f Update beets/library.py
Fix for Issue 450: Expand templates in art_filename config option
2012-12-04 16:25:18 +11:00
Adrian Sampson
a8cf42d05b echonest_tempo: changelog + doc fixes + print fix 2012-12-02 16:25:45 -08:00
Adrian Sampson
eef87c2189 truncation incorporates extension length (GC-461) 2012-11-27 16:54:50 -08:00
Adrian Sampson
953291f736 truncate bytes instead of unicode (GC-422) 2012-11-27 16:43:57 -08:00
Adrian Sampson
7158c01ff8 clean up outdated FIXMEs 2012-10-27 18:47:04 -07:00
Adrian Sampson
99e36d870e send "failed reading file" message to debug
This message was being logged as an error every time MediaFile failed to parse a
file. But this is not actually an error -- the importer uses FileTypeErrors to
determine whether a file is music or not. This resulted in error logs for every
album art file, .m3u, etc. in the imported directory. Verbose output is a better
home for this message.
2012-10-26 21:04:18 -07:00
Adrian Sampson
dcb9ad7373 fix several non-unicode logging statements
A user reported a problem with one of the logging statements where .format()
tried to convert a Unicode string to bytes because the log message was '', not
u''. As a rule, we should ensure that all logging statements use Unicode
literals.
2012-10-24 15:14:33 -07:00
Adrian Sampson
91ad913399 #62: simplify list (and random) code
With the new centralized print_obj function, we can greatly simplify the code
for the list command. This necessitated a couple of additional tweaks:

- For performance reasons, print_obj can now take a compiled template. (There's
  still an issue with using the default/configured template, but we can cross
  that bridge later).
- When listing albums, $path now expands to the album's item dir. So the format
  string '$path' now exactly corresponds to passing the -p switch.

As an added bonus, we can now also reduce copypasta in the random plugin (which
behaves almost exactly the same as list).
2012-10-20 21:10:39 -07:00
Adrian Sampson
b58e0ed7fc Merge pull request #60 from mk-fg/dont_update_mtime_for_different_path
library: don't set/update item mtime if read-path is passed to read()
2012-10-20 17:05:34 -07:00
Adrian Sampson
b9cc206093 changelog & cleanup for pull request #59 2012-10-20 16:57:56 -07:00
Mike Kazantsev
609e57f0a0 library: don't set/update item mtime if read-path is passed to read() 2012-10-20 20:10:29 +06:00
Mike Kazantsev
12cae9ee93 library: log path, reading of which has raised an exception 2012-10-20 20:07:27 +06:00
Adrian Sampson
3a4e1ca4f7 replaygain: add fields to Item
This has been a long time coming, but we now finally keep track of ReplayGain
values in the database. This is an intermediate step toward a refactoring of the
RG plugin; at the moment, these values are not actually saved!
2012-10-17 20:28:24 -07:00
Jakob Schnitzer
e273f9dfa9 Fix a UnicodeDecodeError when using path in templates 2012-10-09 19:11:09 +02:00
Adrian Sampson
c056467c5d friendly error message in Item.write (GC-437) 2012-09-17 10:36:48 -07:00
Adrian Sampson
ef248576f0 bpd: fix crash w/ unicode extensions (GC-439) 2012-09-17 10:24:34 -07:00
Adrian Sampson
dc054907d5 fix non-string value matching in SubstringQuery 2012-09-09 12:17:13 -07:00
Adrian Sampson
90b3dba085 fix match() on RegexpQuery for non-string values 2012-09-08 16:24:39 -07:00
Adrian Sampson
6200f0a4c8 scrub: remove all types of tags 2012-08-24 15:39:13 -07:00
Adrian Sampson
269a77c9e1 fix matching Unicode pathnames in queries 2012-08-23 18:08:31 -07:00
Adrian Sampson
07d00da825 album-only field queries; ^$ match empty string 2012-08-17 10:54:30 -07:00
Adrian Sampson
30ac59f3d2 allow $path in "beet list -f" templates 2012-08-16 09:00:55 -07:00
Adrian Sampson
1f5ae6600b warning when using unrecognized fields in queries 2012-07-25 15:41:22 -07:00
Adrian Sampson
3661f261b6 tiny operator simplification 2012-07-24 16:29:23 -07:00
Adrian Sampson
70000ec4e4 move MBCS check to bytestring_path
This should be used in *every* filename conversion, not just the destination
generation. Also required a change to sorted_walk (erroneously didn't use
syspath).
2012-07-17 11:45:44 -07:00
Adrian Sampson
44459f88d0 Windows: represent paths as UTF-8 internally
When we store paths in the database, we always use bytestrings for consistency.
But on Windows, these paths are converted back to Unicode before they reach the
FS API. This means that the codec used internally is immaterial.

However, we were naively using sys.getfilesystemencoding() for this internal
representation. On Windows, this is MBCS, a broken encoding that can't represent
all of Unicode. This change replaces that with UTF-8, a "real" codec.

The decoding bit now tries UTF-8 and falls back to MBCS for compatibility with
existing databases. The reality, however, is that existing databases may not
work with this change -- a byte string may represent something different in
UTF-8 from what it represents in MBCS. So users should recreated their DBs if
anything goes wrong.
2012-07-17 10:54:47 -07:00
Adrian Sampson
d97f13a899 pypy-compatible sqlite3 invocation 2012-06-24 13:30:36 -07:00
Adrian Sampson
073ee14e56 fix broken matching of path format queries (#405)
A bug in the shlex module with Unicode strings made these queries unparseable
and thus match every track.
2012-06-23 17:18:28 -07:00
Adrian Sampson
b487001c9b exclusive database access (GC-399)
This is the crux of the matter. This new lock synchronizes accesses to the
database itself, allowing only one thread to have transactions active at a time.
In effect, this makes sure that beets only has one SQLite transaction active at
a time (and is very conservative in this effort; no read sharing is allowed
either). This prevents all contention in SQLite and hides the pathological
HAVE_SLEEP=0 behavior.
2012-06-08 11:34:54 -07:00
Adrian Sampson
5d6e9b387a synchronize access to mutable shared maps (GC-399)
We now properly synchronize access to _tx_stacks and _connections, which can be
concurrently mutated by different threads. This way I don't have to worry about
GIL semantics: DRF => SC!
2012-06-08 11:24:16 -07:00
Adrian Sampson
00c47b6811 library has per-thread transaction stacks (GC-399)
The Library object is now (almost) safe to share across threads. Per-thread
resources are now automatically managed internally. There is no longer any need
for the _reopen_lib hack to get multiple copies of the Library object.
2012-06-08 11:09:45 -07:00
Adrian Sampson
d88afbad11 library maintains per-thread DB conns. (GC-399) 2012-06-08 10:49:47 -07:00
Adrian Sampson
711a1c1113 apply artist credits & add to database (GC-286) 2012-05-19 16:13:15 -07:00
Adrian Sampson
13995201a1 human-readable filesystem errors (#387) 2012-05-18 15:16:38 -07:00
Adrian Sampson
f6b37d2c8c remove with_statement __future__ imports
This is the first of several commits that will modernize the beets codebase for
Python 2.6 conventions. (Compatibility with Python 2.5 is hereby abandoned.)
2012-05-13 20:39:07 -07:00
Adrian Sampson
6ce08c4ce6 merge 2012-05-08 11:59:41 -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
5ebb61bab7 moving import (#266): move album art files 2012-05-03 17:08:52 -07: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
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
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
Matteo Mecucci
f4a0595b32 Fixed the regexp function used with sqlite3. 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
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
251026b759 add a new batch of metadata fields
The new fields are:
ALBUM: mb_releasegroupid asin catalognum script language country albumstatus
media albumdisambig
TRACK: disctitle encoder
These are not yet parsed from MusicBrainz responses (just added to MediaFile
and the database).
2012-04-04 00:52:57 -07:00
Adrian Sampson
ffa2402ff4 revamp default character substitutions
There's no longer a distinction between Unix and Windows substitutions. Enough
users reported problems with Windows-forbidden characters on Samba shares that
it seems appropriate to make all filenames Windows-safe, even on Unix. Users who
really want those additional characters (<>:"?*|\) can re-enable them via the
"replace" option. Nobody has complained about beets being *too* conservative.

This also adds sanitization of control characters, which is an all-around good
idea, and the substitution now runs in the Unicode (rather than byte) domain.
2012-04-03 14:22:38 -07:00
Adrian Sampson
de6530f4a5 acoustid ID and fingerprint stored/tracked (#332) 2012-04-01 18:22:42 -07:00
Adrian Sampson
781c26ffd0 normalize to NFC on non-Mac platforms (#367) 2012-03-27 10:44:11 -07:00
Adrian Sampson
823e36ad01 normalize new filenames to with NFD 2012-03-26 12:14:30 -07:00
Adrian Sampson
3c4d8500e5 sort by sort names 2012-03-25 17:35:07 -07:00
Adrian Sampson
12998de8ee mark album artist sort as an album field 2012-03-25 17:13:12 -07:00
Adrian Sampson
2f1ac61d4f track and album artist sort names (GH-25, GC-77)
Previously, there was just an "artist sort name" field -- now there's a
corresponding sort name for both track artists and album artists. I also made
the names shorter (artist_sort and albumartist_sort).
2012-03-25 17:02:52 -07:00
Paul Provost
1e4f2d555f Merge branch 'master' of https://github.com/sampsyo/beets 2012-03-24 17:25:26 -04:00
Adrian Sampson
06f137bff9 %unique path function
Generates disambiguating strings to distinguish albums from one another. To be
used as the basis for a simpler path field, $unique, as a default disambiguator.
2012-03-22 18:04:06 -07:00
Adrian Sampson
8fad15263b reorganize default template functions into class
Using a class wrapper allows additional context to be provided to the functions.
Namely, we can now provide the Item itself to the function, so %foo{} could
conceivably do something useful even without arguments. This will be used for
the upcoming %unique function.
2012-03-22 17:08:22 -07:00
Paul Provost
68952209d5 Added artist sort name
- MP3 tag saved
- Available template field as $artist_sort_name
2012-03-10 18:51:48 -05:00
Adrian Sampson
bb4be3a303 lower case extensions in destination (#331) 2012-01-31 15:11:19 -08:00
Adrian Sampson
337e2556a6 sanitize path components from plugins (#315) 2012-01-30 16:53:05 -08:00
Adrian Sampson
fe33926038 add new audio properties to library/DB
$samplerate now expands to "##kHz" in path formats.
2012-01-27 16:04:51 -08:00
Adrian Sampson
979c33a0b1 fix substring pattern match when value is None 2012-01-06 10:36:34 -08:00
Adrian Sampson
9920cc482c add "scrub" plugin (#280)
--HG--
rename : beetsplug/embedart.py => beetsplug/scrub.py
rename : docs/plugins/embedart.rst => docs/plugins/scrub.rst
2012-01-02 14:03:28 -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
112d0f5452 uniquify conflicting filenames (#182) 2011-12-19 22:52:13 -08:00
Adrian Sampson
8fde981b1d add asciify function 2011-12-19 19:41:09 -08:00
Adrian Sampson
b493bc7004 configurable pathname substitution (#115) 2011-12-19 18:37:35 -08:00
Adrian Sampson
91901fc379 plugin-extensible path format fields (#169) 2011-12-17 21:29:15 -08:00
Adrian Sampson
f1ebc82a55 plugin hooks for template functions (#231) 2011-12-16 11:56:40 -08:00
Adrian Sampson
255fbf6c41 add a small set of default path functions (#231) 2011-12-15 14:27:59 -08:00
Adrian Sampson
3c99e54174 switch out string.Template with new template parser (#231) 2011-12-15 11:53:58 -08:00
Adrian Sampson
6eaf3f96ae don't include path queries when querying albums 2011-12-07 16:52:38 -08:00
Adrian Sampson
348eb2beff don't update mtime when moving
This is incorrect when the file was out-of-sync when moved. A possible approach
in the future could check whether the old mtime was up to date and, in that case
only, keep it up to date with the new filename.
2011-12-07 16:38:38 -08:00
Adrian Sampson
8736d359c6 "timeout" config value (#261) 2011-12-04 18:46:35 -08:00
Adrian Sampson
b9d6928278 consistency policy for DB mtimes (#227) 2011-12-03 17:18:51 -08:00
Adrian Sampson
d805401b23 simplifications afforded by eager result iterators (#261) 2011-11-27 22:35:19 -08:00
Adrian Sampson
bcc348f018 make result iterators query the database eagerly (#261)
Previously, ResultIterators would query the database lazily. Specifically, they
would only fetch a row from the underlying cursor when an Item was pulled from
the iterator. This was a performance optimization. However, it was causing
endless headaches due to SQLite's locking policy: as long as the cursor is
"open", it holds a reader lock. This led to many hard-to-diagnose problems when
trying to acquire a writer lock. This solution may require a little more memory,
but it should put an end to this kind of bug for good.
2011-11-27 22:29:32 -08:00
Adrian Sampson
78dca315d4 slightly clean up mtime feature; changelog mention 2011-11-22 00:11:45 -08:00
Jos van der Til
2c81ee736c Implemented file modified time tracking to beets.
Only files which were modified after beets checked them will be checked again.
Implements feature request #227

--HG--
extra : transplant_source : K%F1d%C5%B1%1F%CA%AB%95ck%8C%AC%25m%F0%26%E4%9DB
2011-11-21 19:51:16 +01:00
Adrian Sampson
af98a2fb01 move/copy album art along with items automatically (#229) 2011-09-15 17:26:12 -07:00
Adrian Sampson
c67f88bccb final refactoring: lib.move() now affects DB 2011-09-15 16:38:36 -07:00
Adrian Sampson
5d3796b404 further move() refactoring: file manipulation on Item 2011-09-15 16:22:47 -07:00
Adrian Sampson
e8b8cb179f refactor: move() is a method on Library (not Item) 2011-09-15 16:15:53 -07:00
Adrian Sampson
94569a774e moving/copying fails when destination exists (#230) 2011-08-28 18:25:38 -07:00
Adrian Sampson
45eeea343e destination option for "beet move" (also tests) 2011-08-05 12:19:34 -07:00
Adrian Sampson
2c56fd22f2 fix replacement of in-library items 2011-08-04 16:14:07 -07:00
Adrian Sampson
248bccf951 move, rather than copying, when re-importing 2011-08-04 14:08:11 -07:00
Adrian Sampson
f54ace110c allow "null" album art setting (when it's already in place) 2011-08-04 12:19:30 -07:00
Adrian Sampson
e84c3e7abd consolidate update command, removing album-munging logic 2011-08-02 23:37:55 -07:00
Adrian Sampson
fdf697dc90 merge in wlof's "update" command 2011-08-02 20:43:21 -07:00
Adrian Sampson
e1d9e6bb45 prune directories when moving 2011-08-02 16:01:11 -07:00
Adrian Sampson
a367b2764d first attempt at command-line modification command (#56) 2011-08-02 13:59:33 -07:00
wlof
2495227724 Detect deleted files
Display detected modifications
2011-08-02 21:20:23 +02:00
wlof
fca60c510e update feature (issue 107) 2011-08-01 04:59:20 +02:00
Adrian Sampson
a448879ca9 infer album artist or VA for as-is imports (#161) 2011-06-29 10:36:07 -07:00
Adrian Sampson
7f206baae5 automatically detect path queries containing / (finishes #146) 2011-06-26 00:25:39 -07:00
Adrian Sampson
fcc2744ac5 use separate shell arguments for queries to preserve whitespace 2011-06-26 00:12:45 -07:00
Adrian Sampson
f3ac19622a a couple of fixes for path queries 2011-06-25 14:23:32 -07:00
Adrian Sampson
1006a9a221 merge/fixup derwin's label patch 2011-06-25 13:04:19 -07:00
Adrian Sampson
6ca995f4e7 new path queries only match prefixes 2011-06-14 23:19:18 -07:00
Adrian Sampson
efa704f61e fix crash when using an item-only field in an album query 2011-06-13 21:27:13 -07:00
Adrian Sampson
6291a71a3c fix "mpdupdate runs twice" bug 2011-05-23 09:45:34 -07:00
Adrian Sampson
39dac9a28d "beet ls -p" outputs paths 2011-05-21 12:40:36 -07:00
Adrian Sampson
e5e11503ad a couple more cursor closings 2011-05-05 18:26:29 -07:00
Adrian Sampson
8341dee3ab reorder items() and albums() parameters to reflect common use 2011-05-05 17:20:24 -07:00
Adrian Sampson
151df84150 remove unused artists() and get() methods on library 2011-05-05 17:11:54 -07:00
Adrian Sampson
3e90579a6c BPD uses new VFS as a backend (#131) 2011-05-05 17:00:05 -07:00
Adrian Sampson
926032fd07 add simple virtual filesystem construction
--HG--
rename : test/test_art.py => test/test_vfs.py
2011-05-05 14:19:47 -07:00
Adrian Sampson
d8ae325dcb stop being sloppy about close()ing SELECT cursors (#170) 2011-05-05 10:06:41 -07:00
Adrian Sampson
e588638e8e fix typo uncovered by pylint 2011-04-28 22:36:29 -07:00
Adrian Sampson
a0e0104d83 clean up some log handler addtions 2011-04-15 12:30:12 -07:00
Adrian Sampson
6cfb862906 conditional deletes in some cases (suggested in #170) 2011-04-13 20:23:33 -07:00
Adrian Sampson
7503c1174a more natural-looking queries for comp field
You can now use "comp:true" or "comp:yes" as well as "comp:1".
2011-04-10 22:55:25 -07:00
Adrian Sampson
e669868896 move a bunch of functions to util 2011-04-10 21:48:05 -07:00
Adrian Sampson
11c5b15c8d fix copying destination for full-album imports 2011-04-10 10:57:13 -07:00
Adrian Sampson
d63a9fd188 singleton: queries 2011-04-09 16:13:12 -07:00
Adrian Sampson
b28ef722a5 singleton path format 2011-04-09 14:50:48 -07:00
Adrian Sampson
61ef980797 $albumartist falls back to $artist (#166) 2011-04-09 12:36:52 -07:00
Adrian Sampson
2dfae9721d fix typo in dead code 2011-04-05 18:43:47 -07:00
Adrian Sampson
c41c9f38f8 add a missing _syspath call 2011-03-23 18:31:44 -07:00
Adrian Sampson
d16311acb6 only prune directories below the library directory 2011-03-23 17:12:07 -07:00
Adrian Sampson
1b6910ac6a move directory-pruning to item's remove() method 2011-03-23 17:03:21 -07:00
Adrian Sampson
7f7c45b252 refactoring, tests, NEWS note on wlof's directory-pruning patch 2011-03-23 16:53:24 -07:00
Adrian Sampson
f69f69cecf merge in some fixes from wlof's repository 2011-03-23 15:50:11 -07:00
Adrian Sampson
096816cba7 path formats can now be specified by album type 2011-03-22 20:09:27 -07:00
wlof
c2d2914178 fix for issue 73 (http://code.google.com/p/beets/issues/detail?id=73) 2011-03-19 19:48:55 +01:00
wlof
1a3769a326 corrected a bug where artist was being used instead of albumartist in
albums default queries
2011-03-19 01:48:33 +01:00
Adrian Sampson
0d869340ec fixes for album artist inference
- Inference must be enabled explicitly with the "infer_aa" flag. It does not
  happen transparently.
- Infer both artist and artist ID.
- Fixed a bug where only the database row was using the inferred data, not the
  returned data structure.
- Added tests.
2011-02-18 12:17:22 -08:00
Adrian Sampson
adefff10dd use super() instead of hard-coding superclass name 2011-02-18 11:30:01 -08:00
Ozzi Lee
82e5f0cfa2 Make sure album.albumartist is set when adding items to a Library.
If the track.albumartist isn't set on the first track, then the
album.albumartist is set to the track.artist.
2011-02-18 06:17:35 -06:00
Ozzi Lee
95a456acfc Use object.setattr in BaseAlbum __init__ method.
BaseAlbum needs to use object.setattr in its __init__ method, because
it overrides __setattr__.
2011-02-02 13:09:06 -06:00
Adrian Sampson
d16e972088 fix count queries over empty results 2011-01-24 15:41:38 -08:00
Adrian Sampson
66b3e5675c update default path formats; make $artist fall back on $albumartist
The default path formats now include both a "default", which is the same as
before but now uses $albumartist instead of $artist, and a "comp" path, which
uses a Compilations directory. Old paths are supported as-is by letting $artist
refer to either a track artist (when present, as it is in all old library
tracks) or album artist (when the track artist isn't present, as is the case
with most albums imported now).
2011-01-24 10:14:19 -08:00
Adrian Sampson
0c24376e6a migration of album table's artist field to albumartist; fix ls -a 2011-01-23 22:49:52 -08:00
Adrian Sampson
75e0924832 move _sanitize_for_path to module namespace 2011-01-23 19:59:41 -08:00
Adrian Sampson
6ade5635e1 light refactoring and renaming for patch
Changed mb_albumtype to albumtype.
Changed album_artist to albumartist.
Reinstated subset relationship between album fields and item fields.
2011-01-23 19:49:48 -08:00
Adrian Sampson
342c360285 apply jonathan.buchanan's compilation patch from issue #48 2011-01-23 18:41:35 -08:00
Adrian Sampson
3bfae3b78c fix permissions on album art (#130) 2011-01-21 17:57:58 -08:00
Adrian Sampson
93594bac5a convert import paths to absolute; more _syspath calls
Again, patch mainly due to jonathan.buchanan.
2011-01-20 00:13:00 -08:00
Adrian Sampson
4359845a01 prohibit trailing spaces in Windows filenames 2011-01-19 13:17:54 -08:00
Adrian Sampson
5904852e4b use "long filename" support instead of short truncation on Windows (#127)
(Patch by jonathan.buchanan. Thanks!)
2011-01-19 13:14:54 -08:00
Adrian Sampson
ab35db7b7a truncate path components to 30 characters on Windows (work around #120) 2011-01-18 20:13:57 -08:00
Adrian Sampson
a23fe1c37f don't copy permissions of imported files 2011-01-01 12:12:55 -08:00
Adrian Sampson
87500cf5c4 fix copying when file is already where it needs to be 2011-01-01 10:49:16 -08:00
Adrian Sampson
7cf10d13e5 fix escaping of / in paths on Windows 2010-09-27 16:56:40 -07:00
Adrian Sampson
0b0db17743 normalize relative paths as they opened 2010-09-22 21:40:12 -07:00
Adrian Sampson
d9383aceb1 merge with events branch 2010-09-13 21:46:03 -07:00
Adrian Sampson
fba874932c beginnings of last.fm fingerprinting plugin for autotagger
This required the introduction of a track_distance method on plugins. We'll also
need to add an album_distance method as well as a mechanism for extending the
search routine (so we can search for albums in MusicBrainz even when they have
no tags). This commit also adds the '-v' flag for printing debug logs (something
we should do more of).
2010-09-13 21:14:49 -07:00
Adrian Sampson
a384aa948b add a couple more events: "library saved" and "import finished" 2010-08-30 12:59:51 -07:00
Adrian Sampson
633b97b302 decode unicode art paths from legacy databases 2010-08-06 10:44:00 -07:00
Adrian Sampson
898b4bd24e destination now uses album values when available
When computing track destination paths, we now look for album-level values when
they're available. This has the effect of making albums go into a single
directory even when their tracks have heterogeneous metadata. We will need to
revisit this once we start explicitly supporting non-album tracks.
2010-08-06 10:36:17 -07:00
Adrian Sampson
181949d1a3 _sanitize_path now uses a non-unicode regex 2010-08-06 10:01:49 -07:00
Adrian Sampson
d1c6448da8 album art paths now stored in blobs in database 2010-08-06 09:55:21 -07:00
Adrian Sampson
2a91ddf40b destinations now return bytestring paths 2010-08-05 13:36:50 -07:00
Adrian Sampson
2950ae1bf6 all paths are now bytestrings (not unicode)
In the end, after all of this, it turns out that we basically need to abandon
the temptation of dealing with unicode paths altogether. The POSIX filesystem
API has no notion of unicode and is very much a bytes-only interface. This
means that undecodable pathnames are a reality we must deal with. This new
approach stores all paths as buffers (blobs) in SQLite and -- as transparently
as possible -- presents them as str objects to the Python code. Legacy
databases will have their paths automatically encoded into str objects, and
will lazily have their unicodes in the database replaced with buffers.
2010-08-05 13:26:30 -07:00
Adrian Sampson
eff42d2136 revert a silly decision about hard-coding latin1
Decoding a path as latin1 when it appears undecodable is a non-solution
because, the next time we want to actually *use* the path, it will be encoded
differently and the file won't be found. Death to undecodable paths!
2010-08-04 12:10:08 -07:00
Adrian Sampson
0c87e2470a deal with invalid pathname encodings
So. Apparently, os.listdir() will *try* to give you Unicode when you give it
Unicode, but will occasionally give you bytestrings when it can't decode a
filename. Also, I've now had two separate reports from users whose filesystems
report a UTF-8 filesystem encoding but whose files contain latin1 characters.
The choices were to (a) switch over to bytestrings entirely for filenames or
(b) just deal with the badly-encoded filenames. Option (a) is very unattractive
because it requires me to store bytestrings in sqlite (which is not only
complicated but would require more code to deal with legacy databases) and
complicates the construction of pathnames from (Unicode) metadata. Therefore,
I've implemented a static fallback to latin1 if the default pathname decode
fails. Furthermore, if that also fails, the _sorted_walk function just ignores
the badly-encoded file (and logs an error).
2010-08-04 11:06:28 -07:00
Adrian Sampson
6b5edbeead path sanitation now removes ? 2010-07-30 15:27:53 -07:00
Adrian Sampson
2eb10e391a add "format" field to MediaFile for getting the file type
This allows using $format in your path format string, which is nice.
2010-07-21 23:01:32 -07:00
Adrian Sampson
6754155c71 Albums now have an internal cache of their values
This makes way more sense than fetching every metadata request from the
database. The performance of "beet ls -a" and the like should be drastically
better.
2010-07-21 16:04:59 -07:00
Adrian Sampson
cc3ec0d8aa albums() browse function now returns Album objects
As part of this, the BaseLibrary class was also adapted to include a notion of
albums. This is reflected by the new BaseAlbum class, which the Album class
(formerly _AlbumInfo) completely replaces in the concrete Library. The BaseAlbum
class just fetches metadata from the underlying items.
2010-07-21 15:02:08 -07:00
Adrian Sampson
7de294ba9f add get_item convenience function to fetch Items by id
The beetfs project uses this to quickly get paths for items when reading them.
2010-07-21 11:26:43 -07:00
Adrian Sampson
e9e90fa538 expand set of album metadata to include everything relevant 2010-07-15 11:22:36 -07:00
Adrian Sampson
7816b411ad simplified interface for add_album 2010-07-14 23:04:59 -07:00
Adrian Sampson
6b99e3f48d importer now takes album art config options and switch
(doesn't yet actually apply art)
2010-07-14 14:58:17 -07:00
Adrian Sampson
4f1b55f7a9 avoid long database locks by storing items at the end of AlbumInfo.move 2010-07-14 14:38:42 -07:00
Adrian Sampson
6a3c024005 add_art convenience function takes care of copying to destination 2010-07-14 14:28:54 -07:00
Adrian Sampson
304e4d6708 albums move and remove their items, manage album art 2010-07-14 14:19:51 -07:00
Adrian Sampson
19ded256cd albums query and modify their associated items 2010-07-14 13:24:11 -07:00
Adrian Sampson
3006f9953c beginnings of explicit album management 2010-07-14 12:40:25 -07:00
Adrian Sampson
722e0ea2b7 AlbumInfo implementation now uses opaque "ident" field (concretely: row id)
--HG--
extra : transplant_source : %F42%F7k%7F%23%3EY%8E1%C2%9B%B9%1DR%1C%28w%AEm
2010-07-13 21:22:55 -07:00
Adrian Sampson
5096a12052 basic (non-collected) implementation of albums table 2010-07-13 19:42:45 -07:00