-
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
Add composer_sort as a tag #2529
Conversation
@dosoe, thanks for your PR! By analyzing the history of the files in this pull request, we identified @sampsyo, @pkess and @geigerzaehler to be potential reviewers. |
It works fine on my files, but I didn't do any further testing. |
Concerning the ID3v2 tag, it is TSOC (Picard>=1.3) and TXXX:COMPOSERSORT (Picard<=1.2). Since the official picard version is now 1.4.2, I used only the second, but that might cause problems. Concerned are beets/mediafile.py |
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 have a number of code style error, but AFAICT it's all whitespace, so fairly harmless. Still, better to not have all that stray whitespace. ;)
You add a couple of tests, but I'm not entirely sure what the tests are supposed to test, so also not sure whether they're needed at all. I will probably need @sampsyo to chime in that.
Also, for good measure, consider making a commit updating the changelog too. :)
(PS. You may also want to read up on writing good commit messages and making atomic commits.)
Thanks for your PR!
beets/autotag/__init__.py
Outdated
if track_info.arranger is not None: | ||
item.arranger = track_info.arranger | ||
|
||
|
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.
Just remove these blank lines.
beets/autotag/hooks.py
Outdated
@@ -155,8 +156,8 @@ def __init__(self, title, track_id, artist=None, artist_id=None, | |||
length=None, index=None, medium=None, medium_index=None, | |||
medium_total=None, artist_sort=None, disctitle=None, | |||
artist_credit=None, data_source=None, data_url=None, | |||
media=None, lyricist=None, composer=None, arranger=None, | |||
track_alt=None): | |||
media=None, lyricist=None, composer=None, composer_sort=None, |
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.
There's a trailing space here.
beets/mediafile.py
Outdated
@@ -1632,12 +1632,21 @@ def update(self, dict): | |||
StorageStyle('LYRICIST'), | |||
ASFStorageStyle('WM/Writer'), | |||
) | |||
|
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.
Follow the style of the rest of the code and don't add a blank line here.
beets/mediafile.py
Outdated
composer = MediaField( | ||
MP3StorageStyle('TCOM'), | ||
MP4StorageStyle('\xa9wrt'), | ||
StorageStyle('COMPOSER'), | ||
ASFStorageStyle('WM/Composer'), | ||
) | ||
|
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 here.
beets/mediafile.py
Outdated
StorageStyle('COMPOSERSORT'), | ||
ASFStorageStyle('WM/Composersortorder'), | ||
) | ||
|
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 here.
test/test_mediafile.py
Outdated
@@ -150,6 +156,12 @@ def test_add_image_structure(self): | |||
self.assertExtendedImageAttributes( | |||
image, desc=u'the composer', type=ImageType.composer | |||
) | |||
|
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.
Don't include whitespace on blank lines.
test/test_mediafile.py
Outdated
image = next(images, None) | ||
self.assertExtendedImageAttributes( | ||
image, desc=u'the sortname of the composer', type=ImageType.composer_sort | ||
) |
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.
Again, not sure this test is relevant here.
test/test_mediafile.py
Outdated
@@ -193,6 +205,11 @@ def test_add_tiff_image(self): | |||
type=ImageType.composer) | |||
mediafile.images += [image] | |||
mediafile.save() | |||
|
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.
Whitespace, blank line…
test/test_mediafile.py
Outdated
@@ -202,6 +219,11 @@ def test_add_tiff_image(self): | |||
mediafile.images))[0] | |||
self.assertExtendedImageAttributes( | |||
image, desc=u'the composer', type=ImageType.composer) | |||
|
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.
Whitespace, blank line…
test/test_mediafile.py
Outdated
'album': u'the album', | ||
'genre': u'the genre', | ||
'composer': u'the composer', | ||
'composer_sort': u'the sortname of the composer', |
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 don't see artist_sort
here, so maybe no need for composer_sort
either?
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.
true, but I wonder why there isn't artist_sort . Imo where there is a name there also should be the sort name.
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.
anyway, removed it.
I have nothing to do with the tests, they just popped randomly. |
…r composer_sort; cleaning up whitespaces.
'Also, for good measure, consider making a commit updating the changelog too. :)' What does that mean? |
and thanks for the links. |
by the way, as a familiar of musicbrainz, you might know how to add a "work" tag properly. |
test/test_mediafile.py
Outdated
@@ -373,7 +350,6 @@ class ReadWriteTestBase(ArtTestMixin, GenreListTestMixin, | |||
'genre', | |||
'lyricist', | |||
'composer', | |||
'composer_sort', |
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 list does have an artist_sort
, so the composer_sort
is probably also applicable here.
That is not how tests work, sorry. The tests break either because changes in this pull request broke something that make existing tests fail, or because new tests added in the pull request are failing. If you really think there's randomness involved, you "Restart build" in Travis (not sure if you can manually trigger a rebuild in AppVeyor). The "Details" links under the "All checks have failed" should have more details you can use to try and figure out what code is failing once you've been convinced it isn't a fluke. |
Code looks decent at a glance, but tests are failing and maybe some code needs to be readded based on feedback from @sampsyu.
Ok, sorry, I should have been more clear. I know that these tests are not strictly speaking random, I just wanted to say that I have nothing to do with them (and btw I didn't add any test in this request). |
beets/autotag/mb.py
Outdated
@@ -218,10 +219,12 @@ def track_info(recording, index=None, medium=None, medium_index=None, | |||
lyricist.append(artist_relation['artist']['name']) | |||
elif type == 'composer': | |||
composer.append(artist_relation['artist']['name']) | |||
composer_sort.append(artist_relation['artist']['sort-name']) |
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 line is now too long, which is why our linting test is failing. You'll need to wrap it to be under 80 characters, the easiest way being this:
composer_sort.append(
artist_relation['artist']['sort-name'])
Thank you! ✨ All merged up. |
My first merge! |
Already discussed on #2519
This is my first pull request (almost) and my first contribution to any open-source project, so please be kind...
It's heavily using https://github.com/beetbox/beets/pull/2333/files/7060b512b848fb36f49dcc091f65a6e7baa83d4f and https://picard.musicbrainz.org/docs/mappings/ . I would have liked to add an arranger_sort tag, but arranger_sort is not listed in the tag mapping (unlike composer_sort), so it will be more difficult.