IPB

Welcome Guest ( Log In | Register )

> foobar2000 General Forum Rules

This is NOT a tech support forum.
Tech support questions go to foobar2000 Tech Support forum instead.

See also: Hydrogenaudio Terms of Service.

 
Reply to this topicStart new topic
Regular expressions on tags, How to apply a regular expression to tagging
scitrek
post Sep 10 2009, 13:07
Post #1





Group: Members
Posts: 10
Joined: 30-June 08
Member No.: 55100



Hi all. I have a little problem with my soudtracks collection and my iPod. As you probably know, scrolling a list very fast (through the click-wheel) in the artist / album selection pops up a letter selection menu. Since all my soundtracks files have the prefix "[OST]" in the album field, I cannot use this tool on my iPod to select a letter in the soundtrack album list.

Now, I've noticed tha in the iPod manager preferences there's the possibility to automatically edit the tags when uploading to the iPod. Right now, the album property is set to

CODE
$if2(%album%,'('None')')


Is it possible to rewrite this line to something like: when the tag starts with "[OST]" add the seventh character in front. So an album tag like "[OST] Titanic" would become "T [OST] Titanic" and so on.

Thanks so much!
Go to the top of the page
+Quote Post
scitrek
post Sep 10 2009, 13:27
Post #2





Group: Members
Posts: 10
Joined: 30-June 08
Member No.: 55100



I don't know why I missed the scripting page on the FooBar wiki... I read the documentation, and I came up with this:

CODE
$if(%album%,$if($substr(%album%,0,5) IS '[OST]',$left(7,1)'pippo'),'('None')')


Does it seem right? How can I test it?

Thanks again!
Go to the top of the page
+Quote Post
marc2003
post Sep 10 2009, 13:39
Post #3





Group: Members
Posts: 4439
Joined: 27-January 05
From: England
Member No.: 19379



a few problems...

IS is part of the search query syntax so can't be used here. use $strcmp.

[ is a special character you'd need to wrap it in single quotes. just like the ( in the example above.

try this
CODE
$if(%album%,$if($strcmp('['OST']',$substr(%album%,0,5)),$substr(%album%,7,7) %album%,%album%),'('None')')


you can test by accessing the properties dialog of the file. right click "album", select "format from other fields", copy/paste the code and you'll get a preview.

This post has been edited by marc2003: Sep 10 2009, 13:41
Go to the top of the page
+Quote Post
scitrek
post Sep 11 2009, 01:50
Post #4





Group: Members
Posts: 10
Joined: 30-June 08
Member No.: 55100



Thank you very much for the revision, it works perfectly now!

This post has been edited by scitrek: Sep 11 2009, 01:50
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 29th July 2014 - 14:45