helgeerbe / picframe

Picture frame viewer for raspi, controlled via mqtt and automatticly integrated as mqtt device in homeassistant.
MIT License
91 stars 27 forks source link

Picframe crash on database access #370

Closed Mettbrot closed 4 months ago

Mettbrot commented 4 months ago

Describe the bug After a while, picframe stops and the console shows the log below. The Database does not contain data up to this point, but grows to 5MB. (I downloaded it to windows and checked with SQLiteBrowser)

/mnt/bilder is a read only mounted network share with ~ 40000 pictures.

I want to filter on the Tag "Favourites", was I correct to put the option in the yaml file?

To Reproduce start picframe and wait for it to crash

What are your OS, Python and picframe versions(please complete the following information):? RaspberryPi 3B with RaspberryOS: Debian version: 12 (bookworm)

viewer:
  blur_amount: 12                         # default=12,  larger values than 12 will increase processing load quite a bit
  blur_zoom: 1.0                          # default=1.0, must be >= 1.0 which expands the backgorund to just fill the space around the image
  blur_edges: False                       # default=False, use blurred version of image to fill edges - will override FIT = False
  edge_alpha: 0.0                         # default=0.5, background colour at edge. 1.0 would show reflection of image
  fps: 20.0                               # default=20.0
  background: [0.0, 0.0, 0.0, 1.0]        # default=[0.2, 0.2, 0.3, 1.0], RGBA to fill edges when fitting
  blend_type: "blend"                     # default="blend", choices={"blend", "burn", "bump"}, type of blend the shader can do
  font_file: "/home/pi/picframe_data/data/fonts/NotoSans-Regular.ttf"
  shader: "/home/pi/picframe_data/data/shaders/blend_new"
  show_text_fm: "%b %d, %Y"               # default "%b %d, %Y", format to show date over the image
  show_text_tm: 20.0                      # default=20.0, time to show text over image with file name
  show_text_sz: 40                        # default=40, text character size
  show_text: "date location"  # default="title caption name date folder location", show text, include combination of words: title, caption name, date, location, folder
  text_justify: "C"                       # text justification L, C or R
  text_bkg_hgt: 0.25                      # default=0.25 (0.0-1.0), percentage of screen height for text background texture
  text_opacity: 1.0                       # default=1.0 (0.0-1.0), alpha value of text overlay
  fit: True                               # default=False, True => scale image so all visible and leave 'gaps'
                                          #                False => crop image so no 'gaps'
  kenburns: False                         # default=False, will set fit->False and blur_edges->False
  display_x: 0                            # offset from left of screen (can be negative)
  display_y: 0                            # offset from top of screen (can be negative)
  display_w: null                         # width of display surface (null->None will use max returned by hardware)
  display_h: null                         # height of display surface
  display_power: 0                        # default=0. choices={0, 1}, 0 will use legacy `vcgencmd` and 1 will use `xset` to blank the display
  use_glx: True                           # default=False. Set to True on linux with xserver running

  mat_images: False                        # default=0.01, True, automatically mat all images. False, don't automatically mat any images. Real value, auto-mat all images with aspect ratio difference > than value
  mat_type: null                          # default=null, A string containing the mat types to choose from when matting images. It can consist of any or
                                          # all of 'float float_polaroid float_color_wrap single_bevel double_bevel double_flat' (null or '' will use all mat types)
  outer_mat_color: null                   # default=null, Color of the outer mat as an RGB list. null will auto-select a reasonable color based on the image.
  inner_mat_color: null                   # default=null, Color of the inner mat as an RGB list. null will auto-select a reasonable color based on the image.
  outer_mat_border: 75                    # default=75, Minimum outer mat border in pixels
  inner_mat_border: 40                    # default=40, Minimum inner mat border in pixels (for styles that use it)
  outer_mat_use_texture: True             # default=True, True uses a texture for the outer mat. False creates a solid-color outer mat.
  inner_mat_use_texture: False            # default=False, True uses a texture for the inner mat. False creates a solid-color inner mat.
  mat_resource_folder: "/home/pi/picframe_data/data/mat" # Folder containing mat image files

  show_clock: False                       # default=False, True shows clock overlay. False does not show clock overlay
  clock_justify: "R"                      # default="R", clock justification L, C, or R
  clock_text_sz: 120                      # default=120, clock character size
  clock_format: "%I:%M"                   # default="%I:%M", strftime format for clock string
  clock_opacity: 1.0                      # default=1.0 (0.0-1.0), alpha value of clock overlay

  menu_text_sz: 40                        # default=40, menu character size
  menu_autohide_tm: 10.0                  # default=10.0, time in seconds to show menu before auto hiding (0 disables auto hiding)
  geo_suppress_list: []                   # default=None, substrings to remove from the location text

model:
  pic_dir: "/mnt/bilder"                   # default="/mnt/bilder", root folder for images
  deleted_pictures: "/home/pi/DeletedPictures"   # move deleted pictures here
  follow_links: False                     # default=False, By default, picframe will not walk down into symbolic links that resolve to directories. Set follow_links to True to visit directories pointed to by symlinks, on systems that support them.
  no_files_img: "/home/pi/picframe_data/data/no_pictures.jpg" # default="PictureFrame2020img.jpg", image to show if none selected
  subdirectory: ""                        # default="", subdir of pic_dir - can be changed by MQTT"
  recent_n: 7                             # default=7 (days), when shuffling file change date more recent than this number of days play before the rest
  reshuffle_num: 1                        # default=1, times through before reshuffling
  time_delay: 20.0                       # default=200.0, time between consecutive slide starts - can be changed by MQTT
  fade_time: 1.0                         # default=10.0, change time during which slides overlap - can be changed by MQTT"
  shuffle: True                           # default=True, shuffle on reloading image files - can be changed by MQTT"
  sort_cols: 'fname ASC'                  # default='fname ASC' can be any columns in the table with optional ASC or DESC separated by commas
                                          # fname, last_modified, file_id, orientation, exif_datetime, f_number,
                                          # exposure_time, iso, focal_length, make, model, lens, rating,
                                          # latitude, longitude, width, height, title, caption, tags,
                                          # is_portrait, location
  tags_filter: 'Favourites'
  image_attr: [                           # image attributes send by MQTT, Keys are taken from exifread library, "PICFRAME GPS" is special to retrieve GPS lon/lat, "PICFRAME LOCATION" is special to retrieve geo reverse (load_geoloc hast to be True)
    "PICFRAME GPS",
    "PICFRAME LOCATION",
    "EXIF FNumber",
    "EXIF ExposureTime",
    "EXIF ISOSpeedRatings",
    "EXIF FocalLength",
    "EXIF DateTimeOriginal",
    "Image Model",
    "Image Make",
    "IPTC Caption/Abstract",
    "IPTC Object Name",
    "IPTC Keywords"]
  load_geoloc: False                      # get location information from open street map NB if you switch this on (recommended)
  geo_key: "this_needs_to@be_changed"     # then you **MUST** change the geo_key to something unique to you
                                          # i.e. use your email address
  locale: "de_DE.UTF-8"                    # "locale -a" shows the installed locales which could used
  key_list: [
    ["tourism","amenity","isolated_dwelling"],
    ["suburb","village"],
    ["city","county"],
    ["region","state","province"],
    ["country"]]
  db_file: "/home/pi/picframe_data/data/pictureframe.db3" # database used by PictureFrame
  portrait_pairs: False
  log_level: "WARNING"                    # default=WARNING, could beDEBUG, INFO, WARNING, ERROR, CRITICAL
  log_file: ""                            # default="" for debugging set this to the path to a file. NB logging messages will
                                          # appended indefinitely so don't forget this. You will need to tidy it up later

mqtt:
  use_mqtt: False                         # default=False. Set True true, to enable mqtt
  server: "your_mqtt_broker"              # No defaults for server
  port: 8883                              # default=8883 for tls, 1883 else (tls must be "" then !!!!!)
  login: "name"                           # your mqtt user
  password: "your_password"               # password for mqtt user
  tls: "/path/to/your/ca.crt"             # filename including path to your ca.crt. If not used, must be set to "" !!!!
  device_id: "picframe"                   # default="picframe" unique id of device. change if there is more than one PictureFrame
  device_url: ""                          # if use_http==True, set url to picframe config page. Must be a valid url, or "" otherwise home assistant runs in an error.

http:
  use_http: False                         # default=False. Set True to enable http NB THIS SERVER IS FOR LOCAL NETWORK AND SHOULD NOT BE EXPOSED TO EXTERNAL ACCESS
  path: "/home/pi/picframe_data/html"            # path to where html files are located
  port: 9000                              # port used to serve pages by http server < 1024 requires root which is *bad* idea
  use_ssl: False
  keyfile: "path/to/key.pem"              # private-key
  certfile: "path/to/cert.pem"            # server certificate

peripherals:
  input_type: null                        # default=null, valid options: {null, "keyboard", "touch", "mouse"}
  buttons:
    pause:                                # pause/unpause the show
      enable: True                        # default=True
      label: "Pause"                      # default="Pause"
      shortcut: " "                       # default=" "
    display_off:                          # turn off the display (when off, any input from selected peripheral will turn it back on)
      enable: True                        # default=True
      label: "Display off"                # default="Display off"
      shortcut: "o"                       # default="o"
    location:                             # shows or hides location information
      enable: False                       # default=False
      label: "Location"                   # default="Location"
      shortcut: "l"                       # default="l"
    exit:                                 # exit PictureFrame
      enable: False                       # default=False
      label: "Exit"                       # default="Exit"
      shortcut: "e"                       # default="e"
    power_down:                           # power down the device, uses sudo
      enable: False                       # default=False
      label: "Power down"                 # default="Power down"
      shortcut: "p"                       # default="p"
Exception in thread Thread-1 (__loop):
Traceback (most recent call last):
  File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.11/threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "/home/pi/picframe/lib/python3.11/site-packages/picframe/image_cache.py", line 54, in __loop
    self.update_cache()
  File "/home/pi/picframe/lib/python3.11/site-packages/picframe/image_cache.py", line 91, in update_cache
    self.__insert_file(file)
  File "/home/pi/picframe/lib/python3.11/site-packages/picframe/image_cache.py", line 415, in __insert_file
    self.__db.execute(meta_insert, vals)
sqlite3.ProgrammingError: Error binding parameter 9: type 'tuple' is not supported
jgodfrey commented 4 months ago

That stack trace indicates a problem with the constructed SQL statement when attempting to insert meta-data for a given image into the DB. It'd probably be fairly easy to find and fix with access to the offending image. Do you happen to know what image is causing the issue?

jgodfrey commented 4 months ago

Assuming you don't know which file is causing the issue, you might try to activate the logging feature, wait for the problem to happen, and then see if the log contains some interesting info. To do that, you'll need to adjust the following in the configuration.yaml file:

Once you're done with the logging, you'll want to turn it off again as the file will get large quickly...

Mettbrot commented 4 months ago

Thank you. So the log file is 280MB large, the last lines before the crash are these

2024-02-07 23:45:07,291 - image_cache.ImageCache - DEBUG - Inserting: /mnt/bilder/Wallpapers/Dual/dmb - Dual Monitor Backgrounds - 30 Stück/A Sea Lion In Summer/ASeaLionInSummer.jpg.php.jpg
2024-02-07 23:45:07,341 - PIL.TiffImagePlugin - DEBUG - tag: Make (271) - type: string (2) Tag Location: 22 - Data Location: 122 - value: b'Canon\x00'
2024-02-07 23:45:07,341 - PIL.TiffImagePlugin - DEBUG - tag: Model (272) - type: string (2) Tag Location: 34 - Data Location: 128 - value: b'Canon EOS DIGITAL REBEL\x00'
2024-02-07 23:45:07,342 - PIL.TiffImagePlugin - DEBUG - tag: Orientation (274) - type: short (3) - value: b'\x01\x00'
2024-02-07 23:45:07,342 - PIL.TiffImagePlugin - DEBUG - tag: XResolution (282) - type: rational (5) Tag Location: 58 - Data Location: 152 - value: b'\xb4\x00\x00\x00\x01\x00\x00\x00'
2024-02-07 23:45:07,343 - PIL.TiffImagePlugin - DEBUG - tag: YResolution (283) - type: rational (5) Tag Location: 70 - Data Location: 160 - value: b'\xb4\x00\x00\x00\x01\x00\x00\x00'
2024-02-07 23:45:07,344 - PIL.TiffImagePlugin - DEBUG - tag: ResolutionUnit (296) - type: short (3) - value: b'\x02\x00'
2024-02-07 23:45:07,348 - PIL.TiffImagePlugin - DEBUG - tag: DateTime (306) - type: string (2) Tag Location: 94 - Data Location: 168 - value: b'2006:08:25 19:37:19\x00\x00'
2024-02-07 23:45:07,351 - PIL.TiffImagePlugin - DEBUG - tag: YCbCrPositioning (531) - type: short (3) - value: b'\x01\x00'
2024-02-07 23:45:07,354 - PIL.TiffImagePlugin - DEBUG - tag: ExifIFD (34665) - type: long (4) - value: b'\xbd\x00\x00\x00'
2024-02-07 23:45:07,363 - PIL.TiffImagePlugin - DEBUG - tag: ExposureTime (33434) - type: rational (5) Tag Location: 203 - Data Location: 567 - value: b'\x01\x00\x00\x00\xf4\x01\x00\x00'
2024-02-07 23:45:07,365 - PIL.TiffImagePlugin - DEBUG - tag: FNumber (33437) - type: rational (5) Tag Location: 215 - Data Location: 575 - value: b'8\x00\x00\x00\n\x00\x00\x00'
2024-02-07 23:45:07,366 - PIL.TiffImagePlugin - DEBUG - tag: ISOSpeedRatings (34855) - type: short (3) - value: b'd\x00'
2024-02-07 23:45:07,368 - PIL.TiffImagePlugin - DEBUG - tag: ExifVersion (36864) - type: undefined (7) - value: b'0221'
2024-02-07 23:45:07,369 - PIL.TiffImagePlugin - DEBUG - tag: DateTimeOriginal (36867) - type: string (2) Tag Location: 251 - Data Location: 583 - value: b'2006:08:25 14:00:59\x00\x00'
2024-02-07 23:45:07,370 - PIL.TiffImagePlugin - DEBUG - tag: DateTimeDigitized (36868) - type: string (2) Tag Location: 263 - Data Location: 604 - value: b'2006:08:25 14:00:59\x00\x00'
2024-02-07 23:45:07,371 - PIL.TiffImagePlugin - DEBUG - tag: ComponentsConfiguration (37121) - type: undefined (7) - value: b'\x01\x02\x03\x00'
2024-02-07 23:45:07,372 - PIL.TiffImagePlugin - DEBUG - tag: CompressedBitsPerPixel (37122) - type: rational (5) Tag Location: 287 - Data Location: 625 - value: b'\x03\x00\x00\x00\x01\x00\x00\x00'
2024-02-07 23:45:07,373 - PIL.TiffImagePlugin - DEBUG - tag: ShutterSpeedValue (37377) - type: signed rational (10) Tag Location: 299 - Data Location: 633 - value: b'>\xf7\x08\x00\x00\x00\x01\x00'
2024-02-07 23:45:07,374 - PIL.TiffImagePlugin - DEBUG - tag: ApertureValue (37378) - type: rational (5) Tag Location: 311 - Data Location: 641 - value: b'\x8a\xf8\x04\x00\x00\x00\x01\x00'
2024-02-07 23:45:07,376 - PIL.TiffImagePlugin - DEBUG - tag: ExposureBiasValue (37380) - type: signed rational (10) Tag Location: 323 - Data Location: 649 - value: b'\x03\x00\x00\x00\x03\x00\x00\x00'
2024-02-07 23:45:07,377 - PIL.TiffImagePlugin - DEBUG - tag: MaxApertureValue (37381) - type: rational (5) Tag Location: 335 - Data Location: 657 - value: b'\x8a\xf8\x04\x00\x00\x00\x01\x00'
2024-02-07 23:45:07,378 - PIL.TiffImagePlugin - DEBUG - tag: MeteringMode (37383) - type: short (3) - value: b'\x05\x00'
2024-02-07 23:45:07,379 - PIL.TiffImagePlugin - DEBUG - tag: Flash (37385) - type: short (3) - value: b'\x00\x00'
2024-02-07 23:45:07,379 - PIL.TiffImagePlugin - DEBUG - tag: FocalLength (37386) - type: rational (5) Tag Location: 371 - Data Location: 665 - value: b'P\x00\x00\x00\x01\x00\x00\x00'
2024-02-07 23:45:07,380 - PIL.TiffImagePlugin - DEBUG - tag: MakerNote (37500) - type: undefined (7) Tag Location: 383 - Data Location: 673 - value: <table: 1292 bytes>
2024-02-07 23:45:07,380 - PIL.TiffImagePlugin - DEBUG - tag: UserComment (37510) - type: undefined (7) Tag Location: 395 - Data Location: 1965 - value: <table: 264 bytes>
2024-02-07 23:45:07,381 - PIL.TiffImagePlugin - DEBUG - tag: FlashPixVersion (40960) - type: undefined (7) - value: b'0100'
2024-02-07 23:45:07,381 - PIL.TiffImagePlugin - DEBUG - tag: ColorSpace (40961) - type: short (3) - value: b'\x01\x00'
2024-02-07 23:45:07,382 - PIL.TiffImagePlugin - DEBUG - tag: PixelXDimension (40962) - type: long (4) - value: b'\x00\x08\x00\x00'
2024-02-07 23:45:07,382 - PIL.TiffImagePlugin - DEBUG - tag: PixelYDimension (40963) - type: long (4) - value: b'\x00\x03\x00\x00'
2024-02-07 23:45:07,383 - PIL.TiffImagePlugin - DEBUG - tag: InteroperabilityIFD (40965) - type: long (4) - value: b'\xc5\x08\x00\x00'
2024-02-07 23:45:07,383 - PIL.TiffImagePlugin - DEBUG - tag: FocalPlaneXResolution (41486) - type: rational (5) Tag Location: 467 - Data Location: 2229 - value: b'\x00\xe0.\x00|\x03\x00\x00'
2024-02-07 23:45:07,384 - PIL.TiffImagePlugin - DEBUG - tag: FocalPlaneYResolution (41487) - type: rational (5) Tag Location: 479 - Data Location: 2237 - value: b'\x00@\x1f\x00S\x02\x00\x00'
2024-02-07 23:45:07,384 - PIL.TiffImagePlugin - DEBUG - tag: FocalPlaneResolutionUnit (41488) - type: short (3) - value: b'\x02\x00'
2024-02-07 23:45:07,385 - PIL.TiffImagePlugin - DEBUG - tag: SensingMethod (41495) - type: short (3) - value: b'\x02\x00'
2024-02-07 23:45:07,386 - PIL.TiffImagePlugin - DEBUG - tag: FileSource (41728) - type: undefined (7) - value: b'\x03'
2024-02-07 23:45:07,386 - PIL.TiffImagePlugin - DEBUG - tag: CustomRendered (41985) - type: short (3) - value: b'\x00\x00'
2024-02-07 23:45:07,387 - PIL.TiffImagePlugin - DEBUG - tag: ExposureMode (41986) - type: short (3) - value: b'\x00\x00'
2024-02-07 23:45:07,387 - PIL.TiffImagePlugin - DEBUG - tag: WhiteBalance (41987) - type: short (3) - value: b'\x00\x00'
2024-02-07 23:45:07,388 - PIL.TiffImagePlugin - DEBUG - tag: SceneCaptureType (41990) - type: short (3) - value: b'\x00\x00'
2024-02-07 23:45:07,399 - PIL.TiffImagePlugin - DEBUG - tag: Make (271) - type: string (2) Tag Location: 22 - Data Location: 122 - value: b'Canon\x00'
2024-02-07 23:45:07,400 - PIL.TiffImagePlugin - DEBUG - tag: Model (272) - type: string (2) Tag Location: 34 - Data Location: 128 - value: b'Canon EOS DIGITAL REBEL\x00'
2024-02-07 23:45:07,400 - PIL.TiffImagePlugin - DEBUG - tag: Orientation (274) - type: short (3) - value: b'\x01\x00'
2024-02-07 23:45:07,401 - PIL.TiffImagePlugin - DEBUG - tag: XResolution (282) - type: rational (5) Tag Location: 58 - Data Location: 152 - value: b'\xb4\x00\x00\x00\x01\x00\x00\x00'
2024-02-07 23:45:07,401 - PIL.TiffImagePlugin - DEBUG - tag: YResolution (283) - type: rational (5) Tag Location: 70 - Data Location: 160 - value: b'\xb4\x00\x00\x00\x01\x00\x00\x00'
2024-02-07 23:45:07,402 - PIL.TiffImagePlugin - DEBUG - tag: ResolutionUnit (296) - type: short (3) - value: b'\x02\x00'
2024-02-07 23:45:07,402 - PIL.TiffImagePlugin - DEBUG - tag: DateTime (306) - type: string (2) Tag Location: 94 - Data Location: 168 - value: b'2006:08:25 19:37:19\x00\x00'
2024-02-07 23:45:07,403 - PIL.TiffImagePlugin - DEBUG - tag: YCbCrPositioning (531) - type: short (3) - value: b'\x01\x00'
2024-02-07 23:45:07,403 - PIL.TiffImagePlugin - DEBUG - tag: ExifIFD (34665) - type: long (4) - value: b'\xbd\x00\x00\x00'
2024-02-07 23:45:07,808 - image_cache.ImageCache - DEBUG - Inserting: /mnt/bilder/Wallpapers/Dual/dmb - Dual Monitor Backgrounds - 30 Stück/Apple/Apple2.jpg.php.jpg
2024-02-07 23:45:07,846 - PIL.TiffImagePlugin - DEBUG - tag: Orientation (274) - type: short (3) - value: b'\x00\x01'
2024-02-07 23:45:07,847 - PIL.TiffImagePlugin - DEBUG - tag: XResolution (282) - type: rational (5) Tag Location: 34 - Data Location: 98 - value: b'\x00\x00\x00H\x00\x00\x00\x01'
2024-02-07 23:45:07,847 - PIL.TiffImagePlugin - DEBUG - tag: YResolution (283) - type: rational (5) Tag Location: 46 - Data Location: 106 - value: b'\x00\x00\x00H\x00\x00\x00\x01'
2024-02-07 23:45:07,848 - PIL.TiffImagePlugin - DEBUG - tag: ResolutionUnit (296) - type: short (3) - value: b'\x00\x02'
2024-02-07 23:45:07,849 - PIL.TiffImagePlugin - DEBUG - tag: Software (305) - type: string (2) Tag Location: 70 - Data Location: 114 - value: b'Adobe Photoshop CS Windows\x00'
2024-02-07 23:45:07,850 - PIL.TiffImagePlugin - DEBUG - tag: DateTime (306) - type: string (2) Tag Location: 82 - Data Location: 141 - value: b'2005:05:12 16:26:56\x00'
2024-02-07 23:45:07,850 - PIL.TiffImagePlugin - DEBUG - tag: ExifIFD (34665) - type: long (4) - value: b'\x00\x00\x00\xa4'
2024-02-07 23:45:07,852 - PIL.TiffImagePlugin - DEBUG - tag: ColorSpace (40961) - type: short (3) - value: b'\x00\x01'
2024-02-07 23:45:07,852 - PIL.TiffImagePlugin - DEBUG - tag: PixelXDimension (40962) - type: long (4) - value: b'\x00\x00\n\x00'
2024-02-07 23:45:07,853 - PIL.TiffImagePlugin - DEBUG - tag: PixelYDimension (40963) - type: long (4) - value: b'\x00\x00\x04\x00'
2024-02-07 23:45:08,044 - image_cache.ImageCache - DEBUG - Inserting: /mnt/bilder/Wallpapers/Dual/dmb - Dual Monitor Backgrounds - 30 Stück/Aviation/Aviation.jpg.php.jpg
2024-02-07 23:45:08,091 - PIL.TiffImagePlugin - DEBUG - tag: Orientation (274) - type: short (3) - value: b'\x00\x01'
2024-02-07 23:45:08,092 - PIL.TiffImagePlugin - DEBUG - tag: XResolution (282) - type: rational (5) Tag Location: 34 - Data Location: 98 - value: b"\x00-\xc6\xc0\x00\x00'\x10"
2024-02-07 23:45:08,092 - PIL.TiffImagePlugin - DEBUG - tag: YResolution (283) - type: rational (5) Tag Location: 46 - Data Location: 106 - value: b"\x00-\xc6\xc0\x00\x00'\x10"
2024-02-07 23:45:08,092 - PIL.TiffImagePlugin - DEBUG - tag: ResolutionUnit (296) - type: short (3) - value: b'\x00\x02'
2024-02-07 23:45:08,093 - PIL.TiffImagePlugin - DEBUG - tag: Software (305) - type: string (2) Tag Location: 70 - Data Location: 114 - value: b'Adobe Photoshop CS2 Windows\x00'
2024-02-07 23:45:08,094 - PIL.TiffImagePlugin - DEBUG - tag: DateTime (306) - type: string (2) Tag Location: 82 - Data Location: 142 - value: b'2007:01:26 23:08:30\x00'
2024-02-07 23:45:08,094 - PIL.TiffImagePlugin - DEBUG - tag: ExifIFD (34665) - type: long (4) - value: b'\x00\x00\x00\xa4'
2024-02-07 23:45:08,095 - PIL.TiffImagePlugin - DEBUG - tag: ColorSpace (40961) - type: short (3) - value: b'\x00\x01'
2024-02-07 23:45:08,096 - PIL.TiffImagePlugin - DEBUG - tag: PixelXDimension (40962) - type: long (4) - value: b'\x00\x00\t\x00'
2024-02-07 23:45:08,097 - PIL.TiffImagePlugin - DEBUG - tag: PixelYDimension (40963) - type: long (4) - value: b'\x00\x00\x03`'
2024-02-07 23:45:08,750 - image_cache.ImageCache - DEBUG - Inserting: /mnt/bilder/Wallpapers/Dual/dmb - Dual Monitor Backgrounds - 30 Stück/Cock Pheasant UK/CockPheasantUK.jpg.php.jpg
2024-02-07 23:45:08,790 - PIL.TiffImagePlugin - DEBUG - tag: ImageDescription (270) - type: string (2) Tag Location: 22 - Data Location: 194 - value: b'PENTAX Image\x00'
2024-02-07 23:45:08,790 - PIL.TiffImagePlugin - DEBUG - tag: Make (271) - type: string (2) Tag Location: 34 - Data Location: 207 - value: b'PENTAX Corporation\x00'
2024-02-07 23:45:08,791 - PIL.TiffImagePlugin - DEBUG - tag: Model (272) - type: string (2) Tag Location: 46 - Data Location: 226 - value: b'PENTAX Optio 50\x00'
2024-02-07 23:45:08,791 - PIL.TiffImagePlugin - DEBUG - tag: Orientation (274) - type: short (3) - value: b'\x01\x00'
2024-02-07 23:45:08,791 - PIL.TiffImagePlugin - DEBUG - tag: XResolution (282) - type: rational (5) Tag Location: 70 - Data Location: 242 - value: b':\x01\x00\x00\x01\x00\x00\x00'
2024-02-07 23:45:08,792 - PIL.TiffImagePlugin - DEBUG - tag: YResolution (283) - type: rational (5) Tag Location: 82 - Data Location: 250 - value: b':\x01\x00\x00\x01\x00\x00\x00'
2024-02-07 23:45:08,792 - PIL.TiffImagePlugin - DEBUG - tag: ResolutionUnit (296) - type: short (3) - value: b'\x02\x00'
2024-02-07 23:45:08,793 - PIL.TiffImagePlugin - DEBUG - tag: Software (305) - type: string (2) Tag Location: 106 - Data Location: 258 - value: b'EvJO Photo-Image Resizer v2.1\x00'
2024-02-07 23:45:08,793 - PIL.TiffImagePlugin - DEBUG - tag: DateTime (306) - type: string (2) Tag Location: 118 - Data Location: 288 - value: b'2009:06:15 22:23:20\x00\x00'
2024-02-07 23:45:08,793 - PIL.TiffImagePlugin - DEBUG - tag: WhitePoint (318) - type: rational (5) Tag Location: 130 - Data Location: 309 - value: b'\x00\x00\x00\x00@B\x0f\x00\x00\x00\x00\x00@B\x0f\x00'
2024-02-07 23:45:08,794 - PIL.TiffImagePlugin - DEBUG - tag: PrimaryChromaticities (319) - type: rational (5) Tag Location: 142 - Data Location: 325 - value: <table: 48 bytes>
2024-02-07 23:45:08,794 - PIL.TiffImagePlugin - DEBUG - tag: YCbCrCoefficients (529) - type: rational (5) Tag Location: 154 - Data Location: 373 - value: b'\x00\x00\x00\x00@B\x0f\x00\x00\x00\x00\x00@B\x0f\x00\x00\x00\x00\x00@B\x0f\x00'
2024-02-07 23:45:08,795 - PIL.TiffImagePlugin - DEBUG - tag: YCbCrPositioning (531) - type: short (3) - value: b'\x02\x00'
2024-02-07 23:45:08,795 - PIL.TiffImagePlugin - DEBUG - tag: ReferenceBlackWhite (532) - type: rational (5) Tag Location: 178 - Data Location: 397 - value: <table: 48 bytes>
2024-02-07 23:45:08,795 - PIL.TiffImagePlugin - DEBUG - tag: ExifIFD (34665) - type: long (4) - value: b'\xbd\x01\x00\x00'
2024-02-07 23:45:08,797 - PIL.TiffImagePlugin - DEBUG - tag: ExposureTime (33434) - type: rational (5) Tag Location: 459 - Data Location: 943 - value: b'\xb9\x07\x00\x00@B\x0f\x00'
2024-02-07 23:45:08,798 - PIL.TiffImagePlugin - DEBUG - tag: FNumber (33437) - type: rational (5) Tag Location: 471 - Data Location: 951 - value: b'\x00>I\x00@B\x0f\x00'
2024-02-07 23:45:08,798 - PIL.TiffImagePlugin - DEBUG - tag: ExposureProgram (34850) - type: short (3) - value: b'\x05\x00'
2024-02-07 23:45:08,799 - PIL.TiffImagePlugin - DEBUG - tag: ISOSpeedRatings (34855) - type: short (3) - value: b'2\x002\x00'
2024-02-07 23:45:08,799 - PIL.TiffImagePlugin - DEBUG - tag: ExifVersion (36864) - type: undefined (7) - value: b'022\x00'
2024-02-07 23:45:08,800 - PIL.TiffImagePlugin - DEBUG - tag: DateTimeOriginal (36867) - type: string (2) Tag Location: 519 - Data Location: 959 - value: b'2008:04:07 02:58:40\x00\x00'
2024-02-07 23:45:08,800 - PIL.TiffImagePlugin - DEBUG - tag: DateTimeDigitized (36868) - type: string (2) Tag Location: 531 - Data Location: 980 - value: b'2008:04:07 02:58:40\x00\x00'
2024-02-07 23:45:08,800 - PIL.TiffImagePlugin - DEBUG - tag: ComponentsConfiguration (37121) - type: undefined (7) - value: b'\x01\x02\x03\x00'
2024-02-07 23:45:08,801 - PIL.TiffImagePlugin - DEBUG - tag: CompressedBitsPerPixel (37122) - type: rational (5) Tag Location: 555 - Data Location: 1001 - value: b'\x00\x00\x00\x00@B\x0f\x00'
2024-02-07 23:45:08,801 - PIL.TiffImagePlugin - DEBUG - tag: ShutterSpeedValue (37377) - type: signed rational (10) Tag Location: 567 - Data Location: 1009 - value: b'\x00\x00\x00\x00@B\x0f\x00'
2024-02-07 23:45:08,802 - PIL.TiffImagePlugin - DEBUG - tag: ApertureValue (37378) - type: rational (5) Tag Location: 579 - Data Location: 1017 - value: b'\x00\x00\x00\x00@B\x0f\x00'
2024-02-07 23:45:08,802 - PIL.TiffImagePlugin - DEBUG - tag: BrightnessValue (37379) - type: signed rational (10) Tag Location: 591 - Data Location: 1025 - value: b'\x00\x00\x00\x00@B\x0f\x00'
2024-02-07 23:45:08,803 - PIL.TiffImagePlugin - DEBUG - tag: ExposureBiasValue (37380) - type: signed rational (10) Tag Location: 603 - Data Location: 1033 - value: b'\x00\x00\x00\x00@B\x0f\x00'
2024-02-07 23:45:08,803 - PIL.TiffImagePlugin - DEBUG - tag: MaxApertureValue (37381) - type: rational (5) Tag Location: 615 - Data Location: 1041 - value: b'0\xd8.\x00@B\x0f\x00'
2024-02-07 23:45:08,804 - PIL.TiffImagePlugin - DEBUG - tag: SubjectDistance (37382) - type: rational (5) Tag Location: 627 - Data Location: 1049 - value: b'\x00\x00\x00\x00@B\x0f\x00'
2024-02-07 23:45:08,804 - PIL.TiffImagePlugin - DEBUG - tag: MeteringMode (37383) - type: short (3) - value: b'\x02\x00'
2024-02-07 23:45:08,804 - PIL.TiffImagePlugin - DEBUG - tag: LightSource (37384) - type: short (3) - value: b'\x00\x00'
2024-02-07 23:45:08,805 - PIL.TiffImagePlugin - DEBUG - tag: Flash (37385) - type: short (3) - value: b'\x18\x00'
2024-02-07 23:45:08,805 - PIL.TiffImagePlugin - DEBUG - tag: FocalLength (37386) - type: rational (5) Tag Location: 675 - Data Location: 1057 - value: b'@1\xf7\x00@B\x0f\x00'
2024-02-07 23:45:08,806 - PIL.TiffImagePlugin - DEBUG - tag: FlashPixVersion (40960) - type: undefined (7) - value: b'010\x00'
2024-02-07 23:45:08,806 - PIL.TiffImagePlugin - DEBUG - tag: ColorSpace (40961) - type: short (3) - value: b'\x01\x00'
2024-02-07 23:45:08,806 - PIL.TiffImagePlugin - DEBUG - tag: PixelXDimension (40962) - type: long (4) - value: b' \r\x00\x00'
2024-02-07 23:45:08,807 - PIL.TiffImagePlugin - DEBUG - tag: PixelYDimension (40963) - type: long (4) - value: b'\x1a\x04\x00\x00'
2024-02-07 23:45:08,807 - PIL.TiffImagePlugin - DEBUG - tag: InteroperabilityIFD (40965) - type: long (4) - value: b'I\x04\x00\x00'
2024-02-07 23:45:08,808 - PIL.TiffImagePlugin - DEBUG - tag: FocalPlaneXResolution (41486) - type: rational (5) Tag Location: 747 - Data Location: 1065 - value: b'\x00\x00\x00\x00@B\x0f\x00'
2024-02-07 23:45:08,808 - PIL.TiffImagePlugin - DEBUG - tag: FocalPlaneYResolution (41487) - type: rational (5) Tag Location: 759 - Data Location: 1073 - value: b'\x00\x00\x00\x00@B\x0f\x00'
2024-02-07 23:45:08,808 - PIL.TiffImagePlugin - DEBUG - tag: FocalPlaneResolutionUnit (41488) - type: short (3) - value: b'\x00\x00'
2024-02-07 23:45:08,809 - PIL.TiffImagePlugin - DEBUG - tag: ExposureIndex (41493) - type: rational (5) Tag Location: 783 - Data Location: 1081 - value: b'\x00\x00\x00\x00@B\x0f\x00'
2024-02-07 23:45:08,809 - PIL.TiffImagePlugin - DEBUG - tag: SensingMethod (41495) - type: short (3) - value: b'\x00\x00'
2024-02-07 23:45:08,810 - PIL.TiffImagePlugin - DEBUG - tag: FileSource (41728) - type: undefined (7) - value: b'\x03'
2024-02-07 23:45:08,810 - PIL.TiffImagePlugin - DEBUG - tag: SceneType (41729) - type: undefined (7) - value: b'\x00'
2024-02-07 23:45:08,810 - PIL.TiffImagePlugin - DEBUG - tag: ExposureMode (41986) - type: short (3) - value: b'\x01\x00'
2024-02-07 23:45:08,811 - PIL.TiffImagePlugin - DEBUG - tag: WhiteBalance (41987) - type: short (3) - value: b'\x00\x00'
2024-02-07 23:45:08,811 - PIL.TiffImagePlugin - DEBUG - tag: DigitalZoomRatio (41988) - type: rational (5) Tag Location: 855 - Data Location: 1089 - value: b'@B\x0f\x00@B\x0f\x00'
2024-02-07 23:45:08,811 - PIL.TiffImagePlugin - DEBUG - tag: FocalLengthIn35mmFilm (41989) - type: short (3) - value: b'\x00\x00'
2024-02-07 23:45:08,812 - PIL.TiffImagePlugin - DEBUG - tag: SceneCaptureType (41990) - type: short (3) - value: b'\x00\x00'
2024-02-07 23:45:08,812 - PIL.TiffImagePlugin - DEBUG - tag: GainControl (41991) - type: short (3) - value: b'\x00\x00'
2024-02-07 23:45:08,812 - PIL.TiffImagePlugin - DEBUG - tag: Contrast (41992) - type: short (3) - value: b'\x00\x00'
2024-02-07 23:45:08,813 - PIL.TiffImagePlugin - DEBUG - tag: Saturation (41993) - type: short (3) - value: b'\x00\x00'
2024-02-07 23:45:08,814 - PIL.TiffImagePlugin - DEBUG - tag: Sharpness (41994) - type: short (3) - value: b'\x02\x00'
2024-02-07 23:45:08,814 - PIL.TiffImagePlugin - DEBUG - tag: SubjectDistanceRange (41996) - type: short (3) - value: b'\x00\x00'

I uploaded the offending picture here: https://www.dropbox.com/scl/fi/a5gnhkyfcw31r7e954j5d/CockPheasantUK.jpg.php.jpg?rlkey=0huj5or92ahu6f2ybympcffnu&dl=0

I hope this helps. I removed the Wallpapers from the folder and started again, they dont belong there anyways :)

jgodfrey commented 4 months ago

Thanks for the info and the link. A few comments / questions:

Mettbrot commented 4 months ago

Sorry I was not clear before. The log file is 280Mb. The image file is the one you downloaded. I removed the folder and picframe runs since this morning so that seems ok :)

The filtering with tags_filter in my config file does not work though, do I have to provide it as array or something?

jgodfrey commented 4 months ago

Sorry I was not clear before. The log file is 280Mb.

Ah, right. I think I understood that at one point during my thought process, but somehow lost track of that detail... ;)

Good to know that things are working without these images and that the d/l image is good for me to test with. I'll try to take a look soon.

jgodfrey commented 4 months ago

I just added this image to my frame and it doesn't appear to have caused any problems. That said, I'm not running the latest version of code from this site or 3rd party packages ATM (and I'm not in a good position to upgrade right now).

Question - if you temporarily move your entire picture library somewhere else and provide only this image to the frame, does it cause the same crash?

jgodfrey commented 4 months ago

Update - I was able to install a fresh copy on a Linux laptop and I'm able to see the error now. I'll report back when I find out more.

jgodfrey commented 4 months ago

OK - so I see the problem. In this image the "ISOSpeedRatings" value (which is expected to be a single integer value) is being returned as a tuple of (50, 50). So, two values. And, that's not a valid format to be inserted by the constructed SQL statement.

Do you know what the ISO speed should be on this image? The data seems to be invalid...

There's any number of possible ways to fix the code in the face of seemingly bad data. For example, we could just take the first value in the case of the data being a tuple...

@helgeerbe or @paddywwoof - any thoughts?

jgodfrey commented 4 months ago

More info...

Examining your image with exiftool, it also reports the ISO value as 50, 50, and doesn't complain about the data being invalid when asked to validate the file. So, that makes me think it might indeed be a legitimate value, but I haven't found any documentation to corroborate that - so, I'm not sure ATM.

Again, it's pretty easy to fix the underlying problem by simply calling this 50, though I'm not sure if that's the best fix or not.

jgodfrey commented 4 months ago

I've created a PR to fix this here:

https://github.com/helgeerbe/picframe/pull/372

@helgeerbe - I'm not sure whether this is the most appropriate fix or not. Feel free to merge, ignore, or continue the discussion...

jgodfrey commented 4 months ago

Thinking more about this, an alternative fix here would be to keep this value "as-is", but convert it from a tuple to a CSV string for db insertion. In the case of the sample image, where the ISO value is 50,50, the above PR will return that as 50. Instead, we could return it as a CSV string like "50,50".

Looking at the DB schema, the ISO field is defined as a REAL data type, but that won't prevent the insertion of a string.

@helgeerbe - I'm happy to submit a different PR to convert this case to a CSV string if you'd prefer. I'm not sure which is best here...

jgodfrey commented 4 months ago

More research and another comment...

Apparently, the 2 values found in this case are know as the "ISO Latitude". They are described in the ISO 12232 spec which can be seen here.

Specific to this issue, the doc mentions this:

To prevent confusion, a single value is designated as the ISO speed, with the ISO speed
latitude upper and lower limits indicating the speed range.

So, this is apparently that "upper and lower limits" situation. My take is that simply pulling the first value out of the tuple is sufficient for picframe's trivial use of this data.

So, I think the current PR is fine IMO.

helgeerbe commented 4 months ago

Hi @jgodfrey, Thanks for fixing this. I think also, that using the first value ist fine. Its just used for information purpose.

jgodfrey commented 4 months ago

Closed the original PR and opened a new one targeting main. The previous PR inadvertently targeted dev...

https://github.com/helgeerbe/picframe/pull/372

helgeerbe commented 4 months ago

@jgodfrey dev was the correct branch ;) I already merged it.

helgeerbe commented 4 months ago

should be fixed with 2024.02.19