Author Topic: Shortening file name in playlist  (Read 1606 times)

rygle

  • Jr. Member
  • **
  • Posts: 22
Hi,

My Roland drum kit will only play MP3 or WAV files that have a 14.3 file name format or shorter.

When syncing to a USB stick, I have figured out how to shorten the file name to the 14.3 character format using this formula;
Code
$If($IsMatch(<Title>,"^.{15,}$")="T",$Left(<Title>,7)-$Right(<Title>,6),<Title>)

This currently shortens songs like "Like, Wow - Wipeout (Live).mp3" to "Like, W-(Live).mp3"

I am using some characters from the left and some from the right to avoid duplicates when I have both a studio and a live version.

However, I would like to also filter out special characters like brackets and inverted commas so I get more of the filename - e.g "Like, Wow - Wipeout (Live).mp3" to "Like Wo-t Live.mp3"

Any ideas?

I used the following pages to get me this far...
http://musicbee.wikia.com/wiki/How_to_Create_a_File-Naming_Template
http://musicbee.wikia.com/wiki/Useful_Virtual_Tag_Formulas

Any help appreciated!

Cheers, Rygle  8)
Last Edit: July 27, 2017, 07:46:31 AM by rygle

redwing

  • Guest
This will remove any character that is not an alphabet, space or number from title tag value.

Code
$RxReplace(<Title>,"[^a-zA-Z 0-9]",)
You could replace each of <Title> in your formula (maybe just 2nd and 3rd title, or all) with the above formula.

rygle

  • Jr. Member
  • **
  • Posts: 22
Hi,

Thanks! That makes sense, but I'm having trouble implementing it.

I've tried replacing "<Title>" with the exact supplied text, and also with the text surrounded by ( and ) brackets, then < and >. Unfortunately none of these pass validation.


Supplied text
Code
$If($IsMatch($RxReplace(<Title>,”[^a-zA-Z 0-9]”,)),"^.{15,}$")="T",$Left($RxReplace(<Title>,”[^a-zA-Z 0-9]”,)),7)-$Right($RxReplace(<Title>,”[^a-zA-Z 0-9]”,)),6),$RxReplace(<Title>,”[^a-zA-Z 0-9]”,)))


(Supplied Text)
Code
$If($IsMatch(($RxReplace(<Title>,”[^a-zA-Z 0-9]”,))),"^.{15,}$")="T",$Left(($RxReplace(<Title>,”[^a-zA-Z 0-9]”,))),7)-$Right(($RxReplace(<Title>,”[^a-zA-Z 0-9]”,))),6),($RxReplace(<Title>,”[^a-zA-Z 0-9]”,))))

<Supplied Text>
Code
$If($IsMatch(<$RxReplace(<Title>,”[^a-zA-Z 0-9]”,))>,"^.{15,}$")="T",$Left(<$RxReplace(<Title>,”[^a-zA-Z 0-9]”,))>,7)-$Right(<$RxReplace(<Title>,”[^a-zA-Z 0-9]”,))>,6),<$RxReplace(<Title>,”[^a-zA-Z 0-9]”,))>)

Again, thanks for your help!

redwing

  • Guest
Try this.

Code
$If($IsMatch($RxReplace(<Title>,"[^a-zA-Z 0-9]",""),"^.{15,}$")="T",$Left($RxReplace(<Title>,"[^a-zA-Z 0-9]",""),7)-$Right($RxReplace(<Title>,"[^a-zA-Z 0-9]",""),6),$RxReplace(<Title>,"[^a-zA-Z 0-9]",""))

rygle

  • Jr. Member
  • **
  • Posts: 22
Thanks, that seems to be having trouble too...

I tried to validate just the
Code
$RxReplace(<Title>,"[^a-zA-Z 0-9]",)
and it seems to have trouble with that. I am wondering if the
elements of that should be separated by , or | or similar, but am not having any luck with alternatives.

redwing

  • Guest
Could be you're running an old version. Then try the latest v3.1.

http://musicbee.niblseed.com/V3_1/MusicBee31_Patched.zip (unzip and overwrite to your MB program folder)

rygle

  • Jr. Member
  • **
  • Posts: 22
Thanks! That was the problem. I was running 3.0.x

I appreciate your wisdom and patience!