Kometa-Team / ImageMaid

Python 3 Script for Cleaning Up Images in Plex
MIT License
297 stars 16 forks source link

Missing "PIC Restore" folder #28

Open NooNameR opened 10 months ago

NooNameR commented 10 months ago

Version Number

1.0.2

What branch are you on?

master

Describe the Bug

Hey folks, I have upgraded to new 1.0.2 quite recently and started to get this error for a move action (which worked and works on 1.0.0):

|                                        Moving Bloat Images                                         |
|====================================================================================================|
| Scanning Metadata Directory For Bloat Images: /plex/Metadata                                       |
| Scanning Metadata for Bloat Images: 3121 directories [00:00, 6872.32 directories/s]
| 3 Bloat Images Found                                                                               |
| Runtime: 0:00:00                                                                                   |
|                                                                                                    |
| Moving Bloat Images                                                                                |
| Moving Bloat Images:   0%|          | 0/3 [00:00<?, ? moved/s]
| MOVE: /plex/Metadata/TV Shows/b/78416367adb991d7a33bb85ae78dacb7a75e76b.bundle/Uploads/posters/1d0cbbf30dd7b97deaa70941ba9c57576b75f443 --> /plex/PIC Restore/TV Shows/b/78416367adb991d7a33bb85ae78dacb7a75e76b.bundle/Uploads/posters/1d0cbbf30dd7b97deaa70941ba9c57576b75f443.jpg |
| Traceback (most recent call last):                                                                 |
|   File "//plex_image_cleanup.py", line 321, in run_plex_image_cleanup                              |
|     util.move_path(path, meta_dir, restore_dir, suffix=".jpg")                                     |
|   File "/usr/local/lib/python3.11/site-packages/pmmutils/util.py", line 60, in move_path           |
|     final_path.parent.mkdir(exist_ok=True)                                                         |
|   File "/usr/local/lib/python3.11/pathlib.py", line 1116, in mkdir                                 |
|     os.mkdir(self, mode)                                                                           |
| FileNotFoundError: [Errno 2] No such file or directory: '/plex/PIC Restore/TV Shows/b/78416367adb991d7a33bb85ae78dacb7a75e76b.bundle/Uploads/posters' |
|                                                                                                    |
| [Errno 2] No such file or directory: '/plex/PIC Restore/TV Shows/b/78416367adb991d7a33bb85ae78dacb7a75e76b.bundle/Uploads/posters' |
|====================================================================================================|
|                                          Critical Report                                           |
|====================================================================================================|
|                                                                                                    |
| Generic Criticals:                                                                                 |
|   [Errno 2] No such file or directory: '/plex/PIC Restore/TV Shows/b/78416367adb991d7a33bb85ae78dacb7a75e76b.bundle/Uploads/posters' |

I'm running Plex Image Cleanup as a container on Unraid:

image

and my .env is:

PLEX_URL=http://plex:32400
PLEX_TOKEN=<redacted>
PLEX_PATH=/plex
MODE=report
SCHEDULE=07:00|daily|mode=move,09:00|weekly(sunday)|mode=clear,05:00|monthly(1)|mode=nothing;photo-transcoder=true
DISCORD=
TIMEOUT=600
SLEEP=60
PHOTO_TRANSCODER=False
EMPTY_TRASH=False
CLEAN_BUNDLES=False
OPTIMIZE_DB=False
TRACE=False
LOG_REQUESTS=False

Logs

No response

N0cky commented 10 months ago

Can confirm, same error for me on 1.0.2 running with docker on a windows machine. After downgrading to 1.0.0 is working without a problem

xFlawless11x commented 10 months ago

Can confirm same error for me running 1.0.2, docker on unraid. Running on 1.0.0 or 1.0. working fine.

vCybah commented 10 months ago

Same here, just found this script and v1.0.2 won't make the folders when in 'move' mode on Linux using the local install. (python 3.11) Downgrading to v1.0.1 seems to work as expected though.

tylerreed19 commented 10 months ago

Having the same issue on a local Windows install as well. Time to downgrade I suppose.

bullmoose20 commented 9 months ago

same here and seemingly unable to revert on both develop and latest the same error when using the MODE=move setting

Gajotres commented 9 months ago

I'm having the same problem.

This is not a permissions issue as I have made sure that the /plex folder is accessible and writable.

If I manually create a 'PIC Restore' folder, the process does not work as the 'PIC Restore' folder already exists.

dube920 commented 7 months ago

Same issue here, manually creating the folder doesn't help at all.

dube920 commented 7 months ago

Recreated docker using kometateam/imagemaid:develop (which is using version 1.0.3 atm), working fine. I'm guessing 1.0.2 and this branch will be killed off in the near future in favor of the rebranding.

BartmanEH commented 5 months ago

I'm running a local install directly with Python. Had the same error of missing PIC Restore folder. I git cloned the develop branch and after reworking the command line to use the new branding python C:\Users\[redacted]\ImageMaid\imagemaid.py --plex [redacted] --url [redacted] --token [redacted] --mode move it seemed to work without error.

darac commented 2 months ago

It looks like the pmmutils repository has gone offline (so my suggested fix there seems to have been lost).

Looking at the traceback, the problem is that PIC/ImageMaid is trying to create a directory, without the parent directory/ies existing.

You can fix this as follows:

  1. git clone the repository and fetch the requirements as per the documentation.
  2. Run plex_image_cleanup.py as you normally would and get a traceback as above.
  3. Look for the error stating e.g. File "/usr/local/lib/python3.11/site-packages/pmmutils/util.py", line 60. This path might be different depending on where you've installed the requirements to. Edit this file with a text editor.
  4. On line 60, change:
    final_path.parent.mkdir(exist_ok=True)

    to

    final_path.parent.mkdir(exist_ok=True, parents=True)
  5. Save the file, quit your editor, and re-run the plex_image_cleanup.py once more.