Skip to content

Instantly share code, notes, and snippets.

@lian
Created January 21, 2010 10:16
Show Gist options
  • Select an option

  • Save lian/282708 to your computer and use it in GitHub Desktop.

Select an option

Save lian/282708 to your computer and use it in GitHub Desktop.
#!/bin/env ruby
# http://sohowww.nascom.nasa.gov/data/realtime/mpeg/
SOHO_URL = "http://sohowww.nascom.nasa.gov/data/LATEST/%s"
MPLAYER_CMD = 'mplayer -ao null -really-quiet -geometry %ix%i+%i+%i %s -loop %i -speed %s &'
SOHO_ETI = {
'ETI_171' => { filename: 'current_eit_171small.mpg' },
#'ETI_195' => { filename: 'current_eit_195small.mpg' },
'ETI_284' => { filename: 'current_eit_284small.mpg' },
'ETI_304' => { filename: 'current_eit_304small.mpg' },
#current_mdi_igrsmall.mpg
#current_mdi_magsmall.mpg
#current_c2small.mpg
#current_c3small.mpg
}
def soho_mplayer(pos_x=0, pos_y=0, repeat=2, speed=0.5)
base_x = pos_x
cols, img_size = 2, 256
#cols, img_size = 3, 200
SOHO_ETI.each do |k,v|
file = k.to_s + '.mpg'
cmd = MPLAYER_CMD % [ img_size, img_size, pos_x, pos_y, file, repeat, speed.to_s ]
unless File.exists? file
url = SOHO_URL % [v[:filename]]
system 'wget -O %s "%s"' % [ file, url ]
end
system cmd ; sleep 0.5
pos_x += img_size
if pos_x >= base_x + (img_size*cols)
pos_x = base_x
pos_y += img_size
end
end
end
if $0 == __FILE__
puts "start playing recent nasa-soho videos"
#soho_mplayer 800, 0, 0, 1.0
soho_mplayer 0, 0, 2, 0.5
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment