TVRename equivilent for movies?

Phrak

08-01-2009 13:26:59

To the collective brains trust (surely someone has an idea!):
Does anyone know of a script/application/whatever that can perform a similar function for Movie files?

I've got about 450 movies on disk, most of them are named relatively nicely, but a few that are still with the scene release name.

Ideally, I'd like to be able to scan a directory of avi, mpg, rm, etc files and:
* Create a new directory for each movie.
* Grab the movie info from IMDB.
* Rename the movie to the "nice" name and include the year it was released.
* Create a .nfo file and cover art for the movie.
* Grab the sub-titles if selected.

I've found a few applications that, in combination with each other, can do most of the above, but not one application that can do it all.

The closest app I've found is an AutoIT script: (http://www.autoitscript.com/forum/index ... 78185&st=0) It's nice, but it doesn't do any form of organisation or renaming.

Any thoughts?

Phrak

sstteevvee

08-01-2009 13:47:21

I've never used it myself, but Media Companion (formerly known as XBMC media companion) claims to do what you want.

Phrak

08-01-2009 14:05:23

Yeah I just tried that one this morning, but again, it does everything except the renaming functions :(

Media Renamer (http://forum.team-mediaportal.com/plugi ... 26-a-13547) claims to do the renaming function, and looks like it's scanning IMDB, but doesn't come back with any information :roll:

*sigh* I really need to learn how to code in a reasonable language - I can script the world with batch files, but when it comes to lookups from the interweb, a batch file ain't gunna cut the mustard.

Phrak

sstteevvee

08-01-2009 14:49:57

If media companion can get the NFO files written, you could write a script that then uses the info in them to rename the files.

I occasionally use PHP for command line scripting. Its a decent language, and has lots of built in functions for processing text, downloading data from the web, as well as doing stuff on the local filesystem like looking through directories, and running arbitrary commands. Depending on how slack you want to be with your programming practice, you can leave off the stricter error/type checking options, too :)

Phrak

08-01-2009 15:58:39

Yeah that's what I've ended up doing - Using Media Companion to scrape the info from IMDB then batch process the .nfo file.

Rename.bat - Version 1.1
:: Change Log:
:: v1.1 2008-01-08 Added error checking for files without a .nfo file; added .mkv support

Usage:
Download Media Companion (http://www.billyad2000.co.uk) and scrape your movies directory to create the .nfo and cover-art files.
Save the below code as rename.bat in the directory where you want to rename files.
Run it!

Functions:
Grab the movie year from the .nfo
Create a directory with the file name and year
Rename the files to include the year and move them into their own directory.

To Do:
Test the usability on some scene releases with their funky names (I haven't got any available right now)
Rename the file with the IMDB info found.

::-----------------------------------------------------------------------------------------
:: Rename.bat
:: Version 1.1
:: Original Author: Tim U.
:: Author email: renamebatch.tim-nospam@spamgourmet.com
:: Release date 2008-01-08

:: Usage:
:: * Download Media Companion (http://www.billyad2000.co.uk)
:: * scrape your movies directory to create the .nfo and cover-art files.
:: * Run rename.bat in the directory where you want to rename files.

:: Functions:
:: * Grab the movie year from the .nfo
:: * Create a directory with the file name and year
:: * Rename the files to include the year and move them into their own directory.

:: To Do:
:: * Test the usability on some scene releases with their funky names (I haven't got any available right now)
:: * Rename the file with the IMDB info found.
:: * Handle multi-part files

:: Change Log:
:: v1.1 2008-01-08 Added error checking for files without a .nfo file; added .mkv support
::-----------------------------------------------------------------------------------------


for /F "tokens=*" %%A in ('dir *.avi *.mpg *.mkv /b') do (set filename=%%A)&(call :rename)
goto :eof

:Rename
set moviename=%filename:~0,-4%
set extension=%filename:~-3%

::Error checking
if %moviename:~-1%==] (echo "%moviename%" is already renamed)&(echo "%moviename%" is already renamed>>Rename_error.log)&(goto :eof)
if not exist "%moviename%.nfo" (echo "%moviename%" has no .nfo file)&(echo "%moviename%" has no .nfo file>>Rename_error.log)&(goto :eof)

::Grab year from .nfo file
for /F "tokens=*" %%A in ('findstr /i "<year>" "%moviename%.nfo"') do set year=%%A

::More error checking
If "%year%"=="<year></year>" (echo "%moviename%" has no IMDB Info)&(echo "%moviename%" has no IMDB Info>>Rename_error.log)&(goto :eof)


Set year= [%year:~6,4%]

echo "%moviename%" renamed to "%Moviename%%year%"
echo "%moviename%" renamed to "%Moviename%%year%">>rename.log

ren "%moviename%.*" "%Moviename%%year%.*"
ren "%moviename%-fanart.*" "%Moviename%%year%-fanart.*"

if not exist "%cd%\%moviename%%year%\*.*" md "%CD%\%moviename%%year%"
move "%Moviename%%year%*.*" "%CD%\%moviename%%year%\"
goto :eof


Hope this helps someone else! :)
Phrak

hameed

12-01-2009 17:50:14

Very VERY nice man :)
Have to try your it ASAP sounds great.

For some "funky" named files check out vcdquality.com ...I am sure you won't need more :)

Phrak

30-01-2009 12:27:46

Cheers :D
Thoughts? Changes?