Start background task to cleanup old hosts (not seen in 24 hours).
(self)
| 1927 | logger.error(f"Error loading images from actions file: {e}") |
| 1928 | |
| 1929 | # Load image series dynamically from subdirectories |
| 1930 | self.image_series = {} |
| 1931 | for status in self.status_list: |
| 1932 | self.image_series[status] = [] |
| 1933 | status_dir = os.path.join(self.statuspicdir, status) |
| 1934 | if not os.path.isdir(status_dir): |
| 1935 | os.makedirs(status_dir) |
| 1936 | logger.warning(f"Directory {status_dir} did not exist and was created.") |
| 1937 | logger.warning(f" {status} wil use the IDLE images till you add some images in the {status} folder") |
| 1938 | |
| 1939 | for image_name in os.listdir(status_dir): |
| 1940 | if image_name.endswith('.bmp') and re.search(r'\d', image_name): |
| 1941 | image = self.load_image(os.path.join(status_dir, image_name), scale=img_scale) |
| 1942 | if image: |
| 1943 | self.image_series[status].append(image) |
| 1944 | |
| 1945 | if not self.image_series: |
| 1946 | logger.error("No images loaded.") |
| 1947 | else: |
| 1948 | for status, images in self.image_series.items(): |
| 1949 | logger.info(f"Loaded {len(images)} images for status {status}.") |
| 1950 |