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

Matching audiobooks no longer possible #92

Closed
WeisseTeetasse opened this issue Mar 10, 2023 · 2 comments · Fixed by #94
Closed

Matching audiobooks no longer possible #92

WeisseTeetasse opened this issue Mar 10, 2023 · 2 comments · Fixed by #94

Comments

@WeisseTeetasse
Copy link

WeisseTeetasse commented Mar 10, 2023

Since today's gitpull matching audiobooks is no longer possible via 'match' context menu setting.
Search instantly returns with nothing found.
Running on Debian 11/latest stable pms

Log:

2023-03-10 15:17:02,345 (7f284e744b38) : DEBUG (model:234) - Deserializing from /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Metadata/Artists/1/da8174c833edd4ed90ff9175a83eedef585412f.bundle/Contents/com.plexapp.agents.audnexus/Info.xml 2023-03-10 15:17:02,349 (7f284e744b38) : CRITICAL (agentkit:1018) - Exception in the search function of agent named 'Audnexus Agent', called with keyword arguments {'parentID': '110581', 'year': None, 'id': '110584', 'name': 'Tyranny of Faith', 'parentGUID': 'com.plexapp.agents.audnexus://B00USHZDJ8?lang=en'} (most recent call last): File "/usr/lib/plexmediaserver/Resources/Plug-ins-77dfff442/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 1011, in _search agent.search(*f_args, **f_kwargs) File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Audnexus.bundle/Contents/Code/__init__.py", line 265, in search quick_match_asin = search_helper.check_for_asin() File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/Audnexus.bundle/Contents/Code/search_tools.py", line 50, in check_for_asin self.media.filename).decode('utf8') File "/usr/lib/plexmediaserver/Resources/Python/python27.zip/urllib.py", line 1235, in unquote bits = s.split('%') AttributeError: 'NoneType' object has no attribute 'split'

@plmcgrn
Copy link
Contributor

plmcgrn commented Mar 18, 2023

Adding on, since I'm hitting this too. This is on a fresh git clone, as well.

Manual search

2023-03-18 00:57:27,083 (7ff8a945db38) :  INFO (sandbox:19) - Custom album search for: Fracture
2023-03-18 00:57:27,083 (7ff8a945db38) :  CRITICAL (agentkit:1018) - Exception in the search function of agent named 'Audnexus Agent', called with keyword arguments {'parentID': '11070', 'year': None, 'id': '17153', 'name': 'Fracture', 'parentGUID': 'com.plexapp.agents.audnexus://B005NE2K7E?lang=en'} (most recent call last):
  File "/usr/lib/plexmediaserver/Resources/Plug-ins-a607d384f/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 1011, in _search
    agent.search(*f_args, **f_kwargs)
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Audnexus.bundle/Contents/Code/__init__.py", line 265, in search
    quick_match_asin = search_helper.check_for_asin()
  File "/config/Library/Application Support/Plex Media Server/Plug-ins/Audnexus.bundle/Contents/Code/search_tools.py", line 50, in check_for_asin
    self.media.filename).decode('utf8')
  File "/usr/lib/plexmediaserver/Resources/Python/python27.zip/urllib.py", line 1235, in unquote
    bits = s.split('%')
AttributeError: 'NoneType' object has no attribute 'split'

Auto search (I noticed this is ignoring my manually-set album/sort album, and using the audio metadata in teh file itself, even though I have "Prefer Local Metadata" disabled.

2023-03-18 01:04:15,080 (7ff8a945db38) :  DEBUG (runtime:88) - Sending packed state data (108 bytes)
2023-03-18 01:04:15,080 (7ff8a945db38) :  DEBUG (runtime:924) - Response: [200] str, 16 bytes
2023-03-18 01:04:26,830 (7ff8a945db38) :  DEBUG (runtime:717) - Handling request GET /:/plugins/com.plexapp.agents.audnexus/messaging/function/X0FnZW50S2l0OlNlYXJjaA__/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoyCmRpY3QKZGljdAo2CnMyCmVuczQKbGFuZ2IxczYKbWFudWFsYjFzNwpwcmltYXJ5aTAKczcKdmVyc2lvbnIxCnM2Cmt3YXJnc3M1CkFsYnVtczEwCm1lZGlhX3R5cGUxMQpzMTMKRnJhY3R1cmUgQmsgMXM1CmFsYnVtczEKMXM1CmluZGV4czE2CjlhZWE1YzllNTEyZTg5NWJzMTcKb3BlblN1YnRpdGxlc0hhc2hzMTMKTWVnYW4gTWlyYW5kYXM2CmFydGlzdHM0MAo2ZTc4NTM2Y2RiMTc5YWEzNmUxYmNhMzcxNDA2ZWM3ODA1NjZiNzljczgKcGxleEhhc2hzMTA4CiUyRm1lZGlhJTJGYXVkaW9ib29rcyUyRk1lZ2FuJTIwTWlyYW5kYSUyRkZyYWN0dXJlJTJGTWVnYW4lMjBNaXJhbmRhJTIwLSUyMEZyYWN0dXJlJTIwMSUyMC0lMjBGcmFjdHVyZSUyRW1wM3M4CmZpbGVuYW1lczQ4CmNvbS5wbGV4YXBwLmFnZW50cy5hdWRuZXh1czovL0IwMDVORTJLN0U%40bGFuZz1lbnMxMApwYXJlbnRHVUlEczUKMTEwNzBzOApwYXJlbnRJRHM4CjI3MjM1NjA0czgKZHVyYXRpb25uczUKdGl0bGVzNQoxNzE1M3MyCmlkcjAK
2023-03-18 01:04:26,831 (7ff8a945db38) :  DEBUG (runtime:49) - Received packed state data (80 bytes)
2023-03-18 01:04:26,832 (7ff8a945db38) :  DEBUG (runtime:814) - Found route matching /:/plugins/com.plexapp.agents.audnexus/messaging/function/X0FnZW50S2l0OlNlYXJjaA__/Y2VyZWFsMQoxCmxpc3QKMApyMAo_/Y2VyZWFsMQoyCmRpY3QKZGljdAo2CnMyCmVuczQKbGFuZ2IxczYKbWFudWFsYjFzNwpwcmltYXJ5aTAKczcKdmVyc2lvbnIxCnM2Cmt3YXJnc3M1CkFsYnVtczEwCm1lZGlhX3R5cGUxMQpzMTMKRnJhY3R1cmUgQmsgMXM1CmFsYnVtczEKMXM1CmluZGV4czE2CjlhZWE1YzllNTEyZTg5NWJzMTcKb3BlblN1YnRpdGxlc0hhc2hzMTMKTWVnYW4gTWlyYW5kYXM2CmFydGlzdHM0MAo2ZTc4NTM2Y2RiMTc5YWEzNmUxYmNhMzcxNDA2ZWM3ODA1NjZiNzljczgKcGxleEhhc2hzMTA4CiUyRm1lZGlhJTJGYXVkaW9ib29rcyUyRk1lZ2FuJTIwTWlyYW5kYSUyRkZyYWN0dXJlJTJGTWVnYW4lMjBNaXJhbmRhJTIwLSUyMEZyYWN0dXJlJTIwMSUyMC0lMjBGcmFjdHVyZSUyRW1wM3M4CmZpbGVuYW1lczQ4CmNvbS5wbGV4YXBwLmFnZW50cy5hdWRuZXh1czovL0IwMDVORTJLN0U@bGFuZz1lbnMxMApwYXJlbnRHVUlEczUKMTEwNzBzOApwYXJlbnRJRHM4CjI3MjM1NjA0czgKZHVyYXRpb25uczUKdGl0bGVzNQoxNzE1M3MyCmlkcjAK
2023-03-18 01:04:26,833 (7ff8a945db38) :  INFO (agentkit:961) - Searching for matches for {'album': 'Fracture Bk 1', 'index': '1', 'openSubtitlesHash': '9aea5c9e512e895b', 'artist': 'Megan Miranda', 'parentID': '11070', 'filename': '%2Fmedia%2Faudiobooks%2FMegan%20Miranda%2FFracture%2FMegan%20Miranda%20-%20Fracture%201%20-%20Fracture%2Emp3', 'parentGUID': 'com.plexapp.agents.audnexus://B005NE2K7E?lang=en', 'plexHash': '6e78536cdb179aa36e1bca371406ec780566b79c', 'duration': '27235604', 'title': None, 'id': '17153'}
2023-03-18 01:04:26,833 (7ff8a945db38) :  DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/library/metadata/17153/tree'
2023-03-18 01:04:26,838 (7ff8a945db38) :  DEBUG (model:32) - Loading model with GUID com.plexapp.agents.audnexus://B005NE2K7E?lang=en
2023-03-18 01:04:26,838 (7ff8a945db38) :  DEBUG (model:234) - Deserializing from /config/Library/Application Support/Plex Media Server/Metadata/Artists/3/4e57b8be7a114d2928d00249a06731b22cd735b.bundle/Contents/com.plexapp.agents.audnexus/Info.xml
2023-03-18 01:04:26,839 (7ff8a945db38) :  INFO (sandbox:19) - -----------------------------------ALBUM SEARCH-----------------------------------
2023-03-18 01:04:26,839 (7ff8a945db38) :  INFO (sandbox:19) - ID                  B005NE2K7E_us
2023-03-18 01:04:26,840 (7ff8a945db38) :  INFO (sandbox:19) - Title               Fracture
2023-03-18 01:04:26,840 (7ff8a945db38) :  INFO (sandbox:19) - Album               Fracture Bk 1
2023-03-18 01:04:26,840 (7ff8a945db38) :  INFO (sandbox:19) - Artist              Megan Miranda
2023-03-18 01:04:26,841 (7ff8a945db38) :  INFO (sandbox:19) - ----------------------------------------------------------------------
2023-03-18 01:04:26,841 (7ff8a945db38) :  INFO (sandbox:19) - Region Override: us
2023-03-18 01:04:26,843 (7ff8a945db38) :  DEBUG (networking:138) - Fetching 'https://api.audible.com/1.0/catalog/products?response_groups=contributors,product_desc,product_attrs&num_results=25&products_sort_by=Relevance&title=Fracture%20Bk%201&author=Megan%20Miranda' from the HTTP cache
2023-03-18 01:04:26,844 (7ff8a945db38) :  INFO (sandbox:19) - No results found for query "Fracture Bk 1"
2023-03-18 01:04:26,845 (7ff8a945db38) :  DEBUG (runtime:88) - Sending packed state data (108 bytes)
2023-03-18 01:04:26,845 (7ff8a945db38) :  DEBUG (runtime:924) - Response: [200] str, 320 bytes

The book does exist on Audible, but I can replicate the API "miss" due to it ignoring my preference to use embedded metadata and the manual search failing hard means I can't match it at all.
https://www.audible.com/pd/Fracture-Audiobook/B00HM8YUTA

Edit:
I figured out what's happening, but I don't have the skills to fix it. When auto search happens, the newer version of search_tools.py uses self.media.filename to look for an ASIN in the filename. This works for auto search, but not manual search. When running manual search, self.media.filename is empty, so it throws this exception.

As a quick workaround, I put and additional check on the relevant if statement, and this worked to allow manual search to work properly.

        log.debug('self.media.filename: %s', self.media.filename) #added this, and that's how I found this was "None" on manual search
        if self.content_type == 'books' and self.media.filename:

where original was

 if self.content_type == 'books' 

This is clearly just a hack for missing source data, so I didn't want to submit a PR for it. I don't know the source data structure/flow enough to determine if this would be a good permanent fix or just a hack to keep us going while waiting for one.

self.media.filename when using auto search

2023-03-18 02:13:12,012 (7fbd2cc17b38) :  DEBUG (sandbox:19) - self.media.filename: %2Fmedia%2Faudiobooks%2FMegan%20Miranda%2FFracture%2FMegan%20Miranda%20-%20Fracture%201%20-%20Fracture%2Emp3

self.media.filename when using manual search

2023-03-18 02:13:15,928 (7fbd2cc17b38) :  DEBUG (sandbox:19) - self.media.filename: None

@djdembeck
Copy link
Owner

@plmcgrn thanks for taking the time to look into this. Yes, manual matching doesn't receive the filename from plex (just how their system works).

As for local/prefer embedded, that I believe is a scanner setting, and not controllable via the agent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants