HydrogenAudio

Hosted Forums => foobar2000 => General - (fb2k) => Topic started by: kidamnesiac on 2012-11-19 23:03:23

Title: Help needed with output style and filename formatting
Post by: kidamnesiac on 2012-11-19 23:03:23
Basically, I'm trying to figure out this formatting style for conversion filenaming so my music collection would be styled like this (best show this on an example):

...\Music\Pearl Jam\[1991] Ten\1.01 - Once.flac
...\Music\Pearl Jam\[1991|2009] Ten\1.01 - Once.flac

Most of it is self-explanatory, but the tricky part to do here (automatically) is the year part. For example, this album, Ten, was re-released in 2009, and if the year of release differs from the original date of release, I want that to show in the filename/directory structure.

I tag my music with the MusicBrainz Picard semi-automatic tagger, which saves the date of release in %date%, and creates a new tag named 'ORIGINALDATE' to store the original date of release. What I've come up so far (posting just the part in brackets as everything else works!):

'['$left($meta(originaldate),4)$if($left($meta(originaldate),4)==$left(%date%,4),,|$left(%date%,4))']'

I'm using the $left(string,4) function as Picard stores dates in the format yyyy-mm-dd and extracting the four left characters gives you the year.

So, as I said, this isn't working right now (the else statement does not execute) and if anybody could help me, thanks a lot!
Title: Help needed with output style and filename formatting
Post by: Daeron on 2012-11-20 00:32:56
Code: [Select]
'['[$ifequal($left(%date%,4),$left(%originaldate%,4),,$left(%originaldate%,4)|)]$left(%date%,4)']'

'==' is not a valid function in titleformatting.

http://wiki.hydrogenaudio.org/index.php?ti...ormat_Reference (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Titleformat_Reference)
Title: Help needed with output style and filename formatting
Post by: BenB on 2012-11-20 06:40:19
The pipe "|" is an invalid character for file and folder names. foobar interprets its presence in a string as a backslash "\" using Copy or Move in File Operations. Thus it will result in a folder named "[1991" containing a folder named "2009] Ten".

Now, as for what I'd use to accomplish what you want:
Code: [Select]
'['[$if($stricmp($year(%originaldate%),$year(%date%)),,$year(%originaldate%)-)]$year(%date%)']'

However, you might want to reconsider using this at all since it will result in multiple folders for an album when the tracks of that album have differing "originaldate" tags such as artist compilations/retrospectives.