imgur.py screenshot on OSX
This commit is contained in:
13
imgur.py
13
imgur.py
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user