Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: File Renaming On Conversion (Read 3398 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

File Renaming On Conversion

Total newbie to file naming and syntax - have searched but unable to find the answer to the following: I wish, on conversion of file to flac in Foobar, to, in each filename with a parenthesis (i.e. "(", or ")") to convert those parentheses to "[" and "]", respectively. In other words, replace round brackets with square brackets. Can anyone provide some much guided assistance as to what command and where I should add to the following string (which is what I typically use in conversion): $caps(%album artist% - %album%/%tracknumber% %title%).

Many thanks.

Re: File Renaming On Conversion

Reply #1
Hi there,

Where you have %title%, instead put $replace(%title%,'(','[',')',']') - I think that should do it though I have not tested.

See foobar Help menu > Title Formatting Help for more info on functions.

Re: File Renaming On Conversion

Reply #2
Hi there,

Where you have %title%, instead put $replace(%title%,'(','[',')',']') - I think that should do it though I have not tested.

See foobar Help menu > Title Formatting Help for more info on functions.

Clearly I came to the right spot. This solution did the trick . I very much appreciate the quick, and extremely helpful answer. Very grateful.

Re: File Renaming On Conversion

Reply #3
One follow up question - is there an easy way to ensure that the renamed files are reflected as the metadata file names, or must one take the extra step to use a program such as Mp3tag to ensure that the filename as converted > metadata file name. Cannot see an easy step in Foobar conversion process to do so.

Many thanks again.

The extent it helps current string is: $caps(%album artist% - $replace(%album%,'(','[',')',']')/%tracknumber% $replace(%title%,'(','[',')',']')%)

Re: File Renaming On Conversion

Reply #4
Think I have it figured out - Properties > Tools > Automatically Fill Values > Source > Other > add string $caps($replace(%title%,'(','[',')',']')%) > Pattern %title%

Unless there is an easier way.

Thanks again.

 

Re: File Renaming On Conversion

Reply #5
What, you think foobar is tricking you? ;)

Yes, using metadata field names anywhere in foobar will always show up as such (although now you are replacing the brackets so they will not match exactly). Except for characters that cannot be used in filenames, like a '?' that gets renamed to a '-' instead.

Another way you could test the tracks is with a right-click > File Operations > Rename, and using the same converter string. It should have nothing to do if everything matches.

Re: File Renaming On Conversion

Reply #6
What, you think foobar is tricking you? ;)

Yes, using metadata field names anywhere in foobar will always show up as such (although now you are replacing the brackets so they will not match exactly). Except for characters that cannot be used in filenames, like a '?' that gets renamed to a '-' instead.

Another way you could test the tracks is with a right-click > File Operations > Rename, and using the same converter string. It should have nothing to do if everything matches.


Thanks again. I have a feeling I'm not finished asking idiotic questions here. Thanks for the patience.

Re: File Renaming On Conversion

Reply #7
No it was fine I was just teasing, feel free to ask anything. 8)

Re: File Renaming On Conversion

Reply #8
Got it - knew you were just pulling my leg. Here is where I have ended up for now:

Source: $caps($replace(%album artist%,'(','[',')',']') - $replace(%artist%,'(','[',')',']') - $replace(%album%,'(','[',')',']')/%tracknumber% $replace(%title%,'(','[',')',']')%)

Pattern: $caps(%album artist% - %artist% - %album%/%tracknumber% %title%)

This is applied prior to conversion using Foobar to upload titles into a Control4/Sonos system.

Expect there is duplication in there. Again, cannot tell you all how much I appreciate being able to seek input from those who know what they are doing. Tx

Re: File Renaming On Conversion

Reply #9
Pattern: $caps(%album artist% - %artist% - %album%/%tracknumber% %title%)

Expect there is duplication in there.
Yep, well it depends on how you have tagged files. I would suggest removing %artist% from above. Firstly, if %album artist% tag is not present it will search %artist%, and vice-versa. (See Reference).

Secondly, remember you are defining folder structure. Say you have a "Various Artists" album tagged to %album artist%, then each individual %artist% being different would end up creating sepearate folders - one track per folder. Not ideal.

Re: File Renaming On Conversion

Reply #10
Yep, well it depends on how you have tagged files. I would suggest removing %artist% from above. Firstly, if %album artist% tag is not present it will search %artist%, and vice-versa. (See Reference).

Secondly, remember you are defining folder structure. Say you have a "Various Artists" album tagged to %album artist%, then each individual %artist% being different would end up creating sepearate folders - one track per folder. Not ideal.
[/quote]

Very helpful again, thanks. A further question on the naming of the file, itself (not the metadata for the file name which will be taken care of by using the strings above). When I run those strings it results in a file with, for example, the name "you got the (silver)" being renamed (ie metadata name) to "You Got The [Silver]". The actual name of the file itself however remains "you got the (silver)". This is easily renamed using the File Operations > Rename to function - with the result the file itself will be renamed to "You Got The [Silver]". My question is - is there a way to insert into the strings above syntax that also would change the name of the file itself in the process, or am I mixing apples and oranges here?

Thanks again. No rush.

Re: File Renaming On Conversion

Reply #11
Source: $caps($replace(%album artist%,'(','[',')',']') - $replace(%artist%,'(','[',')',']') - $replace(%album%,'(','[',')',']')/%tracknumber% $replace(%title%,'(','[',')',']')%)
First things first, note you have an extra % at the end of your string. (Though did not make a difference as foobar ignores it)

[...] My question is - is there a way to insert into the strings above syntax that also would change the name of the file itself in the process, or am I mixing apples and oranges here?
What you describe here is not the expected behavior so I did a quick test. Using this string in Converter on an all-lowercase filename and lowercase metadata - $caps(%tracknumber% $replace(%title%,'(','[',')',']')) - it DOES convert the actual filename correctly to capital first letters and square brackets, as expected - it does NOT rename the metadata, also as expected. So I'm not sure what is going on with your converting if it is the opposite. (? Sorry)

Although, one curiosity, sometimes renaming files in Windows Explorer from one case to the other, while not changing the actual order of letters, it does not save the rename. Even after refreshing the files. Not sure why.

But to answer your question, to rename filenames I think you have to use File Operations. Converter should be renaming them too, though.  :-\

PS: Which version foobar and which encoder/version are you using? I'm foobar v1.3.19 and FLAC 1.3.2 (encoder/version is written to files under Properties > Details tab > Tool)

Re: File Renaming On Conversion

Reply #12
Although, one curiosity, sometimes renaming files in Windows Explorer from one case to the other, while not changing the actual order of letters, it does not save the rename. Even after refreshing the files. Not sure why.
For directories there will be nothing done if the  only change is case. I think it has to do with Windows' handling of cases.
HA contributor Case [nice pun in this case] has a component that will do this:  https://foobar.hyv.fi/?changes=foo_renamer&sort=modified
Note that it works independently of the file operations, so you have to copy the pattern over; also, it is invoked under the "Utilities" menu.

Re: File Renaming On Conversion

Reply #13
Although, one curiosity, sometimes renaming files in Windows Explorer from one case to the other, while not changing the actual order of letters, it does not save the rename. Even after refreshing the files. Not sure why.
For directories there will be nothing done if the  only change is case. I think it has to do with Windows' handling of cases.
HA contributor Case [nice pun in this case] has a component that will do this:  https://foobar.hyv.fi/?changes=foo_renamer&sort=modified
Note that it works independently of the file operations, so you have to copy the pattern over; also, it is invoked under the "Utilities" menu.

Thanks again anamorphic and Porucs

Anamorphic - I am on Foobar v. 1.4 FLAC 1.2.1

Porcus - I have loaded in Case component but cannot seem to copy the applicable pattern into any setting in the renamer fields?

Thanks all.

Re: File Renaming On Conversion

Reply #14
I wish renaming extended to non-audio files, like the cover art which I manually always have to rename when performing conversions for mobile use.

Re: File Renaming On Conversion

Reply #15
For directories there will be nothing done if the  only change is case. I think it has to do with Windows' handling of cases.
Interesting. Well, this test was a bunch of FLAC files that would not rename to lowercase using either fb2k or Explorer (Win10). It did work if I added (/removed?) an extra character though, so maybe you could try that @Fletchesus - add a '.' to the string after %tracknumber% or something.

I thought afterwards it could be because the FLACs were from and created on my other computer / different user account, so could be some ownership rights issue.

In any case, thanks for the heads-up and CASE pun ( :D ), but not really interested adding another component just to figure out this strangeness. ::)

(By the way @Fletchesus, you might want to also check out the Masstagger component if you want to update metadata on tons of tracks at once)