#!/usr/bin/env ruby
#Downloading stuff from Magoosh

require 'ruby-growl'

def download

	puts 'Enter beginnning file number:'
	begin_num=gets.to_i

	puts 'Enter ending file number:'
	end_num=gets.to_i
	
	puts 'Enter naming number to begin(usually 1)'
	begin_name=gets.to_i

	download_url="http://s3.amazonaws.com/magoosh-app.production/lessons/videos/" 

	begin_num.upto(end_num) do |count|

		final_url="#{download_url}#{count}/originals.mp4"
		final_command="wget -O #{begin_name}.mp4 #{final_url}"
		puts "Downloading....#{final_url}"
		`#{final_command}`
		begin_name=begin_name+1
	end

	#notify of finished download
	g = Growl.new "localhost", "ruby-growl"
	g.add_notification "ruby-growl Notification"
	g.notify "ruby-growl Notification", "It came from ruby-growl!", "Download Finished!"
end


download