# Finished TV and Movie Automation in a Virtual Machine

• 1 Votes - 5 Average
• 1
• 2
• 3
• 4
• 5
 Member Posts: 90 Joined: Jul 2006 Reputation: 5 2010-03-22 19:46 Post: #1 I've spent the last year slowly trying to perfect an automated system to download, unpack, rename, move, scrape library data, and delete random files and empty folders for TORRENTS. I think I've finally got it and it's all running in Windows 7 x86 Virtual Machine using Virtualbox. That means I never have to redo the automation process again and can put this on as many computers as I want with only having to change directory paths if they are different on the other computer. It also allows me to remote into the virtual system and mess with it while still watching shows on the HTPC. I might write a detailed guide with images in links in the near future but for now I will just outline it a bit. 1. Install free program Virtualbox and create a machine running whatever version of windows you want. I did Win7x86. Networking needs to be bridged to get its own normal ip address and network with the HTPC. Map network drives of the drives you will need write access to. Install the virtualbox addons. 2. Utorrent - set up rss tv show downloads from your favorite tracker. In the rss downloader label all the tv shows as TV and in utorrent preferences create persistent labels (movies|TV|apps|etc...) and set the option to put finished labeled torrents into a sub directory of their label. Do not need to set a download path for each rss show. The label takes care of that. 3. SCRU - free app for unpacking scene releases (rar files) that can be run by command line. You do not need to setup profiles or monitored directories in it. Just change a few settings. - edit default profile and have rename extracted file to parent directory checked and select "Disable" in the Directory Append option - That's it. Close it and we will use it from command line executed from eventghost. Code: ""{eg.globals.miscPath}" "Z:\Movies Rename Temp"" The "{eg.globals.miscPath}" part of the command line is a new thing I have going. miscPath is a variable that contains the path to my newly downloaded content so that scru knows exactly where to extract from. The creation of the variable is in the eventghost section below. 4. Ember Media Manager - great free app that scrapes all of your movie data and will soon be able to scrape tv shows. Able to run via command line. 5. Therenamer - move and rename movies and tv shows. Just need to set your default TV and Movie directories. Can be run from command line with the simple -fetch or -fetchmovie commands. You can now specify the fetch folder and archive folder from parameters.(Quotes Required) Code: fetchfolder: -ff="???" archivefolder: -af="???" Examples: (works with -fetchmovie too) theRenamer.exe -fetch -ff="c:\abc" theRenamer.exe -fetch -af="d:\def" theRenamer.exe -fetch -ff="c:\abc" -af="d:\def" I store my HD movies in a separate directory so this works perfect for that. my use of it: -fetchmovie -ff="E:\HD Movie Rename Temp" -af="E:\-HD Movies" 6. Belvedere - great free app from lifehacker that can automate a ton of file operations. Some rules I set: - copy files less than 2 minutes old from TV directory to a secondary directory that therenamer reads from so that you can keep seeding, - delete all files in TV, movies, etc that are 2 days or more old. Gives time for seeding - delete sample files, txt, whatever other random left over files from my directories - I'm also using it to monitor a few other directories and things can get tricky with the rules. Been a lot of trial and error to get it to delete, move or copy files of different extensions and creation dates to different directories and to delete different types of files based on different creation dates. For example I keep my high def files for a few more days to seed longer and I also keep them on another drive. 7. eventghost - need to use the plugin directory monitor that it comes with. You add as many of the plugins as there are directories you want to monitor. A big issue I had was that the directory monitor is not able to monitor a mapped network drive properly. You have to have it monitor the drive through a regular network path to the shared directory on the host box (HTPC). example: "\\HTPC\Torrent-Finished\movies" and not "G:\Downloads\Torrent-Finished\movies" (this one is the path through a mapped network drive). You create a macro for each folder you want to monitor. example macro for my movies folder: - event item - DirectoryWatcher5.Created (this one is monitoring my download movies folder for new files) - Pasing path of movie (python script containing code to put the path of the directorywatcher event into a variable that we can call from commant line later) Here is the python script code: Code: from os import path fp = path.abspath(eg.event.payload[0]) eg.globals.miscPath = fp - Start Program: scru.exe (with command line option "{eg.globals.miscPath}" "Z:\Movies Rename Temp") - Start Program: theRenamer.exe (with command line option -fetchmovie) - Start Program: Ember Media Manger (with command line option -newauto -all) - XBMCRepeat: Update Video Library (XBMCRepeat plugin - sends the update library command to any ip address) - Clear Pending Events I now use the email plugin to email me what new TV show just finished downloading. I also parse the event so that only the name is emailed to me and not the entire path as well. The plugin is set up with my gmail account using gmail's pop3 ability. The image below shows two python scripts that parse for the movie path. I no longer use that and only use the one python script that I mentioned above. For my TV shows: - event item - DirectoryWatcher4.Created - parsing filename of tv show (looks at the path in the previous event (above) and grabs just the name of the tv show) - E-mail: Send e-mail:{eg.globals.testVar} (sends email to my gmail account saying, "New Episode of Example Show") - Start Program: Belvedere.exe - has a rule that copies all files that are less than 2 minutes old to secondary directory - Start Program: theRenamer.exe - with command line option -fetch - Start Program: AutoDeleteFolders.bat (.bat file I made that can be put in any folder and when run it will delete all empty folders and subfolders. I have it in my TV download folder and Movies folder) Here is the bat file contents: Code: @echo off for /f "delims=" %%i in ('dir "%~f1" /ad /b /s ^| sort /R') do rd "%%i" 1>NUL 2>&1 - XBMCRepeat: Update Video Library (sends the XBMC update library command to the ip of my host machine that is running XBMC) - Clear Pending Events (You put the bat file in the main parent directory that you want to clean of empty folders and sub folders) I have also created a rule in belvedere that deletes all files in my different download directories that are older than two days. Gives them time to seed and you could change that to whatever you want. 8. Desktop replacement - Rainmeter with the Omnimo skin - Beautiful replacement of the windows desktop for a media center. I also use uremote on my host box as well as my laptop so that I can click a torrent link on a web page and uremote associates itself with the torrent file and sends it to utorrent in the virtual machine. I think I hit most of it and let me know what you think or if anything needs to be fixed. (This post was last modified: 2011-07-12 16:52 by Flook.) find