jkirkcaldy / plex-utills

Manage your Plex library automatically
MIT License
319 stars 24 forks source link

Script stops after completing Movies #105

Closed mtlballer closed 2 years ago

mtlballer commented 2 years ago

My script is erroring out after completing the 4k Movies. After some troubleshooting I discovered that the first 4k TV episode had had it's poster removed entirely, which was causing the script to throw an error and stop, replacing the poster with the proper one fixed the issue. I've pasted the error below. I would thus assume this is somewhat linked to #102 in some way as I certainly did not remove it manually. I've had the issue intermittently on the 4k Movie posters but it has been behaving for some time now. OS is UnRaid 6.9.2. Let me know if you need any further information on this one. Thanks for the script, the amount of time and effort it saves me is amazing!

Exception in thread Thread-1: Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/PIL/ImageFile.py", line 235, in load s = read(self.decodermaxblock) File "/usr/local/lib/python3.9/site-packages/PIL/PngImagePlugin.py", line 896, in load_read cid, pos, length = self.png.read() File "/usr/local/lib/python3.9/site-packages/PIL/PngImagePlugin.py", line 162, in read length = i32(s) File "/usr/local/lib/python3.9/site-packages/PIL/_binary.py", line 85, in i32be return unpack_from(">I", c, o)[0] struct.error: unpack_from requires a buffer of at least 4 bytes for unpacking 4 bytes at offset 0 (actual buffer size is 0)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/local/lib/python3.9/threading.py", line 973, in _bootstrap_inner self.run() File "/usr/local/lib/python3.9/threading.py", line 910, in run self._target(*self._args, **self._kwargs) File "/app/app/scripts.py", line 1284, in posters4k posterTV_4k() File "/app/app/scripts.py", line 1170, in posterTV_4k get_TVposter() File "/app/app/scripts.py", line 1094, in get_TVposter b_hash1 = imagehash.average_hash(b_check1) File "/usr/local/lib/python3.9/site-packages/imagehash.py", line 185, in average_hash image = image.convert("L").resize((hash_size, hash_size), Image.ANTIALIAS) File "/usr/local/lib/python3.9/site-packages/PIL/Image.py", line 889, in convert self.load() File "/usr/local/lib/python3.9/site-packages/PIL/ImageFile.py", line 241, in load raise OSError("image file is truncated") from e OSError: image file is truncated

jkirkcaldy commented 2 years ago

Updating the script to work with trunkated images better now.

Concentrrating on fixing bugs for the movies libraries then moving onto Tv shows.

mtlballer commented 2 years ago

Glad to see you back, hope all is well. I deleted the poster and it hasn't happened since then, seems to be situational but I have no idea what the trigger is.

jkirkcaldy commented 2 years ago

Changed the image open logic so should help with truncated images now.