Skip to content

Multiple attributes paths (i.e Bad:1 and singleton) #5497

Closed Answered by snejus
laurent-lao asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, it is possible to do so using inline plugin and template functions. Try the following configuration

...
plugins:
  ...
  inline
...
item_fields:
  # use 'globals().get' to default to '0' for items which do not have 'bad' set
  is_bad: return globals().get("bad", "0") == "1"
paths:
  # use '%if{cond,then,else}' path function with the variable above
  # to conditionally set the path. You can leave 'else' empty in this case
  singleton: "%if{$is_bad,Bad/}Non-Album/$artist/$title"
  compilation: "%if{$is_bad,Bad/}Compilations/$artist/$title"
  ...
...
  • inline plugin allows you to define custom variables under item_fields configuration
  • define a custom boolean variable is_bad which checks …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by laurent-lao
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants