Skip to content

Instantly share code, notes, and snippets.

@coderforhire
Created December 17, 2012 21:00
Show Gist options
  • Save coderforhire/4322209 to your computer and use it in GitHub Desktop.
Save coderforhire/4322209 to your computer and use it in GitHub Desktop.
if current_playlist_published < new_playlist_published
new_playlist["playlists"][0]["assets"].each do |asset|
url_path = url + asset['path'] + 'files/' + asset["title"]
local_file = web_dir + asset["title"]
file_list = []
file_list << asset["title"]
File.open(web_dir + 'playlist.json', 'w') {|f| f.write(new_playlist_raw) }
if FileTest.exists?(local_file)
pp "#{local_file} ---File Exists Not Downloading---"
else
open( web_dir + asset["title"], 'wb') do |file|
file << open(url_path).read
end
end
end
end
dir_contents = Dir.glob(web_dir + '*')
puts dir_contents
puts file_list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment