def UploadVideo(video,email,password):
humantime = str(datetime.now().strftime("%m/%d/%Y"))
title = 'Time Lapse of Tomato Plants of the Three Days Prior To ' + str(humantime)
description = 'Confused? https://esologic.com/?page_id=1042'
category = 'Tech'
keywords = 'piplanter'
uploadcommand = 'youtube-upload --email=' + email + ' --password=' + password + ' --title="' + title +'"'+ ' --description="' + description + '"' + ' --category=' + category + ' --keywords=' + keywords + ' ' + os.path.normpath(video)
ConsoleDebug('Upload Command: ' + uploadcommand)
for i in range(10):
try:
ConsoleDebug('Attempt [' + str(i) + '] To Upload: ' + str(video))
proc = subprocess.Popen(uploadcommand, shell=True, stdout=subprocess.PIPE)
output = proc.stdout.read()
break
except:
ConsoleDebug('Upload Failed, Retrying')
ConsoleDebug('Upload Error: ' + str(output))
i = i + 1
time.sleep(15)
if i < 10:
ConsoleDebug('Uploaded After ' + str(i) + ' Attempts, Details: URL [ ' + str(output) + ']' )
return output
if i == 10:
ConsoleDebug('Upload Was a Failure')
return 'Upload was a Failure'