Skip to content

Instantly share code, notes, and snippets.

Dir.foreach(web_dir) do |f|
pp f
pp new_playlist["playlists"][0]["assets"].any? {|a| a[:title] == f }
end
new_playlist["playlists"][0]["assets"].each do |asset|
url_path = url + asset['path'] + 'files/' + asset["title"]
local_file = web_dir + 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
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---"
{"playlists"=>
[{"id"=>"2011",
"title"=>"test playlist",
"client_id"=>"1403",
"date_start"=>"0",
"date_end"=>"0",
"time_start"=>"0",
"time_end"=>"0",
"assets"=>
[{"id"=>"2003",
@coderforhire
coderforhire / Error
Created December 19, 2012 14:27
error from chef runs
[sudo] password for remote:
[Wed, 19 Dec 2012 08:24:39 -0600] INFO: *** Chef 0.10.8 ***
[Wed, 19 Dec 2012 08:24:40 -0600] INFO: Run List is [recipe[one_player], recipe[one_player::playlist], recipe[nginx::commons_dir], recipe[nginx], recipe[nginx::commons], recipe[nginx::commons_conf]]
[Wed, 19 Dec 2012 08:24:40 -0600] INFO: Run List expands to [one_player, one_player::playlist, nginx::commons_dir, nginx, nginx::commons, nginx::commons_conf]
stacktrace:
Generated at Wed Dec 19 08:24:40 -0600 2012
Errno::ENOENT: No such file or directory - /var/www/playlist.json
/var/cache/chef/cookbooks/one_player/recipes/playlist.rb:29:in `read'
{"id":"test-install","screen_id":[{"id":"1965"},{"id":"1964"},{"id":"1967"}],"player_path":[{"screen_1":"http://localhost/1965/index.html"},{"screen_2":"http://localhost/1964/index.html"}],"vertical":[{"output_one":"0"},{"output_two":"0"}],"parent_server_url":"http://192.168.5.16","two_player":"1","resolution":[{"output_one":"\"1920x1080\""},{"output_two":"\"1920x1080\""}]}
node.set['multi_player'] = node_databag['multi_player']
template "/home/remote/.fluxbox/startup" do
source "startup.erb"
owner "remote"
group "remote"
mode 0755
variables({
[11825.262227] sd 18:0:0:0: [sdb] Asking for cache data failed
[11825.262230] sd 18:0:0:0: [sdb] Assuming drive cache: write through
[11825.262534] sd 18:0:0:0: [sdb] Attached SCSI removable disk
[11844.632115] usb 4-1: USB disconnect, device number 3
[11850.584111] usb 4-2: USB disconnect, device number 11
[11852.064046] usb 4-2: new full-speed USB device number 12 using uhci_hcd
[11852.244269] scsi19 : usb-storage 4-2:1.0
[11853.248145] scsi 19:0:0:0: Direct-Access Generic STORAGE DEVICE 9139 PQ: 0 ANSI: 0
[11874.000080] usb 4-2: reset full-speed USB device number 12 using uhci_hcd
[11877.276042] usb 4-2: reset full-speed USB device number 12 using uhci_hcd
node_databag['screens'].each_with_index do |screen, i|
hash = Hash.new
hash = {:id => screen['screen']['id'], :url => screen['screen']['url']}
node.set['screens'][i] = hash
end
template "/home/remote/.fluxbox/startup" do
source "startup.erb"
owner "remote"
{"id":"test-two-install","multi_player":false,"video_card":"nvidia","chef_server":"http://chef-server.newground.com","outputs":{"output_two":{"orientation":"horizontal","resolution":"\"1920x1080\""},"output_one":{"orientation":"horizontal","resolution":"\"1920x1080\""}},"media_manager":"http://192.168.5.16","screens":[{"screen":{"id":2108,"url":"http://localhost/"}}]}