Sleepy's Batch Automation Tools for Windows Users (uses uTorrent and TED to download)
#1
Thumbs Up 
Hey folks. Since this project was inspired by XBMC and these forums I thought I'd post about it here. My goal is to have a 100% automated TV show torrenting solution, with TED at the front, and XBMC at the end. I started developing some command-line utilities that fill in the gaps left by the various programs I use. I think some you heavy automation guys on the Windows side may like the stuff I've got planned.

The only thing I have finished right now is a beta of what I'm calling uTorrent Automator. Its very simple and only has two modes / functions at present:

Add Mode is used to add a .torrent task to uTorrent and then immediately apply a specified label to that task. If you enable the right options in uTorrent, this means you can control what subdirectory of your "Downloads" folder the finished files will be used as the destination. I plan on also making it possible to set the queuing properties of the torrent, so you can set up leachy settings for your auto-TV shows while leaving your main uTorrent settings alone.

Removal Mode simply finds any torrents that are still in uTorrent but have a status of "Finished" and removes them. This is a process that the author of uTorrent refuses to make automatic, which is what originally inspired me to begin writing stuff. If you go moving files around while their associated torrent jobs are still present in uTorrent, sometimes annoying things happen. If you set your "Queueing" settings correctly, you can have uTorrent automatically stop tasks once they complete, making this tool "see" and remove them.

Usage:
Code:
uTorrentAutomator.exe <address> <username> <password>
will trigger Removal Mode
Example:
uTorrentAutomator.exe 192.168.1.1:5000 admin admin

Code:
uTorrentAutomator.exe <address> <username> <password> <Label> <Path To Torrent File>
Will add the specified torrent file with the specified label.
Example:
uTorrentAutomator.exe 192.168.1.1:5000 admin admin TV %1
Will work inside of a Windows Batch file and will add the torrent called with it / dragged & dropped onto the batch file.

These are intended for use in a larger batch-driven scheme. I need to either write or find a "Directory Watcher" program which will trigger the download handler chains whenever new downloads complete.

My eventual handler chain will work like this:
TED will download torrents to some directory, which will automatically fire a batch script which uses uTorrentAutomator to add it to uTorrent + the TV label. The show will download to FinishedDownloads\TV, which will have a second directory watcher on it. The second one will fire a TV show manager batch tool, which will fire my uTorrentAutomator (for clearing the finished tasks), then probably TheRenamer, followed by another command-line tool I plan on writing which will call the "UpdateLibrary" function on my various installs of XBMC around the house.

I've got some other plans and welcome any feedback from you fine forum people Smile
I have zipped and uploaded the app here. Its only 17K because its a command console / batch program. I haven't implemented any real error handling yet, so it will crash if it encounters a scenario it doesn't like.

If you guys have any other command-line program needs, I would be happy to throw something together for you, like 'take this filename, apply this RegEx to it and then spit the output back to the console". I'm sure we'll come up with some stuff. I also have some plans for implementing some other download handlers, mainly for the "Movies" label / download destination. Mostly the same as TV shows just with a few tweaks.

EDIT
Forgot to make sure its clear, this was made with C# and you will need the .NET Framework 3.5 installed. If you don't have it, its a free one time install, download here:
http://www.microsoft.com/downloads/detai...laylang=en
Catchy Signature Here
Reply
#2
oh one other thing, I want to set up a couple ways to make it possible to keep track of what has been handled via automation. One of my favorite features on my old PHP download manager project was the idea of creating a personal TV downloads RSS feed. I believe I'll be able to do pretty much the same thing only make this one again a little command-line utility.

Also I just test-ran TheRenamer and found it fails to deal with "daily" / dated shows, which means I may end up porting over the stuff I wrote to do that as well. The hardest part for me was getting all the logic and RegEx debugged, and I'm happy with that so it shoudn't be too tough to port that stuff into a new little program.
Catchy Signature Here
Reply
#3
SleepyP
This would be very useful, I have a few questions, comments and thoughts...

Why use TED?
- it is a nice app but I now use uTorrent with RSS feeds and get basically the same functionality with less apps and hassle... granted it has been a year since I used TED, maybe there is something compelling I don't know about?

There are several apps to monitor dirs and do things - two good examples...
DirMon2 (http://www.dragonglobal.biz/download/)
Belvedere Automated File Manager (http://github.com/adampash/belvedere/tree/master)

TheRenamer is a great app... please post the feature request on their forum. Several of us have and the more that request it the better.

I could see possibly integrating the functions you want into Belvedere since it is under public license... that might make it the most logical move?
I'm not an expert but I play one at work.
Reply
#4
Hey sounds good.
Have a look at this thread: http://forum.xbmc.org/showthread.php?tid=48865
may help u.
Reply
#5
SleepyP Wrote:I need to either write or find a "Directory Watcher" program which will trigger the download handler chains whenever new downloads complete.

Eventghost has a "Directory Watcher" plugin that works like a charm. It triggers an event whenever a new file is created or changed in a folder, and has the option to scan recursively. It would be easy to have an event from the plugin cause the launch of your program. Then just have a different event triggered from the Shows subdirectory to launch the next application of your choice.

Looking forward to a finished product. Sounds like it'll beat my setup!
Reply
#6
OK, so I took a while in getting things together, but I haven't just been sitting around doing nothing Smile
I was having little luck in finding a "folder watcher" utility on Google, so I wrote a Windows Service app that does this. I've had it running on my server for about a week and so far its very stable and does what I expect it to do. It registers as using 0% CPU and 2MB of RAM consistently, which implies it has no memory leaks or big problems. I had to do a big redesign to get it working as expected and also to make the internal timers configurable. I call it "FolderWatcher".

The current version has two folder / program pairs, which I refer to as "watchers" for lack of a better term. Each watcher has its own "cooldown" timer. It does NOT care about anything except for "new file" and "new folder" activities, everything else is ignored. When it sees a new file created in a folder being watched, it fires the program and then starts the cooldown timer. While the timer's running, that folder is no longer being watched. This is to prevent like tons of "start program" events from stacking up in a queue if an entire season of a show (like 20+ files) is suddenly dropped in the TV folder. This service is designed to be very limited in what it does, but flexible in how it does it. The configuration is done in a simple XML file at this point, no big deal.

The other major thing I made is my own TV file renamer / mover / manager thing. I need a name for it, since at the moment its still called DateRenamer. Originally, I wrote it because TheRenamer cannot handle files that are in the "dated" / "daily" format. The developer is supposedly going to do that, but I wanted my own, more tailor-made app.

At this point my renamer handles TV show files with names in all formats currently in use, including date formats, season # episode #, and triple digit format. I use pretty much the same RegEx everyone else uses to find out if something is "a TV show" and then process out the parts of the filename.

What makes mine different is
-If a date format show is encountered, its handled as a "daily" show. My program calls and retrieves episode info from TheTVDB.com, including Episode#, Season#, Episode Title, Episode Synopsis, etc.

-If the show isn't found in TheTVDB (very likely with frequent shows like Colbert Report, Daily Show, etc), I scrape the missing info from TV.com. This also happens on shows where TheTVDB didn't get some of the fields. Basically I scrape both to try and get as much info as possible.

-I allow for two different renaming destinations to be specified: one for "normal" shows, and one for "daily shows". This lets you keep your disposable news shows seperate, so you can auto-prune old episodes and prevent The Daily Show from taking up like 40+ GB of space for no good reason.

-So if a show isn't in TheTVDB.com and I put it where XBMC can see it, even with corrected filenames its still not gonna be able to scrape it if TheTVDB is my default scraper (and it is). Never fear! I also generate an NFO file for each episode, allowing XBMC to automagically be able to pick up these shows regardless of what info is where on the internet.

-Because we have all this info about these shows, and I want to be able to keep track of what is happening automatically when I'm "not looking", my program also generates a standard RSS / Atom feed containing an item for each episode that has been processed. If it finds no local RSS file present, it generates a valid feed document with no items present. Then when an episode is processed and moved, it sticks all the relevant info in an RSS 'item', so it'll show up. This morning I actually woke up and checked my Google Reader to find like 8 shows had come during the night Smile This is my favorite part of the functionality I have created.

-At the moment, I am outputting to the format that XBMC will read automatically with no tweaking which I also happen to like:
<TV Shows Main Share>\<Show Name>\<Show Name>-S<Season#>-E<Episode#>-<Episode Title>
I plan on making this configurable but I've just been really busy figuring out what functionality I "need" and how to implement it. I did the TV.com and NFO file stuff last night, and so now I'm very happy with the way this program is.

-its a Console program and outputs fairly verbose text about what its doing, making logging very easy.


Also today, I wrote a tiny program that finds and deletes empty directories, since some torrents contain folders which become orphaned in my Downloads folder after my other tools have gotten done with them.

So guys, I need beta testers for this stuff. I'm not sure what the rules are about posting stuff, so I'm just gonna stick my tools in a ZIP file and host them on my web space for now. Will post a link when I get a chance.
Catchy Signature Here
Reply
#7
here's a screenshot of the RSS feed as rendered by GoogleReader. Yes, Six Feet Under is an old show I was running through my system just to get the formatting looking nice Smile

Image

The feed's current formatting is to make the title of the item "Show Name-Season ##, Episode ##: Episode Title", then stick in a screenshot from TheTVDB.com if one is available, then stick in the episode synopsis if that is available, and finally read out some file info. I am still not 100% sure what to do with the file info section so any input is more than welcome Smile

I just got done writing up some ReadMe's and then I put all the tools in a ZIP file.
Download It Here
Its a mere 53KB, because they're all .NET programs. Yes, you need the Microsoft .NET Framework 3.5 or better to be installed for these programs to work. They were tested and built on machines running Windows 7, and are as far as I can tell, totally compatible with Windows XP, Vista, and 7. No idea on Win 2000 compatibility.

What I need from you guys:
-A new, better name for the DateRenamer program!
-Feedback and feature requests/ideas
-Testing, testing and more testing.

And finally, you can tune in to my personal TV show RSS feed here if you're curious what it looks like live:
-http://feeds.feedburner.com/HouseOfGeeksTorrents

(me and my roommates run a small gaming / nerdy community thing we call House Of Geeks, and the torrent feed is basically all the TV shows we collectively download on our main data server / torrent box.

-EDIT-

Forgot to actually post the link to the ZIP file the first time... DOY
Catchy Signature Here
Reply
#8
Was doing a bit of research, and I found that Feedburner can be used to automatically take an RSS feed and generate email alerts from it, which covers email as a means of notifying the end-user Smile

Also, a bunch of people were like 'Psh, TED is lame and uTorrent can do the same stuff."

The main reason is that I am "Mr Computer Guy" to lots of other people, and most of them are way less savvy than me. For them, the interface is much much nicer / easier to understand and use.

Here's what uTorrent looks like:
Image

compared to TED:
Image

My MOM (who doesn't even really understand how to put files in folders and stuff) can understand TED, but she would be like "What is thisHuh" if I showed her uTorrent. So yeah, uTorrent may be better / more efficient, but TED is what the n00bs use, so its my test platform.
Catchy Signature Here
Reply
#9
Quote:Removal Mode simply finds any torrents that are still in uTorrent but have a status of "Finished" and removes them. This is a process that the author of uTorrent refuses to make automatic, which is what originally inspired me to begin writing stuff. If you go moving files around while their associated torrent jobs are still present in uTorrent, sometimes annoying things happen. If you set your "Queueing" settings correctly, you can have uTorrent automatically stop tasks once they complete, making this tool "see" and remove them.

Usage:
Code:
uTorrentAutomator.exe <address> <username> <password>
will trigger Removal Mode
Example:
uTorrentAutomator.exe 192.168.1.1:5000 admin admin

Hello I can't get this to work with uTorrent version 1.8.4.
Under Status of the torrent it won't change to "Finished" is changing to Seeding after Downloading.
Under Queue Setting the Seed While is set to 100% but when it reaches that the status is not changing to "Finished"....

HuhHuh?
Reply
#10
also not working with uTorrent version 2.0.1.
maybe you have another solution for automatic remove torrents with status "finished" or "seeding" ?
Thanks for any tips

Regards
Reply
#11
Hello,
Just wanted to see if this util was still about ? I have an almost completely automated download rig and now just need a way to automatically remove torrents. Preferrable would be able to delete them based on their inactivity (e.g. inactive for 2 weeks = delete).

I know this is an old thread but thought there might even be some crew about that have now found a way to do this via script some how. I am hoping they will include it in a future version of utorrent, it's popularity on the utorrent idea's listing is VERY high so it's obviously an in demand feature Smile

Thanks
Tom Wink
Reply
#12
so I was able to hack the original program to remove seeding torrents. there isn't source code in the original link so I had to resort to editing the exe so it looks for torrents in status 201 (seeding) instead of 136 (finished). No other modifications were made and runs with the same commands. Tested with utorrent 2.0.4 and webgui 3.80 9/5/10 version

http://rapidshare.com/files/432911329/uT...mator2.exe
Reply
#13
Thanks for the file Justin. I am thinkn that if I run that tho it will remove all my currently seeding downloads. I will do some testing over the coming days in a VM.

I am running Utorrent 2.2 as it has some decent new features. I have my seed while settings setup so that once a DL reaches a certain amount of upload + has been seeding for 3 weeks it turns it off (changes status to finished).

So I am thinkn my options are as follows;

Run that original utorrent automator script and run it once a day and it should (if it works with latest Utorrent) essentially delete any DL's that have reached the afore mentioned Finished status.
Reply
#14
Ok so I have done some testing. I find that if I use the utorrentautomator.exe in the first link or the utorrentautomator2.exe it errors up and then gives some sort of .net error spewed out into the cmd window something that basically says Web Server Bad Request (400). If I run the utorrentautomator.exe from the second link that has all SleepyP's automation tools it does actually run and then just puts up a "something went wrong" message in the dos window. I am pretty sure I am using the form of the command correct, my WebUI seems to be working alright, tested it on two machines still same error. I am running Utorrrent 2.2 and I think version .370 of the webGUI.
Reply
#15
ok upgraded to latest v380 WebUI, still no dice same error Huh. thoughts ?

Thanks
Reply

Logout Mark Read Team Forum Stats Members Help
Sleepy's Batch Automation Tools for Windows Users (uses uTorrent and TED to download)0