diff --git a/pyshare.desktop b/pyshare.desktop new file mode 100644 index 0000000..ed24ee4 --- /dev/null +++ b/pyshare.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Action +Name=Upload with pyshare +Profiles=profile-zero; + +[X-Action-Profile profile-zero] +Exec=/home/kageru/pyshare/pyshare.py -f %f +Name=Default profile diff --git a/pyshare.py b/pyshare.py old mode 100644 new mode 100755 index 02b4c74..204978a --- a/pyshare.py +++ b/pyshare.py @@ -6,7 +6,7 @@ from pysftp import Connection from subprocess import call from random import choices import pyperclip -import config as config +import config import sys import os import re @@ -48,6 +48,7 @@ def take_screenshot(filename: str) -> None: def ftp_upload(mode='screenshot', ext=None, sourcefile=None) -> tuple: if ext is None: + # TODO files without extension exts = { 'screenshot': 'png', 'text': 'txt', @@ -64,9 +65,10 @@ def ftp_upload(mode='screenshot', ext=None, sourcefile=None) -> tuple: if mode == 'screenshot': take_screenshot(fullpath) conn.put(fullpath) - notify_user(config.url_template.format(filename)) elif mode == 'file': conn.put(sourcefile, filename) + + notify_user(config.url_template.format(filename)) return fullpath, filename