Author Topic: How can I achieve proper filename formatting with Virtualtags?  (Read 1256 times)

chosmochip

  • Newbie
  • *
  • Posts: 3
Welcome Musicbee Members!

Ive been stuck on filename formatting functions I want to accomplish with two Virtual Tags that I hope you can help with that goes as the following:

Filename is called in text that omits the first 4 characters of the filename AND also leaves the extension out.
Example: "01. Song.mp3" becomes "Song" I achieved getting rid of text on both ends separately but not simultaneously.


For the second virtual tag I wish to recall the folder path of an album but only the topmost name of the folder that contains the song.
Example: "C:\User\Music\Library\Portuguese\Artist\[2007] Album\Song" becomes "Album".



This seems like a convoluted solution to an already builtin feature but as I don't understand some languages so I translate the files and folder names, that way they're still tagged correctly but can also see a translated name in Musicbee.
Any help would be greatly appreciated!

hiccup

  • Sr. Member
  • ****
  • Posts: 7890
Welcome you too chosmochip,

I think these two would accomplish what you are trying to do?

Code
$RSplit($Split(<Filename>,". ",2),.,2)

Code
$RSplit(<Path>,\,2)

Note that for the first, instead of removing the first 4 characters, I used '. ' as a splitter. So it will also work for tracks 1. or 01. or 111.

chosmochip

  • Newbie
  • *
  • Posts: 3
Yes! Thank you so much hiccup this is exactly what I was looking for and better optimized! I am curious though as to what the 2 indicates in your code for the path?
Is it a rule in Musicbee for the Split function?

hiccup

  • Sr. Member
  • ****
  • Posts: 7890
Because of the 'R' in $RSplit, it will look for the first '\' delimiter from the right, and will present the 2nd value (from your example, the 1st would be the file-name instead of the folder-name)

Did you find this yet?:
http://musicbee.wikia.com/wiki/Functions
Last Edit: February 05, 2017, 04:10:11 PM by hiccup

chosmochip

  • Newbie
  • *
  • Posts: 3
Thanks, I'll reference it in the future. Thanks again for the help hiccup.