Sign in to follow this  
Followers 0
DoubleMcLovin

File organizer

6 posts in this topic

#1 ·  Posted (edited)

This script will take files in a given directory and do the following:

-extract

-rename

-categorize

And then it will put them into categorical directories. Primary use is for movies and tv series downloaded from the internet to put into a standard format that media library programs like "Media Browser" for windows media center will be able to interpret.

Source code will remain updated at:

http://code.google.com/p/filecustodian/

attached is the most recent source.

Works ideally for torrent movies/shows or movies/shows downloaded via IRC networks. (of course you should legally own these :x before you download them)

EDIT:

Here is a link to the Wiki for this, it should provide plenty of information about this project: http://code.google.com/p/filecustodian/wiki/FileCustodian?ts=1295386319&updated=FileCustodian

EDIT 1/18/2011:

Updated to latest version - 1.3. Major bugfix, see google code download for changelog.

EDIT 1/19/2011

Updated to latest version - 1.31 - Fixes issue with season naming. Should operate smoothly now.

EDIT 2/11/2011:

Updated to latest version - 1.3.0.4 - FULLY FUNCTIONAL!

File.Custodian-1.3.0.4.au3

Edited by DoubleMcLovin

Share this post


Link to post
Share on other sites



I can that a lot of work went into the program and I threw a few AVI's at it that had accumulated in my downloads folder over the years.

You need to add a bit(lot) more description about what the script does with the files so others may use it.

At the moment it's a black box that many wouldn't risk their files with. :x

A couple of questions

Why does it put each episode of a series in it's own directory?

Maybe this could be an option?

Maybe instead you could create a folder for each series?

(e.g. {Main series Folder}\{series name}\{series name} {Series No} {Episode No}.......avi)

Why do some videos get left in their original folder but put into sub folders?

Why if the destination folders aren't created are the files left in their original folder but put into sub folders?

(Shouldn't you just create the destination folders as part of the initialisation?)

A few things you may like to think about:

Create a list (straight text file e.g. Series_list.txt) containing names of all the series you watch.

This could be used in your program to "pre select" what a file will be classified as

If this is to be run by the user (i.e. not background) it needs more feedback so the user can see what is going on.

It looks like a great program but I like to see what is going on before it happens and there is too little feedback for me. :P

Keep up the good work!

John Morrison

aka

Storm-E

Share this post


Link to post
Share on other sites

Hey thank you for the feedback. That is all very useful feedback for me. To be honest this is my first real application that I have made from the ground up, and there are a still a handful of bugs I am actively addressing. I definitely plan on making this program more robust very quickly, it does a few things I am not happy with at the moment (namely the way it interacts with series).

A couple of questions

Why does it put each episode of a series in it's own directory?

Maybe this could be an option?

Maybe instead you could create a folder for each series?

(e.g. {Main series Folder}\{series name}\{series name} {Series No} {Episode No}.......avi)

The behavior you outlined is what it is designed to do and does for me locally. It botches up the names a little of the files, but gets the paths correct. I would be interested to see your misc.log and changes.log files to see how your files are named. As it, it takes series episode and does the following:

-checks to see if it is inside a dir with the same season number (eg: c:\...\Show\Season 1\Show S01 E01 - Episode Name.avi) it does this by looking at the last 4 digits of the root folder compared to the series# in the file name.

-Renames the file to match the above format. It does this by looking for several things, first can it find the words season or series or can it find the letter 's' followed by 1-2 numbers followed by a possible non-numeric digit (regex: \D?) followed by the letter 'e' followed by 1-3 numbers which is not followed by another number for at least 3 characters. If that check fails it tries to find something in the format "##x##" and decides the first 1-2 #'s are the season, and the next 1-3#'s are the episode. This check still fails for shows that have a format such as: "Show 0110 - name.ext" It is hard to sort out those four digits since a lot of files also include the year of production (I am experimenting with excluding sets of 4 numbers that start with 19|20)

Why do some videos get left in their original folder but put into sub folders?

I am not sure what you are asking here, are you saying you have a situation where the format after run matches "c:\...\Movies\subdir\Movie Name\movie.ext" ? This should never happen. However, anything in the 'Series' directory is subject to categorization by seas# as outlined above. Sometimes movies accidentally catch that filter, again another bug I am working on.

Create a list (straight text file e.g. Series_list.txt) containing names of all the series you watch.

This could be used in your program to "pre select" what a file will be classified as

I don't want to use that approach because then it becomes a static ordering as opposed to a dynamic one. This application should be able to take a successfully downloaded file and sort it all by itself without assistance from the end user in any way.

If this is to be run by the user (i.e. not background) it needs more feedback so the user can see what is going on.

Have you read the misc.log file? There is a step by step review of what happens. However, I do see your point and for a full program this would need a GUI and maybe list all possible changes and ask approval before making them. Since I do not want to make a GUI for this yet, and a series of yes/no message boxes are out of the question (that would be annoying) I think this application's natural place is in the background running silently. After all, you don't really want to see the custodian taking out the trash infront of your office, but you definitely don't want the trash there. You just hope he takes care of it when you aren't there.

Again, thank you for your critique, honestly I had not hopped for anyone to really use this anytime soon. I put it on the forum expecting some script kiddey to stumble across it in a few years and be able to play with it (at most, to be honest I figured no one would ever touch my crappy program ever haha). I do plan on writing a full tutorial once I get it to behave with the series a bit more and tidey up some of the code. If you are genuinely interested in this project the link to the google code page I put in the first post will be accurate daily. I have submitted several revisions since the code on this forum already.

Share this post


Link to post
Share on other sites

Hey thank you for the feedback. That is all very useful feedback for me. To be honest this is my first real application that I have made from the ground up, and there are a still a handful of bugs I am actively addressing. I definitely plan on making this program more robust very quickly, it does a few things I am not happy with at the moment (namely the way it interacts with series).

If you're anything like me you'll never be happy with your programs.

The behavior you outlined is what it is designed to do and does for me locally. It botches up the names a little of the files, but gets the paths correct. I would be interested to see your misc.log and changes.log files to see how your files are named. As it, it takes series episode and does the following:

I'll IM them to you.

I am not sure what you are asking here, are you saying you have a situation where the format after run matches "c:\...\Movies\subdir\Movie Name\movie.ext" ? This should never happen. However, anything in the 'Series' directory is subject to categorization by seas# as outlined above. Sometimes movies accidentally catch that filter, again another bug I am working on.

NOPE! I'm saying the AVI files stayed in the original directory but were moved into a folder with the same name as the avi file.

eg

{source}/{file}.AVI became {source}/{file}/{file}.AVI

You'll see in the logs when I send then to you.

BTW if you remove the destinaiton folders (or havn't created them yet) it will do the same behavour.

I don't want to use that approach because then it becomes a static ordering as opposed to a dynamic one. This application should be able to take a successfully downloaded file and sort it all by itself without assistance from the end user in any way.

Sorry didn't explain myself properly.

This would be an additional (first check).

Say I've got an old series that doesn't use the S01E01 format I could add it's name to the file.

All you need to do is add this "extra" check at the top of you checking section if a file isn't found then you move on to the rest of the checks.

Have you read the misc.log file? There is a step by step review of what happens. However, I do see your point and for a full program this would need a GUI and maybe list all possible changes and ask approval before making them. Since I do not want to make a GUI for this yet, and a series of yes/no message boxes are out of the question (that would be annoying) I think this application's natural place is in the background running silently. After all, you don't really want to see the custodian taking out the trash infront of your office, but you definitely don't want the trash there. You just hope he takes care of it when you aren't there.

Yep but if you are the owner of the building and the tenents are complaining you want to be able to see what the custodian is doing.

IN this case IF you want to give real time feedback just have 2 modes of operation. The Gui code could be eliminated from running by a simple IF statement

If GUIflag then
GUI CODE
ENDIF

Again, thank you for your critique, honestly I had not hopped for anyone to really use this anytime soon. I put it on the forum expecting some script kiddey to stumble across it in a few years and be able to play with it (at most, to be honest I figured no one would ever touch my crappy program ever haha). I do plan on writing a full tutorial once I get it to behave with the series a bit more and tidey up some of the code. If you are genuinely interested in this project the link to the google code page I put in the first post will be accurate daily. I have submitted several revisions since the code on this forum already.

I'll take a look.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I've fixed a lot of the bugs, I am still having trouble with it thinking some movies are series. Having trouble manipulating the regex statement, but I should figure it out tomorrow. In the meantime I have updated the file in this post and on the download page of that google code page (thats where the change log is btw). This should make it run much more smoothly.

EDIT: I still wouldn't let this thing go to town on your series just yet, its still being picky about the names and getting them slightly wrong. Its a small error, all regex. But this should be good on your movies.

Edited by DoubleMcLovin

Share this post


Link to post
Share on other sites

After tons of debugging, I am now unable to produce any errors myself using this script. It functions perfectly on my rig and I am now asking anyone in the community who is interested in trying this to let me know if they have any issues with it! Test it out and let me know what you think.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0