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

Error while exporting tacks #95

Open
craftbyte opened this issue Mar 30, 2014 · 3 comments
Open

Error while exporting tacks #95

craftbyte opened this issue Mar 30, 2014 · 3 comments

Comments

@craftbyte
Copy link

Hello,

I was just trying to move my playlists and then this happened:
Error: Illegal value for Message.Field .spotify.metadata.proto.Restriction.catalogue: 4 (not a valid enum value)
at ProtoBuf.Reflect.Field.verifyValue (/var/ng_apps/5320baf9aae556882468c7de/portify/node_modules/spotify-web/node_modules/protobufjs/ProtoBuf.js:2321:27)
at Message.add (/var/ng_apps/5320baf9aae556882468c7de/portify/node_modules/spotify-web/node_modules/protobufjs/ProtoBuf.js:1693:53)
at ProtoBuf.Reflect.Message.decode (/var/ng_apps/5320baf9aae556882468c7de/portify/node_modules/spotify-web/node_modules/protobufjs/ProtoBuf.js:2137:29)
at ProtoBuf.Reflect.Field.decode (/var/ng_apps/5320baf9aae556882468c7de/portify/node_modules/spotify-web/node_modules/protobufjs/ProtoBuf.js:2594:46)
at ProtoBuf.Reflect.Message.decode (/var/ng_apps/5320baf9aae556882468c7de/portify/node_modules/spotify-web/node_modules/protobufjs/ProtoBuf.js:2137:51)
at Message.decode (/var/ng_apps/5320baf9aae556882468c7de/portify/node_modules/spotify-web/node_modules/protobufjs/ProtoBuf.js:1982:41)
at Function.protobufjs_parse_wrapper as parse
at Spotify._parse (/var/ng_apps/5320baf9aae556882468c7de/portify/node_modules/spotify-web/lib/spotify.js:1251:20)
at parseData (/var/ng_apps/5320baf9aae556882468c7de/portify/node_modules/spotify-web/lib/spotify.js:589:18)
at /var/ng_apps/5320baf9aae556882468c7de/portify/node_modules/spotify-web/lib/spotify.js:577:20

Any ideas why?

@yodiz
Copy link

yodiz commented Mar 31, 2014

It seams like the spotify-api has been changed or appended to. And the error is in the dependency spotify-web rather than in portify.

I have no experience in nodejs, or the spotify api. So everything i say should not be belived and is probably wrong. However, after you do the npm install, you can make make changes to the proto files which according to my understanding describes the data-structures of the spotify-api.

The changes needed to make it work (at least for me), is in the metadata.proto file.

enum Catalogue {
AD = 0;
SUBSCRIPTION = 1;
SHUFFLE = 3;
}

Needs to be extended for the value 4, i have no idea what 4 means, my guess is that it is some kind of premium flag (I have premium).

enum Catalogue {
AD = 0;
SUBSCRIPTION = 1;
SHUFFLE = 3;
PremiumOrWhat = 4;
}

message AudioFile {
enum Format {
OGG_VORBIS_96 = 0;
OGG_VORBIS_160 = 1;
OGG_VORBIS_320 = 2;
MP3_256 = 3;
MP3_320 = 4;
MP3_160 = 5;
MP3_96 = 6;
}
optional bytes file_id = 1;
optional Format format = 2;
}

Here spotify seams to now also include the value 7, again i have no idea what this means. Since we are only intrested in the playlist, the actual encoding should be pretty irelevant.

message AudioFile {
enum Format {
OGG_VORBIS_96 = 0;
OGG_VORBIS_160 = 1;
OGG_VORBIS_320 = 2;
MP3_256 = 3;
MP3_320 = 4;
MP3_160 = 5;
MP3_96 = 6;
MP3_WTF = 7;
}
optional bytes file_id = 1;
optional Format format = 2;
}

Here you can find my complete file:
https://gist.github.com/yodiz/9902070

after you change the protofile, it seams like spotify-web uses the compiled version of the proto file, describes in the .desc equivalent. You can compile to .desc using google protoc. Available and described at https://code.google.com/p/protobuf/.

I simply copied protoc.exe to the directory containing the metadata.proto file, and execute the following from the cmd-prompt/powershell. "./protoc.exe --descriptor_set_out=metadata.desc --include_imports metadata.prot"

All of of my playlists except one worked after that. I get an unrelated error on the last one.

Again - this is not very userfriendly and probably erroneous in many ways. My fix, for obvious reasons is not good enough to go into the spotify-web project :).

@rik-derris
Copy link

Yodiz

Thanks for this it maybe not as polished a solution as you'd like and maybe erroneous but it worked for me! I am using on a mac so there was no need to make a compiled version as it does not use it so i only had to change the proto file.

Thanks again - 2 points to Gryffindor!!

@Reiszecke
Copy link

It now continues, it is also requesting an 8 (whatever the fuck that is for, I mean you can't get beyond 320), maybe someone simply failed at converting an array index to a "human" number, however you might wanna add this to OP

Cheers

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

No branches or pull requests

4 participants