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

Custom tags for first author name/asin #39

Open
buswedg opened this issue Nov 25, 2022 · 5 comments
Open

Custom tags for first author name/asin #39

buswedg opened this issue Nov 25, 2022 · 5 comments

Comments

@buswedg
Copy link

buswedg commented Nov 25, 2022

I'd see utility in creating a couple of custom tags to store the first/primary author's name and their asin. Similar to what is discussed here.

Shouldn't be a huge lift, as the authors dic returned by api.audnex.us actually includes an asin for the first author, even if the audiobook has multiple authors. Taking a quick look at the code, and the structure is also handled by the plugin parser. But doesn't seem like the data is stored anywhere.

Clearly, this doesn't conform to the standard set of tags. But creating a couple of custom tags (e.g. FIRSTAUTHOR and FIRSTAUTHORASIN) would allow paths to be structured as:

$firstauthor [$firstauthorasin]/$album%aunique{} ($year) [$asin]/$track - $title

which feels like the right way to organize by unique authors to me.

Handy reference below for an authors dic on a multi-author title, which is returned via this request.

"authors":[{"asin":"B001KHVQXW","name":"Bernie Marcus"},{"name":"Arthur Blank"},{"name":"Bob Andelman"}]
@Neurrone
Copy link
Owner

Neurrone commented Nov 25, 2022

I'm not opposed to doing so.

I have a few questions about how this would be implemented.

  • What happens when there are multiple authors. Should this tag then contain the first author listed, or the first author alphabetically?
  • If this tag naming scheme is extended to second or third authors, then this starts feeling clunky. Do you know if there's a way to encode multiple things in an id3 tag and if so, whether Beets's templates are able to index into them?

@buswedg
Copy link
Author

buswedg commented Nov 25, 2022

I'm pretty new to this, but from what I can tell there is only ever one author with an asin key/value pair in the list of authors dic. That's the case even if the audiobook has multiple authors. Maybe 'first author' isn't the right way to think about this. But either way -- I'm pretty sure this primary/first author always appears first in the list of authors dic. Perhaps you'll want to build in logic to check for existence of the author asin key/value (with a default of none), and not build that logic around the actual order of authors in the dic. That way, it won't matter if there is an edge case for primary/first authors appearing later in the list.

I also don't think there's much value in creating custom tags for the other (second, third etc. authors). You won't get an associated asin value for those authors from the same audiobook api request. And like I said, I think the main benefit here is to get some proper logic to sort books/albums, which you can do with just the first/primary authors asin. I don't have a super large library but do already have some audiobooks with the same author name (but they're in-fact different authors).

@Neurrone
Copy link
Owner

So perhaps primary author may be a better name for it. I understand what you mean now when you said that only one of the authors has an asin.

Would you be interested in raising a PR? Otherwise, I can look at supporting this in a couple of weeks.

@buswedg
Copy link
Author

buswedg commented Nov 27, 2022

Would you be interested in raising a PR? Otherwise, I can look at supporting this in a couple of weeks.

Sure, there is start here. Haven't tested at all. But I can take a closer look next weekend.

@Neurrone
Copy link
Owner

Sounds good.

Btw, you may want to rebase off the latest main branch, as I've made some changes to support uploads to PyPI as well as pep8 compliant formatting.

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

No branches or pull requests

2 participants