Skip to content

Instantly share code, notes, and snippets.

@dnshl
Created August 3, 2013 11:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dnshl/6146194 to your computer and use it in GitHub Desktop.
Save dnshl/6146194 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'FileUtils'
url = 'http://feeds.feedburner.com/simpledesktops\?format\=xml'
dir = Dir.home + '/Pictures/Wallpaper/'
FileUtils.mkdir_p(dir) unless Dir.exists?(dir)
wallpapers = `curl -s #{url} \
| grep .static \
| cut -f4 -d';' \
| cut -f2 -d'"' \
| cut -f1-4 -d'.'`.split("\n")
wallpapers.each do |wallpaper|
output = dir + wallpaper.split("/").last
`curl -s -o #{output} #{wallpaper}` if not File.exists?(output)
end
Dir.rmdir(dir) if Dir.entries(dir).join == "..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment