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

Detect ASINs in file path #42

Closed
wants to merge 2 commits into from

Conversation

xuvatilavv
Copy link
Contributor

Short-circuit album search if an ASIN is detected after a # in the album's file path. Made this for my own library but this might close #19 if I understand it right.

Could be good to also override the artist search if it's possible to get the right data using the album ASIN, but that's beyond my needs at the moment.

@djdembeck
Copy link
Owner

This is a great start to detecting ASIN in file path. That being said, it is a workaround and not a solution. I think the best way to accomplish this would be related to #19. This would look like:

  • Search process finds out there's an asin to use (either in manual search or in file name)
  • Search process skips actually searching, and directly tells the agent to update to this ASIN, not even searching it.

This would remove an entire API call, thus speeding up the process by about 100-400ms.

@djdembeck
Copy link
Owner

djdembeck commented Mar 24, 2022

I've made some changes to the develop branch that you can check out here: 3cca5b6

I still need to test it on file names

@xuvatilavv
Copy link
Contributor Author

Ah, my mistake, didn't notice the separate search queries 😅 your changes are much better, but I would suggest still requiring the ASIN be marked or have some other restriction, since media.filename is the (url encoded) absolute path to the file. The current regex could easily collide with user path structure (e.g. AUDIOBOOKS/...), and prevent any matches from being made.

I'd considered checking for something like \[[A-Z0-9]{10}\] since that's what Libation puts out by default, but that has the unfortunate collision of [UNABRIDGED], which I've seen on files in the wild a fair bit.

@djdembeck
Copy link
Owner

djdembeck commented May 29, 2022

I believe I've found a better regex to eliminate your edge cases: (?=.\\d)[A-Z\\d]{10} This will verify there MUST be at least 1 digit in the 10 letter string. In my testing, Audible always has at least 1 letter. Typically something like 0062872389 (all digits) or B0731R4RFX (starts with B0)

@djdembeck
Copy link
Owner

#49

@djdembeck djdembeck closed this May 29, 2022
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 this pull request may close these issues.

Improve upon asin force matching
2 participants