TV Show Rename Help

A swapping-ground for Regular Expression syntax

TV Show Rename Help

Postby g3rman » Thu Oct 24, 2013 3:18 pm

My TV shows arrive in the following format:

C:\TV\Drama\Show Name.s01e01.xyz\Show Name.s01e01.xyz.avi
C:\TV\Drama\Show Name.s01e02.xyz\Show Name.s01e02.xyz.avi

C:\TV\Comedy\Show Name.s01e01.xyz\Show Name.s01e01.xyz.avi
C:\TV\Comedy\Show Name.s01e02.xyz\Show Name.s01e02.xyz.avi

The first folder after TV is a general label, the next folder is named after the show and episode, which in turn contains the video file.
I have been experimenting with various RegEx filters but can only get things to work partially.

Ideally I would like the shows to end up in the following format:

C:\TV\Drama\Show Name\Series 1\Show Name - S01E01.avi
C:\TV\Drama\Show Name\Series 1\Show Name - S01E02.avi

C:\TV\Comedy\Show Name\Series 1\Show Name - S01E01.avi
C:\TV\Comedy\Show Name\Series 1\Show Name - S01E02.avi

** Please note that S and E should become capitalized **

Any help would be much appreciated!!
g3rman
 
Posts: 2
Joined: Thu Oct 24, 2013 3:15 pm

Re: TV Show Rename Help

Postby truth » Thu Oct 24, 2013 5:41 pm

If you meant to remove the xyz-section, this should work:
(.+?)\.s([0-9]+)e([0-9]+)\..*$
\1 - S\2E\3
truth
 
Posts: 221
Joined: Tue Jun 25, 2013 3:39 am
Location: Earth, OrionArm, MilkyWay

Create batches with BRU

Postby truth » Sat Oct 26, 2013 11:26 am

Note everything below assumes you've renamed files AND folders per original regex!
It stripped the xyz-section & uppercased, but BRU wont create NewDirs, only rename them

I use BRC within batches in such cases, not used to solving this graphically
Since I missed it the 1st time, I'll give this DirPath my best shot... (it's ugly, but it works)
You can use BRU to create the batch commands to automate this:

Again, the below assumes you've already renamed Dirs and Filenames per original regex!
#12SubFolder & Folders (Files=Unchecked)
#1Regex below:
(.+?) - S([0-9]+)E([0-9]+).*$
MD "\1\Series \2" & MOVE /Y "\1 - S\2E\3\*" "\1\Series \2\"

In the left-pane, select Drama
In right-pane, select SubDirs named as Show - S##E##
BRU will create the batch-commands for your desired DirPaths under NewName column
Right-click your selected SubDirs / ClipboardCopy / NewFileName

Paste the batch-commands into a text file, the batch-lines will appear as:
MD "Show Name\Series 01" & MOVE /Y "Show Name\Show Name - S01E01\*" "Show Name\Series 01\"
I added the extra digit(s) in Series # to allow for 2-digit #s (easy to change if your max is only 9)
So long as theres no mis-named or identically-named files... You should be fine with MOVE vs COPY

By matching DirNameChars, it moves files as follows:
Drama\Show1 - S01E01\* ---> Drama\Show1\Series 01\
Drama\Show1 - S01E99\* ---> Drama\Show1\Series 01\
Drama\Show1 - S04E01\* ---> Drama\Show1\Series 04\
Drama\Show1 - S12E01\* ---> Drama\Show1\Series 12\
Drama\Show2 - S04E01\* ---> Drama\Show2\Series 04\
Drama\Show3 - S08E01\* ---> Drama\Show3\Series 08\

Save the text in a .bat/.cmd extension & run it within Drama as CurrentDirectory
I omitted commands to delete empty Dirs afterwards, figured you'd use COPY anyway to preview results

When you're ready, you can add below batchline to delete empty-Dirs (Dirs with 0-byte files are left intact):
FOR /F "usebackq delims=" %%d in (`"dir /ad/b/s | sort /R"`) do rd "%%d"

The prob with this method is you have to do it once for each \MainDir beneath TV!
Its still a good example of letting BRU create specialized commands based on Dir/Filename-matching
If I can think of something more elegant, I'll post back.
truth
 
Posts: 221
Joined: Tue Jun 25, 2013 3:39 am
Location: Earth, OrionArm, MilkyWay

Re: TV Show Rename Help

Postby truth » Sun Oct 27, 2013 7:54 am

The only improvement I foresee is processing all SubDirs 1-lvl below TV (versus just Drama)
That would first require renaming those SubDirs using #9AppendFolderName
(& modding the regex, fairly easy using #9Separators)

This gives BRU the ability to match ParDir, & thus create batch-commands to the correct path
The batch should run from within TV as CurDir to access the correct relative paths beneath
truth
 
Posts: 221
Joined: Tue Jun 25, 2013 3:39 am
Location: Earth, OrionArm, MilkyWay

Re: TV Show Rename Help

Postby g3rman » Mon Oct 28, 2013 12:14 am

Thanks guys,

I ended up using filebot which was able to accomplish everything I was looking to do, including creating directories and moving files there.
g3rman
 
Posts: 2
Joined: Thu Oct 24, 2013 3:15 pm

Re: TV Show Rename Help

Postby truth » Mon Oct 28, 2013 5:32 am

No worries,
I prefer commandline tools, I'd have created a .bat with sed/brc to handle this on-the-fly (varying by DirStructure)
If it were something I needed often, I'd just integrate it into a folders right-click option.

Just wanted to stay with BRU, almost everyone seems to prefer grahical apps today.
So long as it works for you, & you're happy with it, that's what matters.
truth
 
Posts: 221
Joined: Tue Jun 25, 2013 3:39 am
Location: Earth, OrionArm, MilkyWay


Return to Regular Expressions