UDP API DEV: Difference between revisions

From AniDB
Jump to navigation Jump to search
Line 25: Line 25:
Possible Replies:
Possible Replies:
* {str eng}|{str romaji}|{str kanji}|...
* {str eng}|{str romaji}|{str kanji}|...
: such a command can't be added. The length limit for UDP packets would break it for most animes. And the question is whether a command like this is actually needed in the UDP API. [[User:Exp|Exp]] 07:40, 27 July 2007 (UTC)


=== [[UDP_API_Definition#GROUP:_Retrieve_Group_Data|GROUP]] ===
=== [[UDP_API_Definition#GROUP:_Retrieve_Group_Data|GROUP]] ===

Revision as of 07:40, 27 July 2007

UDP API DEVELOPMENT

  • add feature requests here
  • feel free to edit / comment / whatever

Data Commands

ANIME

  • ANIME aid={int4 id}[&acode={int4}[&lang={str}]]
  • FILE fid={int4 id}[&fcode={int4}&acode={int4}[&lang={str}]]

Bit 23 of acode (other name) will return language (official title) defined by lang where lang is a list of ISO 639-1 (?) codes (ie. de,en) ordered by preference. The first existing language will be returned. Applies to 24 (short name list) and 25 (synonym list) also.

An alternative would be to use the language options in the profile.

EPISODE

EPISODES

Feature request:

  • EPISODES aid={int4 id}

return names of all episodes in anime

Possible Replies:

  • {str eng}|{str romaji}|{str kanji}|...
such a command can't be added. The length limit for UDP packets would break it for most animes. And the question is whether a command like this is actually needed in the UDP API. Exp 07:40, 27 July 2007 (UTC)

GROUP

FILE

  • FILE size={int8 size}&ed2k={str ed2khash}[&fcode={int4}&acode={int4}]

Is the UDP API supporting other cheksum formats? Would it be too much trouble to implement i.e. md5 checksums?

Needs db support, meaning exp has to grant it. --Epoximator 09:34, 9 July 2007 (UTC)
Uniqueness of all other hashes besides the ed2k hash is not enforced by anidb. Meaning their use in a FILE lookup might cause some problems in case multiple files with that hash are in the db. Exp 09:41, 9 July 2007 (UTC)

That's odd. How come AOM supports different hash-methods? (I know this may not be asked here) And shouldn't the md5sum be unique, too? I mean uniqueness IS the reason for using hash... Well I guess we can handle everything through ed2k though. Ainawing 15:49, 9 July 2007 (GMT+1)

Well, the hashes are likely to be unique. However, this is not enforced by AniDB. Whether two distinct files really have the same hash or whether it is just an input error (i.e. wrong c&p) of the submitting user, the result is the same. You're trying to do a lookup for which you expect exactly one result or nothing at all and you end up with multiple results. And yes, most clients do support other hashing methods and also submit such data to anidb. However, internally they are all based on ed2k hashes AFAIK. Exp 08:52, 10 July 2007 (UTC)
The real question is: Should we enforce uniqueness? It's not really a problem to implement and shouldn't lead to any problems. We have reports on uniqueness and there are atm 2x2 files with equal md5, which obviously is wrong (if you look at them). Constraints would just mean that DerIdiot doesn't have to go around and fix such entries from time to time. On the other hand, supporting md5 lookup for clients is hardly important and it'll only have a negative impact on performance (although probably unnoticeable). --Epoximator 12:02, 10 July 2007 (UTC)
Well, enforcing uniqueness in the db brings a slight performanc overhead with it, but as file additions are a very seldom event, that wouldn't hurt us. We'd have a couple of extra indicies on the file table, which would increase the storage requirements of the db. Though even that wouldn't be all that much. Supporting MD5 hashes on the UDP API might simplyfy the writing of very simple UDP clients, as there are easily available MD5 libraries for every programming language out there. For ed2k/md4 libs you might have to search for a bit. However, I think I wouldn't go as far as to enforce uniqueness for all our hashes (i.e. sha1 and tth). But it might be seriously worth considering enforcing MD5 uniqueness, especially if we might somday drop ed2k hashes. MD5 hashes would offer a nice fallback in such a case. Exp 08:52, 11 July 2007 (UTC)
Agreed. Even better, since hashes are only being used for identification and checksumming, and not authentication, there's no real need for uniqueness other than the 1 in several trillion chance of a collision. The odds get even better with SHA1 or Tiger or RIPEMD. ed2k is not exactly a standard hash, and MD4 is simply not present in some languages, unless you obtain an external library. (For example, I bundle a native Python MD4 with my client, since that library is rare outside of Linux distributions.) Billessig 09:07, 26 July 2007 (UTC)

Mylist Commands

MYLISTADD: Add file to mylist

Feature request: It'd be useful if the reply of this command would contain the lid of the added file.

Possible Replies:

  • 210 MYLIST ENTRY ADDED
{int4 number of entries added}[|{int4 lid}]

Replies with 3xx and 4xx codes skipped.

Notes:

  • The lid of the added file is written in the reply only in case just one file was added. Actualy, if many files were added, there lid's would by useless to client because it wouldn't know the correspondence between lid's and files.

Notify Commands

NOTIFYGET: Get Notification/Message

--raboni 17:13, 6 Sep 2006 (GMT+1)

--edited by raboni 19:30, 7 Sep 2006 (GMT+1)

Feature request: When you get the notification you only find the anime name and the anime id in it. It would be better if you can also get the file id with this notification, so you can find out which group has released the movie. It is a headache to find the groupname in the HTTP page, if you have in mind that when more than one group release a movie in one day and you have to find out which you wanna have...

Command String:

  • NOTIFYGET type={str type}&id={int4 id}

Possible Replies:
when type = N

  • 293 NOTIFYGET
{int4 aid}|{int4 type}|{int2 count}|{int4 date}|{str anime_name} <-- for backward compatibility
{int4 date}|{int4 fid}
...
  • 393 NO SUCH ENTRY

Info:

  • fid
The File ID of the given episode that has been released.

Example:

 > NOTIFYGET type=N&id=2369&s=xxxxx
 < 293 NOTIFYGET
 2369|2|2|1157526622|Bleach
 1157526611|259847
 1157526622|259848

Comments:

The current system doesn't store fids, only count, when i think about it. This has to be approved by exp himself.--Epoximator 10:33, 24 September 2006 (UTC)

Misc Commands

PING : Ping Command

Request: (Request moved to bug tracker, case #587)

USERLIST : Retrieve Mylist Data of a specified user [rejected]

Feature Request  : The purpose is for a client I want to make, which will essentially be a more user friendly method of viewing and manipulating the view of a user's list. Sort by various categories and so on. I would like to be able to view and browse a specified user's list just as I can with the web interface

Probably best implemented to behave just like the mylist commands.

Command String:
by lid: (userlist user={str name}&id)

  • USERLIST user={str name}&lid={int4 lid}

by fid:

  • USERLIST user={str name}&fid={int4 fid}

by size+ed2k hash:

  • USERLIST user={str name}&size={int4 size}&ed2k={str ed2khash}

by anime + group + epno

  • USERLIST user={str name}&aname={str anime name}&gname={str group name}&epno={int4 episode number}
  • USERLIST user={str name}&aname={str anime name}&gid={int4 group id}&epno={int4 episode number}
  • USERLIST user={str name}&aid={int4 anime id}&gname={str group name}&epno={int4 episode number}
  • USERLIST user={str name}&aid={int4 anime id}&gid={int4 group id}&epno={int4 episode number}

Possible Replies:

  • 221 USERLIST
{int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}
  • 322 MULTIPLE FILES FOUND
{str anime title}|{int episodes}|{str eps with state unknown}|{str eps with state on hhd}|{str eps with state on cd}|{str eps with state deleted}|{str watched eps}|{str group 1 short name}|{str eps for group 1}|...|{str group N short name}|{str eps for group N}
  • 321 NO SUCH ENTRY

Info:

  • The state field provides information about the location and sharing state of a file in mylist.
  • If files are added after hashing, a client should specify the state as 1 (on hdd) (if the user doesn't explicitly select something else).
  • eps is a list of episodes, e.g. "1-12,14-16,T1"

States:

 0 - unknown - state is unknown or the user doesn't want to provide this information
 1 - on hdd - the file is stored on hdd (but is not shared)
 2 - on cd - the file is stored on cd
 3 - deleted - the file has been deleted or is not available for other reasons (i.e. reencoded)

Example:

 > USERLIST user=baka&aname=gits sac&s=xxxxx
 < 322 MULTIPLE FILES FOUND
 Koukaku Kidoutai STAND ALONE COMPLEX|26||1-26|1-26,S2-S27|||V-A|S2-S27|LMF|20-26|KAA|1-26|AonE|1-19|Anime-MX|1-3,9-20

Comments:
It would probably be ok to add this, but note that it would be a hassle to fetch a complete mylist. I mean, you can already do this with your own list, but it takes a lot of time because of the datagram rate limit. (It would take at least 8h to fetch my own list). And that is usage we don't really want @ udp api. And a command that returns all the data at once will, of course, not be allowed. So, in other words, if you just want to check if a friend has a specific file, or what files per anime (multiple files found), then ok, but view and browse a specified user's list just as I can with the web interface is not likely to happen/be allowed.--Epoximator 11:29, 4 June 2006 (CEST)

What I'm really interested in is maintaining local dbs of 3/4 user lists and having a client automatically update them every 2/3 weeks. We use this to coordinate information within our country regarding who has what =p. But what we're interested in is a way to be able to selectively retrieve the entire list by some index. OFcourse if its slow, then it makes sense to maintain it locally and just look for changes. The other thing I really want is to somehow retrieve with mylist file data (or user list file data), the date at which something was added to the list. (I understand this information exists). The idea here is we can locally query these lists for files added within the last 2/3 months. --path 11:53, 25 June 2006 (IST)
That's really not wanted usage for this api. Have you thought about the possibility to use mylist export? You know you can make you own export template and get all the info you want at once? A command that query all changes (lids) within the last 2/3 months (or even weeks) is not going to be added. --Epoximator 12:36, 25 June 2006 (UTC)

Web Service API

I think most of the UDP API funcionality could be exposed as a web service. Not only it would make client programming simpler but could also solve some NAT/Proxy/Firewall UDP problems. This web service would only provide query capabilities, since callbacks (required for notifications) in web services still pose some problems. --Jassuncao 08:43, 20 September 2006 (UTC)

Web services are for big idiot corps with rooms of servers and no competent programmers. Spend TCP->HTTP->SOAP overhead to save on personnel. --Rar 21:49, 23 September 2006 (UTC)
Since this is not the right place to start a flame war I will not comment.