retrieve mylist via udp-api?

Want to help out? Need help accessing the AniDB API? This is the place to ask questions.

Moderator: AniDB

Locked
spid
Posts: 1
Joined: Sat May 21, 2005 8:18 pm

retrieve mylist via udp-api?

Post by spid »

hi,

i'm currently playing around with the udp-api, but somehow i don't get out how to retrieve the mylist-items
i thought this would be enough:

Code: Select all

for(int i = 1; ; i++) {
	answer = sendMessage("MYLIST lid=" + i + "&s=mySessionKey");
	if(answer.getId() == 321) {
		//got no-such-entry
		break;
	} else {
		myList.add(answer.getName());
	}
}
somehow i always get '321 no such entry' when sending the mylist-command - isn't 'lid' what i thought it is? (list-id, which should start with 1 and increase by each mylist-entry)

do i have to do something else to retrieve how a mylist looks like?
PetriW
AniDB Staff
Posts: 1522
Joined: Sat May 24, 2003 2:34 pm

Post by PetriW »

The lid is the unique id of that mylist entry across ALL mylist entries. Aka new mylist entries are given numbers over 6 million atm.

The documentation says:
COMMAND STRING:
by lid: (mylist id)
MYLIST lid={int4 lid}
by fid:
MYLIST fid={int4 fid}
by size+ed2k hash:
MYLIST size={int4 size}&ed2k={str ed2khash}

REPLY:
221 MYLIST
{int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}

OR
321 NO SUCH ENTRY
Aka, you always get the correct lid in the reply from the udp api. To get a lid in the first place you need to ask via either an ed2k link or a file id.
To get a list of all mylist entries you need to use the TCP API.

Note, the for loop above is an example of things you should NOT do with the UDP api, it's heavy as hell on anidb and might get you blocked.
fahrenheit
AniDB Staff
Posts: 438
Joined: Thu Apr 08, 2004 1:43 am
Location: Portugal

Post by fahrenheit »

spid i would sugest something like this to make sure you have a client with somewhat a simple database:

besides the client you are working on, define a file with all the vars you need to import, like all the animes on your mylist, write a simple export template for it, so when the user downloads the export, you get a simple database of what that user has and as you go hashing and adding files you can get that database updated, this would enable that you won't stress the API with requests that are all ready hashed and on the user list and also compiles by the request that exp made in the API specs, low acess profile :P
Locked