import android
droid = android.Android()
from ftplib import FTP
#
#check all variables are present
#
try:
myFTPuser = droid.getIntent().result[u'extras'][u'%myFTPuser']
except:
droid.makeToast('User name missing')
exit(1)
try:
myFTPpass = droid.getIntent().result[u'extras'][u'%myFTPpass']
except:
droid.makeToast('Password missing')
exit(1)
try:
myFTPserver = droid.getIntent().result[u'extras'][u'%myFTPserver']
except:
droid.makeToast('Server name missing')
exit(1)
try:
myFTPlocaldir = droid.getIntent().result[u'extras'][u'%myFTPlocaldir']
except:
droid.makeToast('Local directory name missing')
exit(1)
try:
myFTPlocalfile = droid.getIntent().result[u'extras'][u'%myFTPlocalfile']
except:
droid.makeToast('Local file name missing')
exit(1)
try:
myFTPremotedir = droid.getIntent().result[u'extras'][u'%myFTPremotedir']
except:
droid.makeToast('Remote directory name missing')
exit(1)
try:
myFTPremotefile = droid.getIntent().result[u'extras'][u'%myFTPremotefile']
except:
droid.makeToast('Remote file name missing')
exit(1)
#
# Get full local path name
#
if myFTPlocaldir.endswith("/") is not True:
myFTPlocaldir += "/"
myFTPlocalfilename = myFTPlocaldir + myFTPlocalfile
#
# Upload the file
#
try:
session = FTP(myFTPserver, myFTPuser, myFTPpass)
session.cwd(myFTPremotedir)
uploadfile = open(myFTPlocalfilename,'rb')
session.storbinary('STOR ' + myFTPremotefile, uploadfile)
droid.makeToast("Uploading now...")
uploadfile.close()
session.quit()
droid.makeToast("File transfered")
except:
droid.makeToast("An error occured")
--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
Visit this group at http://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/groups/opt_out.
The real question, could this be adapted to get tasker to integrate with chromecast?!?
Hmmm?
... but not as a tasker plug-in.