secret
Last active

  • Download Gist
screenshot.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
#!/usr/bin/env python
 
import os
import subprocess
import time
 
HOME = os.environ['HOME']
DROPBOX_DIR = os.path.join(HOME, 'Dropbox/Public/screens/')
DROPBOX_URL_TEMPLATE = 'http://dl.dropbox.com/u/%s/screens/%s'
DROPBOX_UID = 'xxxxxx'
 
if __name__ == '__main__':
filename = 's%s.jpg' % time.time()
dest = os.path.join(DROPBOX_DIR, filename)
url = DROPBOX_URL_TEMPLATE % (DROPBOX_UID, filename)
 
args = ['scrot', '-q 100', '-z']
stype = raw_input('[c]urrent, [f]ull or [s]elect? Cfs ') or 'c'
if stype == 'c':
args.append('-u')
elif stype != 'f':
args.append('-s')
args.append('-d %s' % (raw_input('seconds to wait? (default 1) ') or 1))
args.append(dest)
 
p = subprocess.Popen(args)
p.wait()
 
print url

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.