imgur.py screenshot on OSX

This commit is contained in:
James Booth
2016-10-09 22:50:23 +01:00
parent cd92ab06d3
commit 39f5a03e78

View File

@@ -1,13 +1,16 @@
""" """
Requires imgur API Requires imgur API
pip install imgurpython pip install imgurpython
Requires scrot installed for screenshot Requires scrot installed for screenshot (on linux)
sudo apt-get install scrot sudo apt-get install scrot
Uses built in screencapture on OSX
""" """
import prof import prof
import subprocess import subprocess
import sys
from os import path from os import path
from imgurpython import ImgurClient from imgurpython import ImgurClient
@@ -20,9 +23,11 @@ client = ImgurClient(client_id, client_secret)
def _cmd_imgur(arg1): def _cmd_imgur(arg1):
if arg1 == "screenshot": if arg1 == "screenshot":
file_path = "/tmp/_prof_scrot.png" file_path = "/tmp/_prof_screenshot.png"
command = "scrot " + file_path if sys.platform == "darwin":
subprocess.call(command, shell=True) subprocess.call("screencapture " + file_path, shell=True)
else:
subprocess.call("scrot " + file_path, shell=True)
else: else:
try: try:
file_path = path.expanduser(arg1) file_path = path.expanduser(arg1)