SerBrynden / PiClock

A weather clock built around a monitor and a Raspberry Pi with python3 + pyqt5
MIT License
9 stars 6 forks source link

Add 2 line codes to PyQtPiClock.py #7

Closed parallelbgls closed 1 year ago

parallelbgls commented 1 year ago

from line 1566 in PyQtPiClock.py

def get_local(self, path):
        try:
            dir_content = os.listdir(path)
            for each in dir_content:
                full_file = os.path.join(path, each)
                if os.path.isfile(full_file) and (full_file.lower().endswith('png')
                                                  or full_file.lower().endswith('jpg')):
                    self.img_list.append(full_file)
                elif os.path.isdir(full_file):  # Recursively get images inside folder
                    self.get_local(full_file)
        except OSError:
            print(traceback.format_exc())

Sorry I don't have time to folk this project and pull request those codes.

SerBrynden commented 1 year ago

@parallelbgls What is the purpose of this? What problem does it fix?

parallelbgls commented 1 year ago

My photo booth folder is like: /home/rpi/Pictures/Slides/2022/2022-XXX/1.jpg /home/rpi/Pictures/Slides/2022/2022-XXX/2.jpg /home/rpi/Pictures/Slides/2022/2022-YYY/1.jpg /home/rpi/Pictures/Slides/2023/2023-XXX/1.jpg /home/rpi/Pictures/Slides/2023/2023-YYY/1.jpg

So no pictures will be shown without these appending codes if I wrote /home/rpi/Pictures/Slides in Config.py, because there is no jpg file in /home/rpi/Pictures/Slides but only folders.

parallelbgls commented 1 year ago

By the way folders inside Slides are cids mount from synology nas.

parallelbgls commented 1 year ago

Sorry, I don't think this is a good suggestion so I will close this issue.