HydrogenAudio

Hydrogenaudio Forum => General Audio => Topic started by: Seufari on 2009-12-02 08:22:43

Title: Rename mixed FLAC/MP3 files into folders
Post by: Seufari on 2009-12-02 08:22:43
So here is what I am wanting to do... It doesn't seem like much in my eyes, but I cannot seem to find the best way to do it.

I have flac and mp3 files intermingled in a unsorted folder.  I want a program to separate the two into separate directories according to their extension and then by their tag data. 

So here is what it looks like:

Input:
C:\unsorted folder\random subdirectories\mp3 and flac files

Output:
C:\music - mp3\file directories according to tag data\mp3 files
C:\music - flac\file directories according to tag data\flac files


Is there a program that will get this done?
Title: Rename mixed FLAC/MP3 files into folders
Post by: Synthetic Soul on 2009-12-02 09:36:45
foobar (http://www.foobar2000.org/) could do this for you, or (I expect) MP3Tag (http://www.mp3tag.de/en/index.html).

I'll deal with foobar as I don't know MP3Tag (although I think the syntax is the same/similar).

You would throw all files into a playlist, and then choose to move or copy them using a file name pattern like:

Music - %codec%\[%album artist%\][%album%\][Disc %discnumber%\][%tracknumber% - ]%title%$if($meta(album artist),' ('$meta(artist)')',)

... choosing a destination folder of C:\.

You will find the file operations in the context menu of the playlist (select all files, right click, and choose "File Operations" > "Move To".

There is probably a guide here that explains the process in depth further.

Use the preview in the dialogue to ensure that the files will be renamed as you hope.

Edit: The files will be named according to their tags.  You must ensure that your tags are accurate before you perform the operation.  It's always useful to have accurate tags in any case.  "Various Artists" albums should have the ALBUM ARTIST "Various Artists".  Albums with only one artist should not use ALBUM ARTIST, only ARTIST.

The file name pattern above is (apart from the initial folder) the string that I use, and will result in file paths like so:

Music - MP3\Pixies\Doolittle\01 - Debaser.mp3
Music - FLAC\Eels\Blink Lights And Other Revelations\Disc 1\01 -  Theme From Blinking Lights.flac
Music - FLAC\Various Artists\8 Mile Soundtrack\01 - Lose Yourself (Eminem).flac
Music - MP3\Various Artists\CBeebies - The Official Album\Disc 2\01 - Mambo No 5 (Bob The Builder).mp3
Title: Rename mixed FLAC/MP3 files into folders
Post by: probedb on 2009-12-02 09:39:41
Pretty sure mp3tag can do a similar thing.
Title: Rename mixed FLAC/MP3 files into folders
Post by: Synthetic Soul on 2009-12-02 09:45:34
Yes, I very much expect it will, and the OP may be happier to use it if he is happy with his player already.

Personally, I use foobar for playing, tagging, renaming, the lot.
Title: Rename mixed FLAC/MP3 files into folders
Post by: DragonQ on 2009-12-02 10:24:10
I actually wrote a program in VB.NET to do this for me based on tags after I recovered a load of WMA Lossless files from a dead HDD (the recovery software obviously couldn't find the folder or file names because the MFT was corrupt so they were named "Windows Media Audio (xxxx).wma" where xxxx was a random number). Probably wouldn't be useful for you though.
Title: Rename mixed FLAC/MP3 files into folders
Post by: odyssey on 2009-12-02 12:02:57
You can always use %filename% in correlation with Synthetic Soul's example in foobar2000 if you are unsure if your tags are correct.
Title: Rename mixed FLAC/MP3 files into folders
Post by: Zarggg on 2009-12-02 16:07:01
IIRC, doesn't %album artist% defer to %artist% if no Album Artist tag exists?
Title: Rename mixed FLAC/MP3 files into folders
Post by: Seufari on 2009-12-02 16:28:23
Thanks for the quick replys...

Quote
You will find the file operations in the context menu of the playlist (select all files, right click, and choose "File Operations" > "Move To".


Unfortunately my foobar does not have this context menu... When I right click, I get:

Remove
Crop
Sort
Cut
Copy
Utils
Add to Playback Queue
Open Containing Folder
ReplayGain
Properties
Convert

Why is mine different?

Title: Rename mixed FLAC/MP3 files into folders
Post by: dios-mt on 2009-12-02 16:35:50
Unfortunately my foobar does not have this context menu...


Which version you have installed?
File operations came with Version 0.9.5 (http://www.foobar2000.org/changelog#section17).
Latest Version (http://www.foobar2000.org/download) is 0.9.6.9 or 1.0 beta 2a.
Title: Rename mixed FLAC/MP3 files into folders
Post by: Seufari on 2009-12-02 16:38:01
Unfortunately my foobar does not have this context menu...


Which version you have installed?
File operations came with Version 0.9.5 (http://www.foobar2000.org/changelog#section17).
Latest Version (http://www.foobar2000.org/download) is 0.9.6.9 or 1.0 beta 2a.


I have the latest non-beta version...

Re-installing... Seems File Operations is not installed by default...
Title: Rename mixed FLAC/MP3 files into folders
Post by: Synthetic Soul on 2009-12-02 17:18:32
IIRC, doesn't %album artist% defer to %artist% if no Album Artist tag exists?
Yes, it does.

I use the system - and I believe it is reasonably popular - that relies on ALBUM ARTIST only being there if it is required.  Therefore on "normal" albums I set ARTIST only, and on VA albums I set ALBUM ARTIST to "Various Artists" and ARTIST to the track artist.  This means that %album artist% will always provide the album artist, but $if($meta(album artist),' ('$meta(artist)')',) will only append the artist name to the track title if ALBUM ARTIST is set.

Edit: Perhaps a more robust script may only append the artist if ALBUM ARTIST is present and is different to ARTIST, but I personally don't need to complicate my script further.
Title: Rename mixed FLAC/MP3 files into folders
Post by: tpijag on 2009-12-02 17:28:52
I use pretty much the same system.

I believe you can simplify above.

Would adding [%track artist%] to track title column formatting accomplish the same as the if statement?

Just FYI

terry
Title: Rename mixed FLAC/MP3 files into folders
Post by: Zarggg on 2009-12-03 15:25:33
Yes, that's essentially my line of thought, tpijag. I was hoping Synthetic Soul could confirm or deny that.

I actually use the same tagging system (Album Artist iff Artist is not common for all tracks, or release entity -- in the case of Japanese doujin circle releases -- is not the same as the actual artist). However, in my tagging scripts I use something similar to "%album artist% ... [%artist%] ... "
Title: Rename mixed FLAC/MP3 files into folders
Post by: odyssey on 2009-12-03 15:38:37
%album artist% will return the ALBUMARTIST field if it's defined! If it's not set, it will rely on the %artist% field.

Adding brackets [ ] around a tag makes it only appear if the tag is set. If a tag is not set, it will return a questionmark "?" instead.

There's no such thing as %track artist% - You have %artist%, and this will always return the ARTIST field - Not ALBUMARTIST even if it's set or not.

Visiting the foobar2000 forum regarding foobar2000 questions might yield better results - We are a few more than just Synthetic Soul that uses foobar2000  Note there's also an IRC channel for quick/small questions, #foobar2000 @freenode
Title: Rename mixed FLAC/MP3 files into folders
Post by: Synthetic Soul on 2009-12-03 16:12:44
Would adding [%track artist%] to track title column formatting accomplish the same as the if statement?
Yes, that's essentially my line of thought, tpijag. I was hoping Synthetic Soul could confirm or deny that.
Well, I have no idea how long %track artist% (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Titleformat_Reference#.25track_artist.25) has been available, but I must admit I had no knowledge of it, and you are correct: it could simplify my string.  I've been using the above string for a while, and I just haven't bothered trying to improve it.

It seems that I could change:

Code: [Select]
%title%$if($meta(album artist),' ('$meta(artist)')',)

... to:

Code: [Select]
%title%[' ('%track artist%')']

Thanks for the info.
Title: Rename mixed FLAC/MP3 files into folders
Post by: Synthetic Soul on 2009-12-03 16:14:23
Edit: Simplify and improve: as it will deal with tracks with ARTIST and ALBUM ARTIST being the same.

Bah!  What happened to quick posts being joined!
Title: Rename mixed FLAC/MP3 files into folders
Post by: Teknojnky on 2009-12-03 16:44:25
Mediamonkey also does this (auto-organize) and has some conditional branching you can use to customize the paths/naming for particular tags (or absence of tag).

For example, my rather complex and long 'final resting place' mask:

Code: [Select]
$left(\Media\$upper(<Type>)\$if(<Album Artist>,$if(<Album Artist>=various,_<Album Artist>,$if(<Album Artist>=techno,_<Album Artist>,$if(<Album Artist>=soundtrack,_<Album Artist>,<Album Artist@1>\<Album Artist>))),<Artist@1>\<Artist>)\$if(<Album>,$if(<Year>,<Year> - )<Album> [$upper(<Type>)])\$if(<Track#>,<Track#:2> - )<Artist> - <Title>,230)


results in a path like

J:\Media\FLAC\A\A Silver Mt. Zion\2000 - He Has Left Us Alone, but Shafts of Light Sometimes Grace the Corner of Our Rooms... [FLAC]\01 - A Silver Mt. Zion - Broken Chords Can Sing a Little.flac
Title: Rename mixed FLAC/MP3 files into folders
Post by: odyssey on 2009-12-03 17:36:16
So, my sig finally made a point...

%track artist% only returns ARTIST field if it's different from ALBUMARTIST it seems? Well guess that could turn out to be useful some day, but currently... not for me.
Title: Rename mixed FLAC/MP3 files into folders
Post by: odyssey on 2009-12-03 17:40:50
It seems that I could change:

Code: [Select]
%title%$if($meta(album artist),' ('$meta(artist)')',)

... to:

Code: [Select]
%title%[' ('%track artist%')']

Just to make it clear, those two formattings are NOT the same!
Title: Rename mixed FLAC/MP3 files into folders
Post by: Synthetic Soul on 2009-12-04 16:02:40
No.  I assume you are referring to the point I made in post #16?

The first will append " (<artist>)" if ALBUM ARTIST has been set to any value.  If ARTIST is not set you will get " ()".

The second will append " (<artist>)" if ALBUM ARTIST has been set to a value that is different to ARTIST.  If ARTIST is not set you will get "" (nothing).

It works for my current system, and will cope better with tracks that have both set the same (and even tracks that have no ARTIST tag set, of which I have none).  This has also spurred me to make another amendement to cope similarly with a TOTALDISCS value of "1" (I don't want a "Disc N" subfolder if there is only one disc), making my new string:

Code: [Select]
[%album artist%\][%album%\]$ifgreater(%totaldiscs%,1,Disc %discnumber%\,)[%tracknumber% - ]%title%[' ('%track artist%')']

Thanks again to tpijag for the suggestion.