Update sermon-upload to working stable v1.0
This commit is contained in:
		
							parent
							
								
									d4bde8f26e
								
							
						
					
					
						commit
						697a5c5f0f
					
				@ -1,3 +1,5 @@
 | 
				
			|||||||
 | 
					# Sermon Upload v1.0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from subprocess import call # We can do BASH in Python if needed.
 | 
					from subprocess import call # We can do BASH in Python if needed.
 | 
				
			||||||
import os # Lots of system stuff
 | 
					import os # Lots of system stuff
 | 
				
			||||||
from shutil import copyfile # Allow copying of files
 | 
					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 notify2 # Notification utility.
 | 
				
			||||||
import time # Import time into the galaxy
 | 
					import time # Import time into the galaxy
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#time.sleep(10) # Wait 10 seconds.
 | 
					time.sleep(10) # Wait 10 seconds.
 | 
				
			||||||
os.chdir("/home/josh/Downloads/Downloads") #/home/berean/sermons/2018
 | 
					os.chdir("/mnt/52265C99265C8041/Users/Berean-Sound/sermons") #
 | 
				
			||||||
list = sorted(glob.glob('*.mp3'))
 | 
					list = sorted(glob.glob('*.mp3'))
 | 
				
			||||||
mostrecent = list[-1]
 | 
					mostrecent = list[-1]
 | 
				
			||||||
secondrecent = list[-2]
 | 
					secondrecent = list[-2]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#sermoncopy = "/mnt/52265C99265C8041/Users/Berean-Sound/sermons/" + mostrecent
 | 
					sermonsrc = "/mnt/52265C99265C8041/Users/Berean-Sound/sermons/" + mostrecent
 | 
				
			||||||
 | 
					sermondst = "/home/berean/sermons/2018/" + mostrecent # /home/berean/sermons/2018/
 | 
				
			||||||
sermonsrc = "/home/josh/Downloads/Downloads/" + mostrecent
 | 
					 | 
				
			||||||
sermondst = "/home/josh/Downloads/" + mostrecent # /home/berean/sermons/2018/
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
copyfile(sermonsrc, sermondst)
 | 
					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'")
 | 
					#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")
 | 
					#recentsermon = call("echo $sermons")
 | 
				
			||||||
print(recentsermon)
 | 
					#print(recentsermon)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# if mostrecent == recentsermon:
 | 
					# if mostrecent == recentsermon:
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
#     notify2.init('Sermon Script')
 | 
					notify2.init('Sermon Script')
 | 
				
			||||||
#     n = notify2.Notification("Sermon Uploaded",
 | 
					n = notify2.Notification("Sermon Uploaded", # NOTE TO SELF: Add validation.
 | 
				
			||||||
#          mostrecent #(var + " and " + secondrecent) #,
 | 
					     mostrecent #(var + " and " + secondrecent) #,
 | 
				
			||||||
#         # "notification-message-im"   # Icon name
 | 
					         # "notification-message-im"   # Icon name
 | 
				
			||||||
#         )
 | 
					         )
 | 
				
			||||||
#     n.show()
 | 
					n.show()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# else:
 | 
					# else:
 | 
				
			||||||
#     notify2.init('Sermon Script')
 | 
					#     notify2.init('Sermon Script')
 | 
				
			||||||
@ -41,11 +42,3 @@ print(recentsermon)
 | 
				
			|||||||
#         # "notification-message-im"   # Icon name
 | 
					#         # "notification-message-im"   # Icon name
 | 
				
			||||||
#         )
 | 
					#         )
 | 
				
			||||||
#     n.show()
 | 
					#     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/
 | 
					 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user