INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: A massive renaming expression...  (Read 1515 times)

bspachman

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 896
A massive renaming expression...
« on: March 13, 2007, 12:02:53 am »

Okay, it may not be massive by someone like Marko's standards, but it's certainly the biggest I've created. I think I used a couple of techniques that I have not seen posted on the board (at least in my searches).

Here's the directory rule:

Code: [Select]
Base Path:
M:\Mine\        //or 'Others'

Directory Rule:
If(IsEqual([Genre],Podcast),
        Podcast\[Album]\,

        [Album Artist (auto)]\
        If(IsEqual([Album Artist (auto)],U2),
                [Album]\,
                If(IsEqual([Disc #],unknown,8),
                        [Album]\,
                        [Album]\Disc [Disc #]\
                    )
            )
    )

I have 2 main directory trees. One for music I own on physical media (eg. Mine) and the other for my iTunes music store purchases (eg. Others). This expression is straightforward, I think. I have to manually enter which directory tree I'm renaming, then it puts the files in a typical [Album Artist (auto)]\[Album]\ format. There are exceptions for Podcasts and my U2 collection. The only other oddity is that if I've assigned a disc number, then there's an extra level to the directory structure. I only assign disc numbers if there are more than 1 disc in a set. If it's only a single-disc album--no disc number.

Here's the file rule:

Code: [Select]
If(IsEqual([File Type],m4p,8),
        If(IsEmpty(Mid([Filename (name)],60, -1)),
                If(IsEqual([Genre],Podcast),
                        [Track #] - [Name],
                        If(IsEqual([Album Artist],unknown,8),
                                If(IsEqual([Track #],0,2),[Name],[Track #] - [Name]),
                                If(IsEqual([Track #],0,2),[Artist] - [Name],[Track #] - [Artist] - [Name])
                          )
                  ),

                If(IsEqual([Genre],Podcast),
                        [Track #] - Mid([Name],0,52)...
                        If(IsEqual([Album Artist],unknown,8),
                                If(IsEqual([Track #],0,2),Mid([Name],0,57)...,[Track #] - Mid([Name],0,52)...),
                                If(IsEqual([Track #],0,2),Mid([Artist] - [Name]),0,57)...,[Track #] - Mid([Artist] - [Name]),0,52)...)
                          )
                  )
          ),

        If(IsEqual([Media Type],image,8),
                [Album Artist (auto)] - [Album],
                If(IsEqual([File Type],ape,8),
                        If(IsEqual([Track #],0,2),
                                [Album],
                                If(IsEqual([Album Artist],unknown,8),
                                        [Track #] - [Name],
                                        [Track #] - [Artist] - [Name]
                                  )
                          ),

                        If(IsEqual([Name],.cue,8),
                                [Album].cue,
                                If(IsEqual([Genre],Podcast),
                                        [Track #] - [Name],
                                        If(IsEqual([Album Artist],unknown,8),
                                                If(IsEqual([Track #],0,2),[Name],[Track #] - [Name]),
                                                If(IsEqual([Track #],0,2),[Artist] - [Name],[Track #] - [Artist] - [Name])
                                          )
                                  )
                          )
                  )
          )
  )

Again, like many of Marko's expressions--intimidating to look at, but not so bad once you break it down. My basic track naming scheme is [Track #] - [Name]. If I've assigned an Album Artist for an album (eg. Various, Soundtrack, etc.), then I include the track's [Artist] as part of the name.

There are exceptions for the CUE files I have in my MC library, as well as the APE files that are associated with them and the album art that is stored in each album's directory. The album art is [Album Artist (auto) - [Album]. The others (CUE & APE) are named with just the Album name. Of course, nothing is simple, so the few albums I have that are ripped directly to APE files have track numbers and they get named like the others, with [Track #] - [Name]

Podcasts have their own rules....

However, what I like the most is the auto-trimming of m4p files so they can be played by the QuickTime engine. JRiver is on the record as saying that you can't play files back via QuickTime if the filename is longer than 64 characters (which I believe includes the '.xxx' extension), so the practical filename length is actually 60 characters.

I discovered that the expression engine does NOT throw an error when asked to return characters that don't exist, so for my m4p files, I check 'IsEmpty(Mid([Filename (name)],60, -1)', which basically finds filenames longer than 60 characters.

I can then use normal naming techniques in conjunction with the 'Mid()' command to shorten the filenames with ellipsises.

The only gotcha I ran into here is that if you include the [Track #] field within the 'Mid()' command, the track number is coerced into a string, so you lose the auto-padding options that are so nice to use in the renaming options. That's why the track# fields are outside my 'Mid()' renaming commands.

Sorry for the long post, but I hope it gives some folks new ideas...

Best,
Brad
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9119
Re: A massive renaming expression...
« Reply #1 on: March 13, 2007, 02:59:36 am »

Nice!! :D
Some expression strings can take a little head-scratching and trial and error to get right, but the results are always worth it for me, be it for a rename option, a thumbnail text item, a pane or a column. Once they're done, they just get on with doing their job and it's easy to forget the complexity (real or imagined) of the expression work going on behind the scenes. The things that can be achieved via expressions are really fascinating.

I've built "one set of renaming options to fit them all".
It's a really neat thing that means no matter what the file type, or where it currently resides, as long as the tags are correct, I just need to load the rename tool and hit the OK button (because the last used strings are remembered) and the job's done.

I'm also building another (only audio done so far) that does a reverse check on the files to see if the file name and path match the tags, which highlights those files that have had things like punctuation or spelling corrected after the initial move.

It's great when you see your creation in action, and at the same time, you realise a couple of things...
1. You are pleased you use MC because no other media manager out there offers that level of user customisation.
2. Due to the highly personal nature of your chosen use of the expression string, many of the strings you create are of little use to anyone else, which is why expression sharing threads don't really work.

The good thing that does come from them however, is that they remind everyone of their existence, thus encouraging others to experiment, which can only be a good thing, surely.

*cough*
I really hoped that v12 would bring us the ability to use expressions in the base path field of the rename from props tool, but that is beginning to look unlikely now.
Experience has taught me to never say never though, so c'mon Matt, how about it? The ability to have something along the lines of if(isequal([media type],Video),D:,if(isequal([media type],Audio),E:,F:)) in the base field would be seriously useful. :)

-marko.
Pages: [1]   Go Up