Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatter gets syntax support for if-exists-tag, if-exists-bracket, if-else-bracket #7

Open
porg opened this issue Jun 2, 2022 · 0 comments

Comments

@porg
Copy link

porg commented Jun 2, 2022

Problem

/Volumes/iTunesFS/PlaylistsTrackFormat.txt
%(artist) - %(album) - %(trackNumber#00) %(name).%(ext.lowercaseString)

For classical music I often only state the composer and leave the artist field empty.
With a stubborn filename formatter I get results like this:

/Volumes/iTunesFS/Playlists/Genre/Classical
- Requiem en ré mineur KV 626 - 04 Tuba mirum.mp3

Proposed Solution

Introduce "if exists bracket" as a new syntax element

  • which outputs null if its contained tag evaluates as null
  • or else outputs the result of the tag plus any static text before or after

Syntax Idea

  • Tag %() — The syntax as it currently is. Outputs the tag value.
  • If-exists-bracket *{}
    • If the contained tag evaluates as non-null then output the tag plus free text before or after it.
    • Else output NULL.

Additional ideas

  • If-exists-tag *() - Output tag if it exists
  • If-else-bracket *{tag plus freetext}{tag2 plus freetext}{tag3}{freetext only as last alternative}
    • If the contained tag evaluates as non-null then output the tag plus free text before or after it.
    • Else try the next curly bracket, which again can be a tag and/or a freetext.
    • An alternative consisting of freetext only is only effective at the last position. As it always evaluates as true all further alternative after it are discarded.

Examples where and how this would help

*{%(composer) - }*{%(artist) - }*(trackNumber#00) - }%(name).%(ext.lowercaseString)

  • Composer plus suffix in an If-exists-bracket followed by artist plus suffix in and If-exists-bracket.
  • In any permutation you will get a nice output.

*{%(composer)}{%(artist)} - *(trackNumber#00) - }%(name).%(ext.lowercaseString)

  • Even more elegant: Composer as the preferred tag, artist as the alternative tag, then separator as freetext.

*{%(artist) - }*{%(album) - }*(trackNumber#00) - }%(name).%(ext.lowercaseString)

%(artist) - *{%(trackNumber#00)}{00}%(name).%(ext.lowercaseString)

  • So you will get "Artist TrackNumber Songname" or "Artist || Songname"
  • Arthur Band 18 Adulthood.mp3
  • Beta Gamma || Adulthood.mp3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant