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

mpd:Update protocol version to 0.19 #1213

Merged
merged 3 commits into from Jul 8, 2015

Conversation

2 participants
@fatg3erman
Contributor

fatg3erman commented Jul 5, 2015

Since mpd 0.19, it has concatenated multiple values using
a ';' character. Mopidy has been using ', '. This makes mopidy
use a ';' for all artist-related values.

In mpd 0.18, multiple values were displayed as multiple lines in
the output, hence this change bumps the mpd protocol version to
0.19 to reflect the new behaviour.

fatg3erman added some commits Jul 5, 2015

mpd:Update protocol version to 0.19
Since mpd 0.19, it has concatenated multiple values using
a ';' character. Mopidy has been using ', '. This makes mopidy
use a ';' for all artist-related values.

In mpd 0.18, multiple values were displayed as multiple lines in
the output, hence this change bumps the mpd protocol version to
0.19 to reflect the new behaviour.
mpd:Update protocol to 0.19
Update tests to reflect new function names
def test_artists_to_mpd_format_artist_with_no_name(self):
def test_concatenate_muultiple_values_artist_with_no_name(self):

This comment has been minimized.

@jodal

jodal Jul 5, 2015

Member

s/muultiple/multiple/

translated = translator.concatenate_multiple_values(artists, 'name')
self.assertEqual(translated, '')
def test_concatenate_muultiple_values_artist_with_no_musicbrainz_id(self):

This comment has been minimized.

@jodal

jodal Jul 5, 2015

Member

s/muultiple/multiple/

self.assertEqual(translated, '')
def test_concatenate_muultiple_values_artist_with_no_musicbrainz_id(self):
artists = [Artist(name="Jah Wobble")]

This comment has been minimized.

@jodal

jodal Jul 5, 2015

Member

Please default to using single quotes, unless the string contains a single quote, then it is preferable to use double quotes instead of escaping the single quote inside the string.

"""
Format track artists for output to MPD client.
Format track artist values for output to MPD client.
:param artists: the artists
:type track: array of :class:`mopidy.models.Artist`

This comment has been minimized.

@jodal

jodal Jul 5, 2015

Member

Not something you changed, but this is obviously wrong. Should be s/track/artists/

:param artists: the artists
:type track: array of :class:`mopidy.models.Artist`
:param attribute: the artist attribute to use
:type string

This comment has been minimized.

@jodal

jodal Jul 5, 2015

Member

This should be:

:type attribute: string
"""
Format track artists for output to MPD client.
Format track artist values for output to MPD client.

This comment has been minimized.

@jodal

jodal Jul 5, 2015

Member

Is this function useful for other things than artists? There's nothing artist specific here any longer.

Maybe just replace all artist references here with "model" right away?

This comment has been minimized.

@fatg3erman

fatg3erman Jul 5, 2015

Contributor

MPD does in fact concatenate anything and everything. I've seen multiple values for track number, for example. Not sure that's ever useful, or indeed helpful, but yes the function is pretty generic so I'll change that.

if track.performers:
result.append(('Performer', artists_to_mpd_format(track.performers)))
result.append(
(

This comment has been minimized.

@jodal

jodal Jul 5, 2015

Member

I think I prefer this parens to go on the previous line, and same with the closing parens. That way we save two lines of mostly whitespace and one indentation level on the code that matters.

If you want, you might try to rename the function to just concat_multiple_values(). That might be short enough to format it all on a single line, like it used to be.

This comment has been minimized.

@fatg3erman

fatg3erman Jul 5, 2015

Contributor

Yeah sure, this was my first experience with flake8, and with formatting to 80 characters. flake8 didn't like 2 parens on the same line, or something about the first way I did it anyway. I think renaming the function sounds like a good option.

if track.composers:
result.append(('Composer', artists_to_mpd_format(track.composers)))
result.append(
(

This comment has been minimized.

@jodal

jodal Jul 5, 2015

Member

Same comment as for Performer below.

@jodal jodal self-assigned this Jul 5, 2015

@jodal jodal added this to the v1.1 - Robust core milestone Jul 5, 2015

@jodal

This comment has been minimized.

Member

jodal commented Jul 5, 2015

This looks good, so I ended up just doing nitpicking :-)

@fatg3erman

This comment has been minimized.

Contributor

fatg3erman commented Jul 5, 2015

I'm pretty happy with that for a first attempt :) I'll address your comments as soon as I have a little more time.

mpd:Update protocol to 0.19
Address issues raised in review:
Fix formatting by shortening function name to concat_multi_values
Change comments and variable names to reflect generic nature of function
Fix typos in tests
Default to single quotes for strings
@jodal

This comment has been minimized.

Member

jodal commented Jul 8, 2015

Protip: Watcher get no notifications when you push new commits to a PR, so a "I pushed some new commits" comment brings focus back to your PR a lot faster :-)

jodal added a commit that referenced this pull request Jul 8, 2015

Merge pull request #1213 from fatg3erman/feature/update-mpd-to-0.19
mpd: Concatenate multiple artist names, etc using ";" instead of multiple lines

This is a part of updating the MPD protocol version to 0.19

@jodal jodal merged commit db1f504 into mopidy:develop Jul 8, 2015

3 checks passed

Scrutinizer 2 updated code elements
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-0.01%) to 77.02%
Details
@fatg3erman

This comment has been minimized.

Contributor

fatg3erman commented Jul 8, 2015

Thanks for the tip :) Will this get merged to 1.0.x?

@jodal

This comment has been minimized.

Member

jodal commented Jul 8, 2015

No, I don't think so as it's really not a bug fix, but a protocol upgrade. What more is required for us to be 0.19 compatible?

@fatg3erman

This comment has been minimized.

Contributor

fatg3erman commented Jul 8, 2015

There is a new command:

rangeid {ID} {START:END}

    Specifies the portion of the song that shall be played. START and END are 
    offsets in seconds (fractional seconds allowed); both are optional. Omitting both
    (i.e. sending just ":") means "remove the range, play everything".
    A song that is currently playing cannot be manipulated this way.

Other than that, I can't see any other (documented) changes.

@jodal

This comment has been minimized.

Member

jodal commented Jul 21, 2015

For the record: I've now added empty not implemented skeletons for all the new commands listed in the MPD 0.19.0 changelog.

@fatg3erman fatg3erman deleted the fatg3erman:feature/update-mpd-to-0.19 branch Jul 21, 2015

@kingosticks kingosticks referenced this pull request Oct 20, 2015

Open

Incompabilities with MPD protocol v0.19 #1315

3 of 10 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment