simon-weber / gmusicapi

An unofficial client library for Google Music.
https://unofficial-google-music-api.readthedocs.io
BSD 3-Clause "New" or "Revised" License
2.48k stars 257 forks source link

Failed to validate field 'playlists' list schema #62

Closed EnigmaCurry closed 11 years ago

EnigmaCurry commented 11 years ago

Hi, I ran across thunner the other day and wanted to try it out. I'm getting the following error in the gmusicapi.log file:

2012-12-26 19:07:44,537 - gmusicapi.Api - WARNING - Received an unexpected response from call loadalltracks.

... a gigantic response object...

2012-12-26 19:07:44,551 - gmusicapi.Api - DEBUG - failed schema: {'additionalProperties': {'continuationToken': {'type': 'string'}}, 'type': 'object', 'properties': {'continuation': {'type': 'boolean'}, 'playlist': {'items': {'additionalProperties': False, 'type': 'object', 'properties': {'comment': {'type': 'string', 'blank': True}, 'rating': {'type': 'integer'}, 'lastPlayed': {'required': False, 'type': 'integer'}, 'disc': {'required': False, 'type': 'integer'}, 'matchedId': {'type': 'string', 'blank': True}, 'composer': {'type': 'string', 'blank': True}, 'year': {'required': False, 'type': 'integer'}, 'id': {'type': 'string', 'blank': True}, 'subjectToCuration': {'type': 'boolean'}, 'album': {'type': 'string', 'blank': True}, 'playlistEntryId': {'required': False, 'type': 'string', 'blank': True}, 'title': {'type': 'string', 'blank': True}, 'deleted': {'type': 'boolean'}, 'albumArtist': {'type': 'string', 'blank': True}, 'durationMillis': {'type': 'integer'}, 'type': {'type': 'integer'}, 'titleNorm': {'type': 'string', 'blank': True}, 'track': {'required': False, 'type': 'integer'}, 'storeId': {'required': False, 'type': 'string', 'blank': True}, 'albumArtistNorm': {'type': 'string', 'blank': True}, 'totalTracks': {'required': False, 'type': 'integer'}, 'beatsPerMinute': {'type': 'integer'}, 'genre': {'type': 'string', 'blank': True}, 'playCount': {'type': 'integer'}, 'creationDate': {'type': 'integer'}, 'name': {'type': 'string', 'blank': True}, 'albumNorm': {'type': 'string', 'blank': True}, 'artist': {'type': 'string', 'blank': True}, 'url': {'type': 'string', 'blank': True}, 'totalDiscs': {'required': False, 'type': 'integer'}, 'albumArtUrl': {'required': False, 'type': 'string', 'blank': True}, 'artistNorm': {'type': 'string', 'blank': True}}}, 'type': 'array'}, 'playlistId': {'type': 'string'}, 'differentialUpdate': {'type': 'boolean'}, 'requestTime': {'type': 'integer'}}} 2012-12-26 19:07:44,552 - gmusicapi.Api - WARNING - error was: Failed to validate field 'playlist' list schema: additional properties not defined by 'properties' are not allowed in list item

'gigantic response object' has all of my tracks in it, which I don't really want to post here, but it's a dict containing the following (top-level) keys:

This same error occurs when I run the gmusicapi.test.integration_test_api.

This same error occurs for the 'loadplaylist' call as well.

I'm in the US if that matters.

I'm currently trying to debug it myself, but I'm not very familiar with this code yet.

Thanks!

simon-weber commented 11 years ago

Ah, I think this is fixed in develop. Try installing gmusicapi from the develop branch: clone, then cd Unofficial-Google-Music-API; git checkout develop; pip install -e .

There's been so many protocol changes that I'm a bit behind with pushing the fixes! Sorry about that.

EnigmaCurry commented 11 years ago

Using the develop branch didn't seem to change the error.

I can appreciate the challenge of keeping this thing working against a rolling and undocumented API!

I'll continue to try and debug this and let you know what I find. thanks.

simon-weber commented 11 years ago

Ah, ok. I've got a debug build all set up from a similar issue recently. Can you run this for me please?

The validictory part is important; I need to bug him to get a recent version on the cheeseshop =)

EnigmaCurry commented 11 years ago

(debugenv)[ryan@sarang Unofficial-Google-Music-API]$ python -m gmusicapi.test.integration_test_api Warning: this test suite might modify the library it is run on. Email: Password: 2012-12-26 20:12:50,520 - gmusicapi.UnitTestedApi - WARNING - Received an unexpected response from call loadalltracks. 2012-12-26 20:12:50,534 - gmusicapi.UnitTestedApi - WARNING - error was: Failed to validate field 'playlist' list schema: additional property 'pending' not defined by 'properties' are not allowed in list item 2012-12-26 20:12:59,246 - gmusicapi.UnitTestedApi - WARNING - Received an unexpected response from call loadalltracks. 2012-12-26 20:12:59,260 - gmusicapi.UnitTestedApi - WARNING - error was: Failed to validate field 'playlist' list schema: additional property 'albumMatchedId' not defined by 'properties' are not allowed in list item 2012-12-26 20:13:02,512 - gmusicapi.UnitTestedApi - WARNING - Received an unexpected response from call loadplaylist. 2012-12-26 20:13:02,523 - gmusicapi.UnitTestedApi - WARNING - error was: Failed to validate field 'playlists' list schema: Failed to validate field 'playlist' list schema: additional property 'albumMatchedId' not defined by 'properties' are not allowed in list item 2012-12-26 20:13:04,412 - gmusicapi.UnitTestedApi - WARNING - Received an unexpected response from call loadplaylist. 2012-12-26 20:13:04,422 - gmusicapi.UnitTestedApi - WARNING - error was: Failed to validate field 'playlists' list schema: Failed to validate field 'playlist' list schema: additional property 'albumMatchedId' not defined by 'properties' are not allowed in list item 2012-12-26 20:13:07,382 - gmusicapi.UnitTestedApi - WARNING - Received an unexpected response from call loadplaylist. 2012-12-26 20:13:07,393 - gmusicapi.UnitTestedApi - WARNING - error was: Failed to validate field 'playlists' list schema: Failed to validate field 'playlist' list schema: additional property 'albumMatchedId' not defined by 'properties' are not allowed in list item 2012-12-26 20:13:14,000 - gmusicapi.UnitTestedApi - WARNING - Received an unexpected response from call loadplaylist. 2012-12-26 20:13:14,011 - gmusicapi.UnitTestedApi - WARNING - error was: Failed to validate field 'playlists' list schema: Failed to validate field 'playlist' list schema: additional property 'albumMatchedId' not defined by 'properties' are not allowed in list item .2012-12-26 20:13:18,881 - gmusicapi.UnitTestedApi - WARNING - Received an unexpected response from call loadalltracks. 2012-12-26 20:13:18,895 - gmusicapi.UnitTestedApi - WARNING - error was: Failed to validate field 'playlist' list schema: additional property 'pending' not defined by 'properties' are not allowed in list item 2012-12-26 20:13:26,076 - gmusicapi.UnitTestedApi - WARNING - Received an unexpected response from call loadalltracks. 2012-12-26 20:13:26,091 - gmusicapi.UnitTestedApi - WARNING - error was: Failed to validate field 'playlist' list schema: additional property 'albumMatchedId' not defined by 'properties' are not allowed in list item 2012-12-26 20:13:37,410 - gmusicapi.UnitTestedApi - WARNING - Received an unexpected response from call loadalltracks. 2012-12-26 20:13:37,424 - gmusicapi.UnitTestedApi - WARNING - error was: Failed to validate field 'playlist' list schema: additional property 'pending' not defined by 'properties' are not allowed in list item 2012-12-26 20:13:45,235 - gmusicapi.UnitTestedApi - WARNING - Received an unexpected response from call loadalltracks. 2012-12-26 20:13:45,250 - gmusicapi.UnitTestedApi - WARNING - error was: Failed to validate field 'playlist' list schema: additional property 'albumMatchedId' not defined by 'properties' are not allowed in list item ..2012-12-26 20:13:48,583 - gmusicapi.UnitTestedApi - WARNING - Received an unexpected response from call loadplaylist. 2012-12-26 20:13:48,594 - gmusicapi.UnitTestedApi - WARNING - error was: Failed to validate field 'playlists' list schema: Failed to validate field 'playlist' list schema: additional property 'albumMatchedId' not defined by 'properties' are not allowed in list item 2012-12-26 20:13:52,463 - gmusicapi.UnitTestedApi - WARNING - Received an unexpected response from call loadplaylist. 2012-12-26 20:13:52,474 - gmusicapi.UnitTestedApi - WARNING - error was: Failed to validate field 'playlists' list schema: Failed to validate field 'playlist' list schema: additional property 'albumMatchedId' not defined by 'properties' are not allowed in list item 2012-12-26 20:13:54,374 - gmusicapi.UnitTestedApi - WARNING - Received an unexpected response from call loadplaylist. 2012-12-26 20:13:54,385 - gmusicapi.UnitTestedApi - WARNING - error was: Failed to validate field 'playlists' list schema: Failed to validate field 'playlist' list schema: additional property 'albumMatchedId' not defined by 'properties' are not allowed in list item

...

Ran 6 tests in 136.165s

OK

simon-weber commented 11 years ago

Perfect; thanks.

One more thing: can I get an example of these new fields? I made a little script to enumerate their values. Can you post the results of:

I should probably make some standard way for people to report this - recently, my CI hasn't been the one finding the new keys.

EnigmaCurry commented 11 years ago

(debugenv)[ryan@sarang Unofficial-Google-Music-API]$ python examine_keys.py 2012-12-26 20:42:34,643 - gmusicapi.Api - WARNING - Received an unexpected response from call loadalltracks. 2012-12-26 20:42:34,657 - gmusicapi.Api - WARNING - error was: Failed to validate field 'playlist' list schema: additional property 'pending' not defined by 'properties' are not allowed in list item 2012-12-26 20:42:43,017 - gmusicapi.Api - WARNING - Received an unexpected response from call loadalltracks. 2012-12-26 20:42:43,031 - gmusicapi.Api - WARNING - error was: Failed to validate field 'playlist' list schema: additional property 'albumMatchedId' not defined by 'properties' are not allowed in list item 5478 total songs

albumMatchedId 1 matches 1: u'B2dvyvjodqbcvwax33bthvxrbrq'

pending 2 matches 2: True

simon-weber commented 11 years ago

Great, thanks. I included those new keys: fab96472bc633a0c8e50f0246b6214aa3bbffcbe (and e27de496997bef678e0e007466e8a7f9070be508 - whoops).

Give the develop branch another try; the warnings should be fixed now.

EnigmaCurry commented 11 years ago

That gets me past the bulk of the problems. See my pull request which fixes a minor typo.

simon-weber commented 11 years ago

Merged. Thanks for your help!

djingo commented 11 years ago

Hi, I am having the same problem described here and I am using the latest develop branch.... Is this still a known issue? Thanks!

simon-weber commented 11 years ago

This pops up every time new metadata is added; eg I saw 5dade9f7fcb992b2d8891ea47941c58985d1a0d3 when I pushed yesterday's release.

Can you post the validation error that you see?

djingo commented 11 years ago

Here's what I'm seeing when I run the integration test:

2013-02-28 09:57:16,637 - gmusicapi.api (944) [ERROR]: please report the following unknown response format for GetLibrarySongs: {} Traceback (most recent call last): File "gmusicapi/api.py", line 937, in _make_call protocol.validate(msg) File "gmusicapi/protocol/webclient.py", line 69, in validate return validictory.validate(res, cls._res_schema) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/validictory/init.py", line 31, in validate return v.validate(data, schema) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/validictory/validator.py", line 559, in validate self._validate(data, schema) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/validictory/validator.py", line 562, in _validate self.validate("_data", {"_data": data}, schema) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/validictory/validator.py", line 593, in validate newschema.get(schemaprop)) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/validictory/validator.py", line 223, in validate_properties properties.get(eachProp)) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/validictory/validator.py", line 593, in __validate newschema.get(schemaprop)) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/validictory/validator.py", line 266, in validate_items (fieldname, old_error), fieldname, e.value) ValidationException: Failed to validate field 'playlist' list schema: additional property 'artistMatchedId' not defined by 'properties' are not allowed in list item

... repeated over and over ....

djingo commented 11 years ago

By the way, I removed the dict contents in GetLibrarySongs in my post above... it was enormous.

simon-weber commented 11 years ago

Are you using develop as of yesterday (which has that commit I posted)? It should fix the artistMatchedId error.

djingo commented 11 years ago

Oh, looks like it IS fixed. I thought I was on develop, but I guess I inadvertently was on the debug branch you set up earlier in this thread. My bad. Thanks for your help and sorry to pull you into my issues. By the way, I've been following this repository since you first started it last year and I'd like to take this opportunity to thank you for this great work.

simon-weber commented 11 years ago

Oh hey, no problem. And thanks! =)

simon-weber commented 11 years ago

ps, definitely thanks for making an account and pinging me - it's great to seeing people get involved =)

djingo commented 11 years ago

I've hit another wall using thunner. Now I'm getting hung up on the matchedId property: 2013-02-28 12:00:36,131 - gmusicapi.Api - WARNING - Received an unexpected response from call loadalltracks. 2013-02-28 12:00:36,188 - gmusicapi.Api - WARNING - error was: Failed to validate field 'playlist' list schema: additional property 'matchedId' not defined by 'properties' are not allowed in list item 2013-02-28 12:00:38,044 - gmusicapi.Api - WARNING - Received an unexpected response from call loadalltracks. 2013-02-28 12:00:38,097 - gmusicapi.Api - WARNING - error was: Failed to validate field 'playlist' list schema: additional property 'matchedId' not defined by 'properties' are not allowed in list item 2013-02-28 12:00:40,575 - gmusicapi.Api - WARNING - Received an unexpected response from call loadalltracks. 2013-02-28 12:00:40,629 - gmusicapi.Api - WARNING - error was: Failed to validate field 'playlist' list schema: additional property 'matchedId' not defined by 'properties' are not allowed in list item ...

djingo commented 11 years ago

nevermind... I'll try not to be so hasty before posting next time.

simon-weber commented 11 years ago

Hm, that should be recognized: https://github.com/simon-weber/Unofficial-Google-Music-API/blob/develop/gmusicapi/protocol/metadata.py#L137.

Try doing python -c 'import gmusicapi; print gmusicapi.__version__'; that'll let you know what version is actually running.

It might help to blow away your current venv and then install develop fresh from github with pip install git+git://github.com/simon-weber/Unofficial-Google-Music-API.git@develop.

simon-weber commented 11 years ago

Ah, ok; no problem!