Created
January 5, 2010 00:11
-
-
Save bdotdub/269014 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This is a script that will automatically download the latest video from the | |
# Final Gear torrent feed. I don't write many shell scripts so please excuse | |
# any bad shell scripting. | |
# My setup is to have Transmission automatically open torrents that are in | |
# my $HOME/Downloads/Torrents directory. You can set this in: | |
# Transfers > Auto Add | |
delay=300 | |
result='' | |
# Find latest Final Gear Torrent | |
latest=$(curl http://feeds.finalgear.com/finalgeartorrents 2>/dev/null | grep '<enclosure' | sed 's#^.*url="\(.*\)" type=.*#\1#' | head -1) | |
# While it's the same | |
while [[ $result = '' ]]; do | |
result=$(curl http://feeds.finalgear.com/finalgeartorrents 2>/dev/null | grep '<enclosure' | sed 's#^.*url="\(.*\)" type=.*#\1#' | head -1 | grep -v $latest) | |
echo "[ $(date) ] Nothing yet..." | |
sleep $delay | |
done | |
cd $HOME/Downloads/Torrents | |
curl "$result" | gunzip > $(basename $result) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'active_support' | |
require 'rss' | |
TorrentsDir = ENV['TOP_GEAR_DOWNLOAD_DIR'] || "/Users/#{ENV['USER']}/Downloads/Torrents" | |
FinalGearTorrentRss = 'http://feeds.finalgear.com/finalgeartorrents' | |
end_time = Time.now + 12.hours | |
while Time.now < end_time | |
rss = RSS::Parser.parse(open(FinalGearTorrentRss).read, false) | |
latest_item = rss.items[4] | |
if latest_item.pubDate > 1.day.ago | |
Dir.chdir(TorrentsDir) | |
`open /Applications/Transmissions.app` | |
`curl #{latest_item.link} | gunzip > top_gear.torrent` | |
exit | |
end | |
puts "[#{Time.now}] Didn't find anything new... sleeping for 5 minutes" | |
sleep 300 | |
end | |
puts "Did not download torrent" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment