jacquesh / foo_openlyrics

An open-source lyric display panel for foobar2000
MIT License
401 stars 24 forks source link

Configurable Artist and Title remapping #325

Open regorxxx opened 5 months ago

regorxxx commented 5 months ago

Allow to configure the artist and title web lookup, so things like multiple artist, exotic chars or personalized tags can be handled via TF:

For ex. [$stripprefix($meta(artist,0))] or [$replace(%title%,$char(40),,$char(41),)]...

Example from Lyrics Show 3: image

Note this allows an infinite amount of possibilities to fix common problems looking for things.

jacquesh commented 5 months ago

Certainly a useful tool for power users like yourself. If I understand correctly this would supersede the "Exclude text in brackets at the end of artist/album names" checkbox that we currently have.

We'd need to either continue supporting that option, or set a default if users have that option enabled (presumably involving $cut and $strrchr).

regorxxx commented 5 months ago

Without regexp is not trivial, but here it is:

-> My [hey] artist [ho] $puts(char,'[')$puts(tag,My '['hey']' artist '['ho']')$puts(spacer,$strrchr($get(tag),$get(char))) $ifequal($strrchr($get(tag),']'),$len($get(tag)),$trim($left($get(tag),$sub($get(spacer),1))),$get(tag)) -> My [hey] artist

-> My [hey] artist $puts(char,'[')$puts(tag,My '['hey']' artist)$puts(spacer,$strrchr($get(tag),$get(char))) $ifequal($strrchr($get(tag),']'),$len($get(tag)),$trim($left($get(tag),$sub($get(spacer),1))),$get(tag)) -> My [hey] artist

It only removes the brackets if the last char is ']':

$puts(char,'[')$puts(tag,%ARTIST%)$puts(spacer,$strrchr($get(tag),$get(char)))
$ifequal($strrchr($get(tag),']'),$len($get(tag)),$trim($left($get(tag),$sub($get(spacer),1))),$get(tag))

Minified:

$ifequal($strrchr(%ARTIST%,']'),$len(%ARTIST%),$trim($left(%ARTIST%,$sub($strrchr(%ARTIST%,'['),1))),%ARTIST%)

Personally I would leave the option as is, since it's already coded, on top of the TF.