Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR in app: Exception on /triggers/manual [POST] #5

Closed
jrcalvert opened this issue Feb 7, 2024 · 6 comments · Fixed by #9
Closed

ERROR in app: Exception on /triggers/manual [POST] #5

jrcalvert opened this issue Feb 7, 2024 · 6 comments · Fixed by #9
Labels
help wanted Extra attention is needed

Comments

@jrcalvert
Copy link

Hello - I am getting the error below for some paths. The paths do exist and are accesible by Plex.

[2024-02-07 07:56:24,572] WARNING in app: Starting directory scan of: /RAID/deleted/TV
[2024-02-07 07:56:24,578] ERROR in app: Exception on /triggers/manual [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 2525, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1822, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1820, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1796, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/app.py", line 30, in trigger
metadata_files = plex_api.find_metadata_from_dirs(directory=directory)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/plexapihandler.py", line 33, in find_metadata_from_dirs
media_name = pathlib.PurePath(directory).parts[section_parts]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
IndexError: tuple index out of range
172.19.0.1 - - [07/Feb/2024 07:56:24] "POST /triggers/manual?dir=/RAID/deleted/TV HTTP/1.1" 500 -

@dantebarba
Copy link
Owner

  1. Are you using the 0.2.0 version or 0.1.1?
  2. Does it happen in all the scans or only in this particular case?

@dantebarba
Copy link
Owner

dantebarba commented Feb 8, 2024

Because of the line number I can infer that you are using the old 0.1.1 version. Nevertheless the new version should still have that bug in it.

Looks like the bug is caused by Plex having a different media location than the instance triggering the update (sonarr, radarr, bazarr o whatever service is calling the adapter). This is generally due to mount discrepancies.

If you are using Docker I recommend to keep the same filepath between the instance calling the adapter and Plex.

@dantebarba dantebarba added the help wanted Extra attention is needed label Feb 8, 2024
@jrcalvert
Copy link
Author

I have just updated to the latest container and I've double-checked the paths - they are all the same and are consistent with the host paths themselves as Plex runs natively.

@dantebarba
Copy link
Owner

@jrcalvert hmm looks like I've found the issue but to confirm it I need you to provide the full path to the media file that produced the error. The full path should include the media file. You can mask any username if you'd like for security. I will also need the path to the media library that you added in Plex.

As a summary what I think is happening is: for paths which have a subdirectory the scanning will work okay, but for the absolute paths that contain the media file it won't.

Lets say you have the media library /RAID/deleted/TV in plex. If you scan for /RAID/deleted/TV/Walking_Dead/Season_1/S01E01.mkv it will work. Lets now assume you have /RAID/deleted/TV in plex but your file is located at /RAID/deleted/TV/S01E01.mkv, this will not work.

See how the first example has subpaths Walking_Dead and Season_1 in it after the media library path, but the second example doesn't. This happens because the script assumes a sonarr/radarr-like file structure which is not always the case.

media_name = pathlib.PurePath(directory).parts[section_parts]

If you can confirm all this by providing the full paths I will push a version with a fix. Thanks

@dantebarba
Copy link
Owner

@jrcalvert the issue has. been solved in https://github.com/dantebarba/autoscan-adapter/tree/0.3.0

@jrcalvert
Copy link
Author

jrcalvert commented Feb 19, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
2 participants