sampsyo/beets — pull request #72 by flz (2013-01-05 23:12:41+00:00)
Title: Add support for code blocks to inline plugin

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.

Issue tracked at: http://code.google.com/p/beets/issues/detail?id=487

Tested with the following pathfields config:

pathfields:
nalbumartist: import re; import unidecode; _ = re.sub(r'[^a-zA-Z0-9.()-]+', '_', unidecode.unidecode(albumartist))
nalbum: import re; import unidecode; _ = re.sub(r'[^a-zA-Z0-9.()-]+', '_', unidecode.unidecode(album))
lnartist: import re; import unidecode; _ = re.sub(r'[^a-zA-Z0-9.()-]+', '_', unidecode.unidecode(artist)).lower()
lntitle: import re; import unidecode; _ = re.sub(r'[^a-zA-Z0-9.()-]+', '_', unidecode.unidecode(title)).lower()
extra: u'%s%s' % ('-FLAC' if 'FLAC' in format.upper() else '', '-%dCD' % (disctotal) if disctotal > 1 else '')
disctrack: u'%i%02i' % (disc, track) if disctotal > 1 else u'%02i' % (track)