Index: /IR_camera/get_IR_camera.py
===================================================================
--- /IR_camera/get_IR_camera.py	(revision 781)
+++ /IR_camera/get_IR_camera.py	(revision 781)
@@ -0,0 +1,131 @@
+#Do not forget
+#export GI_TYPELIB_PATH=$GI_TYPELIB_PATH:../../src:/home/delerue/aravis/src/
+#export LD_LIBRARY_PATH=../../src/.libs:/home/delerue/aravis/src/.libs
+#On raspberry replace delerue by pi
+
+#Run with python3
+
+import sys
+sys.path.append('/home/delerue/python-aravis/')
+sys.path.append('/home/pi/python-aravis/')
+
+import os
+import os.path
+import aravis
+import numpy as np
+from aravis import Camera
+from PIL import Image
+import matplotlib.pyplot as plt
+from io import BytesIO
+import time
+
+import requests
+import ftplib
+
+# Import smtplib for the actual sending function
+import smtplib
+from email.mime.text import MIMEText
+from validate_email import validate_email
+
+url='http://10.0.1.133/jpg/image.jpg'
+run_IR_File='/home/delerue/run_IR.txt'
+save_IR_File='/home/delerue/save_IR.txt'
+path_images='/home/delerue/IR_images/'
+
+ids = aravis.get_device_ids() #List visible cameras
+cam = Camera(ids[0]) #get the first camera
+cam.start_acquisition_continuous(nb_buffers=1)
+fig = plt.figure(figsize=(14,7))
+#fig = plt.figure(figsize=(16,9))
+#fig = plt.figure(figsize=(4,3))
+figIR=fig.add_subplot(121)
+figZavio=fig.add_subplot(122)
+#fid=open(run_IR_File,'w')
+#fid.close()
+iloop=1
+while (os.path.isfile(run_IR_File))and(iloop<50):
+        iloop=iloop+1
+        #print(iloop)
+        try:
+                imageZavioImg=Image.open(BytesIO(requests.get(url, auth=('admin', 'admin')).content))
+                imageIR = cam.pop_frame()# get next frame from camera
+                imageIR = cam.pop_frame()# get next frame from camera
+        except:
+                print('Error reading images')
+                
+        imageZavio = np.array(imageZavioImg)
+        #print frame
+        figIR_img=figIR.imshow(imageIR)        
+        figIR.set_title('Infrarouge')
+        figIR_img.set_cmap('jet')
+        figIR_img.axes.get_xaxis().set_visible(False)
+        figIR_img.axes.get_yaxis().set_visible(False)
+        figZavio_img=figZavio.imshow(imageZavio)
+        figZavio.set_title('Visible')
+        figZavio_img.axes.get_xaxis().set_visible(False)
+        figZavio_img.axes.get_yaxis().set_visible(False)
+        #fig.set_cmap('hot')
+        nowstr=time.strftime("%d/%m/%Y %H:%M:%S")
+        nowfile=time.strftime("%Y_%m_%d_%H_%M_%S")
+        plt.suptitle('Musee Sciences ACO\n'+nowstr, fontsize=32)
+        plt.savefig(path_images+'latest.png')
+        if os.path.isfile(save_IR_File):
+                nowfilename='image_'+nowfile+'.png'
+                plt.savefig(path_images+nowfilename)
+                print('Image sauvee sous '+nowfilename)
+                fid=open(path_images+nowfilename+".to_upload",'w')
+                fid.close()
+                try:
+                        fid=open(save_IR_File,'r')
+                        linemail=fid.readline()
+                        fid.close()                        
+                except:
+                        print('Email file error')
+                if validate_email(linemail.strip()):
+                        print(linemail.strip()+' is a valid email address!')
+                        fid=open(path_images+nowfilename+".to_email",'w')
+                        fid.write(linemail.strip())
+                        fid.close()
+                        email_dest=linemail.strip()
+                        email_src=nowfilename
+                        while(len(email_src)>1):
+                                msg = MIMEText('Bonjour,\nVotre image infrarouge est disponible sur http://lal.delerue.org/ETALON/IR/' + email_src )
+                                msg['Subject'] = 'Votre image infrarouge' 
+                                msg['From'] = 'Visites@sciencesaco.fr'
+                                msg['From'] = 'Visites ACO <Visites@sciencesaco.fr>'
+#                                msg['From'] = 'Visites Musee Sciences ACO'
+                                msg['To'] = email_dest
+                                try:
+                                        mails=smtplib.SMTP_SSL('lalrelay.in2p3.fr')
+                                        mails.login('delerue@lal.in2p3.fr','IR&THz4SP')
+                                        mails.sendmail('visites@sciencesaco.fr',msg['To'], msg.as_string())
+                                        mails.quit()
+                                        print('msg envoye a ' + email_dest)
+                                        os.remove(path_images+email_src+".to_email")
+                                        email_src=""
+                                except:
+                                        print('Envoie de courriel impossible')
+                                        email_src=""
+                else:
+                        print(linemail.strip()+' is not a valid email address!')
+                try:
+                        ftp=ftplib.FTP('ftp.delerue.org','delerue','st.exupery')                        #ftp.login()
+                        ftp.cwd('/www/lal.delerue.org/ETALON/IR/')
+                        #print ftp.retrlines('LIST')
+                        ftp.storbinary('STOR '+nowfilename, open(path_images+nowfilename, 'rb'))
+                        #print ftp.retrlines('LIST')
+                        ftp.quit()
+                        print('Image disponible sur http://lal.delerue.org/ETALON/IR/' + nowfilename )
+                except:
+                        print('FTP error')
+                os.remove(save_IR_File)
+        plt.show(block=False)
+        #time.sleep(0.5)
+        fig.canvas.draw()
+        #figZavio.clear()
+        #plt.close()                
+        fig.canvas.draw()
+#                #cam.shutdown()
+cam.stop_acquisition()
+
+                        
