Audnexus.bundle
Audnexus.bundle copied to clipboard
ASIN quick matching book (album) fails
I am not having luck with the ASIN in the book's folder name. Looking at the logs it looks like the ASIN matching gets altered
My setup: File path on linux: .../Audiobooks/Andrzej Sapkowski/Sword of Destiny B017WP4D6C/....
The attached log is what happens when I have:
- cleaned out my plex audiobooks
- move the folder "Sword of Destiny B017WP4D6C" into place.
- tell the plex library to scan files
and the attached screen shot is what shows up in plex.
com.plexapp.agents.audnexus-B017WP4D6C.log
In the log lines below you can see there is the correct ASIN of B017WP4D6C in the file name but it does a quick search on 20B017WP4D which isn't right.
2022-06-04 16:26:32,255 (7fd3293eab38) : INFO (agentkit:961) - Searching for matches for {'album': 'Sword of Destiny (Unabridged)', 'openSubtitlesHash': 'a033ae7dd9bc6727', 'artist': 'Andrzej Sapkowski', 'title': None, 'filename': '%2Fexports%2Faudiobooks%2FAudiobooks%2FAndrzej%20Sapkowski%2FSword%20of%20Destiny%20B017WP4D6C%2FSword%20of%20Destiny%20%28Unabridged%29%2Em4b', 'plexHash': '0f21a5af6327fe7d51789b7cfda068e015674f32', 'parentGUID': 'com.plexapp.agents.audnexus://B001ICAMAW?lang=en', 'parentID': '693334', 'duration': '46005836', 'id': '693335'}
2022-06-04 16:26:32,256 (7fd3293eab38) : DEBUG (networking:143) - Requesting 'http://127.0.0.1:32400/library/metadata/693335/tree'
2022-06-04 16:26:32,258 (7fd3293eab38) : DEBUG (model:32) - Loading model with GUID com.plexapp.agents.audnexus://B001ICAMAW?lang=en
2022-06-04 16:26:32,258 (7fd3293eab38) : DEBUG (model:234) - Deserializing from /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Metadata/Artists/9/7323b7bed6f8174de0e7cbb5340f500417e8fe2.bundle/Contents/com.plexapp.agents.audnexus/Info.xml
2022-06-04 16:26:32,259 (7fd3293eab38) : INFO (sandbox:19) - -----------------------------------ALBUM SEARCH-----------------------------------
2022-06-04 16:26:32,259 (7fd3293eab38) : INFO (sandbox:19) - ID B001ICAMAW
2022-06-04 16:26:32,260 (7fd3293eab38) : INFO (sandbox:19) - Title Sword of Destiny (Unabridged)
2022-06-04 16:26:32,260 (7fd3293eab38) : INFO (sandbox:19) - Album Sword of Destiny (Unabridged)
2022-06-04 16:26:32,260 (7fd3293eab38) : INFO (sandbox:19) - Artist Andrzej Sapkowski
2022-06-04 16:26:32,260 (7fd3293eab38) : INFO (sandbox:19) - ----------------------------------------------------------------------
2022-06-04 16:26:32,260 (7fd3293eab38) : INFO (sandbox:19) - Using quick match based on asin: 20B017WP4D
2022-06-04 16:26:32,260 (7fd3293eab38) : DEBUG (runtime:88) - Sending packed state data (108 bytes)
If I fix match with "B017WP4D6C" things correct themselves but that defeats putting the ASIN in the directory name.
I ran into the same problem, looks like a bug in the ASIN parser.
When search_asin
is called in search_tools.py
, the input string is URL-encoded. That means that if your directory name is "My Book B017WP4D6C", then search_asin
sees My%20Book%20B017WP4D6C
, and detects 20B017WP4D
as the ASIN (the first 10 symbols that match the ASIN regex).
One possible solution - I fixed it in code like this:
diff --git a/Contents/Code/search_tools.py b/Contents/Code/search_tools.py
index eb0bdcd..91ee7da 100644
--- a/Contents/Code/search_tools.py
+++ b/Contents/Code/search_tools.py
@@ -548,4 +548,4 @@ def clear_contributor_text(string):
def search_asin(input):
if input:
- return re.search(asin_regex, input)
+ return re.search(asin_regex, urllib.unquote(input).decode('utf8'))
--
Alternatively, you could probably also format your album name as My Book_B017WP4D6C
(underscore instead of space), as underscores are untouched in URL-encoded strings.
Hi, I have the same problem. I tried the code change you suggested @cpp-10, but it is not working. I am not a coder so I may have not understood the diff details you posted:
Is it just replacing the line "return re.search(asin_regex, input)" with "return re.search(asin_regex, urllib.unquote(input).decode('utf8'))", or was there something else I need to change?
Thanks.
It looks like I solved the problem temporarily by enabling Local Media Assets under the audnexus agent album settings (I didn't even have to move it above audnexus).