IrateDev.NewIrateProtocol History
Hide minor edits - Show changes to markup
Logging in
Client : GET http://irate.server.org/?u=myuser&p=mypass
"u=myuser&p=mypass" : The client connects with login/pass : myuser/mypass . If the user "myuser" doesn't exists, it'll be automatically created with the given password.
After the first login, the client will only send a hash of this password to the server.
Computing the hash
Asking for new tracks
Client : GET http://../?u=myuser&h=HASH&do=getnew&n=5
"do=getnew&n=5" : The client asks for 5 new tracks.
Server reply :
(HTTP Headers)
<tracks>
<track>
<id>XXXX</id>
<artistname>XXXX</artistname>
<albumname>XXXX</albumname>
<distribution>
<id>SHA1?</id>
<codec>VORBIS</codec>
<averagebitrate>128</averagebitrate>
<crediturl>http://www.magnatune.com/artists/XXXX</crediturl>
<source>
<protocol>http</protocol>
<link>http://../XXX.mp3</link>
</source>
<source>
...
</source>
</distribution>
<distribution>
...
</distribution>
</track>
<track>
...
</track>
... 3 more times ....
</tracks>
Fields for a track
- id : string, 6digit - 8digit - 2digit mod 97
- artistname : string
- albumname : string
- trackname : string
- duration : int (length in seconds)
- source : string (url), see behind for attributes
- crediturl : string
Fields for a distribution
- crediturl : string
- codec : string (http://www.matroska.org/technical/specs/codecid/)
- averagebitrate : int (indicative)
Fields for a source
- protocol : string (eg. "http" or "bittorrent" or whatever)
- link : string
- crediturl : string
Rating tracks
Client : GET http://../?u=myuser&h=HASH&do=rate&rate=99:6,33:9
"do=rate&t=99:6,33:9" : Rate the tracks 99 and 33 to 6/10 and 9/10
Getting all the ratings back to the client
Client : GET http://../&u=myuser&h=HASH&do=getratings
"do=getratings" : the client asks for its previous ratings
Server replu :
(HTTP Headers)
<ratings>55:6,43:3</ratings>
The client had previously done 2 ratings : it rated the track with ID 55 to 6/10, and the track 43 to 3/10
Errors
The server returns an error like this :
Server reply :
<error>ERROR_CODE</error>
The error codes can be :
- WRONG_PASSWORD : The password doesn't match for the user.
- MUST_LOGIN : The username or the password wasn't given
see XmlRpc.
Server reply : \\
Server reply :
<distribution>
<distribution> \\
Client : GET http://../?u=myuser&h=HASH&do=rate&t=99:6,33:9
Client : GET http://../?u=myuser&h=HASH&do=rate&rate=99:6,33:9
(HTTP Headers)
<tracks>
<track>
<id>XXXX</id>
<artistname>XXXX</artistname>
<albumname>XXXX</albumname>
<distribution>
<id>SHA1?</id>
<codec>VORBIS</codec>
<averagebitrate>128</averagebitrate>
<crediturl>http://www.magnatune.com/artists/XXXX</crediturl>
<source protocol="http">http://../XXX.mp3</source>
<source ...>...</source>
</distribution>
<distribution>
...
</distribution>
</track>
<track>
...
</track>
... 3 more times .... \\
(HTTP Headers)
<tracks>
<track>
<id>XXXX</id>
<artistname>XXXX</artistname>
<albumname>XXXX</albumname>
<distribution> <id>SHA1?</id>
<codec>VORBIS</codec>
<averagebitrate>128</averagebitrate>
<crediturl>http://www.magnatune.com/artists/XXXX</crediturl>
<source>
<protocol>http</protocol>
<link>http://../XXX.mp3</link>
</source>
<source>
...
</source>
</distribution>
<distribution>
...
</distribution>
</track>
<track>
...
</track>
... 3 more times .... \\
- crediturl : string
- link : string
- crediturl : string
<Track>
<tracks>
<track> \\
<source protocol="http" crediturl="http://www.magnatune.com/artists/XXXX">http://../XXX.mp3</source>
<source ...>...</source>
</Track>
<distribution>
<id>SHA1?</id>
<codec>VORBIS</codec>
<averagebitrate>128</averagebitrate>
<crediturl>http://www.magnatune.com/artists/XXXX</crediturl>
<source protocol="http">http://../XXX.mp3</source>
<source ...>...</source>
</distribution>
<distribution>
...
</distribution>
</track> \\
<Track>
<id>YYYYY</id>
<artistname>YYYYY</artistname>
...
</Track>
<track>
...
</track> \\
... 3 more times ....
... 3 more times ....
</tracks>
- id : string, server-dependant (todo: global IDs ?)
- id : string, 6digit - 8digit - 2digit mod 97
Attributes for a source
Fields for a distribution
- crediturl : string
- codec : string (http://www.matroska.org/technical/specs/codecid/)
- averagebitrate : int (indicative)
Fields for a source
- crediturl : string
Client : GET http://../?u=myuser&p=mypass&do=rate&t=99:6,33:9
Client : GET http://../?u=myuser&h=HASH&do=rate&t=99:6,33:9
Client : GET http://../&u=myuser&p=mypass&do=getratings
Client : GET http://../&u=myuser&h=HASH&do=getratings
<Ratings>55:6,43:3</Ratings>
<ratings>55:6,43:3</ratings>
<Error>ERROR_CODE</Error>
<error>ERROR_CODE</error>
Client : GET http://../?u=myuser&p=mypass&do=rate&t=99&r=6
Client : GET http://../?u=myuser&p=mypass&do=rate&t=99:6,33:9
"do=rate&t=99&r=6" : Rate the track with id "99" with 6/10
Server reply :
(HTTP Headers)
rate
OK \\
"do=rate&t=99:6,33:9" : Rate the tracks 99 and 33 to 6/10 and 9/10
getratings
55:6,43:3
<Ratings>55:6,43:3</Ratings>
(HTTP Headers)
error
ERROR_CODE
<Error>ERROR_CODE</Error>
After the first login, the client will only send a hash of this password to the server.
Computing the hash
Client : GET http://../?u=myuser&p=mypass&do=getnew&n=5
Client : GET http://../?u=myuser&h=HASH&do=getnew&n=5
getnew
id:XXXX
artistname:XXXX
albumname:XXXX
id:YYYYY
artistname:YYYYY
albumname:YYYYYY \\
<Track>
<id>XXXX</id>
<artistname>XXXX</artistname>
<albumname>XXXX</albumname>
<source protocol="http" crediturl="http://www.magnatune.com/artists/XXXX">http://../XXX.mp3</source>
<source ...>...</source>
</Track>
<Track>
<id>YYYYY</id>
<artistname>YYYYY</artistname>
...
</Track>
Fields for a track
- id : string, server-dependant (todo: global IDs ?)
- artistname : string
- albumname : string
- trackname : string
- duration : int (length in seconds)
- source : string (url), see behind for attributes
Attributes for a source
- protocol : string (eg. "http" or "bittorrent" or whatever)
- crediturl : string
Getting all the ratings back to the client
Client : GET http://../&u=myuser&p=mypass&do=getratings
"do=getratings" : the client asks for its previous ratings
Server replu :
(HTTP Headers)
getratings
55:6,43:3
The client had previously done 2 ratings : it rated the track with ID 55 to 6/10, and the track 43 to 3/10
id:XXXX \\
id:YYYYY \\
Rating tracks
Client : GET http://../?u=myuser&p=mypass&do=rate&t=99&r=6
"do=rate&t=99&r=6" : Rate the track with id "99" with 6/10
Server reply :
(HTTP Headers)
rate
OK
Errors
The server returns an error like this :
Server reply :
(HTTP Headers)
error
ERROR_CODE
The error codes can be :
- WRONG_PASSWORD : The password doesn't match for the user.
- MUST_LOGIN : The username or the password wasn't given
Describe NewIrateProtocol here.
Draft of the new HTTP iRATE protocol
Logging in
Client : GET http://irate.server.org/?u=myuser&p=mypass
"u=myuser&p=mypass" : The client connects with login/pass : myuser/mypass . If the user "myuser" doesn't exists, it'll be automatically created with the given password.
Asking for new tracks
Client : GET http://../?u=myuser&p=mypass&do=getnew&n=5
"do=getnew&n=5" : The client asks for 5 new tracks.
Server reply :
(HTTP Headers)
getnew
artistname:XXXX
albumname:XXXX
artistname:YYYYY
albumname:YYYYYY
... 3 more times ....