gilesknap / gphotos-sync

Google Photos and Albums backup with Google Photos Library API
Apache License 2.0
2.03k stars 167 forks source link

Errors indexing Google Takout export as comparison folder #308

Closed cosmincc closed 2 years ago

cosmincc commented 3 years ago

Description I'm using gphotos sync in a venv with python 3.8 (came installed as default). It managed to build the google photos index successfully, but when building the local index for the comparison it has errors like these:

/opt/gphotos-sync/lib/python3.8/site-packages/gphotos/LocalFilesMedia.py:174: RuntimeWarning: ASCII tag contains 5 fewer bytes than specified
  result = self.__exif.image_description

Traceback (most recent call last):
  File "/opt/gphotos-sync/lib/python3.8/site-packages/gphotos/LocalFilesScan.py", line 75, in index_local_item
    lf = LocalFilesMedia(path)
  File "/opt/gphotos-sync/lib/python3.8/site-packages/gphotos/LocalFilesMedia.py", line 89, in __init__
    self.get_exif()
  File "/opt/gphotos-sync/lib/python3.8/site-packages/gphotos/LocalFilesMedia.py", line 137, in get_exif
    self.__exif = exif.Image(image_file)
  File "/opt/gphotos-sync/lib/python3.8/site-packages/exif/_image.py", line 80, in __init__
    self._parse_segments(img_bytes)
  File "/opt/gphotos-sync/lib/python3.8/site-packages/exif/_image.py", line 55, in _parse_segments
    self._segments["APP1"] = App1MetaData(img_bytes[app1_start_index:cursor])
  File "/opt/gphotos-sync/lib/python3.8/site-packages/exif/_app1_metadata.py", line 481, in __init__
    self._parse_ifd_segments()
  File "/opt/gphotos-sync/lib/python3.8/site-packages/exif/_app1_metadata.py", line 415, in _parse_ifd_segments
    tiff_header = unpack_from(TiffHeader, self.body_bytes)
  File "/opt/gphotos-sync/lib/python3.8/site-packages/plum/_plum.py", line 981, in unpack_from
    unpack_from_and_dump(fmt, buffer, offset)
  File "/opt/gphotos-sync/lib/python3.8/site-packages/plum/_plum.py", line 1041, in unpack_from_and_dump
    items, _offset = _unpack(fmt, buffer, offset, False, dump)
  File "/opt/gphotos-sync/lib/python3.8/site-packages/plum/_plum.py", line 852, in _unpack
    raise UnpackError(unexpected_exception)
plum._exceptions.UnpackError: 

+--------+-------------------+-------+-------+---------------+
| Offset | Access            | Value | Bytes | Type          |
+--------+-------------------+-------+-------+---------------+
|        |                   |       |       | TiffHeader    |
| 0      | [0] (.byte_order) |       | b6 1e | TiffByteOrder |
+--------+-------------------+-------+-------+---------------+

ValueError occurred during unpack operation:

7862 is not a valid TiffByteOrder

To Reproduce

  1. python3 -m venv gphotos-sync
  2. ./gphotos-sync/bin/activate
  3. pip3 install gphotos-sync
  4. gphotos-sync --album-date-by-first-photo --index-only --compare-folder Takeout/Google\ Photos --progress gphotos
gilesknap commented 2 years ago

I'm afraid I'm deprecating the comparison feature. Just too hard to maintain and not widely used.