This seems pretty straight forward to me. I would do it in several passes. The first two, I would just a search to find the files that match. Then use an expression to change what you want. Specifically:
1. Type into the search box:
[Name]=[Movie: "
That should find everything that matches your criteria.
2. In the results, highlight everything. Then open the tagging pane and change the [Media SubType] field to Movie.
3. Now, with the same stuff still highlighted, change the [Name] field to make it the way you want. If you want to remove the first 7 characters, you can use this expression:
=removeleft([Name],7)
Just type (or cut and paste) that expression into the [Name] field in the tagging pane and it will change them all. Here's the reference for the removeleft() function:
http://wiki.jriver.com/index.php/Expression_Language#RemoveLeft.28.E2.80.A6.29:_Trims_characters_from_the_beginning_of_a_stringNow you can do your renames using the rename, move, and copy tool. Just do a search for [Media Subtype]=Movie, then select all and do your rename. Use the "Filename" section of the RM&C tool, and just type in the expression you want to use. The one you showed in your psuedo code seems very straightforward.
Do a similar process for your TV Shows. Search for the media subtype. Then highlight all, and use the Rename, Move, and Copy tool with your expression for the filename of those files.
Some basic cautions and disclaimers:
1. I have not tested any of the above expressions. You should test them and be cautious.
2. Please make a database backup before you start! File > Library > Back up library
3. These types of things should be tested on one or a few files to start, and then on larger batches. UNDO is your friend. Try to undo as soon as possible if you make a mistake or have unexpected results.
4. Read the docs on the RM&C tool:
http://wiki.jriver.com/index.php/Rename,_Move,_and_Copy_FilesIt's one of the most useful and powerful tools in MC and you'll do well to understand how it works, so you can use it wisely.
5. ALWAYS, always, use the preview pane in the RM&C tool! This lets you validate what the tool is going to do BEFORE you press OK to do it. This will save you tons of grief and will probably save you a lot of work. It has saved me from many, many, many mistakes, by showing me that I was not going to get what I was expecting. This allowed me to modify my rules and get what I wanted instead.
6. Take things one step at a time. You'll get there.
Ask here if you need more help. Good luck!
Brian.