Skip to content

Instantly share code, notes, and snippets.

@batok
Created May 26, 2010 15:04
Show Gist options
  • Save batok/414602 to your computer and use it in GitHub Desktop.
Save batok/414602 to your computer and use it in GitHub Desktop.
p = subprocess.Popen("rm -f {0}/tmp/*png".format(os.getcwd()),shell = True)
pid, sts = os.waitpid(p.pid,0)
for i,fname in enumerate([x for x in self.filelist if ".png" in x]):
cuantos = i +1
if True:
p = subprocess.Popen("ln -s {0}/{1} {0}/tmp/sc{2:d}.png".format( os.getcwd(), fname, cuantos), shell = True)
pid, sts = os.waitpid(p.pid,0)
the_file = "{0}/{1}".format(os.getcwd(), flv_name)
command_line = "ffmpeg -r 0.5 -f image2 -i {0}/tmp/sc%d.png -i output.wav -r 25 -qscale 3 -g 100 -acodec libfaac -ab 128k -y {0}/narrated_screenshot_series.flv".format(os.getcwd())
p = subprocess.Popen(command_line, shell = True)
pid, sts = os.waitpid(p.pid, 0)
dlg = wx.MessageDialog(self, "Do you want to upload the {0} file\n with a size of {1} bytes to s3?".format(flv_name, os.stat(the_file).st_size), "Flv upload", style = wx.YES_NO)
retCode = dlg.ShowModal()
if retCode == wx.ID_YES:
with open(the_file, "rb") as f1:
file_name = flv_name
key = self.bucket.new_key( file_name )
key.set_contents_from_file( f1, policy = "public-read")
file_uploaded = True
try:
self.growl_notifier.notify("upload", file_name,"Uploaded",sticky = True)
except:
pass
self.last_screenshot_file_name = flv_name
try:
if s3accounts.cloudfront_bucket:
dlg2 = wx.MessageDialog(self, "Do you want this file copied to your cloudfront streaming bucket?", "Cloudfront bucket", style = wx.YES_NO)
rcode = dlg2.ShowModal()
if rcode == wx.ID_YES:
target_bucket = s3accounts.cloudfront_bucket
key = self.bucket.get_key(flv_name)
key.copy(target_bucket, key)
tb = self.connection.get_bucket(target_bucket)
key2 = tb.get_key(flv_name)
key2.set_acl("public-read")
dlg2.Destroy()
try:
l_url = "{0}{1}".format(s3accounts.streaming_url, flv_name.replace(".flv",""))
txt = wx.TextDataObject( l_url )
if wx.TheClipboard.Open():
wx.TheClipboard.SetData( txt )
wx.TheClipboard.Close()
except:
pass
except:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment