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

Add composer_sort as a tag #2529

Merged
merged 9 commits into from
May 12, 2017
Merged

Add composer_sort as a tag #2529

merged 9 commits into from
May 12, 2017

Conversation

dosoe
Copy link
Contributor

@dosoe dosoe commented Apr 28, 2017

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.

@mention-bot
Copy link

@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.

@dosoe
Copy link
Contributor Author

dosoe commented Apr 28, 2017

It works fine on my files, but I didn't do any further testing.

@dosoe
Copy link
Contributor Author

dosoe commented Apr 28, 2017

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

Freso
Freso previously requested changes Apr 28, 2017
Copy link
Member

@Freso Freso left a 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!

if track_info.arranger is not None:
item.arranger = track_info.arranger


Copy link
Member

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.

@@ -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,
Copy link
Member

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.

@@ -1632,12 +1632,21 @@ def update(self, dict):
StorageStyle('LYRICIST'),
ASFStorageStyle('WM/Writer'),
)

Copy link
Member

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.

composer = MediaField(
MP3StorageStyle('TCOM'),
MP4StorageStyle('\xa9wrt'),
StorageStyle('COMPOSER'),
ASFStorageStyle('WM/Composer'),
)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or here.

StorageStyle('COMPOSERSORT'),
ASFStorageStyle('WM/Composersortorder'),
)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or here.

@@ -150,6 +156,12 @@ def test_add_image_structure(self):
self.assertExtendedImageAttributes(
image, desc=u'the composer', type=ImageType.composer
)

Copy link
Member

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.

image = next(images, None)
self.assertExtendedImageAttributes(
image, desc=u'the sortname of the composer', type=ImageType.composer_sort
)
Copy link
Member

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.

@@ -193,6 +205,11 @@ def test_add_tiff_image(self):
type=ImageType.composer)
mediafile.images += [image]
mediafile.save()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitespace, blank line…

@@ -202,6 +219,11 @@ def test_add_tiff_image(self):
mediafile.images))[0]
self.assertExtendedImageAttributes(
image, desc=u'the composer', type=ImageType.composer)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitespace, blank line…

'album': u'the album',
'genre': u'the genre',
'composer': u'the composer',
'composer_sort': u'the sortname of the composer',
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anyway, removed it.

@dosoe
Copy link
Contributor Author

dosoe commented Apr 28, 2017

I have nothing to do with the tests, they just popped randomly.

@dosoe
Copy link
Contributor Author

dosoe commented Apr 28, 2017

'Also, for good measure, consider making a commit updating the changelog too. :)' What does that mean?

@dosoe
Copy link
Contributor Author

dosoe commented Apr 28, 2017

and thanks for the links.

@dosoe
Copy link
Contributor Author

dosoe commented Apr 28, 2017

by the way, as a familiar of musicbrainz, you might know how to add a "work" tag properly.

@@ -373,7 +350,6 @@ class ReadWriteTestBase(ArtTestMixin, GenreListTestMixin,
'genre',
'lyricist',
'composer',
'composer_sort',
Copy link
Member

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.

@Freso
Copy link
Member

Freso commented Apr 28, 2017

I have nothing to do with the tests, they just popped randomly.

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.

@Freso Freso dismissed their stale review April 28, 2017 20:42

Code looks decent at a glance, but tests are failing and maybe some code needs to be readded based on feedback from @sampsyu.

@dosoe
Copy link
Contributor Author

dosoe commented Apr 28, 2017

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).

@@ -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'])
Copy link
Member

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'])

@sampsyo
Copy link
Member

sampsyo commented May 12, 2017

Thank you! ✨ All merged up.

@sampsyo sampsyo merged commit e444143 into beetbox:master May 12, 2017
sampsyo added a commit that referenced this pull request May 12, 2017
Add composer_sort as a tag
sampsyo added a commit that referenced this pull request May 12, 2017
@dosoe
Copy link
Contributor Author

dosoe commented May 12, 2017

My first merge!

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.

5 participants