feat(media): dynamic label separator #515
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added a dynamic label separator (and a placeholder for it
{s}) that when used will be automatically stripped if it is anywhere but between valid and non-empty placeholders (like{artist})This is useful when there's a part of the label missing.
Example (old): Label is
{title} - {artist}. If the{artist}data is not there the label will end up looking likeMedia Title -.With the dynamic placeholder this will be detected and stripped.
Example (new): Label is
{title}{s}{artist}and separator is set to-. So now, if everything is fine and both title and artist are there you will get what you expectMedia Title - Artist. But if the artist is missing you will just getMedia Title.Also works with any additional strings added in between or around the placeholders.
Example:
[{title}{s}{artist}]will still produce a proper[Media Title]without the separator if the artist value is empty.Changes:
tokenizer.pyto media utils to process the label.