added direct file upload and a desktop file for custom file manager actions
This commit is contained in:
parent
b9fa6dc19c
commit
b635bef081
|
@ -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
|
|
@ -6,7 +6,7 @@ from pysftp import Connection
|
||||||
from subprocess import call
|
from subprocess import call
|
||||||
from random import choices
|
from random import choices
|
||||||
import pyperclip
|
import pyperclip
|
||||||
import config as config
|
import config
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
@ -48,6 +48,7 @@ def take_screenshot(filename: str) -> None:
|
||||||
|
|
||||||
def ftp_upload(mode='screenshot', ext=None, sourcefile=None) -> tuple:
|
def ftp_upload(mode='screenshot', ext=None, sourcefile=None) -> tuple:
|
||||||
if ext is None:
|
if ext is None:
|
||||||
|
# TODO files without extension
|
||||||
exts = {
|
exts = {
|
||||||
'screenshot': 'png',
|
'screenshot': 'png',
|
||||||
'text': 'txt',
|
'text': 'txt',
|
||||||
|
@ -64,9 +65,10 @@ def ftp_upload(mode='screenshot', ext=None, sourcefile=None) -> tuple:
|
||||||
if mode == 'screenshot':
|
if mode == 'screenshot':
|
||||||
take_screenshot(fullpath)
|
take_screenshot(fullpath)
|
||||||
conn.put(fullpath)
|
conn.put(fullpath)
|
||||||
notify_user(config.url_template.format(filename))
|
|
||||||
elif mode == 'file':
|
elif mode == 'file':
|
||||||
conn.put(sourcefile, filename)
|
conn.put(sourcefile, filename)
|
||||||
|
|
||||||
|
notify_user(config.url_template.format(filename))
|
||||||
|
|
||||||
return fullpath, filename
|
return fullpath, filename
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user