Commit graph

62 commits

Author SHA1 Message Date
Adrian Sampson
e54c7eec3d Standardize __future__ imports without parentheses
Since the list is short enough now, we don't need parentheses for the line
wrap. This is a little less ugly.
2016-02-28 15:03:51 -08:00
Adrian Sampson
d53019f9db Further whitespace fiddling
Most commonly, this sticks with:

    log.debug(
        'some long message here'
    )

instead of placing the closing ) at the end of the string literal.
2016-02-28 14:48:10 -08:00
Peter Kessen
30cf407074 Removed import of unicode_literals from plugins
* rewrite
* scrub
* smartplaylist
* spotify
* the
2016-02-20 14:31:27 +01:00
Jack Wilsdon
12cd5306b7 Update copyright dates to 2016 2015-12-30 15:42:06 +00:00
Peter Kessen
3eb8008b11 added encoding as comment in files
added line like
# -*- coding: utf-8 -*-
to all files with correct license in header
2015-11-19 18:41:01 +01:00
Adrian Sampson
48637f22e9 smartplaylist: Handle exceptional cases in setup 2015-11-09 21:52:10 -08:00
Bruno Cauet
8f5bae26fd Smartplaylists: improve tests & code modularization 2015-03-25 10:44:33 +01:00
Bruno Cauet
bcd57bd2b5 Test queries building sort management in smartplaylist
Slighly modify Sort parsing: avoid building MultiplSort() instances
comptised of a single sort, but return that sort instead, since it wraps
things with any gain.
2015-03-18 18:53:41 +01:00
Bruno Cauet
45c0c9b3cb Deal with sorting
Try to follow any sort found & manage absence of sort. When there are
multiple sort directives given, concatenate them.

Tests not extended yet.
2015-03-18 18:09:42 +01:00
Bruno Cauet
65b52b9c48 python 2.6 compat: don't use set literals
In smartplaylist and test_smartplaylist.
2015-03-16 19:42:54 +01:00
Bruno Cauet
b79c025142 CLI tests for smartplaylist plugin
No import CLI test.
2015-03-16 18:36:08 +01:00
Bruno Cauet
40e793cdb1 Fix flake8 errors 2015-03-16 16:25:43 +01:00
Bruno Cauet
774decda7d Smartplayist: parse_query_parts() → ...ry_string() 2015-03-16 16:21:49 +01:00
Bruno Cauet
2d9f665848 Smartplaylist: offer "splupdate <playlist names>"
splupdate command of the SmartPlaylistPlugin looks in "args" for matches
of playlist names.
2015-03-16 16:03:14 +01:00
Bruno Cauet
f06c33cb71 Smartplaylist: update only if item changed 2015-03-16 15:16:40 +01:00
Bruno Cauet
4bfa439ee1 database_change: send model that changed 2015-03-16 14:32:37 +01: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
David Logie
29de697a8d Fix bug where playlists were not created in subdirs.
Playlist names containing path separators would cause beets to crash if
the parent directories for the playlist didn't already exist.
2015-01-24 13:00:25 +00:00
Bruno Cauet
1e0185188a Smartplaylist: fix song path writing (str → bytes) 2015-01-21 10:36:45 +01:00
Bruno Cauet
a5026100a3 All plugins use unicode_literals
Given that part of them has no test I may have broke them
2015-01-20 16:22:27 +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
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
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
9a2a9b0144 smartplaylist: fix docstring 2015-01-13 18:53:47 +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
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
Frederik “Freso” S. Olesen
4b1f0cbf48 Happy 2015. ;)
See 7a410f636b

Command used:

    git grep -l 'Copyright 201'|xargs sed -i -E 's/Copyright 201./Copyright 2015/'`
2015-01-08 21:37:09 +01:00
Adrian Sampson
9ce956d648 Accuracy in variable naming (#1138)
That's a Query object, not a string.
2014-12-12 15:41:49 -08:00
David Logie
c09745f75c Remove unused dbcore import. 2014-12-12 23:06:15 +00:00
David Logie
11c60ce101 smartplaylist: Respect sort terms in queries. 2014-12-12 14:38:35 +00:00
Adrian Sampson
80116ccc9e Introduce parse_query_string for the common case
Most clients other than Library._fetch know what type they have!
2014-09-15 18:21:22 -07:00
PierreRust
3130a6add9 Minor changes from review (mostly style) 2014-07-24 12:51:21 +02:00
Pierre Rust
1303a915c1 Sort implementation
* sort can be sepcified using the 'field_name'(+|-) syntax
 * supports fixed fields and flexible attributes
 * includes plugins fix for API changes (might have missed some)
2014-06-15 22:32:25 +02:00
Adrian Sampson
e5a9db1cac fix up some indentation warnings in plugins 2014-04-13 17:55:49 -07:00
Fabrice Laporte
3ead936fe5 flake8 cleaning beetsplug/*
Remaining warnings are related to visual indentation.
2014-04-13 23:24:57 +02:00
Bruno Tournay
865ea40eab Simplified config access 2014-03-10 22:44:38 +01:00
Bruno Tournay
33632e0caf We can now disable auto regeneration of smartplaylist 2014-03-09 22:57:07 +01:00
Adrian Sampson
fb038ecc30 changelog & style tweaks for album_query (#595) 2014-03-09 13:22:34 -07:00
Bruno Tournay
8a73a173df Attempt to factorize duplicate code 2014-03-09 20:15:51 +01:00
Bruno Tournay
05d54b4f23 Added ability to also include in playlist result from query based on albums (album_query parameter). 2014-03-08 21:24:56 +01:00
Adrian Sampson
ab8d008049 use OrQuery for smartplaylist (#575) 2014-03-07 14:38:40 -08:00
Adrian Sampson
f06a16819f spl mutli-query (#575): remove option, changelog 2014-03-07 14:26:49 -08:00
Bruno Tournay
ab513f7bc2 Add the ability to gather the result of ^Cveral queries into a smartplaylist 2014-03-05 21:40:24 +01:00
Adrian Sampson
9ee4adc5e1 move remaining generic Query types to dbcore.query
NumericQuery is still broken. This, of course, is the whole reason for the
change.
2014-01-20 16:40:50 -08:00
Adrian Sampson
04c0bd50fd smartplaylist: use new evaluate_template signature 2013-12-29 12:30:44 -08:00
Adrian Sampson
f82d466b77 eliminate lib argument to Item.evaluate_template 2013-09-17 08:44:26 -07:00
Adrian Sampson
bf904187e2 smartplaylist: split query w/ shlex (fixes #256) 2013-04-21 20:55:07 -07:00