Complicated renaming

I think I need some help getting this one accomplished. I'd like to take "file.mp3" and rename it to certain specifications with (hopefully) one click. Specs:

  1. Rename it to "Artist - Album - Track number - Title" based on the ID3 tags, with the track number padded to two digits.

  2. Title case the song title. Don't worry about the album title.

  3. Take the words "the," "a," or "an," if they occur at the beginning of the song title, and move them to the end. Again, not worrying about doing the same on the album title. Example: "The Battle of Evermore" should become "Battle of Evermore, The".

In DOpus 8, I could do this with three rename presets, three or four button clicks, and an external program written especially for my personal renaming needs by steje. I think I can probably do all of this now with one mouse click in DOpus 9, but I'm having some trouble getting there.

I'm using tanis's TitleCase script as a preset, but there's a limitation in it that forces me to do two extra steps. These are the steps, using a particular mp3 as an example:

  1. Turn "file.mp3" into "The Battle Of Evermore.mp3" based on the ID3 tag.
  2. Apply title case using tanis's script. Now I should have "The Battle of Evermore.mp3"
  3. Add the other ID3 tag info. Now I should have "Led Zeppelin - IV - 03 - The Battle of Evermore.mp3"
  4. Move the word "The" to the end of the title. I should now have "Led Zeppelin - IV - 03 - Battle of Evermore, The.mp3"

Here's the button:

Rename REGEXP FILEINFO PATTERN (.*)(\..*) TO {mp3title}\2 Rename PRESET="Title Case" Rename FILEINFO PATTERN * TO "{mp3artist} - {mp3album} - {mp3track|#2} - *" Rename REGEXP PATTERN (.*)( - [0-9][0-9] - )(The|A|An)( )(.*)\.(.*) TO \1\2\5, \3.\6

If I take each of those instructions and put them in separate buttons, then execute them one after the other, they each do what they're supposed to. But, when I put them all together in one button, they don't. Running that button on my example file produces only partial results, because the renames don't happen quickly enough to be processed by the next command. If I had a script, I'm sure it could do it, but I don't have any knowledge of VBscript or Perl or anything else.

So, I guess I'm asking for help in getting this button working. Is there a way to pause multi-function buttons yet? Could someone maybe punch out a quick script for this? Any ideas on how to accomplish this?

Thanks for reading and thinking about this.

--chriscrutch

Running several renames in the same button still isn't a good idea in Opus 9. Since the new Rename Scripting feature handles most of the cases where people wanted to do that the problems with multiple-rename commands haven't been addressed.

Unfortunately, this is one case where you will still need to have two renames. This is because, at the moment, rename scripts don't have access to the file information fields (MP3 title, etc.).

Giving scripts access to those fields seems like an obvious extension and I've filed a feature request.

In the meantime I think you'll need a two button solution:[ol][li]Rename the file so its name includes all of the MP3 fields you need, with some kind of separator between the fields that makes it easy for part 2 to do its job.

e.g. A_Led Zeppelin_ D_IV_ T_03_ S_The Battle of Evermore_ E_mp3_

Doesn't have to be exactly like that but if the script can search for things like A...__ when it wants the artist name then its life will be easier.
[/li]
[li]The second rename would be a script which takes the name generated above and changes it as you want, applying titlecase (which you should be able to include as a subroutine in a larger script, to keep the logic tidy) to the song title part.[/li][/ol]
Someone might have to help you with the second part if you don't know VBScript. (I don't think I'll have time for a couple of days but I'll try to have a look when I have time, if nobody else has.)

I just realised/remembered that you can do this in one click and scripts already have access to the file information fields (sort of).

You can combine the two renames I mentioned above into one, by creating the filename with the MP3 information in the normal way (using the old name/new name) and turning on script mode at the same time.

The script's strNewName argument will contain the filename after it has been converted by the old name/new name fields and it can then work on that.

Here is a very basic example that shows it works:


That's a neat little find, there, nudel. But for my particular purpose, it will still take two buttons, even with the VBscript.

I guess I'll have to do two-click renames for now, and while I'm waiting for the DOpus update that will allow scripts to be able to access the tags, I might be able to learn enough VBscript to get me by.

Thanks.

--chriscrutch

I think you can do it in one click, you just feed each of the required tags into the script's new-name argument. In my example I only fed one tag in but there's nothing to stop you feeding in more.

Of course, it would be nicer if scripts had more direct access to tags and other information. A feature request has been filed for that.