This script is made by : kiwimonk
What does it do ??
- If it containes a movie file, it renames it based on the folder name
- Moves movies into a folder called : Movies
- When it's a TV show it sticks it in a folder named after wahtever is before the first dash
- If the folder does not contain a movie name , it removes the _
Set-up instructions :
To setup the script in windows explorer. you open regedit...
\HKEY_CLASSES_ROOT\Directory\shell\
Make a key in here called Movie Magic
then a key in that one called Command
Now in command double click on the (Default) string and set it to:
C:\Python25\python.exe C:\xx\aftersab.py "%1"
Good to go! Now just right click on a folder in your download directory in Windows Explorer. to give it a go. If you uncomment the last line:
#forty = raw_input("Continue")
It will leave the output on the screen.. can be handy if its not working right.
For Script : http://binpaste.pastebin.ca/869508
So this is a script you run yourself on folders !!!
Warning: This script is highly unpolished, and sometimes can screw up.
Its setup not to delete movie directories with stuff still in it in case that happens.
Like sometimes it will only pickup one cd and leave the other named wrong.
TV & Movie Script (Windows)
TV & Movie Script (Windows)
Last edited by rascalli on February 2nd, 2008, 3:44 am, edited 1 time in total.
Re: TV & Movie Script (Windows)
set-up instructions are back
read the post better , this is not a SAB script !!!
You run this script yourself
read the post better , this is not a SAB script !!!
You run this script yourself
Re: TV & Movie Script (Windows)
I put the command in PostProc.cmd (and modified the aftersab.py code a bit)
Saved script as aftersab.py in sab folder (where PostProc.cmd is also at)
PostProc.cmd with script as-is (to allow you to confirm directory delete)
START C:\Python25\python.exe aftersab.py %1
PostProc.cmd after modified to not require a prompt to be answered (and moving goes to parent directory).
(instead of deleting, I had the remaining folder of files to ~Removed path.)
C:\Python25\python.exe aftersab.py %1
The TV section never seemed to be triggered, then I realized the != should be == under TV, and != for movies.
Here's the changes in (movie section part of) script (including the changes where directory delete occurs):
change the != to == for TV section above where this goes.
elif thefilename != thefilename.rsplit('_-_')[0]: ## Movie Handler
for movingthese in movethesefiles:
print 'New Name: ' + thedir.replace(thefilename, '') + movingthese
os.rename(thedir + movingthese, thedir.replace(thefilename, '') + movingthese) ## Move to Parent Dir
_mkdir(thedir.replace(thefilename, '~Removed')) ## Create Dir for Removed
os.rename(thedir, thedir.replace(thefilename, '~Removed') + thefilename)
The same style of code can be used under TV, which if you want to avoid confirmations (see START command under PostProc.cmd above), use the ~Removed code there too.
_mkdir(thedir.replace(thefilename, '~Removed')) ## Create Dir for Removed
os.rename(thedir, thedir.replace(thefilename, '~Removed') + thefilename)
I found that python doesn't like tab for indentation...must use spaces!
The glitch I found was when a subtitle file was found it moved it instead of the video (not sure how to fix that yet).
Although you can use registry to make the on-demand method work too, I wanted it automatic.
For making TV episodes go to parent dir without using the ShowTitle folder, comment the lines that mkdir, and os.rename and use this line instead
os.rename(thedir + newfilename + '.' + filetype[0], thedir.replace(thefilename, '') + newfilename + '.' + filetype[0]) ## Move file into Parent Dir
Saved script as aftersab.py in sab folder (where PostProc.cmd is also at)
PostProc.cmd with script as-is (to allow you to confirm directory delete)
START C:\Python25\python.exe aftersab.py %1
PostProc.cmd after modified to not require a prompt to be answered (and moving goes to parent directory).
(instead of deleting, I had the remaining folder of files to ~Removed path.)
C:\Python25\python.exe aftersab.py %1
The TV section never seemed to be triggered, then I realized the != should be == under TV, and != for movies.
Here's the changes in (movie section part of) script (including the changes where directory delete occurs):
change the != to == for TV section above where this goes.
elif thefilename != thefilename.rsplit('_-_')[0]: ## Movie Handler
for movingthese in movethesefiles:
print 'New Name: ' + thedir.replace(thefilename, '') + movingthese
os.rename(thedir + movingthese, thedir.replace(thefilename, '') + movingthese) ## Move to Parent Dir
_mkdir(thedir.replace(thefilename, '~Removed')) ## Create Dir for Removed
os.rename(thedir, thedir.replace(thefilename, '~Removed') + thefilename)
The same style of code can be used under TV, which if you want to avoid confirmations (see START command under PostProc.cmd above), use the ~Removed code there too.
_mkdir(thedir.replace(thefilename, '~Removed')) ## Create Dir for Removed
os.rename(thedir, thedir.replace(thefilename, '~Removed') + thefilename)
I found that python doesn't like tab for indentation...must use spaces!
The glitch I found was when a subtitle file was found it moved it instead of the video (not sure how to fix that yet).
Although you can use registry to make the on-demand method work too, I wanted it automatic.
For making TV episodes go to parent dir without using the ShowTitle folder, comment the lines that mkdir, and os.rename and use this line instead
os.rename(thedir + newfilename + '.' + filetype[0], thedir.replace(thefilename, '') + newfilename + '.' + filetype[0]) ## Move file into Parent Dir
Last edited by trax on February 2nd, 2008, 8:54 pm, edited 1 time in total.