Commit graph

2077 commits

Author SHA1 Message Date
Adrian Sampson
614fbf20ca Tests for #1285: parameterize tests
Also remove an errant `print` and use `rb''` literals for regexes.
2015-01-31 11:24:27 -08:00
Bruno Cauet
e99adddb11 Importer: byte strings for multi-disc directories
Make regexes from raw byte strings and not unicode.
Update the tests.

Fix #1285
2015-01-31 15:40:49 +01:00
Bruno Cauet
557330e994 Fix open numeric ranges
Also improve InvalidQueryError message and update
NumericQuery._convert() docstring.

Fix #1288.
2015-01-31 14:21:32 +01:00
Tom Jaspers
927a53d59b Merge pull request #1281 from tomjaspers/configurable-colors
Colors are now user configurable.

Conflicts:
	beets/ui/__init__.py
	beets/ui/commands.py
2015-01-30 13:48:19 +01:00
Tom Jaspers
0947b8f286 Move color-lookup from config in to the colorize function
The mapping occurs lazily (and only once); now in a more pythonic style
2015-01-30 13:40:55 +01:00
Tom Jaspers
f483012183 Colorize is now to be called with the abstract color_name instead of the color.
E.g., `colorize('text_success', 'hello world')`

To ensure compatibility with 3rd party plugins, a valid color ('red') can still be passed,
but it will be logged.
2015-01-29 14:33:57 +01:00
Adrian Sampson
2496867daf Merge pull request #1272 from tomjaspers/master
Display clear error message when MusicBrainz is unreachable
2015-01-28 11:42:40 -08:00
Bruno Cauet
61c7c837ec Fix byte string management in ui.print_()
Joining byte strings → prefix ' ' with b
2015-01-28 11:13:54 +01:00
Adrian Sampson
790c41a73d write: Do not try to write non-writable fields
Fix #1268.
2015-01-27 15:03:19 -08:00
Bruno Cauet
154917bbd1 Add unicode() for Distance: show the distance 2015-01-27 12:16:40 +01: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
Adrian Sampson
94020963d2 Merge pull request #1269 from brunal/libmodels-formatting
Automatic formatting for Album & Item
2015-01-26 15:12:06 -08:00
Bruno Cauet
4aba4320e6 Rollback ui.print_() auto-conv of args to string
Since this raises problems the best is probably to maintain the base
behaviour: expect byte strings or unicodes.
2015-01-26 23:47:12 +01:00
Bruno Cauet
4e904c78af Simplify LibModel format management
Delete `ui.format_` and then `ui.print_obj`. Simply ensure that when
there is no format it defaults to '' = default format = config option.
2015-01-26 23:09:56 +01:00
Tom Jaspers
e7f3987b42 Centralize check and string literal into MusicBrainzAPIError.__init__ for #1190 2015-01-26 22:19:02 +01:00
Adrian Sampson
da019c75e3 Fix logging of MusicBrainz errors
Eager formatting was actually causing a failure because it looked like a
template string with an invalid substitution group.
2015-01-26 12:10:06 -08:00
Tom Jaspers
d3fce35481 Colors are user configurable
- Colors are mapped on to a dictionary using abstract names (e.g., text_success)
- Add `colors` option under `ui` to allow users to choose their own color scheme
- Move configuration option `color` from top-level to `ui`
- Show deprecation warning if top-level `color` configuration is used (but respect it)

Fix #1238
2015-01-26 17:24:32 +01:00
Tom Jaspers
67e1065229 Display clear error message when MusicBrainz is unreachable: "MusicBrainz not reachable"
Catch musicbrainzngs.WebServiceError before the general musicbrainzngs.MusicBrainzError
Fix #1190
2015-01-26 14:25:32 +01: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
Bruno Cauet
065cb59ce7 Restore show_change() logging: MatchInfo, not Item 2015-01-26 09:44:51 +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
Adrian Sampson
a10d9750a6 Merge pull request #1233 from pprkut/tracktotal
Make tracktotal an item-level field.
2015-01-25 13:02:31 -08:00
Bruno Cauet
8165dec985 Delete manual formattings of album & item 2015-01-25 21:32:22 +01:00
Bruno Cauet
62cd6e37aa Update ui.print_obj_(), add ui.format_()
Code now relies on `format()` for items and albums displaying/logging.
`ui.print_()` calls `unicode()` or `str()` on the strings so for most
usages calling `ui.print_(obj)` replaces `ui.print_(obj, lib, None)`.

Where there is a special format `ui.print_(format(obj, fmt))` is fine,
but when `fmt` can be None then one has to call
`ui.print_(ui.format_(obj, fmt))` -- which is what `ui.print_obj` now
does.
2015-01-25 21:07:03 +01: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
Adrian Sampson
1a48185b80 Changelog and style for #1260 2015-01-23 10:37:05 -08:00
Matthias Kiefer
b16898743d Fixed IndexError on reading embedded cover art with invalid cover type 2015-01-23 13:44:08 +01:00
Bruno Cauet
c2f8cb9983 Merge branch 'master' into future
Conflicts:
	test/test_plugins.py
2015-01-21 10:04:33 +01:00
Adrian Sampson
7e21c68487 Logging: pass through non-problematic values
9b83cef was a little too aggressive; we need most objects to go through
unconverted so '{0.title}' and such still work in format strings. This is now
just a targeted workaround for the case I encountered.
2015-01-20 16:28:42 -08:00
Adrian Sampson
9b83cef0de Handle encoding misfortunes in logging (#1248)
The beets loggers now, as proposed in #1044, do their utmost to avoid crashing
when logged values are not valid Unicode or Unicode-convertible. This came up
urgently when a `CalledProcessError` could not be logged with `'u{}'.format()`
(!!!) so we needed to some manner of conversion, but it should be possible to
log paths without `displayable_path`. In fact, it may be time to retire
`displayable_path` for the most part.
2015-01-20 16:17:59 -08:00
Adrian Sampson
293e2512ed Imported count: sensitive to plugin skips
Regression from b7125e4343 pointed out by
@mried.
2015-01-20 09:55:56 -08:00
Bruno Cauet
d6a4046245 Avoid stacking logger prefixes 2015-01-20 17:34:01 +01:00
Bruno Cauet
f263935a51 Prevent shlex.split from returning strange encodings 2015-01-20 16:57:20 +01:00
Bruno Cauet
132f5ba912 Fix bytes/str with unicodenazi 2015-01-20 16:41:18 +01:00
Bruno Cauet
438044c6ae Fix bytes/str with unicode-nazi
Further cleaning will require setting unicode_literals on plugins
2015-01-20 15:25:12 +01:00
Bruno Cauet
02d8e88ef1 Replace all mentions of 'str' with 'bytes' 2015-01-20 12:48:15 +01:00
Bruno Cauet
9c41c39913 Do __name__ comparison with bytes and not unicode 2015-01-20 12:03:57 +01:00
Bruno Cauet
dae1bf026f functemplate: delete try/except/print debug stmts 2015-01-20 11:52:27 +01:00
Bruno Cauet
2dab8e5fd6 Import unicode_literals in beets package 2015-01-19 21:41:33 +01:00
Bruno Cauet
6fff7a954c Import unicode_literals in beets.dbcore 2015-01-19 17:18:50 +01:00
Bruno Cauet
8dd7bf0f0b unicode_literals in beets.ui and beets.autotag
Well, that was easy!
2015-01-19 17:18:50 +01:00
Bruno Cauet
c8d24c748e Import unicode_literals in beets.util
The hardest conversio is (by far) functemplate. It will also reguire a
great length of adaptation for python3, since the grammar of the
language changes and several functions (such as ast.arguments and
ast.FunctionDef) take additional mandatory parameters that don't exist
in python2.
2015-01-19 14:53:05 +01:00
Heinz Wiesinger
c86a5f9d97 Make tracktotal an item-level field.
This fixes tracktotal being stored incorrectly for multi-disc releases
where the individual discs have a different number of tracks and
per_disc_numbering is enabled.
2015-01-19 13:02:21 +01:00
Bruno Cauet
90b388b775 Use __future__ imports but unicode_literals everywhere
Include import of __future__ features division, absolute_imports and
print_function everywhere. Don't add unicode_literals yet for it is
harder to convert.

Goal is smoothing the transition to python 3.
2015-01-19 12:25:16 +01:00
Frederik “Freso” S. Olesen
29739dbe04 Move autotag.mb.SEARCH_LIMIT to configuration.
Merge branch 'search-limit-in-config'

From pull request #1245 by @Freso.
2015-01-19 11:46:05 +01:00
Bruno Cauet
d5e3ff2f48 Improve repr(ConfigView): fix class name displayed
Use config.__class__.__name__ instead of "ConfigView" in __repr__().

Before:
>>> from beets import ui
>>> c
<ConfigView: root>
>>> c['foo']
<ConfigView: foo>

After:
>>> from beets import ui
>>> c
<LazyConfig: root>
>>> c['foo']
<Subview: foo>
2015-01-19 10:42:00 +01:00