Created
September 6, 2020 17:24
-
-
Save rubenkr/e310990338b5644c6f74aa876b3e53e4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
import os | |
import smtplib | |
import subprocess | |
sender = '[email protected]' | |
receivers = ['[email protected]'] | |
fullpath = sys.argv[1] | |
recording = sys.argv[2] | |
string_fullpath = str(fullpath) | |
string_recording = str(recording) | |
message = """From: TVHeadend <[email protected]> | |
To: Pushover <[email protected]> | |
Subject: TVHeadend New Recording: | |
""" | |
try: | |
smtpObj = smtplib.SMTP('localhost') | |
smtpObj.sendmail(sender, receivers, message + recording) | |
print "Successfully sent email" | |
except SMTPException: | |
print "Error: unable to send email" | |
print "Converting started for recording: " + string_recording + " in path: " + string_fullpath | |
# arguments need to be converted to strings | |
subprocess.call(['/config/convert-mkv2mp4.sh %s %s' % (string_fullpath, string_recording)], shell = True) | |
# better use call instead of popen -better use subprocess instead of OS.system | |
#os.system('bash /config/convert-mkv2mp4.sh {} {}' .format(str(fullpath), str(recording)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment