Automatic Downloads

Here’s a little script for all you Mac hackers out there. Say you have a media PC, like a Mac Mini, sitting in your home theater. Now you probably don’t surf for torrents on your TV — if you’re like me, you find them on your laptop and then have to copy the torrent file over the network, then mouse around on the media PC to open the torrent file up.
But what if you had a Drop Box where you could just toss in .torrents over the network, and have your TV immediately start downloading them for you? Why, that would be digital bliss!!
Supposedly Transmission has a feature that does this. The only problem is it doesn’t work. So I hacked together this. The script only works with SMB — alas, AFP does not notify the file system about changes, so automatic Folder Actions do not work. But as long as you don’t mind having at least one folder set-up for Windows File Sharing, try this…

on adding folder items to this_folder after receiving these_items
tell application “Finder”
set torrentsExt to {“.torrent”}

set allFiles to files of this_folder
repeat with theFile in allFiles
copy name of theFile as string to FileName

if FileName ends with torrentsExt then
tell application “Transmission”
open theFile
end tell
end if

end repeat
end tell
end adding folder items to


Update: Here’s another little hack to do something similar for music. If you download your music on another computer, but want it added to a central library hooked directly up to your TV, like I do, you can add this to the above script and have music automatically put away after being dropped in…Below the set torrentsExt line, add

set musicExt to {“.mp3”}
set myMusic to alias “Mac OS:Users:You:Music:”

Below the if…end if for torrentsExt add

if FileName ends with musicExt then
move theFile to myMusic
end if

Then you could set-up a Folder Action like this one, to automatically add it to your iTunes Library. More ideas here

Leave a Reply

Your email address will not be published. Required fields are marked *