Commit graph

4490 commits

Author SHA1 Message Date
Bruno Cauet
70ef96d565 Make list(ui.config) raise a TypeError
As per PEP234 (https://www.python.org/dev/peps/pep-0234/) if an object
has __getitem__() but not __iter__() then the former will be used to
build an iterable, invoking it with 0, then 1, ... until a KeyError is
raised. Lazy configuration makes it never happen, and list(config) runs
indefinitely, hogging all memory.

Implement __iter__(), which raises a TypeError, to solve that problem.
2015-01-19 10:35:32 +01:00
Adrian Sampson
f346853710 embedart: Do not use shell for subprocess
This avoids bugs when the filename contains spaces, etc.

Pinging @Kraymer: I gave this a brief test, but can you check whether I messed
anything up more subtly?

Came up when looking at #1241.
2015-01-18 16:25:23 -08:00
Adrian Sampson
909c96b060 embedart: Handle unparseable IM output (#1241) 2015-01-18 16:18:22 -08:00
Adrian Sampson
dc5a79e35c New import_task_created event
Part of #1186.
2015-01-18 15:37:48 -08:00
Adrian Sampson
f145e3b184 More comment cleanup
It has been a while since I have looked at these, and many of the FIXMEs no
longer make sense to me. Better to open issues if there's really something to
fix.
2015-01-18 14:58:08 -08:00
Frederik “Freso” S. Olesen
167abda752 Merge branch 'master' of https://github.com/sampsyo/beets
Conflicts:
	docs/changelog.rst
2015-01-18 23:05:23 +01:00
Frederik “Freso” S. Olesen
5060fc34ea Changelog for classical genres in lastgenre plugin. 2015-01-18 23:03:50 +01:00
Adrian Sampson
9352927a0f Merge branch 'master' of github.com:sampsyo/beets 2015-01-18 14:00:37 -08:00
Frederik “Freso” S. Olesen
6031cab891 lastgenre: Add "mass" to the classical genre tree. 2015-01-18 23:00:27 +01:00
Frederik “Freso” S. Olesen
61797e7a74 lastgenre: Add classical music.
Merge branch 'Horla-master'

From pull request #1240 by @Horla. Fixes #1239.
2015-01-18 22:54:19 +01:00
Adrian Sampson
90e4a78d94 Move archive logic to ImportTaskFactory
Also move sentinel generation there.
2015-01-18 13:46:56 -08:00
Horla
587ff39f22 Update genres-tree.yaml
Removing "classic"
2015-01-18 22:46:40 +01:00
Horla
8ed9e50e18 Update genres-tree.yaml
Changing "classic" to "classical"
2015-01-18 22:27:34 +01:00
Horla
3fdc5c936e Update genres.txt
Add classical subgenres
2015-01-18 22:13:36 +01:00
Horla
3a3150b740 Update genres-tree.yaml
Add classic genre with its subgenres
2015-01-18 22:11:01 +01:00
Adrian Sampson
b7125e4343 Centralize some counting in ImportTaskFactory
Part of a larger effort to simplify read_tasks for plugin interposition
(#1186).
2015-01-18 13:03:36 -08:00
Adrian Sampson
4169da3dd1 Fix "skipped N directories" message 2015-01-17 19:05:00 -08:00
Adrian Sampson
8a60875086 More docstring fixes in ImportTaskFactory 2015-01-17 19:01:15 -08:00
Adrian Sampson
b273be9d59 Event handlers can now return values
Part of #1186, which I hope to break into smaller pieces.
2015-01-17 18:39:56 -08:00
Adrian Sampson
c392932a92 Improve some docstrings 2015-01-17 18:30:47 -08:00
Adrian Sampson
6f2d9845b5 Add an assertion for summarize_items (#1232) 2015-01-17 14:20:53 -08:00
Adrian Sampson
bf02855ee1 Remove Beatport plugin (c.f. #1229) 2015-01-16 12:15:54 -08:00
Bruno Cauet
7c2d5f0948 Import beets.ui in discogs plugin
The discogs plugin uses beets.ui but did not explicitely import it,
which might cause it to crash when used in standalone.
2015-01-16 17:59:35 +01:00
Bruno Cauet
d2726e1c25 Fix mpdstats plugin config management
Fix #1228:
- remove erroneous calls to `self.config`
- always use `config['mpd']` and not `self.config` (which is
  config['mpdstats']) to match the doc
2015-01-16 11:08:24 +01:00
Adrian Sampson
6fb3b24c31 Merge pull request #1221 from brunal/crash-on-invalid-queries
Stop on invalid queries instead of ignoring them
2015-01-15 10:50:05 -08:00
Bruno Cauet
08c9ad43fa Document the new behaviour in docstrings & changelog 2015-01-15 11:55:42 +01:00
Bruno Cauet
f4b4847919 Rename exception: InvalidQuery → InvalidQueryError
Follow PEP8.
2015-01-15 11:47:35 +01:00
Bruno Cauet
b49cd3b73b Lyrics plugin: fix google backend
Give config on backends init so the Google backend can get the API key
and Engine Id.
Fix #1226
2015-01-15 11:28:04 +01:00
Adrian Sampson
c1ce71f35c smartplaylist: Fix album_query (fix #1225)
This is far less elegant and functional, but at least it is correct.
2015-01-14 22:00:30 -08:00
Adrian Sampson
38c5bb3666 Fix a docstring 2015-01-14 21:53:13 -08:00
Bruno Cauet
0c3675ada0 Fix replaygain: add 'log' to __init__ parameters 2015-01-14 16:17:20 +01:00
Bruno
27eee3829c Merge pull request #1222 from sampsyo/smartplaylist
Update smartplaylist logging & unicode management
2015-01-14 12:47:07 +01:00
Bruno Cauet
0d1fa80651 Smartplaylist: don't utf8-encode the name
A Template expression expects an unicode, not an utf8-encoded string.
Add a test for that.
2015-01-14 12:32:00 +01:00
Bruno Cauet
6408904a8c Smartplaylit: fix log format string
{0.name} → {0[name]} since the argument is a dict.
2015-01-14 12:15:44 +01:00
Bruno Cauet
3804eb5b52 Stop on invalid queries instead of ignoring them
So far an invalid query won't be applied:
    $ beet ls The Beatles year:196a
will be treaded as
    $ beet ls The Beatles
With this commit it stops beets, returns 1 and produces
    $ invalid query: u'196a' is not an int or a float
This applies to any querying and therefore on many command, plugins and
some configuration options.
Invalid queries exist on numeric fields and on regular expression usage.

Compile regular expression queries upon instantiation instead of upon
each match test.

The reporting can be improved (give more context). Fix #1219.
2015-01-14 11:28:50 +01:00
Adrian Sampson
ccd5e71519 Merge pull request #1218 from brunal/no-global-no-print
Clean plugins: no global, no print
2015-01-13 10:37:56 -08:00
Bruno Cauet
9a2a9b0144 smartplaylist: fix docstring 2015-01-13 18:53:47 +01:00
Bruno Cauet
ca91bc8920 mpdupdate: fix indent 2015-01-13 18:53:30 +01:00
Bruno Cauet
753388550e Clean PlexUpdate plugin
- no global variable
- use logging instead of prints
2015-01-13 12:36:16 +01:00
Bruno Cauet
de86b9b570 Clean MPDupdate plugin
- no global variable
- use logging instead of prints
- unicode logging
2015-01-13 12:30:40 +01:00
Bruno Cauet
a7beaa6d6e Clean & shorten smartplaylist code
- better log messages
- more idiomatic code: "X not in Y" instead of "not (X in Y)"
- shorten _items_for_query:
    - pre-detect whether it's album_query or query, hiding conf. spec to
      the function.
    - Let library.{items,album} parse the query string, therefore
      falling back to beets-level sort spec. if none is given in the
      query
2015-01-13 12:11:52 +01:00
Bruno Cauet
82772966c8 Smartplaylist: fix incorrect doc
With auto mode playlists are regenerated *at the end of the session, if
a database update happened*, and not after a database update.
2015-01-13 11:53:39 +01:00
Bruno Cauet
7c4496c110 Smartplaylist: log messages instead of printing
ui.print_ → self._log.info

Also change config['smartplaylist'] into self.config
2015-01-13 11:42:23 +01:00
Bruno Cauet
fdb768c9db Simplify smartplaylist flow
Suppress the global variable, register listeners if it's needed only.
2015-01-13 11:31:42 +01:00
Bruno Cauet
2e57d8660e Ensure there's no duplicate plugin listeners
A same function cannot be registered twice on a given event.
This will permit improvements of some plugins (e.g. smartplaylist)
2015-01-13 11:29:42 +01:00
Bruno Cauet
c8309cbe57 Simplify BeetsPlugin.listen()
Deduplicate code with BeetsPlugin.register_listener().
2015-01-13 11:11:16 +01:00
Bruno
a86fb19f92 Merge pull request #1217 from brunal/logging
Use a standard logger for the import log
2015-01-13 09:34:19 +01:00
Bruno Cauet
2cf327e0fd beet.importer: remove unnecessary log.info() call 2015-01-13 09:23:55 +01:00
Bruno Cauet
81754e5760 beets.logging exports NullHandler on python 2.6
NullHandler is not available in python 2.6. We backport it so the
importer log can use it for it is more convenient than guarding calls to
self.logger (see beets/importer.py)
2015-01-13 09:20:29 +01:00
Bruno Cauet
cce0a5d81f ImporterSession.tag_log(): improve docstring 2015-01-13 09:12:50 +01:00