diff --git a/Sermon-Upload/sermon-upload.py b/Sermon-Upload/sermon-upload.py index e215f83..e9ffdf9 100644 --- a/Sermon-Upload/sermon-upload.py +++ b/Sermon-Upload/sermon-upload.py @@ -1,3 +1,5 @@ +# Sermon Upload v1.0 + from subprocess import call # We can do BASH in Python if needed. import os # Lots of system stuff from shutil import copyfile # Allow copying of files @@ -5,34 +7,33 @@ import glob # Import glob tools for file listings. import notify2 # Notification utility. import time # Import time into the galaxy -#time.sleep(10) # Wait 10 seconds. -os.chdir("/home/josh/Downloads/Downloads") #/home/berean/sermons/2018 +time.sleep(10) # Wait 10 seconds. +os.chdir("/mnt/52265C99265C8041/Users/Berean-Sound/sermons") # list = sorted(glob.glob('*.mp3')) mostrecent = list[-1] secondrecent = list[-2] -#sermoncopy = "/mnt/52265C99265C8041/Users/Berean-Sound/sermons/" + mostrecent - -sermonsrc = "/home/josh/Downloads/Downloads/" + mostrecent -sermondst = "/home/josh/Downloads/" + mostrecent # /home/berean/sermons/2018/ +sermonsrc = "/mnt/52265C99265C8041/Users/Berean-Sound/sermons/" + mostrecent +sermondst = "/home/berean/sermons/2018/" + mostrecent # /home/berean/sermons/2018/ copyfile(sermonsrc, sermondst) -#call('rsync --update --progress -e "ssh -i /home/berean/sermons/.tempssh/temp" *.mp3 sermons@bereanbibleutah.org:/home/josh/sermons/2018/') +os.chdir("/home/berean/sermons/2018/") +os.system("rsync --update --progress -e 'ssh -i /home/berean/sermons/.tempssh/temp' *.mp3 sermons@bereanbibleutah.org:/home/josh/sermons/2018/") #call(sermons=$("ssh -i /home/berean/sermons/.tempssh/temp sermons@bereanbibleutah.org 'ls /home/josh/sermons/2018'") -recentsermon = call("$(echo hi)") +#recentsermon = call("$(echo hi)") #recentsermon = call("echo $sermons") -print(recentsermon) +#print(recentsermon) # if mostrecent == recentsermon: # -# notify2.init('Sermon Script') -# n = notify2.Notification("Sermon Uploaded", -# mostrecent #(var + " and " + secondrecent) #, -# # "notification-message-im" # Icon name -# ) -# n.show() +notify2.init('Sermon Script') +n = notify2.Notification("Sermon Uploaded", # NOTE TO SELF: Add validation. + mostrecent #(var + " and " + secondrecent) #, + # "notification-message-im" # Icon name + ) +n.show() # else: # notify2.init('Sermon Script') @@ -41,11 +42,3 @@ print(recentsermon) # # "notification-message-im" # Icon name # ) # n.show() - -# IFS=$'\n' -# recentsermon=$(echo "${sermons[*]}" | sort -nr) #| head -n2) -# echo $recentsermon - -#cd .. -#cd 2016 -#rsync --progress -e "ssh -i ../.tempssh/temp" *.mp3 sermons@bereanbibleutah.org:/home/josh/sermons/2016/