Short-bus / pilomar

RaspberryPi based miniature observatory
https://shortbus.blog/
GNU General Public License v3.0
63 stars 14 forks source link

Check ProjectPath variable is respected globally. #35

Closed Short-bus closed 7 months ago

Short-bus commented 7 months ago

Jérémie / (Bobleponge91) found places in the source code where ProjectPath variable is not respected. It is looking for hardcoded /home/pi root for some files. Check all source codes to deal with any hardcoded paths. Is it viable for ProjectPath to be automatically set based upon the location of pilomar.py file when it is run?

Short-bus commented 7 months ago

grep of the /src directory shows the following references to /home/pi

pi@pilomar:~/pilomar/src $ grep "/home/pi" *.py

pilomarcelestrak.py pilomarcelestrak.py: self.CelestrakCacheFileName = '/home/pi/pilomar/data/celestrakcache.json' # The disc cache filename used to store the data locally.

pilomarimage.py pilomarimage.py: cv2.imwrite('/home/pi/pilomar/data/CloudDetectionGrayscale.jpg',imagebuffer) pilomarimage.py: cv2.imwrite('/home/pi/pilomar/data/CloudDetectionBlurred.jpg',imagebuffer) pilomarimage.py: cv2.imwrite('/home/pi/pilomar/data/CloudDetectionThreshold.jpg',imagebuffer)

pilomar.py pilomar.py:ProjectRoot = '/home/pi/pilomar' # Where are all the project's folders sitting? pilomar.py: /home/pi/pilomar/ pilomar.py:FolderList["dataroot"] = "/home/pi/pilomar/data/" # Create default DATA pointer. pilomar.py:FolderList["log"] = "/home/pi/pilomar/log/" # Create default LOG pointer. pilomar.py:load = Loader('/home/pi/pilomar/data') # Create own version of Skyfield 'load' object. This version saves cache files in the data directory.

The reference in pilomarimage.py is not used in the current version of pilomar, but the references in pilomar.py and pilomarcelestrak.py need to be addressed.

Short-bus commented 7 months ago

Testing version which addresses the above, it also dynamically calculates the ProjectRoot directory based upon the location of the /src/pilomar.py program being run.