Commit graph

20 commits

Author SHA1 Message Date
Adrian Sampson
38f1e6aec2 new FlexModel base class
I intend to use this for both Item and Album to avoid code duplication and
simplify code that uses both entities.
2013-08-16 17:22:17 -07:00
Adrian Sampson
3b438b7778 inline: rename "pathfields" to "item_fields" 2013-05-28 23:20:19 -07:00
Adrian Sampson
0176e10ccf inline: allow album field definitions
Under the album_field heading.
2013-05-28 23:10:47 -07:00
Adrian Sampson
a0cb31956d distinguish Album and Item template fields
An earlier change (due to @pedros) added the ability for plugins to define
template fields that work with Albums as well as Items. This enables some
cool new use cases but required that every template field definition check the
type of its arguments. Instead, this iteration on the idea distinguishes
between fields meant for Items and those meant for Albums.

In addition to simplifying the implementation of these functions, this also
enables the creation of album fields with identical names to item fields.
(For example, a user contacted me recently about adding a $bitrate field for
albums, which would be the average bitrate of the items. They can do this now
using a plugin.)

I also changed the docs to stop using the decorator approach to registering
template fields. We're moving toward removing those.
2013-05-28 22:30:23 -07:00
Tai Lee
e3fa403ad2 Only execute pathfields expressions and functions if they are called with an Item argument. Otherwise, return an empty string. 2013-05-25 12:28:52 +10:00
Adrian Sampson
1898a79d4f fix inline for album plugin fields (#274) 2013-05-17 12:13:01 -07:00
Adrian Sampson
887d1c1287 fix inline and rewrite for instance fields
I'm transitioning to using exclusively instance-level fields instead of
class-level fields in plugin objects, but I neglected to bring inline and
rewrite into the future. This manifested as silent inaction on the part of
these plugins.

This change restores the old behavior (for compatibility) but also updates the
plugins to use the new behavior.
2013-02-02 08:35:54 -08: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
f7bef39769 GH-72: use function bodies instead of special var 2013-01-05 17:48:00 -08:00
Adrian Sampson
14b5170aec GH-72: some cleanup and changelog note 2013-01-05 17:20:39 -08:00
Florent Thoumie
da0642a026 inline: Add support for code blocks.
This should be backwards compatible. In case the the path field
isn't a statement, beets will assume it's a block of code that
stores the value in a special '_' variable.
2013-01-05 23:00:10 +00:00
Adrian Sampson
cf3860257f inline: fix defaults (dict, not list) 2012-12-31 15:54:26 -08:00
Adrian Sampson
6d68a4855e per-plugin configuration defaults in __init__()
This uses the new BeetsPlugin.config convenience view heavily. Things are
slowly getting less verbose.
2012-12-18 22:35:44 -08:00
Adrian Sampson
55cac36d35 sync with latest confit
This includes Confit's shift to using OrderedDict, which needs some debugging.
2012-12-18 20:03:52 -08:00
Adrian Sampson
3ef9e006f4 finish confit-ifying all the plugins 2012-12-13 17:14:19 -08:00
Adrian Sampson
760fff3ace use new "except ... as ...:" syntax
This replaces the older "except ..., ...:" syntax.
2012-05-13 21:18:50 -07:00
Adrian Sampson
b68e87b92c The Great Trailing Whitespace Purge of 2012
What can I say? I used to use TextMate!
2012-05-13 20:22:17 -07:00
Adrian Sampson
74f14a7aeb fix plugin errors with missing sections 2012-01-31 18:52:27 -08:00
Adrian Sampson
7b265e353d print a better error for exceptions raised from inline snippets 2012-01-29 13:27:47 -08:00
Adrian Sampson
890021008a inline plugin: define template fields in config (#169) 2011-12-27 14:43:58 -08:00