-
Notifications
You must be signed in to change notification settings - Fork 0
/
show_uploader.py
33 lines (25 loc) · 1.02 KB
/
show_uploader.py
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
30
31
32
33
#!/usr/bin/python
import sys
import subprocess
import paramiko
import webbrowser
source = '''source directory'''
destination = '''destination'''
file = sys.argv[1] #podcast file passed through command
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostname='', username='', password='')
ftp_client = client.open_sftp()
def printTotals(transferred, toBeTransferred):
print "\r{0} MB of: {1} MB".format(transferred /1024, toBeTransferred /1024),
#https://pythonadventures.wordpress.com/tag/xsel/
def text_to_clipboards(text):
# "primary":
xsel_proc = subprocess.Popen(['xsel', '-pi'], stdin=subprocess.PIPE)
xsel_proc.communicate(text)
# "clipboard":
xsel_proc = subprocess.Popen(['xsel', '-bi'], stdin=subprocess.PIPE)
xsel_proc.communicate(text)
ftp_client.put(source+file,destination+file, callback=printTotals)
text_to_clipboards('''HTML code to copied into the clipboards''')
webbrowser.open('''Blogging platform link to open CMS directly''')