-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fixed #2200 and a small typo #2294
Conversation
Ahh well, that's a lot of failing tests... |
Most tests (except for flake-8) are failing because of this - https://github.com/beetbox/beets/blob/master/test/test_mb.py#L131 This assertion fails due to the previous schema of the "release". Possible fixes -
|
all_types.append(rel_primarytype.lower()) | ||
if 'secondary-type-list' in release['release-group']: | ||
for secondarytype in release['release-group']['secondary-type-list']: | ||
all_types.append(secondarytype.lower()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can extend the list in one shot here :
all_types.extend([x.lower() for x in release['release-group']['secondary-type-list']])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
surely ! seems a better way !
all_types = [] | ||
if 'primary-type' in release['release-group']: | ||
rel_primarytype = release['release-group']['primary-type'] | ||
if rel_primarytype: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You check the string not emptiness in that case but not for secondarytype. Intentional ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey !
Yes this was intentional
line 285 confirms if the key exists or not. The value for the key 'secondary-type-list' will always be a list, so if the key exists, it can either be an empty list or full of elements, and in either way, the for loop handles the situation.
all_types.append(secondarytype.lower()) | ||
if len(all_types) != 0: | ||
all_types = ','.join(all_types) | ||
info.albumtype = all_types.lower() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these two lines could be done in one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, will do
Had another question though, should the joining string be ',' or ', ' (with a space) to follow the general standard everywhere of having a space after a comma in comma separated values .
Welcome & thanks for tackling this issue! |
Great! Thanks for getting started! I have a couple of questions:
|
@sampsyo I guess the best place to know the answer to that is on the musicbrainz channel. I'll ask them there and correspond back to you here :) |
@sampsyo So I checked up with musicbrainz channel on irc. It mostly seems that the 'type' field is legacy (it isn't documented on http://wiki.musicbrainz.org/Release_Group/Type either) Most of the testing confirms that type value is same as the secondarytypes value (http://dpaste.com/07H2C7T) what do you suggest, should we keep type or replace it ? Update: - It seems the ''type'' field was later divided into two - primarytype and secondarytype. Possible fix - extract data from 'type' field after parsing data from the primarytype and the secondarytype to see if it contains a unique albumtype and add to the list of tags if unique |
Awesome! Thanks for doing some investigation. It sounds like the "type" field is deprecated. Since it's not completely clear yet how to get a 1-1 replacement with the new metadata fields, let's start by just adding some logging statements to record the new data. That way, we'll avoid disrupting anyone's workflow but we'll also be in a position to ask users what they want us to do with the new (and old) data. Would you mind changing your current modifications to just use |
if rel_primarytype: | ||
all_types.append(rel_primarytype.lower()) | ||
if 'secondary-type-list' in release['release-group']: | ||
all_types.extend([secondarytype.lower() for secondarytype in\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
backslash is redundant between bracket
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, any other way to avoid no. of characters > 79 error ?
I'm out of ways I guess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, you can just leave off the \ here! Since the expression is surrounded by parentheses, Python will be able to figure out what you mean without it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I think it's failing a flake-8 test due to this reason
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's currently complaining that the slash is there when it doesn't need to be ("backslash is redundant").
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh okay !
rel_type = release['release-group']['type'] | ||
if rel_type and rel_type.lower() not in all_types: | ||
all_types.append(rel_type) | ||
if len(all_types): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or just if all_types:
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure :)
@sampsyo , sorry for late reply Also, I wonder how enabling logging feature will help to ask the user which data they want to use. |
Ah, the idea is just to have the logging there so curious people can view what would be applied if we switched to the new data. Then, later, we can propagate these fields to the actual music. The point is that people have configuration files out there that depend on |
@sampsyo , I told this to Freso as well, I really don't mind the GCI task and everything. I'm here to help and make this better and in that way, learn a little as well. (And anyway, I'm still having problems claiming tasks, so I'm pretty sure I can keep on helping with this) |
That is ofc, if I'm capable enough to do them and there aren't more pressing issues/features you have to work on. |
Great! In any case, just for sane development practices, let's do the logging thing first. Then we can move on to inventing the new fields. In fact, the best way to attack the second stage will be through another ticket we put on GCI (#1547). |
Sure ! |
Great! You can see some other |
Alright ! |
Let's log them separately. Thank you! |
Is there a a problem with the Appvoyer tests ? |
if 'secondary-type-list' in release['release-group']: | ||
if release['release-group']['secondary-type-list']: | ||
log.debug('Secondary Type(s) (new data): ' + ', '.join( | ||
[secondarytype.lower() for secondarytype in \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This backslash is unnecessary. Just remove it and flake8 should be happy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That may put up another flag for it being larger than 79 characters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try nonetheless
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh wait
So I can remove the backslash and it still accepts it for being in the brackets !
Didn't know that. Oops. Sorry
Yes; thanks for pointing that out! We've broken some tests on Windows; I'll sort that out. And thank you! This is looking good, and you're right that everything's passing except for flake8. As you can see from the log, the problem is another redundant backslash. Just remove that and everything should go green (and we can call the GCI task complete). |
\o/ The Travis checks finally pass ! |
I'll be closing this PR for the time we decide what to do with it so that the new commits don't get added to this one. |
Reopening this, as it was closed by me due to a confusion (I didn't know about branching back then) |
Sorry for the delay! I merged the logging code, which should bring us closer to a complete solution for storing multiple album types. |
Added functionality to retrieve secondary album tags from Musicbrainz and add all tags as a comma separated string (with primary tag as first value)
Also fixed a small typo.