Concatenate brackets using inline plugin?

How can I concatenate brackets with a variable using the inline plugin?

I’m wanting to put “(EP)” or “(Single)” in my album folder names.

What I currently have:

paths:
    default: $albumartist - $year - $album%aunique{} %upper{$albumtype_EP}%title{$albumtype_Single}/$track - $title
item_fields:
    albumtype_EP: albumtype if albumtype == 'ep' else ''
    albumtype_Single: albumtype if albumtype == 'single' else ''

Thanks!

Hello! I don’t quite know what you mean by “concatenate brackets.” Perhaps you just want to put ”(“ + ... + “)” in your Python expression?

that actually produces an error:

inline: syntax error in inline field definition:
Traceback (most recent call last):
  File "/volume2/@appstore/python/lib/python2.7/site-packages/beetsplug/inline.py", line 91, in compile_inline
    func = _compile_func(python_code)
  File "/volume2/@appstore/python/lib/python2.7/site-packages/beetsplug/inline.py", line 48, in _compile_func
    code = compile(body, 'inline', 'exec')
  File "inline", line 2
    ”(“ + albumtype + “)” if albumtype == 'ep' else ''
    ^
SyntaxError: invalid syntax

If I use single quotes albumtype_EP: '(' + albumtype + ')' if albumtype == 'ep' else '' I get this error:

configuration error: file /volume2/homes/XXX/beets/config.yaml could not be read: while parsing a block mapping
  in "/volume2/homes/XXX/beets/config.yaml", line 15, column 5
expected <block end>, but found '<scalar>'
  in "/volume2/homes/XXX/beets/config.yaml", line 15, column 23

This seems to work:

item_fields:
    albumtype_EP: u'(' + albumtype + u')' if albumtype == 'ep' else ''

Sounds like you got it! For future reference, you’ll want to take care to wrap your Python code in YAML strings. The u prefix avoided the need for that this time.