Commit graph

558 commits

Author SHA1 Message Date
Tom Jaspers
2ce38a254e Sort is case insensitive by default
Renamed "ignore_case" to more canonical "case_insensitive"
2015-04-18 10:25:28 +02:00
Tom Jaspers
18d262a59c Sort can ignore case if configured to do so
- Config option `sort_ignore_case`
- Default behavior was (and is) case sensitive
2015-04-17 14:24:56 +02:00
Adrian Sampson
56ca69d63d Fix #1404 by only writing _media_fields
This just makes "date" and "original_date" into ordinary flexible fields,
which is probably the way it should be.
2015-04-16 19:55:48 -07:00
Bruno Cauet
fa4d0b39a0 Item.read(): use int.bit_length()
Available now that py26 support's been dropped.
2015-04-01 15:49:19 +02:00
Bruno Cauet
e374830cca Path queries: use {norm,sys}path on path.
Finishes #1385.
2015-04-01 09:55:24 +02:00
Bruno Cauet
ad34642877 Improve path query parts detection: test existence
Detect path parts of a query with `PathQuery.is_path_query()` which
tests for `os.sep` presence AND query part existence.

Also fix a bug where "my_path/" would not get detected: colon absence would
make search for `os.sep` only happen in "my_path".

Fix #1385.
2015-03-30 13:08:14 +02:00
Bruno Cauet
265fa962eb Merge branch 'master' into thumbnails 2015-03-25 18:17:12 +01:00
Bruno Cauet
4bfa439ee1 database_change: send model that changed 2015-03-16 14:32:37 +01:00
Bruno Cauet
e789b04c9a Rename LibModel.format_config_key → _format_config_key
Fix #1346
2015-03-07 13:57:12 +01:00
Bruno Cauet
58b39f1000 Merge branch 'master' into subcommand-auto-format-path 2015-03-05 17:53:31 +01:00
Bruno Cauet
6234fee67d Option parser: add common options with a method
Add a new OptionParser subclass: CommonOptionsOptionParser, which
provides facilities for adding --album, --path and --format options. The
last one is quite versatile.

Update base commands (from beets.ui.commands) to use those.
2015-03-05 15:01:20 +01:00
Bruno Cauet
f14f47f059 Renamed list_format_* into format_* 2015-03-04 16:51:28 +01:00
Bruno Cauet
226a90d12a PathQuery: fix docstring 2015-03-02 08:51:59 +01:00
Adrian Sampson
31c7c4a877 Avoid a little global state (#1330)
For even clearer interaction with the environment.
2015-03-01 17:11:59 -08:00
Adrian Sampson
eec8d5d2be Doc rewording for #1330 2015-03-01 17:09:36 -08:00
Adrian Sampson
e14f28fdda Merge pull request #1330 from brunal/path-query-case-sensitivity
Fix path query case sensitivity

Conflicts:
	docs/changelog.rst
2015-03-01 17:01:45 -08:00
Bruno Cauet
9efcfbb8fa PathQuery: add 'case_sensitivity' param
- fully tested
- default value is platform-aware
2015-03-01 18:10:07 +01:00
Bruno Cauet
cb504ad163 library.parse_query_string: assert query is unicode 2015-03-01 15:01:27 +01:00
Bruno Cauet
6fc678e947 PathQuery: use substr() instead of instr()
substr() is only available in SQLite 3.7.15+, which is not available yet
on Debian stable, CentOS & co. Use substr() instead.
2015-02-18 18:52:22 +01:00
Bruno Cauet
7bcd3a383b Library.get_default_{item, album}_sort: static methods
See #1329.
2015-02-18 12:29:55 +01:00
Bruno Cauet
eae98aff0e PathQuery is case-{,in}sensitive on {UNIX,Windows}
PathQuery use LIKE on Windows and instr() = 1 on UNIX.

Fix #1165.
2015-02-17 13:09:04 +01:00
Bruno Cauet
39a6145d2d Plugin play uses default item sort in album mode
Offer library.get_default_{item,album}_sort for that purpose.
2015-02-16 12:26:23 +01:00
Adrian Sampson
494990a7a2 Merge pull request #1322 from tomjaspers/import-metadata-source
Set importer metadata source as field
2015-02-15 09:45:12 -08:00
Tom Jaspers
1555d3fe17 Importer metadata source is saved as flex attr
Saving a file "as is" keeps the data_source attribute unset
2015-02-15 17:46:00 +01:00
Adrian Sampson
296c2fc3de Merge pull request #1325 from brunal/master
Delete 'format' variables that shadow the built-in
2015-02-13 17:50:46 -08:00
Adrian Sampson
b80713ce5b Lambda-free reference to instance method
Amends 9cdd541943, the fix for #1326.
2015-02-13 17:37:55 -08:00
Tom Jaspers
9cdd541943 Error handling for 'filesize' field
- Logs a warning and returns 0 if getsize fails
- Add tests for this

Fix #1326
2015-02-13 12:24:21 +01:00
Bruno Cauet
d267741ff3 Delete 'format' variables that shadow the built-in
Also cleanup the 'the' plugin a bit: delete unused variables.

Relates to #1300.
2015-02-11 16:26:16 +01:00
Tom Jaspers
228e5c0432 Importer metadata source is set as a field
TrackInfo and AlbumInfo were already keeping track of this,
so just had to add it as an actual field to Item and Album

See #1311
2015-02-10 18:17:37 +01:00
Bruno Cauet
c6455c269f Merge branch 'master' into thumbnails
Conflicts:
	docs/changelog.rst
2015-02-09 16:08:29 +01:00
Bruno Cauet
f443e0bfc5 InvalidQueryArgumentTypeError does not extend InvalidQueryError
Places where InvalidQueryArgumentTypeError may be raised (i.e. all
current ones) may not know the query therefore it cannot be an
InvalidQueryError. The InvalidQueryArgumentTypeError is caught in
beets.library.Library._fetch() and an InvalidQueryError is then raised.

Improve #1290.
2015-02-09 15:44:49 +01:00
Bruno Cauet
54887e7655 Widen usage of InvalidQueryError
Replace previous InvalidQueryError with InvalidQueryArgumentTypeError
which extends the former as TypeError. However they lack context: the
query that caused the error.

Raise an InvalidQueryError when a shell-like expression cannot be parsed
by shlex.

Improve #1290.
2015-02-09 15:28:06 +01:00
Tom Jaspers
049aa2f297 Album path queries get constructed automatically
Ensures that relative path queries also work for -a mode
2015-02-06 10:38:41 +01:00
Tom Jaspers
80c96d98de Oops, flake8 formatting 2015-02-05 10:54:42 +01:00
Tom Jaspers
d8ebc71f98 Auto path detection: use clearer variable name
Per sampsyo's suggestion

See #1302
2015-02-05 09:47:30 +01:00
Tom Jaspers
5d49b24ea1 Automatic path query detection on album queries
- Path detection happens regardless of the model class
- PathQuery can now match flexattr (in fast-mode)

Fix #1302
2015-02-04 12:55:55 +01:00
Tom Jaspers
6ed0b2e0f3 Expose an Item's filesize as a field
- Update test-case for info to make sure the item's path is pointing to an actual file.

See #1291
2015-02-02 21:52:23 +01:00
Thomas Scholtes
51ab099145 Extend item.write() to embed images without changing item
Fixes #1241 and geigerzaehler/beets-check#14

Before, `embed_item` would add the images to the item and then call
`item.write()` to write the item data, including the image, to the
file. This would trigger `item.store()` in the `after_write` hook of
the check plugin. This would in turn try to persist the temporary
`images` attribute of the item, resulting in an SQL error.
2015-02-01 15:35:24 +01:00
Tom Jaspers
43e9044843 Duplicate album-import summary shows old/new filesize
E.g.:
Old: 13 items, MP3, 256kbps, 44:32, 101MB
New: 13 items, MP3, 320kbps, 44:31, 128MB

Fix #1291
2015-01-31 22:11:43 +01:00
Bruno Cauet
a72ae5991f Add send_art event for embedart and thumbnails
Album.set_art() sends a 'art_sent' event, with the album as a
parameter. embedart and thumbnails listen to that event, instead of
listening to 'album imported'. Consequences:
- 'embedart' and 'thumbnails' don't have to be after 'fetchart' on the
  plugins config line.
- embedart and thumbnails work event when a "beets fetchart" command is
  issued.
- if another plugin ever set art then embedart and thumbnails will "just
  work" with it.
2015-01-31 21:06:01 +01:00
Bruno Cauet
f284d8fad5 Handle shlex parse errors in query strings
Provide context: offending query string.
Update changelog.
Fix #1290.
2015-01-31 19:54:07 +01:00
Adrian Sampson
790c41a73d write: Do not try to write non-writable fields
Fix #1268.
2015-01-27 15:03:19 -08:00
Adrian Sampson
35ba6dedfd Tiny tweaks for #1247 2015-01-26 17:21:45 -08:00
Adrian Sampson
b8dab9cf9f Merge pull request #1247 from brunal/future
Use all __future__ imports in beets core

Conflicts:
	beetsplug/web/__init__.py
	test/test_embedart.py
2015-01-26 17:02:07 -08:00
Adrian Sampson
e3c127b159 Changelog and slight reformatting for #1269 2015-01-26 15:14:45 -08:00
Bruno Cauet
060c275fd3 Merge branch 'master' into libmodels-formatting
Conflicts:
	beetsplug/embedart.py
2015-01-26 10:17:15 +01:00
Bruno Cauet
3787f8a1dd Improve comments on formatting inner workings 2015-01-26 10:14:11 +01:00
Adrian Sampson
f2ed7b2373 Fix dumb naming mistake in e0cc68c 2015-01-25 13:18:26 -08:00
Adrian Sampson
e0cc68cf07 Tiny renaming for #1233 2015-01-25 13:03:28 -08:00
Bruno Cauet
73d200184b Implement __format__ on Album and Item
Cut the need to format manually (and often incorrectly) when logging by
implementing the __format__ magic method (see PEP 3101) on LibModel
(the parent class of Album & Item).

Based on a discussion in PR #1262
2015-01-25 19:41:49 +01:00