https://wiki.anidb.net/api.php?action=feedcontributions&user=Ommina&feedformat=atomAniDB - User contributions [en]2024-03-29T14:31:56ZUser contributionsMediaWiki 1.40.0https://wiki.anidb.net/index.php?title=User:Ommina&diff=22962User:Ommina2017-10-16T22:55:09Z<p>Ommina: </p>
<hr />
<div>{{TOCright}}<br />
<br />
--> Edit FILE docs to include MyList data block <--<br />
<br />
=== CATEGORY: Retrieve Category Data ===<br />
<br />
=== SIMILAR: Approve or Disapprove of a Similar Pairing ===<br />
<br />
'''Command String:'''<br />
* SIMILAR entity=1&id1={int4 id}&id2={int4 id}[&approve={str [y|n|r]}]<br />
<br />
'''Possible Replies:'''<br />
* 275 SIMILAR APPROVAL<br />
{int entity}|{int sid}|{int id1}|{int id2}|{int total}|{int approved}|{str [y|n]}<br />
* 276 SIMILAR APPROVAL FOUND<br />
{int entity}|{int sid}|{int id1}|{int id2}|{int total}|{int approved}|{str [y|n]}<br />
* 277 SIMILAR APPROVAL UPDATED<br />
{int entity}|{int sid}|{int id1}|{int id2}|{int total}|{int approved}|{str [y|n]}<br />
* 278 SIMILAR APPROVAL REVOKED<br />
{int entity}|{int sid}|{int id1}|{int id2}|{int total}|{int approved}|{str r}<br />
<br />
* 375 NO SUCH SIMILAR PAIRING<br />
{int entity}|{int id1}|{int id2}<br />
* 376 NO SUCH SIMILAR PAIRING APPROVAL<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1.<br />
* ''id1'' and ''id2'' represent an ''existing'' pair of ids. There are no provisions for ''adding'' new similar pairs<br />
* Which id is assigned to ''id1'' and which id is assigned to ''id2'' is irrelevant<br />
* Use ''approval=y'' to approve the pair, ''approve=n'' to disapprove, and ''approve=r'' to revoke (delete) an existing approval/disapproval.<br />
* If an approval vote is already assigned, submitting a new ''y''/''n'' value will replace the old vote.<br />
<br />
=== UPDATED: Get List of Updated Anime IDs ===<br />
Returns a list of AniDB anime ids of anime that have been updated in in a given time frame, ordered by descending date.<br />
<br />
'''Command String:'''<br />
* UPDATED entity=1&[age={int4 id}|time={int4 date}]<br />
<br />
'''Possible Replies:'''<br />
* 243 UPDATED<br />
{int entity}|{int total count}|{int last update date}|{list aid}<br />
<br />
* 343 NO UPDATES<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1<br />
* Either ''age'' OR ''time'' can be specified, but not both<br />
* ''age'' is specified in days.<br />
** eg: age=30 requests a list of aid values of anime that have changed in the past 30 days<br />
* ''time'' is specified in unix time.<br />
** eg: time=1264982400 requests a list of aid values of anime that have changed since 2010-02-01<br />
* A maximum of 200 values will be returned<br />
* ''count'' specifies the total number of items found for the given time period. In short, if this value is great than 200, you have not retrieved all applicable ids.<br />
* ''last update date'' will contain the AniDB update time of the ''last'' aid to appear on the list<br />
<br />
'''An anime will be considered updated if:'''<br />
* A change is made to the anime record itself<br />
* An ''main'' or ''official'' anime title is added, edited, or deleted (not ''short'' or ''synonym'')<br />
* An episode for the anime is added, or delete (but NOT edited!) ( --> But perhaps airdate changes should <-- )<br />
* An episode title is added, edited, or delete<br />
* An anime category is added, or deleted (but NOT edited: eg, weight change)<br />
* An anime relation is added, or deleted<br />
<br />
=== REVIEW: Get Anime Review ===<br />
Retrieves the review scores and text for an anime review. Like ANIMEDESC, it will likely take multiple calls to this comment to retrieve a complete review - almost all reviews will overflow the size limits of a UDP packet.<br />
<br />
'''Command String:'''<br />
* REVIEW rid={int4 id}<br />
<br />
'''Possible Replies:'''<br />
* 234 REVIEW<br />
: {int4 current part}|{int4 max parts}|{int4 review id}|{int4 author uid}|{int4 score_animation}|{int4 score_sound}|{int4 score_story}|{int4 score_character}|{int4 score_value}|{int4 score_enjoyment}|{str review_text}<br />
* 234 REVIEW<br />
: {int4 current part}|{int4 max parts}|{str review_text}<br />
<br />
* 334 NO SUCH REVIEW<br />
<br />
'''Info:'''<br />
* IDs and scores are returned with part zero only. Parts one through max exclude the scores and return the text block only.<br />
<br />
<br />
<br />
<br />
<br />
[Maybe exchange author uid for author name. Or a uid->name lookup via USER?]<br />
<br />
=== WISHLIST: Retrieve Wishlist Data ===<br />
<br />
Retrieve wishlist data.<br />
<br />
'''Command String:'''<br><br />
full list:<br />
* WISHLIST<br />
by aid:<br />
* WISHLIST aid={int4 aid}<br />
by wishlist id:<br />
* WISHLIST lid={int4 lid}<br />
by priority:<br />
* WISHLIST priority={int4 priority}<br />
<br><br />
'''Possible Replies:'''<br><br />
<br><br />
by aid, lid:<br />
*223 WISHLIST<br />
: {int4 lid}|{int4 aid}|{int2 type}|{int2 priority}|{int4 fromuid}|{str comment}|{int4 adddate}<br />
<br><br />
full list, by priority:<br />
<br />
*229 MULTIPLE WISHLIST ITEMS<br />
: {int4 aid}|{int4 type}|{int4 priority}/n<br />
: {int4 aid}|{int4 type}|{int4 priority}/n<br />
..repeated n times<br />
<br><br><br />
*323 NO SUCH WISHLIST ITEM<br />
<br><br />
'''Info:'''<br />
* ''Priority'' values are 0: low, 1: medium, 2: high<br />
* ''Type'' values are 1: to watch, 2: to get<br />
* Multiple items are returned in descending priority (high priority first)<br />
* The ''fromuid'' field represents the uid of the user that created the wishlist entry. Typically this is the actual user, but could be a buddy.<br />
<br />
=== WISHLISTADD: Add Anime to Wishlist ===<br />
<br />
'''Command String:'''<br><br />
<br />
* WISHLISTADD aid={int4 aid}&type={int2 type}&priority={int2 priority}[&comment={str comment}]<br />
<br />
<br />
* 226 WISHLIST ITEM ADDED<br />
: {int4 wishlist id}<br />
* 228 WISHLIST ITEM UPDATED<br />
: {int4 wishlist id}<br />
<br />
=== WISHLISTDEL: Remove Anime from Wishlist ===<br />
<br />
=== NOTIFICATION: Retrieve Notification Date ===<br />
<br />
=== NOTIFICATIONADD: Add Anime or Group to Notify List ===<br />
<br />
'''Command String:'''<br><br />
<br />
by anime id:<br />
* NOTIFICATIONADD aid={int4 aid}&type={int2 type}&priority={int2 priority}<br />
by group id:<br />
* NOTIFICATIONADD gid={int4 gid}&type={int2 type}&priority={int2 priority}<br />
<br><br />
'''Possible Replies:'''<br />
<br />
* 246 NOTIFICATION ITEM ADDED<br />
: {int4 notification id}<br />
* 248 NOTIFICATION ITEM UPDATED<br />
: {int4 notification id}<br />
* 399 NO CHANGES<br />
<br><br />
'''Info:'''<br />
* ''Priority'' values are 0: low, 1: medium, 2: high<br />
* ''Type'' values are 0: all, 1: new, 2: group, 3: complete<br />
<br />
=== NOTIFICATIONDEL: Remove Anime or Group from Notify List ===<br />
<br />
'''Command String:'''<br><br />
<br />
by anime id:<br />
* NOTIFICATIONDEL aid={int4 aid}<br />
by group id:<br />
* NOTIFICATIONDEL gid={int4 gid}<br />
<br><br />
'''Possible Replies:'''<br />
<br />
* 247 NOTIFICATION ITEM DELETED<br />
: {int4 notification_table}|{int4 relid}<br />
* 324 NO SUCH NOTIFICATION ITEM<br />
<br />
<br><br />
'''Info:'''<br />
* ''notification_table'' values are 1: anime, 2: group<br />
* ''relid'' value matches the aid/gid supplied<br />
<br />
=== Empty Table === <br />
<br />
<table><br />
<tr><br />
<td colspan="3" align="center">Byte 1</td><br />
</tr><br />
<tr><br />
<td>Bit</td><br />
<td>Decimal</td><br />
<td>Data Field</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>String</td><br />
</tr><br />
</table><br />
<br />
=== Permissions (badges) ===<br />
<br />
<pre>[22 Jan 12 16:57] * Ommina: baka gives good advice. Let's get the permission thing fully figured out. If I'm going to stop playing minecraft, I don't want to have to redo stuff. (and now gone for food.)<br />
[22 Jan 12 17:04] * worf: well ... what do we have<br />
[22 Jan 12 17:04] * worf: we have a set of personal settings that only affect you<br />
[22 Jan 12 17:05] * worf: hiding thumbnails, hiding all images, hiding porn images, hiding all porn<br />
[22 Jan 12 17:06] * worf: but those dont need to be considered in the xml<br />
[22 Jan 12 17:07] * worf: and then we have the permissions <br />
[22 Jan 12 17:07] * worf: see me in user list, see my anime list, see storage info, see source info, see viewed info, see ep info, see file info, see state info, see my votes, see my wishlist, see my userpage, see my porn<br />
[22 Jan 12 17:08] * worf: see my porn - obviously would apply to the hentai badge<br />
[22 Jan 12 17:09] * worf: see my anime list - should apply to all anime and creator badges<br />
[22 Jan 12 17:09] * DerIdiot: see my anime list/see viewed info/see ep info/see my votes are the ones that matter<br />
[22 Jan 12 17:11] * worf: see my votes shouldnt matter<br />
[22 Jan 12 17:11] * DerIdiot: wasn't sure if you have some badge with them<br />
[22 Jan 12 17:11] * DerIdiot: if not then yes it doesn't<br />
[22 Jan 12 17:11] * worf: there is a counter badge<br />
[22 Jan 12 17:11] * worf: but we are already displaying the number of votes on the userpage anyway<br />
[22 Jan 12 17:12] * worf: i dont think that permission hides the counter either<br />
[22 Jan 12 17:12] * DerIdiot: i'm not 100% sure, but if not then yes you cna ignore it<br />
[22 Jan 12 17:14] * worf: the only usage of PERM_SEEVOTES on the userpage appears to be for hiding the latest votes<br />
[22 Jan 12 17:17] * worf: so ... <br />
[22 Jan 12 17:17] * worf: PERM_SEEMYPORN for the hentai badge<br />
[22 Jan 12 17:18] * worf: PERM_SHOWMYLIST for all anime and creator based badges including the hentai badge<br />
[22 Jan 12 17:18] * worf: PERM_VIEWEDINFO same as the above i guess<br />
[22 Jan 12 17:20] * worf: PERM_EPINFO shouldnt apply since we arent displaying which episodes have been watched. just how many<br />
[22 Jan 12 17:22] * DerIdiot: PERM_EPINFO says that somethign is in mylist; PERM_VIEWEDINFO does the same + says that it's watched<br />
[22 Jan 12 17:25] * worf: if you have PERM_SHOWMYLIST on "everyone" and PERM_EPINFO on "no one" then you can only see which anime a person has but not which episodes<br />
[22 Jan 12 17:25] * DerIdiot: yes<br />
[22 Jan 12 17:25] * worf: hm, ok<br />
[22 Jan 12 17:25] * worf: it hides the counts too<br />
[22 Jan 12 17:26] * worf: k<br />
[22 Jan 12 17:26] * DerIdiot: but you only got watched badges not collecting ones right?<br />
[22 Jan 12 17:26] * worf: yes<br />
[22 Jan 12 17:26] * DerIdiot: then PERM_VIEWEDINFO is enough<br />
[22 Jan 12 17:26] * DerIdiot: should prolly have PERM_SHOWMYLIST and PERM_VIEWEDINFO<br />
[22 Jan 12 17:27] * worf: hmm<br />
</pre><br />
<br />
<br />
=== EPISODEDESC: Retrieve Episode Description ===<br />
'''Command String:'''<br><br />
by eid<br />
* EPISODEDESC eid={int eid}<br />
<br />
'''Possible Replies:'''<br />
* 241 EPISODE DESCRIPTION<br />
: {int4} eid|{str description}<br />
* 341 NO DESCRIPTION<br />
<br />
'''Info:'''<br />
* Be aware of the UDP packet size limits. As of this writing, fewer than one percent of all episode descriptions will not fit into one packet. That value falls further if compression is enabled. Nonetheless, some especially enthusiastic descriptions will be truncated as necessary.</div>Omminahttps://wiki.anidb.net/index.php?title=User:Ommina&diff=22961User:Ommina2017-10-14T07:19:16Z<p>Ommina: </p>
<hr />
<div>{{TOCright}}<br />
<br />
--> Edit FILE docs to include MyList data block <--<br />
<br />
=== CATEGORY: Retrieve Category Data ===<br />
<br />
=== SIMILAR: Approve or Disapprove of a Similar Pairing ===<br />
<br />
'''Command String:'''<br />
* SIMILAR entity=1&id1={int4 id}&id2={int4 id}[&approve={str [y|n|r]}]<br />
<br />
'''Possible Replies:'''<br />
* 275 SIMILAR APPROVAL<br />
{int entity}|{int sid}|{int id1}|{int id2}|{int total}|{int approved}|{str [y|n]}<br />
* 276 SIMILAR APPROVAL FOUND<br />
{int entity}|{int sid}|{int id1}|{int id2}|{int total}|{int approved}|{str [y|n]}<br />
* 277 SIMILAR APPROVAL UPDATED<br />
{int entity}|{int sid}|{int id1}|{int id2}|{int total}|{int approved}|{str [y|n]}<br />
* 278 SIMILAR APPROVAL REVOKED<br />
{int entity}|{int sid}|{int id1}|{int id2}|{int total}|{int approved}|{str r}<br />
<br />
* 375 NO SUCH SIMILAR PAIRING<br />
{int entity}|{int id1}|{int id2}<br />
* 376 NO SUCH SIMILAR PAIRING APPROVAL<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1.<br />
* ''id1'' and ''id2'' represent an ''existing'' pair of ids. There are no provisions for ''adding'' new similar pairs<br />
* Which id is assigned to ''id1'' and which id is assigned to ''id2'' is irrelevant<br />
* Use ''approval=y'' to approve the pair, ''approve=n'' to disapprove, and ''approve=r'' to revoke (delete) an existing approval/disapproval.<br />
* If an approval vote is already assigned, submitting a new ''y''/''n'' value will replace the old vote.<br />
<br />
=== UPDATED: Get List of Updated Anime IDs ===<br />
Returns a list of AniDB anime ids of anime that have been updated in in a given time frame, ordered by descending date.<br />
<br />
'''Command String:'''<br />
* UPDATED entity=1&[age={int4 id}|time={int4 date}]<br />
<br />
'''Possible Replies:'''<br />
* 243 UPDATED<br />
{int entity}|{int total count}|{int last update date}|{list aid}<br />
<br />
* 343 NO UPDATES<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1<br />
* Either ''age'' OR ''time'' can be specified, but not both<br />
* ''age'' is specified in days.<br />
** eg: age=30 requests a list of aid values of anime that have changed in the past 30 days<br />
* ''time'' is specified in unix time.<br />
** eg: time=1264982400 requests a list of aid values of anime that have changed since 2010-02-01<br />
* A maximum of 200 values will be returned<br />
* ''count'' specifies the total number of items found for the given time period. In short, if this value is great than 200, you have not retrieved all applicable ids.<br />
* ''last update date'' will contain the AniDB update time of the ''last'' aid to appear on the list<br />
<br />
'''An anime will be considered updated if:'''<br />
* A change is made to the anime record itself<br />
* An ''main'' or ''official'' anime title is added, edited, or deleted (not ''short'' or ''synonym'')<br />
* An episode for the anime is added, or delete (but NOT edited!) ( --> But perhaps airdate changes should <-- )<br />
* An episode title is added, edited, or delete<br />
* An anime category is added, or deleted (but NOT edited: eg, weight change)<br />
* An anime relation is added, or deleted<br />
<br />
=== REVIEW: Get Anime Review ===<br />
Retrieves the review scores and text for an anime review. Like ANIMEDESC, it will likely take multiple calls to this comment to retrieve a complete review - almost all reviews will overflow the size limits of a UDP packet.<br />
<br />
'''Command String:'''<br />
* REVIEW rid={int4 id}<br />
<br />
'''Possible Replies:'''<br />
* 234 REVIEW<br />
: {int4 current part}|{int4 max parts}|{int4 review id}|{int4 author uid}|{int4 score_animation}|{int4 score_sound}|{int4 score_story}|{int4 score_character}|{int4 score_value}|{int4 score_enjoyment}|{str review_text}<br />
* 234 REVIEW<br />
: {int4 current part}|{int4 max parts}|{str review_text}<br />
<br />
* 334 NO SUCH REVIEW<br />
<br />
'''Info:'''<br />
* IDs and scores are returned with part zero only. Parts one through max exclude the scores and return the text block only.<br />
<br />
<br />
<br />
<br />
<br />
[Maybe exchange author uid for author name. Or a uid->name lookup via USER?]<br />
<br />
=== WISHLIST: Retrieve Wishlist Data ===<br />
<br />
Retrieve wishlist data.<br />
<br />
'''Command String:'''<br><br />
full list:<br />
* WISHLIST<br />
by aid:<br />
* WISHLIST aid={int4 aid}<br />
by wishlist id:<br />
* WISHLIST lid={int4 lid}<br />
by priority:<br />
* WISHLIST priority={int4 priority}<br />
<br><br />
'''Possible Replies:'''<br><br />
<br><br />
by aid, lid:<br />
*223 WISHLIST<br />
: {int4 lid}|{int4 aid}|{int2 type}|{int2 priority}|{int4 fromuid}|{str comment}|{int4 adddate}<br />
<br><br />
full list, by priority:<br />
<br />
*229 MULTIPLE WISHLIST ITEMS<br />
: {int4 aid}|{int4 type}|{int4 priority}/n<br />
: {int4 aid}|{int4 type}|{int4 priority}/n<br />
..repeated n times<br />
<br><br><br />
*323 NO SUCH WISHLIST ITEM<br />
<br><br />
'''Info:'''<br />
* ''Priority'' values are 0: low, 1: medium, 2: high<br />
* ''Type'' values are 1: to watch, 2: to get<br />
* Multiple items are returned in descending priority (high priority first)<br />
* The ''fromuid'' field represents the uid of the user that created the wishlist entry. Typically this is the actual user, but could be a buddy.<br />
<br />
=== WISHLISTADD: Add Anime to Wishlist ===<br />
<br />
'''Command String:'''<br><br />
<br />
* WISHLISTADD aid={int4 aid}&type={int2 type}&priority={int2 priority}[&comment={str comment}]<br />
<br />
<br />
* 226 WISHLIST ITEM ADDED<br />
: {int4 wishlist id}<br />
* 228 WISHLIST ITEM UPDATED<br />
: {int4 wishlist id}<br />
<br />
=== WISHLISTDEL: Remove Anime from Wishlist ===<br />
<br />
=== NOTIFICATION: Retrieve Notification Date ===<br />
<br />
=== NOTIFICATIONADD: Add Anime or Group to Notify List ===<br />
<br />
'''Command String:'''<br><br />
<br />
by anime id:<br />
* NOTIFICATIONADD aid={int4 aid}&type={int2 type}&priority={int2 priority}<br />
by group id:<br />
* NOTIFICATIONADD gid={int4 gid}&type={int2 type}&priority={int2 priority}<br />
<br><br />
'''Possible Replies:'''<br />
<br />
* 246 NOTIFICATION ITEM ADDED<br />
: {int4 notification id}<br />
* 248 NOTIFICATION ITEM UPDATED<br />
: {int4 notification id}<br />
* 399 NO CHANGES<br />
<br><br />
'''Info:'''<br />
* ''Priority'' values are 0: low, 1: medium, 2: high<br />
* ''Type'' values are 0: all, 1: new, 2: group, 3: complete<br />
<br />
=== NOTIFICATIONDEL: Remove Anime or Group from Notify List ===<br />
<br />
'''Command String:'''<br><br />
<br />
by anime id:<br />
* NOTIFICATIONDEL aid={int4 aid}<br />
by group id:<br />
* NOTIFICATIONDEL gid={int4 gid}<br />
<br><br />
'''Possible Replies:'''<br />
<br />
* 247 NOTIFICATION ITEM DELETED<br />
: {int4 notification_table}|{int4 relid}<br />
* 324 NO SUCH NOTIFICATION ITEM<br />
<br />
<br><br />
'''Info:'''<br />
* ''notification_table'' values are 1: anime, 2: group<br />
* ''relid'' value matches the aid/gid supplied<br />
<br />
=== Empty Table === <br />
<br />
<table><br />
<tr><br />
<td colspan="3" align="center">Byte 1</td><br />
</tr><br />
<tr><br />
<td>Bit</td><br />
<td>Decimal</td><br />
<td>Data Field</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>String</td><br />
</tr><br />
</table><br />
<br />
=== Permissions (badges) ===<br />
<br />
<pre>[22 Jan 12 16:57] * Ommina: baka gives good advice. Let's get the permission thing fully figured out. If I'm going to stop playing minecraft, I don't want to have to redo stuff. (and now gone for food.)<br />
[22 Jan 12 17:04] * worf: well ... what do we have<br />
[22 Jan 12 17:04] * worf: we have a set of personal settings that only affect you<br />
[22 Jan 12 17:05] * worf: hiding thumbnails, hiding all images, hiding porn images, hiding all porn<br />
[22 Jan 12 17:06] * worf: but those dont need to be considered in the xml<br />
[22 Jan 12 17:07] * worf: and then we have the permissions <br />
[22 Jan 12 17:07] * worf: see me in user list, see my anime list, see storage info, see source info, see viewed info, see ep info, see file info, see state info, see my votes, see my wishlist, see my userpage, see my porn<br />
[22 Jan 12 17:08] * worf: see my porn - obviously would apply to the hentai badge<br />
[22 Jan 12 17:09] * worf: see my anime list - should apply to all anime and creator badges<br />
[22 Jan 12 17:09] * DerIdiot: see my anime list/see viewed info/see ep info/see my votes are the ones that matter<br />
[22 Jan 12 17:11] * worf: see my votes shouldnt matter<br />
[22 Jan 12 17:11] * DerIdiot: wasn't sure if you have some badge with them<br />
[22 Jan 12 17:11] * DerIdiot: if not then yes it doesn't<br />
[22 Jan 12 17:11] * worf: there is a counter badge<br />
[22 Jan 12 17:11] * worf: but we are already displaying the number of votes on the userpage anyway<br />
[22 Jan 12 17:12] * worf: i dont think that permission hides the counter either<br />
[22 Jan 12 17:12] * DerIdiot: i'm not 100% sure, but if not then yes you cna ignore it<br />
[22 Jan 12 17:14] * worf: the only usage of PERM_SEEVOTES on the userpage appears to be for hiding the latest votes<br />
[22 Jan 12 17:17] * worf: so ... <br />
[22 Jan 12 17:17] * worf: PERM_SEEMYPORN for the hentai badge<br />
[22 Jan 12 17:18] * worf: PERM_SHOWMYLIST for all anime and creator based badges including the hentai badge<br />
[22 Jan 12 17:18] * worf: PERM_VIEWEDINFO same as the above i guess<br />
[22 Jan 12 17:20] * worf: PERM_EPINFO shouldnt apply since we arent displaying which episodes have been watched. just how many<br />
[22 Jan 12 17:22] * DerIdiot: PERM_EPINFO says that somethign is in mylist; PERM_VIEWEDINFO does the same + says that it's watched<br />
[22 Jan 12 17:25] * worf: if you have PERM_SHOWMYLIST on "everyone" and PERM_EPINFO on "no one" then you can only see which anime a person has but not which episodes<br />
[22 Jan 12 17:25] * DerIdiot: yes<br />
[22 Jan 12 17:25] * worf: hm, ok<br />
[22 Jan 12 17:25] * worf: it hides the counts too<br />
[22 Jan 12 17:26] * worf: k<br />
[22 Jan 12 17:26] * DerIdiot: but you only got watched badges not collecting ones right?<br />
[22 Jan 12 17:26] * worf: yes<br />
[22 Jan 12 17:26] * DerIdiot: then PERM_VIEWEDINFO is enough<br />
[22 Jan 12 17:26] * DerIdiot: should prolly have PERM_SHOWMYLIST and PERM_VIEWEDINFO<br />
[22 Jan 12 17:27] * worf: hmm<br />
</pre><br />
<br />
<br />
=== EPISODEDESC: Retrieve Episode Description ===<br />
'''Command String:'''<br><br />
by eid<br />
* EPISODEDESC eid={int eid}<br />
<br />
'''Possible Replies:'''<br />
* 241 EPISODE DESCRIPTION<br />
: {int4} eid|{str description}<br />
* 341 NO DESCRIPTION</div>Omminahttps://wiki.anidb.net/index.php?title=User:Ommina/TcpV2_Beta&diff=22840User:Ommina/TcpV2 Beta2017-07-23T02:55:06Z<p>Ommina: Created page with "{{TOCright}} {{eyecatch|NOTE! NOTE! This is important!| This document, and the associated API, are both in early development. Absolutely no promises are made that command..."</p>
<hr />
<div>{{TOCright}}<br />
<br />
<br />
{{eyecatch|NOTE! NOTE! This is important!|<br />
This document, and the associated API, are both in early development. Absolutely no promises are made that commands, replies, formats, availability, colour, spin, charge, font, or anything else will not change. Possibly repeatedly. Not even a whiff of a hint of a promise. If a client starts coding against this, and something changes, it's on their head. Really.}}<br />
<br />
=== Clients ===<br />
<br />
If you want to create a client you have to register it {{AniDBLink|client|here}} and [[HTTP / UDP / TCP Clients|here]].<br />
<br />
=== Flooding and Caching ===<br />
All users of this API should employ heavy local caching. Requesting the same dataset multiple times on a single day can get you banned. The same goes for request flooding. You should not issue more than one request every 0.5(?) seconds (two requests per second).<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Parameters ===<br />
Requests can be issued to the API in either '''URLEncoded query string''' ''OR'' '''JSON''' format.<br />
<br />
If JSON is used, do not use a 'pretty printed' string (that is, JSON with indents and internal line breaks). Instead, send the JSON as a single string, with a newline at the end.<br />
<br />
Parameters do not need to appear in any particular order.<br />
<br />
All users of the TCP API need to be registered and have to provide their registered client identifier and version number on each request.<br />
<br />
All commands require ''client'', ''clientver'', ''protover'', and ''request'' parameters.<br />
<br />
Authenticated commands will also require ''user'', and ''pass'' parameters.<br />
<br />
<br />
Parameters:<br />
* <tt>request={string}</tt> [required]<br />
** API command requested. See following sections.<br />
<br />
* <tt>protover={integer}</tt> [required]<br />
** protocol version in use. Possible values: 1<br />
<br />
* <tt>client={string}</tt> [required]<br />
** client identification string, needs to be a registered client identifier, see: <br />
<br />
* <tt>clientver={integer}</tt> [required]<br />
** client version number, needs to be valid client version number for the given client identification string.<br />
<br />
* <tt>user={string}</tt> [authenticated commands]<br />
** user's AniDB username<br />
<br />
* <tt>pass={string}</tt> [authenticated commands]<br />
** user's AniDB password<br />
<br />
<br />
Example:<br />
<br />
query string: <u><nowiki>request=version&client={str}&clientver={int}&protover=1</nowiki></u><br />
<br />
or<br />
<br />
JSON: <nowiki>{"request":"version","client":"{str}", "clientver":"{str}","protover":1}</nowiki><br />
<br />
<br />
== User Data Commands ==<br />
<br />
=== Mylist ===<br />
Allows retrieval of a user's mylist entry.<br />
<br />
request=mylist<br />
<br />
'''Command String:'''<br><br />
by (mylist list id) lid:<br />
* lid={int4 lid}<br />
by fid:<br />
* fid={int4 fid}<br />
by size+ed2k hash:<br />
* size={int4 size}&ed2k={str ed2khash}</div>Omminahttps://wiki.anidb.net/index.php?title=HTTP_API_Definition&diff=22839HTTP API Definition2017-07-16T09:30:44Z<p>Ommina: </p>
<hr />
<div>{{TOCright}}<br />
<br />
== General ==<br />
The HTTP XML API is only a small part of the AniDB API framework, please refer to [[API]] for an overview.<br />
<br />
=== Clients ===<br />
<br />
If you want to create a client you have to register it {{AniDBLink|client|here}} and [[HTTP / UDP Clients|here]].<br />
<br />
=== Encoding ===<br />
All content is UTF8 encoded and gzip compressed (you may have to handle the decompressing yourself, if your HTTP library doesn't support compression of HTTP data). Transfer is in chunks, which are part of HTTP 1.1. This is the case even when your client requested uncompressed HTTP 1.0.<br />
<br />
=== Flooding and Caching ===<br />
All users of this API should employ heavy local caching. Requesting the same dataset multiple times on a single day can get you banned. The same goes for request flooding. You should not request more than one page every two seconds.<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Parameters ===<br />
These parameters apply to all HTTP XML API pages and should always be added to the request URLs.<br />
<br />
All users of the HTTP XML API need to be registered and have to provide their registered client identifier and version number on each request.<br />
<br />
Parameters:<br />
* <tt>client={string}</tt> [required]<br />
** client identification string, needs to be a registered client identifier, see: <br />
<br />
* <tt>clientver={integer}</tt> [required]<br />
** client version number, needs to be valid client version number for the given client identification string.<br />
<br />
* <tt>protover={integer}</tt> [required]<br />
** protocol version in use. Possible values: 1<br />
<br />
* <tt>request={string}</tt> [required]<br />
** HTTP XML datapage requested. See following sections.<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1</nowiki></u><br />
<br />
== Data Commands ==<br />
<br />
=== Anime ===<br />
Allows retrieval of non-file or episode related information for a specific anime by AID (AniDB anime id).<br />
<br />
==== Search ====<br />
* [[API#Anime_Titles|Look here]]<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=anime</tt><br />
* <tt>aid={integer}</tt> [required]<br />
** AniDB anime id of the anime you want to retrieve data for.<br />
<br />
<br />
{{eyecatch|Note|The tags node presently contains both 'spoiler' and 'localspoiler' attributes. Both represent the same value. Clients should use 'localspoiler'; in time, 'spoiler' will be removed.}}<br />
<br />
<br />
{{eyecatch|Important!|The meaning of the <temporary> vote node has changed since the HTTP API was put in place. To help keep clients compatible, the node will not be removed short term, but client consumers should be aware that this value now represents the mean of all votes (both permanent and temporary).}}<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime&client={str}&clientver={int}&protover=1&aid={int}</nowiki></u><br />
<br />
===== Data =====<br />
<pre><br />
<?xml version="1.0" encoding="UTF-8"?><br />
<anime id="1" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>1999-01-04</startdate><br />
<enddate>1999-03-29</enddate><br />
<titles><br />
<title xml:lang="x-jat" type="main">Seikai no Monshou</title><br />
<title xml:lang="zh-Hans" type="syn">星界之纹章</title><br />
<title xml:lang="en" type="short">CotS</title><br />
<title xml:lang="x-jat" type="short">SnM</title><br />
<title xml:lang="ja" type="official">星界の紋章</title><br />
<title xml:lang="en" type="official">Crest of the Stars</title><br />
<title xml:lang="fr" type="official">Crest of the Stars</title><br />
<title xml:lang="pl" type="official">Crest of the Stars</title><br />
</titles><br />
<relatedanime><br />
<anime id="4" type="Sequel">Seikai no Senki</anime><br />
<anime id="6" type="Prequel">Seikai no Danshou</anime><br />
<anime id="1623" type="Summary">Seikai no Monshou Tokubetsuhen</anime><br />
</relatedanime><br />
<url>http://www.sunrise-inc.co.jp/seikai/</url><br />
<creators><br />
<name id="4495" type="Original Work">Morioka Hiroyuki</name><br />
</creators><br />
<description>Jinto Lin`s life changes forever when the Humankind Empire Abh takes over his home planet of Martine without firing a single shot. He is soon sent off to study the Abh language and culture and to prepare himself for his future as a nobleman — a future he never dreamed of. Or wanted.Now, Jinto is entering the next phase of his training, and he is about to meet his first Abh, the lovely Lafiel. But Jinto is about to learn that she is more than she appears to be. And together they will have to fight for their very lives.</description><br />
<ratings><br />
<permanent count="2953">8.53</permanent><br />
<temporary count="96">7.58</temporary><br />
<review count="11">8.75</review><br />
</ratings><br />
<picture>440.jpg</picture><br />
<categories><br />
<category id="174" parentid="8" hentai="false" weight="500"><br />
<name>Space Travel</name><br />
<description>Space Travel usually refers going to space or travelling there with or without a spacecraft. There are different forms of space travel like Interplanetary travel, Interstellar travel or Intergalactic travel. Since it isn`t possible to travel faster than light, most anime series involve some sort "sub-space travel mechanism" as a way to travel faster than light.</description><br />
</category><br />
<category id="274" parentid="268" hentai="false" weight="400"><br />
<name>Novel</name><br />
<description>Note that novel means book with words in paper, so no comics and no "visual novels", which should go under manga and dating-sim - visual Novel/erotic game respectively.&#13;<br />
&#13;<br />
Note that it can be applied to novels as we know them but also the typical light novels for teens and young adults, which are common in Japan and aside from being short include a number of illustrations. </description><br />
</category><br />
</categories><br />
<tags><br />
<tag id="136" approval="20" spoiler="false" update="2009-05-23"><br />
<name>space opera</name><br />
<count>71</count><br />
</tag><br />
<tag id="175" approval="17" spoiler="false" update="2008-03-13"><br />
<name>space elves</name><br />
<count>12</count><br />
</tag><br />
<tag id="389" approval="15" spoiler="false" update="2008-06-03"><br />
<name>war setting</name><br />
<count>64</count><br />
</tag><br />
<tag id="393" approval="18" spoiler="false" update="2008-06-03"><br />
<name>space battles</name><br />
<count>43</count><br />
<description>There are space battles in this anime. Usually between Earth forces and some alien invader, but ship to ship skirmishes in deep space are just as common.</description><br />
</tag><br />
</tags><br />
<characters><br />
<character id="7493" type="appears in" update="2009-05-28"><br />
<name>Gosroth</name><br />
<description>The Resii Gothroth.The first Abh ship lost in the war.</description><br />
<episodes>1,1012</episodes><br />
<picture>26147.jpg</picture><br />
</character><br />
<character id="7501" type="appears in" update="2009-05-28"><br />
<name>Planet Martine</name><br />
<description>The homeworld of Jinto</description><br />
<episodes>1</episodes><br />
</character><br />
<character id="7503" type="appears in" update="2009-05-28"><br />
<name>Rock Lynn</name><br />
<description>The former president of Martine, later made count of the Hyde system, after striking a deal with the Abh (in episode 1)</description><br />
<episodes>1</episodes><br />
<picture>26165.jpg</picture><br />
</character><br />
</characters><br />
<episodes><br />
<episode id="1" update="2005-03-10"><br />
<epno>1</epno><br />
<length>24</length><br />
<airdate>1999-01-03</airdate><br />
<rating votes="17">5.66</rating><br />
<title xml:lang="ja">侵略</title><br />
<title xml:lang="en">Invasion</title><br />
<title xml:lang="fr">Invasion</title><br />
<title xml:lang="x-jat">shinryaku</title><br />
</episode><br />
<episode id="2" update="2005-03-11"><br />
<epno>2</epno><br />
<length>24</length><br />
<airdate>1999-01-10</airdate><br />
<rating votes="12">6.66</rating><br />
<title xml:lang="ja">星たちの眷族</title><br />
<title xml:lang="en">Kin of the Stars</title><br />
<title xml:lang="fr">Les parents des Étoiles</title><br />
<title xml:lang="x-jat">Hoshi-tachi no Kenzoku</title><br />
</episode><br />
</episodes><br />
</anime><br />
</pre><br />
<br />
==== Errors ====<br />
[http://anidb.net/perl-bin/animedb.pl?show=cmt&post=159118 According to ommina] the API does not use HTTP return code. Instead you will get XML consisting of one tag with a textual description.<br />
<pre><br />
<error>Banned</error><br />
</pre><br />
<br />
=== Random Recommendation ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random recommendations' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomrecommendation</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomrecommendation</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomrecommendation</nowiki></u><br />
<br />
<pre><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="7899" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>2010-10-04</startdate><br />
<enddate>2010-12-27</enddate><br />
<title xml:lang="x-jat" type="main">Arakawa Under the Bridge 2</title><br />
<picture>54734.jpg</picture><br />
<ratings><br />
<permanent count="781">623</permanent><br />
<recommendations>8</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
...<br />
<br />
<randomrecommendation><br />
</pre><br />
<br />
=== Random Similar ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random similar' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomsimilar</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomsimilar</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomsimilar</nowiki></u><br />
<br />
<pre><br />
<randomsimilar><br />
<similar><br />
<source aid="7056" restricted="false"><br />
<title xml:lang="x-jat" type="main">Aoi Bungaku Series</title><br />
<picture>37124.jpg</picture><br />
</source><br />
<target aid="3654" restricted="false"><br />
<title xml:lang="x-jat" type="main">Ayakashi: Japanese Classic Horror</title><br />
<picture>44085.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
</randomsimilar><br />
</pre><br />
<br />
=== Hot Anime ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Unlike the two random result commands, the results here will match the results as supplied by the main web page (with some possible variance of a few hours, depending on cache life.)<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=hotanime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=hotanime</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=hotanime</nowiki></u><br />
<br />
<pre><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
</pre><br />
<br />
=== Main ===<br />
<br />
A one-stop command returning the combined results of random recommendation, random similar, and hot anime. Use this command instead of scraping the HTML, and if you need more than one of the individual replies.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=main</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=main</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=main</nowiki></u><br />
<br />
<pre><br />
<main><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
<randomsimilar><br />
<similar><br />
<source aid="8107" restricted="false"><br />
<title xml:lang="x-jat" type="main">A Channel: The Animation</title><br />
<picture>59870.jpg</picture><br />
</source><br />
<target aid="4777" restricted="false"><br />
<title xml:lang="x-jat" type="main">Lucky Star</title><br />
<picture>65555.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
<randomsimilar><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="44" restricted="false"><br />
<type>OVA</type><br />
<episodecount>1</episodecount><br />
<startdate>2000-05-24</startdate><br />
<enddate>2000-05-24</enddate><br />
<title xml:lang="x-jat" type="main">Amon Devilman Mokushiroku</title><br />
<picture>14016.jpg</picture><br />
<ratings><br />
<permanent count="317">387</permanent><br />
<recommendations>1</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
....<br />
<br />
</randomrecommendation><br />
</main><br />
</pre><br />
<br />
== User Data Commands ==<br />
<br />
=== User Mylist Summary ===<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=mylistsummary&user={str anidb username}&pass={str anidb password}[&output=xml|json]</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=mylistsummary</tt><br />
** Returns a list of the user's anime list in summary form, roughly matching the data in the "my list" page of the web interface.<br />
* <tt>user={str username}&pass={str password}</tt><br />
** The user name and password of the desired user. This is their main password, not the API password specified in the profile.<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=mylistsummary&user={str}&pass={str}</nowiki></u><br />
<br />
<pre><br />
<mylistsummary uid="40237"><br />
<mylistitem aid="5841" state="2"><br />
<episodecount>22</episodecount><br />
<seencount>22</seencount><br />
<specialcount>9</specialcount><br />
<seenspecialcount>4</seenspecialcount><br />
</mylistitem><br />
<mylistsummary><br />
</pre><br />
<br />
=== User Hints ===<br />
<br />
Returns a list of unwatched titles and a calculated rating, based upon existing votes. The list may be empty if the requested user is very new, has not voted for enough titles, or has very stale (a number of months old) data.<br />
<br />
Hints are calculated once a day.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=hints&user={str anidb username}&pass={str anidb password}&type=1[&output=xml|json]</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=hints</tt><br />
* <tt>user={str username}&pass={str password}</tt><br />
** The user name and password of the desired user. This is their main password, not the API password specified in the profile.<br />
* <tt>type=1</tt><br />
** always 1, but must be included.<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=hints&user={str}&pass={str}&type=1</nowiki></u><br />
<br />
<pre><br />
<hints uid="40237" type="1"><br />
<hint adddate="2015-03-23"><br />
<relid>5</relid><br />
<calculated>8.09</calculated><br />
</hint><br />
</hints><br />
</pre><br />
<br />
[[Category:Development]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=HTTP_API_Definition&diff=22838HTTP API Definition2017-07-16T09:28:04Z<p>Ommina: /* Access */</p>
<hr />
<div>{{TOCright}}<br />
<br />
== General ==<br />
The HTTP XML API is only a small part of the AniDB API framework, please refer to [[API]] for an overview.<br />
<br />
=== Clients ===<br />
<br />
If you want to create a client you have to register it {{AniDBLink|client|here}} and [[HTTP / UDP Clients|here]].<br />
<br />
=== Encoding ===<br />
All content is UTF8 encoded and gzip compressed (you may have to handle the decompressing yourself, if your HTTP library doesn't support compression of HTTP data). Transfer is in chunks, which are part of HTTP 1.1. This is the case even when your client requested uncompressed HTTP 1.0.<br />
<br />
=== Flooding and Caching ===<br />
All users of this API should employ heavy local caching. Requesting the same dataset multiple times on a single day can get you banned. The same goes for request flooding. You should not request more than one page every two seconds.<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Parameters ===<br />
These parameters apply to all HTTP XML API pages and should always be added to the request URLs.<br />
<br />
All users of the HTTP XML API need to be registered and have to provide their registered client identifier and version number on each request.<br />
<br />
Parameters:<br />
* <tt>client={string}</tt> [required]<br />
** client identification string, needs to be a registered client identifier, see: <br />
<br />
* <tt>clientver={integer}</tt> [required]<br />
** client version number, needs to be valid client version number for the given client identification string.<br />
<br />
* <tt>protover={integer}</tt> [required]<br />
** protocol version in use. Possible values: 1<br />
<br />
* <tt>request={string}</tt> [required]<br />
** HTTP XML datapage requested. See following sections.<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1</nowiki></u><br />
<br />
== Data Commands ==<br />
<br />
=== Anime ===<br />
Allows retrieval of non-file or episode related information for a specific anime by AID (AniDB anime id).<br />
<br />
==== Search ====<br />
* [[API#Anime_Titles|Look here]]<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=anime</tt><br />
* <tt>aid={integer}</tt> [required]<br />
** AniDB anime id of the anime you want to retrieve data for.<br />
<br />
<br />
{{eyecatch|Note|The tags node presently contains both 'spoiler' and 'localspoiler' attributes. Both represent the same value. Clients should use 'localspoiler'; in time, 'spoiler' will be removed.}}<br />
<br />
<br />
{{eyecatch|Important!|The meaning of the <temporary> vote node has changed since the HTTP API was put in place. To help keep clients compatible, the node will not be removed short term, but client consumers should be aware that this value now represents the mean of all votes (both permanent and temporary).}}<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime&client={str}&clientver={int}&protover=1&aid={int}</nowiki></u><br />
<br />
===== Data =====<br />
<code><pre><br />
<?xml version="1.0" encoding="UTF-8"?><br />
<anime id="1" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>1999-01-04</startdate><br />
<enddate>1999-03-29</enddate><br />
<titles><br />
<title xml:lang="x-jat" type="main">Seikai no Monshou</title><br />
<title xml:lang="zh-Hans" type="syn">星界之纹章</title><br />
<title xml:lang="en" type="short">CotS</title><br />
<title xml:lang="x-jat" type="short">SnM</title><br />
<title xml:lang="ja" type="official">星界の紋章</title><br />
<title xml:lang="en" type="official">Crest of the Stars</title><br />
<title xml:lang="fr" type="official">Crest of the Stars</title><br />
<title xml:lang="pl" type="official">Crest of the Stars</title><br />
</titles><br />
<relatedanime><br />
<anime id="4" type="Sequel">Seikai no Senki</anime><br />
<anime id="6" type="Prequel">Seikai no Danshou</anime><br />
<anime id="1623" type="Summary">Seikai no Monshou Tokubetsuhen</anime><br />
</relatedanime><br />
<url>http://www.sunrise-inc.co.jp/seikai/</url><br />
<creators><br />
<name id="4495" type="Original Work">Morioka Hiroyuki</name><br />
</creators><br />
<description>Jinto Lin`s life changes forever when the Humankind Empire Abh takes over his home planet of Martine without firing a single shot. He is soon sent off to study the Abh language and culture and to prepare himself for his future as a nobleman — a future he never dreamed of. Or wanted.Now, Jinto is entering the next phase of his training, and he is about to meet his first Abh, the lovely Lafiel. But Jinto is about to learn that she is more than she appears to be. And together they will have to fight for their very lives.</description><br />
<ratings><br />
<permanent count="2953">8.53</permanent><br />
<temporary count="96">7.58</temporary><br />
<review count="11">8.75</review><br />
</ratings><br />
<picture>440.jpg</picture><br />
<categories><br />
<category id="174" parentid="8" hentai="false" weight="500"><br />
<name>Space Travel</name><br />
<description>Space Travel usually refers going to space or travelling there with or without a spacecraft. There are different forms of space travel like Interplanetary travel, Interstellar travel or Intergalactic travel. Since it isn`t possible to travel faster than light, most anime series involve some sort "sub-space travel mechanism" as a way to travel faster than light.</description><br />
</category><br />
<category id="274" parentid="268" hentai="false" weight="400"><br />
<name>Novel</name><br />
<description>Note that novel means book with words in paper, so no comics and no "visual novels", which should go under manga and dating-sim - visual Novel/erotic game respectively.&#13;<br />
&#13;<br />
Note that it can be applied to novels as we know them but also the typical light novels for teens and young adults, which are common in Japan and aside from being short include a number of illustrations. </description><br />
</category><br />
</categories><br />
<tags><br />
<tag id="136" approval="20" spoiler="false" update="2009-05-23"><br />
<name>space opera</name><br />
<count>71</count><br />
</tag><br />
<tag id="175" approval="17" spoiler="false" update="2008-03-13"><br />
<name>space elves</name><br />
<count>12</count><br />
</tag><br />
<tag id="389" approval="15" spoiler="false" update="2008-06-03"><br />
<name>war setting</name><br />
<count>64</count><br />
</tag><br />
<tag id="393" approval="18" spoiler="false" update="2008-06-03"><br />
<name>space battles</name><br />
<count>43</count><br />
<description>There are space battles in this anime. Usually between Earth forces and some alien invader, but ship to ship skirmishes in deep space are just as common.</description><br />
</tag><br />
</tags><br />
<characters><br />
<character id="7493" type="appears in" update="2009-05-28"><br />
<name>Gosroth</name><br />
<description>The Resii Gothroth.The first Abh ship lost in the war.</description><br />
<episodes>1,1012</episodes><br />
<picture>26147.jpg</picture><br />
</character><br />
<character id="7501" type="appears in" update="2009-05-28"><br />
<name>Planet Martine</name><br />
<description>The homeworld of Jinto</description><br />
<episodes>1</episodes><br />
</character><br />
<character id="7503" type="appears in" update="2009-05-28"><br />
<name>Rock Lynn</name><br />
<description>The former president of Martine, later made count of the Hyde system, after striking a deal with the Abh (in episode 1)</description><br />
<episodes>1</episodes><br />
<picture>26165.jpg</picture><br />
</character><br />
</characters><br />
<episodes><br />
<episode id="1" update="2005-03-10"><br />
<epno>1</epno><br />
<length>24</length><br />
<airdate>1999-01-03</airdate><br />
<rating votes="17">5.66</rating><br />
<title xml:lang="ja">侵略</title><br />
<title xml:lang="en">Invasion</title><br />
<title xml:lang="fr">Invasion</title><br />
<title xml:lang="x-jat">shinryaku</title><br />
</episode><br />
<episode id="2" update="2005-03-11"><br />
<epno>2</epno><br />
<length>24</length><br />
<airdate>1999-01-10</airdate><br />
<rating votes="12">6.66</rating><br />
<title xml:lang="ja">星たちの眷族</title><br />
<title xml:lang="en">Kin of the Stars</title><br />
<title xml:lang="fr">Les parents des Étoiles</title><br />
<title xml:lang="x-jat">Hoshi-tachi no Kenzoku</title><br />
</episode><br />
</episodes><br />
</anime><br />
</pre></code><br />
<br />
==== Errors ====<br />
[http://anidb.net/perl-bin/animedb.pl?show=cmt&post=159118 According to ommina] the API does not use HTTP return code. Instead you will get XML consisting of one tag with a textual description.<br />
<code><pre><br />
<error>Banned</error><br />
</pre></code><br />
<br />
=== Random Recommendation ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random recommendations' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomrecommendation</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomrecommendation</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomrecommendation</nowiki></u><br />
<br />
<code><pre><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="7899" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>2010-10-04</startdate><br />
<enddate>2010-12-27</enddate><br />
<title xml:lang="x-jat" type="main">Arakawa Under the Bridge 2</title><br />
<picture>54734.jpg</picture><br />
<ratings><br />
<permanent count="781">623</permanent><br />
<recommendations>8</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
...<br />
<br />
<randomrecommendation><br />
</pre></code><br />
<br />
=== Random Similar ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random similar' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomsimilar</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomsimilar</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomsimilar</nowiki></u><br />
<br />
<code><pre><br />
<randomsimilar><br />
<similar><br />
<source aid="7056" restricted="false"><br />
<title xml:lang="x-jat" type="main">Aoi Bungaku Series</title><br />
<picture>37124.jpg</picture><br />
</source><br />
<target aid="3654" restricted="false"><br />
<title xml:lang="x-jat" type="main">Ayakashi: Japanese Classic Horror</title><br />
<picture>44085.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
</randomsimilar><br />
</pre></code><br />
<br />
=== Hot Anime ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Unlike the two random result commands, the results here will match the results as supplied by the main web page (with some possible variance of a few hours, depending on cache life.)<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=hotanime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=hotanime</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=hotanime</nowiki></u><br />
<br />
<code><pre><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
</pre></code><br />
<br />
=== Main ===<br />
<br />
A one-stop command returning the combined results of random recommendation, random similar, and hot anime. Use this command instead of scraping the HTML, and if you need more than one of the individual replies.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=main</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=main</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=main</nowiki></u><br />
<br />
<pre><br />
<main><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
<randomsimilar><br />
<similar><br />
<source aid="8107" restricted="false"><br />
<title xml:lang="x-jat" type="main">A Channel: The Animation</title><br />
<picture>59870.jpg</picture><br />
</source><br />
<target aid="4777" restricted="false"><br />
<title xml:lang="x-jat" type="main">Lucky Star</title><br />
<picture>65555.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
<randomsimilar><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="44" restricted="false"><br />
<type>OVA</type><br />
<episodecount>1</episodecount><br />
<startdate>2000-05-24</startdate><br />
<enddate>2000-05-24</enddate><br />
<title xml:lang="x-jat" type="main">Amon Devilman Mokushiroku</title><br />
<picture>14016.jpg</picture><br />
<ratings><br />
<permanent count="317">387</permanent><br />
<recommendations>1</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
....<br />
<br />
</randomrecommendation><br />
</main><br />
</pre><br />
<br />
== User Data Commands ==<br />
<br />
=== User Mylist Summary ===<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=mylistsummary&user={str anidb username}&pass={str anidb password}[&output=xml|json]</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=mylistsummary</tt><br />
** Returns a list of the user's anime list in summary form, roughly matching the data in the "my list" page of the web interface.<br />
* <tt>user={str username}&pass={str password}</tt><br />
** The user name and password of the desired user. This is their main password, not the API password specified in the profile.<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=mylistsummary&user={str}&pass={str}</nowiki></u><br />
<br />
<code><pre><br />
<mylistsummary uid="40237"><br />
<mylistitem aid="5841" state="2"><br />
<episodecount>22</episodecount><br />
<seencount>22</seencount><br />
<specialcount>9</specialcount><br />
<seenspecialcount>4</seenspecialcount><br />
</mylistitem><br />
<mylistsummary><br />
</pre></code><br />
<br />
=== User Hints ===<br />
<br />
Returns a list of unwatched titles and a calculated rating, based upon existing votes. The list may be empty if the requested user is very new, has not voted for enough titles, or has very stale (a number of months old) data.<br />
<br />
Hints are calculated once a day.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=hints&user={str anidb username}&pass={str anidb password}&type=1[&output=xml|json]</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=hints</tt><br />
* <tt>user={str username}&pass={str password}</tt><br />
** The user name and password of the desired user. This is their main password, not the API password specified in the profile.<br />
* <tt>type=1</tt><br />
** always 1, but must be included.<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=hints&user={str}&pass={str}&type=1</nowiki></u><br />
<br />
<code><pre><br />
<hints uid="40237" type="1"><br />
<hint adddate="2015-03-23"><br />
<relid>5</relid><br />
<calculated>8.09</calculated><br />
</hint><br />
</hints><br />
</pre></code><br />
<br />
[[Category:Development]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=HTTP_API_Definition&diff=22837HTTP API Definition2017-07-16T09:24:54Z<p>Ommina: /* User Data Commands */</p>
<hr />
<div>{{TOCright}}<br />
<br />
== General ==<br />
The HTTP XML API is only a small part of the AniDB API framework, please refer to [[API]] for an overview.<br />
<br />
=== Clients ===<br />
<br />
If you want to create a client you have to register it {{AniDBLink|client|here}} and [[HTTP / UDP Clients|here]].<br />
<br />
=== Encoding ===<br />
All content is UTF8 encoded and gzip compressed (you may have to handle the decompressing yourself, if your HTTP library doesn't support compression of HTTP data). Transfer is in chunks, which are part of HTTP 1.1. This is the case even when your client requested uncompressed HTTP 1.0.<br />
<br />
=== Flooding and Caching ===<br />
All users of this API should employ heavy local caching. Requesting the same dataset multiple times on a single day can get you banned. The same goes for request flooding. You should not request more than one page every two seconds.<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Parameters ===<br />
These parameters apply to all HTTP XML API pages and should always be added to the request URLs.<br />
<br />
All users of the HTTP XML API need to be registered and have to provide their registered client identifier and version number on each request.<br />
<br />
Parameters:<br />
* <tt>client={string}</tt> [required]<br />
** client identification string, needs to be a registered client identifier, see: <br />
<br />
* <tt>clientver={integer}</tt> [required]<br />
** client version number, needs to be valid client version number for the given client identification string.<br />
<br />
* <tt>protover={integer}</tt> [required]<br />
** protocol version in use. Possible values: 1<br />
<br />
* <tt>request={string}</tt> [required]<br />
** HTTP XML datapage requested. See following sections.<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1</nowiki></u><br />
<br />
== Data Commands ==<br />
<br />
=== Anime ===<br />
Allows retrieval of non-file or episode related information for a specific anime by AID (AniDB anime id).<br />
<br />
==== Search ====<br />
* [[API#Anime_Titles|Look here]]<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=anime</tt><br />
* <tt>aid={integer}</tt> [required]<br />
** AniDB anime id of the anime you want to retrieve data for.<br />
<br />
<br />
{{eyecatch|Note|The tags node presently contains both 'spoiler' and 'localspoiler' attributes. Both represent the same value. Clients should use 'localspoiler'; in time, 'spoiler' will be removed.}}<br />
<br />
<br />
{{eyecatch|Important!|The meaning of the <temporary> vote node has changed since the HTTP API was put in place. To help keep clients compatible, the node will not be removed short term, but client consumers should be aware that this value now represents the mean of all votes (both permanent and temporary).}}<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime&client={str}&clientver={int}&protover=1&aid={int}</nowiki></u><br />
<br />
===== Data =====<br />
<code><pre><br />
<?xml version="1.0" encoding="UTF-8"?><br />
<anime id="1" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>1999-01-04</startdate><br />
<enddate>1999-03-29</enddate><br />
<titles><br />
<title xml:lang="x-jat" type="main">Seikai no Monshou</title><br />
<title xml:lang="zh-Hans" type="syn">星界之纹章</title><br />
<title xml:lang="en" type="short">CotS</title><br />
<title xml:lang="x-jat" type="short">SnM</title><br />
<title xml:lang="ja" type="official">星界の紋章</title><br />
<title xml:lang="en" type="official">Crest of the Stars</title><br />
<title xml:lang="fr" type="official">Crest of the Stars</title><br />
<title xml:lang="pl" type="official">Crest of the Stars</title><br />
</titles><br />
<relatedanime><br />
<anime id="4" type="Sequel">Seikai no Senki</anime><br />
<anime id="6" type="Prequel">Seikai no Danshou</anime><br />
<anime id="1623" type="Summary">Seikai no Monshou Tokubetsuhen</anime><br />
</relatedanime><br />
<url>http://www.sunrise-inc.co.jp/seikai/</url><br />
<creators><br />
<name id="4495" type="Original Work">Morioka Hiroyuki</name><br />
</creators><br />
<description>Jinto Lin`s life changes forever when the Humankind Empire Abh takes over his home planet of Martine without firing a single shot. He is soon sent off to study the Abh language and culture and to prepare himself for his future as a nobleman — a future he never dreamed of. Or wanted.Now, Jinto is entering the next phase of his training, and he is about to meet his first Abh, the lovely Lafiel. But Jinto is about to learn that she is more than she appears to be. And together they will have to fight for their very lives.</description><br />
<ratings><br />
<permanent count="2953">8.53</permanent><br />
<temporary count="96">7.58</temporary><br />
<review count="11">8.75</review><br />
</ratings><br />
<picture>440.jpg</picture><br />
<categories><br />
<category id="174" parentid="8" hentai="false" weight="500"><br />
<name>Space Travel</name><br />
<description>Space Travel usually refers going to space or travelling there with or without a spacecraft. There are different forms of space travel like Interplanetary travel, Interstellar travel or Intergalactic travel. Since it isn`t possible to travel faster than light, most anime series involve some sort "sub-space travel mechanism" as a way to travel faster than light.</description><br />
</category><br />
<category id="274" parentid="268" hentai="false" weight="400"><br />
<name>Novel</name><br />
<description>Note that novel means book with words in paper, so no comics and no "visual novels", which should go under manga and dating-sim - visual Novel/erotic game respectively.&#13;<br />
&#13;<br />
Note that it can be applied to novels as we know them but also the typical light novels for teens and young adults, which are common in Japan and aside from being short include a number of illustrations. </description><br />
</category><br />
</categories><br />
<tags><br />
<tag id="136" approval="20" spoiler="false" update="2009-05-23"><br />
<name>space opera</name><br />
<count>71</count><br />
</tag><br />
<tag id="175" approval="17" spoiler="false" update="2008-03-13"><br />
<name>space elves</name><br />
<count>12</count><br />
</tag><br />
<tag id="389" approval="15" spoiler="false" update="2008-06-03"><br />
<name>war setting</name><br />
<count>64</count><br />
</tag><br />
<tag id="393" approval="18" spoiler="false" update="2008-06-03"><br />
<name>space battles</name><br />
<count>43</count><br />
<description>There are space battles in this anime. Usually between Earth forces and some alien invader, but ship to ship skirmishes in deep space are just as common.</description><br />
</tag><br />
</tags><br />
<characters><br />
<character id="7493" type="appears in" update="2009-05-28"><br />
<name>Gosroth</name><br />
<description>The Resii Gothroth.The first Abh ship lost in the war.</description><br />
<episodes>1,1012</episodes><br />
<picture>26147.jpg</picture><br />
</character><br />
<character id="7501" type="appears in" update="2009-05-28"><br />
<name>Planet Martine</name><br />
<description>The homeworld of Jinto</description><br />
<episodes>1</episodes><br />
</character><br />
<character id="7503" type="appears in" update="2009-05-28"><br />
<name>Rock Lynn</name><br />
<description>The former president of Martine, later made count of the Hyde system, after striking a deal with the Abh (in episode 1)</description><br />
<episodes>1</episodes><br />
<picture>26165.jpg</picture><br />
</character><br />
</characters><br />
<episodes><br />
<episode id="1" update="2005-03-10"><br />
<epno>1</epno><br />
<length>24</length><br />
<airdate>1999-01-03</airdate><br />
<rating votes="17">5.66</rating><br />
<title xml:lang="ja">侵略</title><br />
<title xml:lang="en">Invasion</title><br />
<title xml:lang="fr">Invasion</title><br />
<title xml:lang="x-jat">shinryaku</title><br />
</episode><br />
<episode id="2" update="2005-03-11"><br />
<epno>2</epno><br />
<length>24</length><br />
<airdate>1999-01-10</airdate><br />
<rating votes="12">6.66</rating><br />
<title xml:lang="ja">星たちの眷族</title><br />
<title xml:lang="en">Kin of the Stars</title><br />
<title xml:lang="fr">Les parents des Étoiles</title><br />
<title xml:lang="x-jat">Hoshi-tachi no Kenzoku</title><br />
</episode><br />
</episodes><br />
</anime><br />
</pre></code><br />
<br />
==== Errors ====<br />
[http://anidb.net/perl-bin/animedb.pl?show=cmt&post=159118 According to ommina] the API does not use HTTP return code. Instead you will get XML consisting of one tag with a textual description.<br />
<code><pre><br />
<error>Banned</error><br />
</pre></code><br />
<br />
=== Random Recommendation ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random recommendations' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomrecommendation</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomrecommendation</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomrecommendation</nowiki></u><br />
<br />
<code><pre><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="7899" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>2010-10-04</startdate><br />
<enddate>2010-12-27</enddate><br />
<title xml:lang="x-jat" type="main">Arakawa Under the Bridge 2</title><br />
<picture>54734.jpg</picture><br />
<ratings><br />
<permanent count="781">623</permanent><br />
<recommendations>8</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
...<br />
<br />
<randomrecommendation><br />
</pre></code><br />
<br />
=== Random Similar ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random similar' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomsimilar</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomsimilar</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomsimilar</nowiki></u><br />
<br />
<code><pre><br />
<randomsimilar><br />
<similar><br />
<source aid="7056" restricted="false"><br />
<title xml:lang="x-jat" type="main">Aoi Bungaku Series</title><br />
<picture>37124.jpg</picture><br />
</source><br />
<target aid="3654" restricted="false"><br />
<title xml:lang="x-jat" type="main">Ayakashi: Japanese Classic Horror</title><br />
<picture>44085.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
</randomsimilar><br />
</pre></code><br />
<br />
=== Hot Anime ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Unlike the two random result commands, the results here will match the results as supplied by the main web page (with some possible variance of a few hours, depending on cache life.)<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=hotanime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=hotanime</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=hotanime</nowiki></u><br />
<br />
<code><pre><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
</pre></code><br />
<br />
=== Main ===<br />
<br />
A one-stop command returning the combined results of random recommendation, random similar, and hot anime. Use this command instead of scraping the HTML, and if you need more than one of the individual replies.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=main</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=main</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=main</nowiki></u><br />
<br />
<code><pre><br />
<main><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
<randomsimilar><br />
<similar><br />
<source aid="8107" restricted="false"><br />
<title xml:lang="x-jat" type="main">A Channel: The Animation</title><br />
<picture>59870.jpg</picture><br />
</source><br />
<target aid="4777" restricted="false"><br />
<title xml:lang="x-jat" type="main">Lucky Star</title><br />
<picture>65555.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
<randomsimilar><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="44" restricted="false"><br />
<type>OVA</type><br />
<episodecount>1</episodecount><br />
<startdate>2000-05-24</startdate><br />
<enddate>2000-05-24</enddate><br />
<title xml:lang="x-jat" type="main">Amon Devilman Mokushiroku</title><br />
<picture>14016.jpg</picture><br />
<ratings><br />
<permanent count="317">387</permanent><br />
<recommendations>1</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
....<br />
<br />
</randomrecommendation><br />
</main><br />
</pre></code><br />
<br />
== User Data Commands ==<br />
<br />
=== User Mylist Summary ===<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=mylistsummary&user={str anidb username}&pass={str anidb password}[&output=xml|json]</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=mylistsummary</tt><br />
** Returns a list of the user's anime list in summary form, roughly matching the data in the "my list" page of the web interface.<br />
* <tt>user={str username}&pass={str password}</tt><br />
** The user name and password of the desired user. This is their main password, not the API password specified in the profile.<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=mylistsummary&user={str}&pass={str}</nowiki></u><br />
<br />
<code><pre><br />
<mylistsummary uid="40237"><br />
<mylistitem aid="5841" state="2"><br />
<episodecount>22</episodecount><br />
<seencount>22</seencount><br />
<specialcount>9</specialcount><br />
<seenspecialcount>4</seenspecialcount><br />
</mylistitem><br />
<mylistsummary><br />
</pre></code><br />
<br />
=== User Hints ===<br />
<br />
Returns a list of unwatched titles and a calculated rating, based upon existing votes. The list may be empty if the requested user is very new, has not voted for enough titles, or has very stale (a number of months old) data.<br />
<br />
Hints are calculated once a day.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=hints&user={str anidb username}&pass={str anidb password}&type=1[&output=xml|json]</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=hints</tt><br />
* <tt>user={str username}&pass={str password}</tt><br />
** The user name and password of the desired user. This is their main password, not the API password specified in the profile.<br />
* <tt>type=1</tt><br />
** always 1, but must be included.<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=hints&user={str}&pass={str}&type=1</nowiki></u><br />
<br />
<code><pre><br />
<hints uid="40237" type="1"><br />
<hint adddate="2015-03-23"><br />
<relid>5</relid><br />
<calculated>8.09</calculated><br />
</hint><br />
</hints><br />
</pre></code><br />
<br />
[[Category:Development]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=UDP_API_Definition&diff=22790UDP API Definition2017-04-10T22:38:07Z<p>Ommina: /* Notify Commands */</p>
<hr />
<div>{{TOCright}}<br />
<br />
== General Information ==<br />
'''Author:''' [[User:Exp|Exp]] & [[User:Epoximator|Epoximator]] & [[User:Ommina|Ommina]]<br><br />
'''Version:''' 0.03.730 (2015-03-25)<br><br />
'''Version number used for protover parameter:''' "3"<br />
<br />
'''IMPORTANT INFORMATION FOR ALL INTERESTED:'''<br />
* If you are mainly interested in notifications and private messaging, check out our [[Jabber]] and [[RSSRDF]] support first.<br />
* The UDP API is not an appropriate choice if you desire to download a local copy of the AniDB database.<br />
* If you want to create a client you have to register it {{AniDBLink|client|here}} and [[UDP Clients|here]].<br />
** Check out the clients that are being developed. There exists usable code in many different languages already.<br />
* If you have suggestions for improvements or new features use the [[UDP API DEV|development]] page.<br />
* Please also take a look at the [[API]] page.<br />
<br />
== Formats used in this Spec ==<br />
* {vartype varname} - Specifies what shall be inserted at this point and its type.<br />
* [...] - Everything between [ and ] is optional.<br />
<br />
=== Used types ===<br />
* ''int2'' - 2 byte Integer (in string representation)<br />
* ''int4'' - 4 byte Integer (in string representation)<br />
* ''boolean'' - true or false - use '1' for ''true'', '0' for ''false''<br />
* ''str'' - String (UDP packet length restricts string size to 1400 bytes)<br />
* ''hexstr'' -- a hex representation of a decimal value, two characters per byte. If multiple bytes are represented, byte one is the first two characters of the string, byte two the next two, and so on.<br />
<br />
=== Content Encoding ===<br />
* Default character encoding: ''ASCII''<br />
* Escape scheme for option values (to server): ''html form encoding'' + ''newline''<br />
** This means you have to encode at least <tt>&</tt> in your option values in html form encoding style (<tt>&amp;amp;</tt>) before sending them to the api server. All other html form encodings are optional.<br />
** All newlines should be replaced by &lt;br /&gt;<br />
* Escape scheme for returned data fields (from server): ', | and newline<br />
** Content newlines are encoded as &lt;br /&gt;, ' is encoded as ` and | is encoded as /.<br />
** Dates are returned in unix time (number of seconds elapsed since January 1, 1970 00:00:00 UTC)<br />
<br />
== Basics ==<br />
=== General ===<br />
The network communication is ''packet'' and ''line'' based. Each AniDB API command is exactly one UDP packet containing one line. Results are sent as one packet but may consist out of multiple lines. A return value always starts with a 3 byte result code followed by a human readable version of the result code. Be aware that important data fields may be returned directly after the return code (see: 200,201,209,271,272,504).<br />
The meaning for all result codes can be found in this document. If there is more than one entry returned, it's one entry per line. Lines are terminated by a <tt>\n</tt> (no dos linefeed <tt>\r</tt>). The elements of a format string are separated by a "|" character.<br />
<br />
<tt>{three digit return code} {str return string}\n</tt><br><br />
<tt>{data field 0}|{data field 1}|...|{data field n}</tt><br />
<br />
'''IMPORTANT:'''<br />
* All commands except PING, ENCRYPT, ENCODING, AUTH and VERSION '''requires''' login, meaning that the ''session tag'' must be set (<tt>s=xxxxx</tt>).<br />
* A client should ignore any additional trailing data fields it doesn't expect. Additional fields are going to be added to the output of some commands from time to time. Those additional fields will simply be appended to the end of the existing output. A client should be written in a way so that it is not affected by such new fields.<br />
* Due to the length constraints of an UDP package (over PPPoE) the replies from the server will never exceed 1400 bytes. String fields will be truncated if necessary to ensure this. No warnings are given when this happens.<br />
* A client should handle all possible return codes for each command.<br />
** Possible return codes for '''all commands''':<br />
*** 505 ILLEGAL INPUT OR ACCESS DENIED<br />
*** 555 BANNED<br />
***: {str reason}<br />
*** 598 UNKNOWN COMMAND<br />
*** 600 INTERNAL SERVER ERROR<br />
*** 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
*** 602 SERVER BUSY - TRY AGAIN LATER<br />
*** 604 TIMEOUT - DELAY AND RESUBMIT<br />
** Additional return codes for all commands that '''require login''':<br />
*** 501 LOGIN FIRST<br />
*** 502 ACCESS DENIED<br />
*** 506 INVALID SESSION<br />
<br />
{{eyecatch|Note|The '555 BANNED' message should not be expected by the client. This message is only enabled temporary to help developers understand what they are doing wrong.}}<br><br />
<br />
{{eyecatch|Note|<br />
While in daily maintenance the AniDB API will reply with<br />
<br />
601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
<br />
to all commands. If a client receives such a return value it should wait at least 30 minutes before trying again.}}<br />
<br />
=== Server / UDP Connection ===<br />
The Client has to send data packets to:<br />
* '''Server:''' api.anidb.net<br />
* '''Port:''' 9000/UDP<br />
The servername and port should not be hardcoded into a frontend but should be read from a configuration file.<br />
<br />
=== Server Errors ===<br />
* At any time the API might return a fatal error of the form:<br />
: <tt>6xx ERROR DESCRIPTION</tt><br />
* Possible codes are 600-699.<br />
* Occurrences of these errors (except 601 and 602) should be reported to [[User:Ommina|Ommina]].<br />
{{eyecatch|Note|6XX messages do not always return the tags given with the command which caused the error!}}<br />
<br />
=== Connection Problems ===<br />
There are many ways for a client to end up banned or the API might currently be handling too many concurrent connections.<br />
If a client does not get any reply to an AUTH command it should start to increase the retry delay exponentially with every failed login attempt. (i.e. try again after 30 seconds if the first login attempt failed, if the second fails too retry after 2 minutes, then 5 minutes, then 10 minutes, then 30 minutes, ... until you reach a retry delay of ~2-4h.)<br />
<br />
=== Local Port ===<br />
A client should select a fixed local port >1024 at install time and reuse it for local UDP Sockets. If the API sees too many different UDP Ports from one IP within ~1 hour it will ban the IP. (So make sure you're reusing your UDP ports also for testing/debugging!)<br />
<br />
The local port may be hardcoded, however, an option to manually specify another port should be offered.<br />
<br />
'''Note when behind a [[Wikipedia:Network address translation|NAT]]/masquerading router:'''<br><br />
A session between the server and a client is identified by the ''IP and port'' used by the client. So when the port (or IP) changes within a session the client has to authenticate again. If a client is behind a NAT router it can’t actually control the local port used for the connection. The router will normally ''translate'' the port to support several computers on a LAN to share the Internet connection. The public port (as determined by the router and seen by the server) which has been assigned to the connection will only be reserved for as long as it is in use. This means that the router will usually ''deallocate the port after a fixed timeout period'' (eg. five, ten or 15 minutes). Once that happens the client will no longer be able to receive UDP messages from the server (the messages will be discarded as undeliverable by the router) and a new port will be selected once the client tries to send a message to the server (which will result in a new connection session - '''Note:''' This could get you banned!, see above). So in order to keep a session over a NAT router alive, the client has to ping the server within the router's deallocation period to prevent a timeout.<br />
<br />
The client can decide whether it is behind a NAT router or not by adding <tt>nat=1</tt> to the AUTH command. This will cause the response to include the IP and port as seen by the server. If the port differs from the port reported by the local socket, the connection subject to NAT and the client should issue PING commands in regular intervals. Please do not send pings more often than is necessary to keep NAT connections alive.<br />
<br />
=== Flood Protection ===<br />
To prevent high server load the UDP API server enforces a strict flood protection policy.<br />
* Short Term:<br />
** A Client MUST NOT send more than 0.5 packets per second (that's one packet every two seconds, not two packets a second!)<br />
** The server will start to enforce the limit after the first 5 packets have been received.<br />
* Long Term:<br />
** A Client MUST NOT send more than one packet every four seconds over an extended amount of time.<br />
** ''An extended amount of time'' is not defined. Use common sense.<br />
<br />
Once a client exceeds a rate limit all further UDP packets from that client will be dropped without feedback until the client's packet rate is back down to acceptable levels.<br />
<br />
{{eyecatch|Note|Dropped packets are still taken into account for the packet rate. Meaning if you continuously send packets your client will be banned forever.}}<br />
<br />
Generally clients should be written in a way to minimize server and network load. You should always keep that in mind.<br />
<br />
Abusive clients may be banned completely.<br />
<br />
{{eyecatch|Note|<br />
If you suddenly stop getting replies from the AniDB API or you normally don't have a notable packetloss and from one point on you suddenly note a high packetloss percentage you have most likely entered a critical flood ratio.<br />
If the AniDB API isn't answering at all it might either be down or you have been banned, this is normally caused by violating the API specs (i.e. too many connections using different ports from one IP, too many auth failures, ...) (usually lasts 30 minutes).<br />
If you're experiencing packet loss you have probably reached the rate limit and the API starts to randomly drop incoming packets from your IP. (can be solved by enforcing a delay between multiple commands when you're sending a batch)}}<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Caching ===<br />
To minimize server and network load a client should use local caching in order to prevent repeated API requests for the same data.<br />
<br />
A client should locally cache FILE/EP/ANIME/GROUP/... info wherever possible for extended amounts of time.<br />
(I.e. if a client is used to scan a local folder with anime files and add them via API to a users MyList then it shall only ask for all files in the first run and cache the info for all files known to AniDB. If run again over the same folder it shall only check those files which were unknown to AniDB at the time of the last check.)<br />
<br />
Later versions of the API might enforce this by banning clients which ask for the same information more than once every week/month.<br />
<br />
=== Tag option ===<br />
The API will add a user defined string at the beginning of each reply line separated with a space, if desired.<br />
* To enable add the <tt>tag={str usertag}</tt> option to a command.<br />
* A tag is only valid for the command it was send with, meaning it is not persistent. If you want to have tags in front of all reply lines you will have to append the tag option to each command you send to the server.<br />
* Tags are meant to enable a client to handle more than one request/reply at a time.<br />
<br />
Usage example:<br />
AUTH user=baka&pass=baka&protover=25&client=someclient&clientver=1&tag=abc123<br />
abc123 200 Jxqxb LOGIN ACCEPTED<br />
or<br />
LOGOUT s=Jxqxb&tag=byebye<br />
byebye 203 LOGGED OUT<br />
<br />
{{eyecatch|Note|The tag option is valid for all api commands and is thus not explicitly listed in the description of each command.}}<br />
<br />
=== Data Indexes (fid,aid,eid,gid,lid) ===<br />
* All indexes start at 1 (not 0).<br />
* It is possible for table entries to have id fields with a value of 0 (i.e. gid). Those are to be interpreted as "NONE" or "NULL".<br />
* An ID is '''never''' reused. That means after an entry is deleted no new entry will ever have that ID again.<br />
* Mylist IDs (lid) are globally unique, not per-user unique.<br />
<br />
== Authing Commands ==<br />
{{eyecatch|Note|'''ANY''' command which requires parameters may return: 505 ILLEGAL INPUT OR ACCESS DENIED}}<br />
<br />
----<br />
=== AUTH: Authing to the AnimeDB ===<br />
'''Command String:'''<br />
* AUTH user={str username}&pass={str password}&protover={int4 apiversion}&client={str clientname}&clientver={int4 clientversion}[&nat=1&comp=1&enc={str encoding}&mtu{int4 mtu value}&imgserver=1]<br />
<br />
'''Possible Replies:'''<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
* 500 LOGIN FAILED<br />
* 503 CLIENT VERSION OUTDATED<br />
* 504 CLIENT BANNED - {str reason}<br />
* 505 ILLEGAL INPUT OR ACCESS DENIED<br />
* 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
when nat=1<br />
* 200 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED<br />
* 201 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
when imgserver=1<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
{str image server name}<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
{str image server name}<br />
<br />
'''Info:'''<br />
{{eyecatch|Note|The password is the normal AniDB website password! The password listed in the profile as API Password in only used for the optional encryption feature.}}<br />
* The ''session_key'' is a String containing only ''a-z,A-Z,0-9'' chars of a length of ''4-8'' characters.<br />
: It has to be stored by the client and needs to be sent as parameter with every command which requires the user to logged in.<br />
* The ''session_key'' String is appended as parameter "s", i.e. "PUSH notify=1&msg=1&s={str session_key}".<br />
* On a '''500 LOGIN FAILED''' message the client should request the user to enter username and password again.<br />
* In case of a '''501 LOGIN FIRST''' message the client should silently resend an auth command and send the failed command again.<br />
* A '''502 ACCESS DENIED''' message should abort the current action on the client side and display a message to the user.<br />
* A '''503 CLIENT VERSION OUTDATED''' message states that the udp server has been updated and does not support your client any longer. (protover is too low). A 201 message refers to a new version of the client software.<br />
* A '''506 INVALID SESSION''' means that either the session key parameter "s" was not provided with a command that requires it or the session key is no longer valid. The client should reissue an AUTH command.<br />
{{eyecatch|Note|A frontend shall expect 501 and 502 messages to be returned on ANY command.}}<br><br />
{{eyecatch|Note|AniDB usernames may only contain characters (a-z,A-Z), numbers (0-9), underscores (_) and hyphens (-).}}<br />
* The client should send the apiversion of the AnimeDB API version it supports as value of the protover parameter.<br />
* The client MAY NOT send anything but the version of the API Specs the author used to write the client! (as it is stated at the top of this file @ "Version number used for protover parameter")<br />
: The API will compare that value to it's own version of the API and if the version of the client is older the API will decide whether the changes were significant enough to deny the old client access to the DB.<br />
* The clientname shall be a lower-case string containing only the chars ''a-z'' of ''4-16 chars'' length which identifies the client. (i.e. mykickassclient)<br />
* The clientversion shall be a number starting with 1, increased on every change in the client.<br />
: clientname and clientversion might be used by the API to distinguish between different clients and client versions if that should ever become necessary.<br />
{{eyecatch|Important|<br />
* DO NOT use the clientname of an existing client. If you modify an existing client's code to meet your own needs, create a new client name for yourself.<br />
* ALWAYS increase the clientversion number if you release a new client version.}}<br />
* A Login and its assigned ''session_key'' is valid until the virtual UDP connection times out or until a LOGOUT command is issued.<br />
* The virtual UDP connection times out if no data was received from the client for '''35 minutes'''.<br />
* A client should issue a UPTIME command once every 30 minutes to keep the connection alive should that be required.<br />
* If the client does not use any of the notification/push features of the API it should NOT keep the connection alive, furthermore it should explicitly terminate the connection by issuing a LOGOUT command once it finished it's work.<br />
* If it is very likely that another command will be issued shortly (within the next 20 minutes) a client SHOULD keep the current connection open, by not sending a LOGOUT command.<br />
{{eyecatch|Important|<br />
* A client should NOT perform a full AUTH / command / LOGOUT cycle for each command it wants to send. Again, if another command is likely within 20 minutes, remain logged in.}}<br />
* The client shall notify the user if it received a 201 message at login.<br />
: This means a new version of the client is available, however the old version is still supported otherwise a client banned message would have been returned.<br />
* The user should get a pop-up message on 503 and 504 messages telling him to update his client software.<br />
: ('''Note:''' 504 means that this version of the client is banned, not the user!)<br />
* The 'nat' option makes the client able to detect whether it is behind a nat router or not. When the client is behind a nat router it should keep the "connection" alive with the PING command.<br />
{{eyecatch|Important|Make sure your client handles ALL possible AUTH return codes before giving out any versions!}}<br />
* When ''enc=x'' is defined the server will change the encoding used to x.<br />
**If the encoding is supported it will change right away (including the response) and be reset on logout/timeout.<br />
**If not supported then the argument will be silently ignored. Use ENCODING to test what works.<br />
**Supported encodings are [http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html these].<br />
* ''comp=1'' means that the client supports compression ([http://java.sun.com/j2se/1.5.0/docs/api/java/util/zip/Deflater.html DEFLATE]).<br />
**The server will compress (instead of truncating) the datagrams when needed if this option is enabled.<br />
**The first two bytes of compressed datagrams will always be set to zero. (So tags should never start with that.)<br />
* Default [[Wikipedia:MTU (networking)|''MTU'']] is 1400. Minimum allowed is 400, maximum 1400, due [[Wikipedia:Point-to-Point Protocol over Ethernet|PPPoE]].<br />
<br />
----<br />
<br />
=== LOGOUT: Logout ===<br />
'''Command String:'''<br />
* LOGOUT<br />
<br />
'''Possible Replies:'''<br />
* 203 LOGGED OUT<br />
* 403 NOT LOGGED IN<br />
<br />
'''Info:'''<br />
* This command only works if you are already logged in.<br />
* A logout should ALWAYS be issued if the client is currently logged in and is either exiting or not expecting to send/receive any AniDB API packets for the next >= 30 minutes.<br />
<br />
----<br />
=== ENCRYPT: Start Encrypted Session ===<br />
Will cause all future messages from the server, except the first (the reply to the ENCRYPT command itself), to be encrypted (128 bit [[Wikipedia:Advanced Encryption Standard|AES]]). The client will also have to encrypt all future requests sent to the server. All non-encrypted messages will be discarded by the server. The encryption key is the [[Wikipedia:MD5|MD5]] hash of a special ''UDP API Key'' (defined in the users profile) concatenated with the salt string as given in the reply to the ENCRYPT message. A normal AUTH message is still necessary to authenticate and should follow the ENCRYPT command once the API has acknowledged the encryption.<br />
<br />
'''Command String:'''<br />
* ENCRYPT user={str name}&type={int2 type}<br />
<br />
'''Possible Replies:'''<br />
* 209 {str salt} ENCRYPTION ENABLED<br />
* 309 API PASSWORD NOT DEFINED<br />
* 509 NO SUCH ENCRYPTION TYPE<br />
* 394 NO SUCH USER<br />
<br />
'''Info:'''<br />
* ''user'' is the user name.<br />
* ''type'' is the type of encryption; 1 => 128 bit AES (only one defined).<br />
* ''API Key'' is the one defined in the {{AniDBLink|profile|profile settings page}}.<br />
* It is not possible to disable the encryption once enabled while staying logged in.<br />
** A logout (the logout message needs to be correctly encrypted) or timeout will disable the encryption.<br />
* In order to minimize server load, encryption should be disabled by default and should have to be enabled manually by the user in the configuration options.<br />
* The encryption key is md5(api_key_of_user+''salt'').<br />
* Padding of the message needs to be done according to the PKCS5Padding scheme.<br />
<br />
== Notify Commands ==<br />
=== Introduction ===<br />
Broadly speaking, notifications provide an indication to the client that some event has occurred within the AniDB database.<br />
<br />
There are three types:<br />
* New file [[Notifications|notification]]. (Only anime type supported.)<br />
* New private message notification.<br />
* New buddy event notification.<br />
<br />
Note that, while a user can subscribe to multiple 'new file' events (see [[Notifications|notifications]]), at present, the UDP API only supports notifications of new files by anime. New files by group, or new files by producer, are NOT presently supported. Just the same, keeping in mind that the API is designed to potentially support such notifications in the future will help in understanding why some of the commands are structured the way they are.<br />
<br />
The word "notification" is also used a bit inconsistently in this document. An AniDB notification is originally a "new file [[Notifications|notification]]". It might be more correct to use the term "event" for the original "happening" and then "notification" as the means to notify the user (client). New-file, new-message, buddy-* and going-down are all events that results in notifications. Only the first two type of events are persistent, though, meaning they exist and remain in the same state until some user action affects them.<br />
<br />
=== Getting Notifications ===<br />
Clients that wish to receive notifications have two routes available to them. They are by no means mutually exclusive and selecting one does not imply a client is unable to use commands from another.<br />
<br />
'''Method One: Polling'''<br />
<br />
With this method, the client contacts the server at some interval (no more than once every 20 minutes) to see if there are new file notifications waiting. If there are, the client can the get further details of the files in question. This is analogous to checking an email server every half hour to see if new email has arrived.<br />
<br />
Its principal advantage is that it is easy to design and code. Blocking sockets are sufficient as the client can expect the reply received to correspond with the command sent.<br />
<br />
The disadvantage of this approach is that it introduces a delay and some uncertainty in receiving notifications. If, for example, the user clears the notification on the website before the client collects it, the client will not learn of the new file. Similarly, if the user does not dismiss notifications via the site, the client will have an increasing amount of stale data to work though. Finally, notifications cleared by the client also clears them from the website, so users will need to be made aware of what is going on.<br />
<br />
A polling HOWTO:<br />
<br />
* Use NOTIFY (no more than once every 20 minutes) to get the number of pending notifications<br />
* IF there are new notifications pending, use NOTIFYLIST to get a list of notification types and associated IDs.<br />
* Use NOTIFYGET to receive a notification, supplying the ID provided by NOTIFYLIST<br />
* Use NOTIFYACK to acknowledge a notification, supplying the ID provided by NOTIFYLIST (if desired)<br />
<br />
{{eyecatch|Note|The ID supplied by NOTIFYLIST will be the ID of the affected notification type. Since, at present, only the anime type is supported, this value is always an aid. In the future, it may represent a group or producer ID. In these cases, the str '''type''' value will indicate what entity the ID represents.}}<br />
<br />
'''Method Two: Server PUSH'''<br />
<br />
With this method, the server takes the active role in advising the client that a new file has arrived. The client must register with the server to receive further advice information, and will be responsible for keeping the login session from timing out, and any NAT router ports open. The UDP packet is sent to the ip and port from which the AUTH command was received.<br />
<br />
This method compensates for the disadvantages of the polling method, but is more difficult to code. Blocking sockets are no longer an option, nor can a client make any assumptions that an incoming packet will necessarily be a reply to the last command sent. The tag option may be helpful here.<br />
<br />
A PUSH HOWTO:<br />
<br />
* PUSH to register your client session.<br />
* Listen for 720-799 NOTIFICATIONs ('''not 290''').<br />
* Use PUSHACK to to acknowledge the notification using the nid supplied with NOTIFICATION<br />
* Use NOTIFYGET to receive a notification, suppling the relid provided by NOTIFICATION (NOT the packet ID)<br />
* Use NOTIFYACK to acknowledge a notification, suppling the relid provided by NOTIFICATION (if desired)<br />
* Use UPTIME (with an interval between 30 and 35 minutes) to keep login session valid<br />
<br />
It is probably a good idea to use tags to separate NOTIFICATIONs from the other communication. NOTIFICATIONs will '''never''' have tags.<br />
<br />
=== PUSH: UDP Notification Registration ===<br />
Register your client as an observer for AniDB notification events for the current user. If you are registered for one or more event types the AniDB server will send an UDP packet (format see below) on each change which affects the current user.<br />
<br />
'''Command String:'''<br />
* PUSH notify={boolean on_new_file}&msg={boolean on_new_private_message}[&buddy={boolean on_buddy_event}]<br />
<br />
'''Possible Replies:'''<br />
* 270 NOTIFICATION ENABLED<br />
OR (if both values are 0)<br />
* 370 NOTIFICATION DISABLED<br />
<br />
'''Info:'''<br />
* A client which has registered to receive UDP notification packets must:<br />
** Issue a PUSHACK command for each notification received with ''notify_packet_id'' provided in the notification packet.<br />
** Use PING to keep the connection alive (< 30 min).<br />
** Use UPTIME to ensure that the session is OK (>= 30 min).<br />
* Every notification generated is resent 3 times unless acknowledged. After that the client is logged out.<br />
<br />
=== NOTIFY: Notifications ===<br />
Get number of pending notifications (and number of online buddies).<br />
<br />
'''Command String:'''<br />
* NOTIFY [buddy=1]<br />
<br />
'''Possible Replies:'''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}<br />
when ''buddy=1''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}|{int4 number_of_online_buddies}<br />
<br />
'''Info:'''<br />
* If the client did send a NOTIFY within the last 35 minutes and it was confirmed by AniDB then receiving a 501 LOGIN FIRST message for the next NOTIFY command shows that AniDB logged the client out because it did not respond to a PUSH Notification packet.<br />
* There is no command to retrieve missed PUSH Notifications.<br />
{{eyecatch|Note|This command MUST NOT be issued more than once every 20 minutes.}}<br />
<br />
----<br />
=== NOTIFYLIST: List Notification/Message IDs ===<br />
List id of all pending (not acknowledged) ''new private message'' and ''new file'' notifications. Buddy events cannot be acknowledged.<br />
<br />
'''Command String:'''<br />
* NOTIFYLIST<br />
<br />
'''Possible Replies:'''<br />
*291 NOTIFYLIST<br />
: {str type}|{int4 id}<br />
: {str type}|{int4 id}<br />
: ...<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as required by NOTIFYGET. For messages it is the actual message id, for notifications it is the id of the related type; anime, group or producer. Since only file notifications related to anime is implemented atm, it is the anime id (aid).<br />
* NOTIFYLIST returns one line per entry, if no entries are available only the first line of the reply is returned.<br />
{{eyecatch|Note|This command MUST NOT be issued regularly but should only be triggered by either a push message received by the client or a reply to a NOTIFY command which tells you that there are messages/notifications waiting.}}<br />
<br />
----<br />
=== NOTIFYGET: Get Notification/Message ===<br />
Receive private message or file notification.<br />
<br />
'''Command String:'''<br />
* NOTIFYGET type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 292 NOTIFYGET<br />
: {int4 id}|{int4 from_user_id}|{str from_user_name}|{int4 date}|{int4 type}|{str title}|{str body}<br />
* 392 NO SUCH ENTRY<br />
when type = N<br />
* 293 NOTIFYGET<br />
: {int4 relid}|{int4 type}|{int2 count}|{int4 date}|{str relidname}|{str fids}<br />
* 393 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as given by NOTIFYLIST (or ''relid'' from 271 NOTIFICATION and mid from 272 NOTIFICATION)<br />
* for message entries (M):<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: type is the type of the message (0=normal msg, 1=annonymous, 2=system msg, 3=mod msg)<br />
* for notification entries (N):<br />
: relid is the id of the related type (anime)<br />
: relname is the name of the related type (anime)<br />
: type is the notification type (0=all, 1=new, 2=group, 3=complete)<br />
: count is the number of events pending for this subscription<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: fids is a comma separated list with the affected file ids<br />
<br />
----<br />
=== NOTIFYACK: Acknowledge Notification/Message ===<br />
This command will mark a message read or clear a ''new file'' notification. Buddy events are not acknowledgeable.<br />
<br />
'''Command String:'''<br />
* NOTIFYACK type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 281 NOTIFYACK SUCCESSFUL<br />
* 381 NO SUCH ENTRY<br />
when type = N<br />
* 282 NOTIFYACK SUCCESSFUL<br />
* 382 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
<br />
====Notification Packet Format====<br />
'''New File Notify:'''<br />
<br />
720 {int4 notify_packet_id} NOTIFICATION - NEW FILE<br />
{int4 fidlist}|{int2 reltype}|{int2 priority}<br />
<br />
* fidlist is a comma separated list of file ids<br />
* reltype is: 1 = anime, 2 = group, 3 = producer<br />
* priority is: 0 = low, 1 = medium, 2 = high<br />
* new file notifications are created as a batch, so it is not unusual to get several new files for a particular anime at once. It is in this case that a comma separated list of fids will be returned<br />
<br />
{{eyecatch|Note|Group (and producer) related file notifications are not implemented yet.}}<br />
<br />
<br />
'''New Private Message Notify:'''<br />
<br />
794 {int4 notify_packet_id} NOTIFICATION - NEW MESSAGE<br />
{int2 type}|{int4 date}|{int4 sent_by_uid}|{str sent_by_name}|{str subject}|{str body}|{int mid}<br />
<br />
* type is the type of the message (0=normal msg, 1=anonymous, 2=system msg, 3=mod msg)<br />
* date is the time the message was sent (in seconds since 1.1.1970)<br />
* sender uid/sender name are the user id and user name of the sender<br />
* subject is the message subject<br />
* body is message body (can be truncated)<br />
* mid is message id and can be used with NOTIFYACK<br />
<br />
'''Buddy Event Notify:'''<br />
753 {int4 notify_packet_id} NOTIFICATION - BUDDY<br />
{int4 buddy uid}|{int2 event type}<br />
* Possible event types:<br />
** 0 => LOGIN<br />
** 1 => LOGOUT<br />
** 2 => ACCEPTED<br />
** 3 => ADDED<br />
<br />
<br />
'''Going Down Event Notify:'''<br />
799 {int4 notify_packet_id} NOTIFICATION - SHUTTING DOWN<br />
{int4 time offline}|{int4 comment}<br />
<br />
* Clients with any notification on will receive the SHUTTING DOWN message before the API goes offline.<br />
* Time offline is the time in minutes the API will be down, 0 if indefinite (client can direct user to the AniDB site for status updates).<br />
* The comment is a short explanation for the downtime.<br />
* Only one datagram will be sent, and the server will not listen for replies.<br />
<br />
<br />
=== PUSHACK: UDP Notification Acknowledge ===<br />
Used to acknowledge notification packets (720-799). A client must be prepared to issue this command before using '''PUSH'''.<br />
<br />
'''Command String:'''<br />
* PUSHACK nid={int4 notify_packet_id}<br />
<br />
'''Possible Replies:'''<br />
* 701 PUSHACK CONFIRMED<br />
* 702 NO SUCH PACKET PENDING<br />
<br />
'''Info:'''<br />
* See: '''PUSH'''<br />
<br />
== Notification Commands ==<br />
<br />
=== NOTIFICATIONADD: Add Anime or Group to Notify List ===<br />
<br />
'''Command String:'''<br><br />
<br />
by anime id:<br />
* NOTIFICATIONADD aid={int4 aid}&type={int2 type}&priority={int2 priority}<br />
by group id:<br />
* NOTIFICATIONADD gid={int4 gid}&type={int2 type}&priority={int2 priority}<br />
<br><br />
'''Possible Replies:'''<br />
<br />
* 246 NOTIFICATION ITEM ADDED<br />
: {int4 notification id}<br />
* 248 NOTIFICATION ITEM UPDATED<br />
: {int4 notification id}<br />
* 399 NO CHANGES<br />
<br><br />
'''Info:'''<br />
* ''Priority'' values are 0: low, 1: medium, 2: high<br />
* ''Type'' values are 0: all, 1: new, 2: group, 3: complete<br />
<br />
=== NOTIFICATIONDEL: Remove Anime or Group from Notify List ===<br />
<br />
'''Command String:'''<br><br />
<br />
by anime id:<br />
* NOTIFICATIONDEL aid={int4 aid}<br />
by group id:<br />
* NOTIFICATIONDEL gid={int4 gid}<br />
<br><br />
'''Possible Replies:'''<br />
<br />
* 247 NOTIFICATION ITEM DELETED<br />
: {int4 notification_table}|{int4 relid}<br />
* 324 NO SUCH NOTIFICATION ITEM<br />
<br />
<br><br />
'''Info:'''<br />
* ''notification_table'' values are 1: anime, 2: group<br />
* ''relid'' value matches the aid/gid supplied<br />
<br />
== Buddy Commands ==<br />
Group of commands used to administrate your buddylist.<br />
<br />
=== BUDDYADD: Add a user to Buddy List ===<br />
'''Command String:'''<br />
* BUDDYADD uid={int4 buddy uid}<br />
* BUDDYADD uname={int4 buddy name}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 255 BUDDY ADDED<br />
* 355 BUDDY ALREADY ADDED<br />
<br />
----<br />
=== BUDDYDEL: Remove a user from Buddy List ===<br />
'''Command String:'''<br />
* BUDDYDEL uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 256 BUDDY DELETED<br />
<br />
----<br />
=== BUDDYACCEPT: Accept user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYACCEPT uid={int4 user uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 257 BUDDY ACCEPTED<br />
* 357 BUDDY ALREADY ACCEPTED<br />
<br />
----<br />
=== BUDDYDENY: Deny user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYDENY uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 258 BUDDY DENIED<br />
* 358 BUDDY ALREADY DENIED<br />
<br />
----<br />
=== BUDDYLIST: Retrieve Buddy List ===<br />
'''Command String:'''<br />
* BUDDYLIST startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 253 {int2 start} {int2 end} {int2 total} BUDDY LIST<br />
: {int4 uid}|{str username}|{int2 state}<br />
: ...<br />
'''Info:'''<br />
* state is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = this user is in your buddylist<br />
* bit 2 = this user has accepted you<br />
* bit 3 = this user is waiting for your approval<br />
<br />
----<br />
=== BUDDYSTATE: Retrieve Buddy States===<br />
'''Command String:'''<br />
* BUDDYSTATE startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 254 {int2 start} {int2 end} {int2 total} BUDDY STATE<br />
: {int4 uid}|{int2 onlinestate}<br />
: ...<br />
<br />
'''Info:'''<br />
* onlinestate is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = http online (user has issued a HTTP request within the last 10 minutes)<br />
* bit 2 = udp api online (user is currently connected to the udp api server)<br />
* example: 0=offline, 1=http online, 2=udp api online, 3=http&udp api online<br />
<br />
== Data Commands ==<br />
=== ANIME: Retrieve Anime Data ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIME aid={int4 id}[&amask={hexstr}]<br />
by name<br />
* ANIME aname={str anime name}[&amask={hexstr}]<br />
<br />
'''Possible Replies:'''<br />
<br />
If no ''amask'' is provided:<br />
* 230 ANIME<br />
: {int4 aid}|{int4 eps}|{int4 ep count}|{int4 special cnt}|{int4 rating}|{int4 votes}|{int4 tmprating}|{int4 tmpvotes}|{int4 review rating average}|{int4 reviews}|{str year}|{str type}|{str romaji}|{str kanji}|{str english}|{str other}|{str short names}|{str synonyms}|{str category list}<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* Fields are returned in the same order they appear in the ''amask'' field list: byte 1, bit 7 first<br />
* Synonyms and short names are separated with '<br />
* Category fields are separated with ',' and ordered by weight (desc). ''However'', be aware that categories are no longer used nor updated internally, and category responses are only returned to avoid breaking older clients. Use tags as a replacement. <br />
* By name: must be perfect match of romaji/kanji/english/other/synonym/short name.<br />
* 'Producer id list' and 'producer name list' match the data returned by the former producer bits (but using the revised creator ids)<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
* '''Note:''' The character id list is the first data to be truncated if needed. And then: tag list, synonym list, short name list. This applies to the FILE command too.<br />
* Selecting an 'unused' or 'reserved' bit will return an "illegal input" (505) response.<br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="5" align="center"><b>amask</b></td></tr><br />
<tr><br />
<td align="center"><b>Byte 1</b></td><br />
<td align="center"><b>Byte 2</b></td><br />
<td align="center"><b>Byte 3</b></td><br />
<td align="center"><b>Byte 4</b></td><br />
<td align="center"><b>Byte 5</b></td><br />
<td align="center"><b>Byte 6</b></td><br />
<td align="center"><b>Byte 7</b></td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int aid</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int dateflags</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 special ep count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int air date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int end date</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str url</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str picname</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int vote count</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 temp rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int temp vote count</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 average review rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int review count</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str award list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>bool is 18+ restricted</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int ANN id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int allcinema id</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str AnimeNfo id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str tag name list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int tag id list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>int tag weight list</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int date record updated</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int character id list</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 specials count</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 credits count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 other count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 trailer count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 parody count</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<br />
'''Related aid type (Byte 1, Bit 2):'''<br />
<pre><br />
value meaning<br />
<br />
1 sequel<br />
2 prequel<br />
11 same setting<br />
12 alternative setting<br />
32 alternative version<br />
41 music video<br />
42 character<br />
51 side story<br />
52 parent story<br />
61 summary<br />
62 full story<br />
100 other<br />
</pre><br />
<br />
'''Examples:''' (note that the given amask gives the same result as the default request)<br />
> ANIME aid=1&amask=b2f0e0fc000000&s=xxxxx<br />
< 230 ANIME<br />
1|1999-1999|TV Series|Space,Future,Plot Continuity,SciFi,Space Travel,Shipboard,Other Planet,Novel,Genetic Modification,Action,Romance,Military,Large Breasts,Gunfights,Adventure,Human Enhancement,Nudity|Seikai no Monshou|星界の紋章|Crest of the Stars||13|13|3|853|3225|756|110|875|11<br />
<br />
<br />
----<br />
<br />
=== ANIMEDESC: Retrieve Anime Description ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIMEDESC aid={int4 id}&part={int4 partno}<br />
<br />
'''Possible Replies:'''<br />
* 233 ANIMEDESC<br />
: {int4 current part}|{int4 max parts}|{str description}<br />
* 330 NO SUCH ANIME<br />
* 333 NO SUCH DESCRIPTION<br />
<br />
'''Info:'''<br />
* The maximum length of the anime description is roughly 5000 characters, but the maximum length of a UDP packet is 1400 bytes<br />
* Multiple calls to ANIMEDESC may be necessary to retrieve the complete text, retrieving separate 1400 byte parts with each call<br />
* ''part'' is zero-based<br />
* '''Note:''' No support, at present, for retrieving descriptions by title. ''aid'' only<br />
<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> ANIMEDESC aid=3169&part=0&s=xxxxx<br />
< 233 ANIMEDESC<br />
0|1|As summer break arrives for the students, Jun Sakurada is busily studying on his own in the library, making up for time lost <cut><br />
<br />
----<br />
=== CALENDAR: Get Upcoming Titles ===<br />
Returns the anime ids of the 25 most recently aired / released anime, directly followed by the next 25 anime due to be aired / released, ordered by start date.<br />
<br />
'''Command String:'''<br />
* CALENDAR<br />
<br />
'''Possible Replies:'''<br />
* 297 CALENDAR<br />
{int aid}|{int startdate}|{int dateflags}/n<br />
<br />
..repeated n times<br />
<br />
* 397 CALENDAR EMPTY<br />
<br />
'''Info:'''<br />
* Takes no parameters (other than the session string)<br />
* Titles returned are filtered by the 'show adult' preference of the logged in user. That is, users who have elected to hide adult content will have it hidden here as well.<br />
* Do not depend on the command always returning exactly 50 titles; there may not always be 25 future titles pending, depending on the user's 'adult' preferences, and the date in relation to the relation to the current anime season.<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
<br />
----<br />
=== CHARACTER: Get Character Information ===<br />
Returns character details associated with a given character ID, including associated anime ids, episode ids, and seiyuu.<br />
<br />
'''Command String:'''<br />
* CHARACTER charid={int characterid}<br />
<br />
'''Possible Replies:'''<br />
* 235 CHARACTER<br />
: {int charid}|{str character name kanji}|{str character name transcription}|{str pic}|{anime blocks}|{int episode list}|{int last update date}|{int2 type}|{str gender}<br />
<br />
: An 'anime block' is {int anime id},{int appearance},{int creatorid},{boolean is_main_seiyuu} repeated as many times as necessary, separated by a single quote ( ' ). <br />
<br />
* 335 NO SUCH CHARACTER<br />
<br />
'''Info:'''<br />
* If no seiyuu is associated with the character for a given aid, the 'creatorid' and 'is_main_seiyuu' fields will be empty, but the commas will remain.<br />
* An empty episode list is "undefined": no episode values have been added.<br />
* ''appearance'' values: 0='appears in', 1='cameo appearance in', 2='main character in', 3='secondary cast in'<br />
* ''type'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** 1 => 'Character'<br />
** 2 => 'Mecha'<br />
** 3 => 'Organisation'<br />
** 4 => 'Vessel' <br />
* ''gender'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** "M" => 'Male'<br />
** "F" => 'Female'<br />
** "I" => 'Intersexual'<br />
** "D" => 'Dimorphic'<br />
** "-" => 'none/does not apply'<br />
** "?" => 'unknown'<br />
<br />
'''Example:'''<br />
<br />
CHARACTER charid=488&s=DChan<br />
235 CHARACTER<br />
488|ニコ・ロビン|Nico Robin|14789.jpg|4097,2,1900,1'69,2,1901,0'6199,0,1900,1'5691,0,1900,1'2644,0,,'4851,0,1900,1||1236938094<br />
<br />
=== CREATOR: Get Creator Information ===<br />
<br />
'''Command String:'''<br />
* CREATOR creatorid={int creatorid}<br />
<br />
'''Possible Replies:'''<br />
* 245 CREATOR<br />
: {int creatorid}|{str creator name kanji}|{str creator name transcription}|{int type}|{str pic_name}|{str url_english}|{str url_japanese}|{str wiki_url_english}|{str wiki_url_japanese}|{int last update date}<br />
<br />
* 345 NO SUCH CREATOR<br />
<br />
'''Info:'''<br />
* ANIME AMASK byte6, bit5<br />
* ''type'' values: 1='person', 2='company', 3='collaboration'<br />
<br />
Example:<br />
<br />
245 CREATOR<br />
718|GAINAX|Gainax|2|10092.png||http://www.gainax.co.jp/|Gainax|Gainax|1237048093<br />
<br />
=== EPISODE: Retrieve Episode Data ===<br />
'''Command String:'''<br><br />
by eid<br />
* EPISODE eid={int eid}<br />
by anime and episode number<br />
* EPISODE aname={str anime name}&epno={int4 episode number}<br />
* EPISODE aid={int anime id}&epno={int4 episode number}<br />
<br />
'''Possible Replies:'''<br />
* 240 EPISODE<br />
: {int eid}|{int aid}|{int4 length}|{int4 rating}|{int votes}|{str epno}|{str eng}|{str romaji}|{str kanji}|{int aired}|{int type}<br />
* 340 NO SUCH EPISODE<br />
<br />
'''Info:'''<br />
* length is in minutes<br />
* Returned 'epno' includes special character (only if special) and padding (only if normal).<br />
** Special characters are S(special), C(credits), T(trailer), P(parody), O(other).<br />
* The ''type'' is the raw episode type, used to indicate numerically what the special character will be<br />
** 1: regular episode (no prefix), 2: special ("S"), 3: credit ("C"), 4: trailer ("T"), 5: parody ("P"), 6: other ("O")<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> EPISODE eid=1&s=xxxxx<br />
< 240 EPISODE<br />
1|1|24|400|4|01|Invasion|shinryaku|??<br />
<br />
> EPISODE aname=Seikai no Monshou&epno=2&s=xxxxx<br />
< 240 EPISODE<br />
2|1|24|750|2|02|Kin of the Stars|Hoshi-tachi no Kenzoku|??????|1295059229|1<br />
<br />
----<br />
<br />
=== FILE: Retrieve File Data ===<br />
'''Command String:'''<br><br />
by fid:<br />
* FILE fid={int4 id}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by size+ed2k hash:<br />
* FILE size={int8 size}&ed2k={str ed2khash}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by anime, group and epno<br />
* FILE aname={str anime name}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aname={str anime name}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
<br />
'''Possible Replies:'''<br />
* 220 FILE<br />
: {int4 fid}|{int4 aid}|{int4 eid}|{int4 gid}|{int4 state}|{int8 size}|{str ed2k}|{str anidbfilename}<br />
* 220 FILE<br />
: {int4 fid}|...(data list)<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 0}|{int4 fid 1}|...|{int4 fid n}<br />
* 320 NO SUCH FILE<br />
<br />
'''Info:'''<br />
* fid, aid, eid, gid are the unique ids for the file, anime, ep, group entries at AniDB.<br />
: You can use those to create links to the corresponding pages at AniDB.<br />
* anidbfilename is the AniDB filename for the file.<br />
: However this name does not contain all the extra information of the filenames on AniDB and might be composed slightly different.<br />
* fmask and amask are hexidecimal strings where each bit corresponds to a data field related to the specified file (see below). The data list received is sorted and returned in the same order as the tables: top to bottom, left to right, with fmask preceding amask. There is '''no''' provision to retrieve all fields. Further, requesting a 'unusued' or 'reserved' bit will return an "illegal input" error.<br />
* fid is always returned as the first value, regardless of what masks are provided.<br />
* Only the first matching file is returned when aname, gname and epno is used.<br />
* "audio codec" and "audio bitrate" will return multiple values if there are multiple audio streams present in the file. Values will be separated by a single quote. <br />
* For byte 1, bit 2 (other episodes): episode IDs will be followed by an integer '''percentage''' that indicate the percentage of the related episode this file covers. Typically 100%, there are cases where it will be 50, 30, or other values. This value provides no indication where, within an episode, the file represents. That is, 50% could mean the file covers the first half of the episode, the second half, or some 50% range in between.<br />
'''State:'''<br />
<pre><br />
bit / int value meaning<br />
1 / 1 FILE_CRCOK: file matched official CRC (displayed with green background in AniDB)<br />
2 / 2 FILE_CRCERR: file DID NOT match official CRC (displayed with red background in AniDB)<br />
3 / 4 FILE_ISV2: file is version 2<br />
4 / 8 FILE_ISV3: file is version 3<br />
5 / 16 FILE_ISV4: file is version 4<br />
6 / 32 FILE_ISV5: file is version 5<br />
7 / 64 FILE_UNC: file is uncensored<br />
8 / 128 FILE_CEN: file is censored<br />
<br />
examples:<br />
state ==== 9 ==> FILE_CRCOK+FILE_ISV3 ==> file matched official CRC and is version 3<br />
state ==== 0 ==> - ==> file was not crc checked and is version 1<br />
state ==== 34 ==> FILE_CRCERR+FILE_ISV5 ==> file DID NOT match official CRC and is version 5<br />
state ==== 1 ==> FILE_CRCOK ==> file matched official CRC and is version 1<br />
state ==== 8 ==> FILE_ISV3 ==> file was not CRC checked and is version 3<br />
</pre><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''fmask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
<td align="center">'''Byte 5'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 aid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 eid</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 gid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 mylist id</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>list other episodes</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>int2 IsDeprecated</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int2 state</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int8 size</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ed2k</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str md5</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str sha1</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str crc32</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>video colour depth</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str quality</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str audio codec list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 audio bitrate list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str video codec</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 video bitrate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str video resolution</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str file type (extension)</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str dub language</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str sub language</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 length in seconds</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str description</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 aired date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str anidb file name</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 mylist state</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 mylist filestate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 mylist viewed</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 mylist viewdate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str mylist storage</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str mylist source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str mylist other</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''amask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 anime total episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str category list</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str epno</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ep name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str ep romaji name</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str ep kanji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 episode rating</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 episode vote count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str group name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str group short name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int4 date aid record updated</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
'''Examples:''' (html escaped code intended)<br />
> FILE size=177747474&ed2k=70cd93fd3981cc80a8ea6a646ff805c9&fmask=7FF8FEF8&amask=C000F0C0&s=xxxxx<br />
< 220 FILE<br />
312498|4688|69260|4243|0||0|1|177747474|70cd93fd3981cc80a8ea6a646ff805c9|b2a7c7d591333e20495de3571b235c28|7af9b962c17ff729baeee67533e5219526cd5095|a200fe73|high|DTV|Vorbis (Ogg Vorbis)|104|H264/AVC|800|704x400|japanese|english'english'english|1560||1175472000|26|26|01|The Wings to the Sky|Sora he no Tsubasa|????|#nanoha-DamagedGoodz|Nanoha-DGz<br />
<br />
----<br />
<br />
=== GROUP: Retrieve Group Data ===<br />
'''Command String:'''<br><br />
by gid<br />
* GROUP gid={int gid}<br />
by name/shortname<br />
* GROUP gname={str group name}<br />
<br />
'''Possible Replies:'''<br />
* 250 GROUP<br />
: {int gid}|{int4 rating}|{int votes}|{int4 acount}|{int fcount}|{str name}|{str short}|{str irc channel}|{str irc server}|{str url}|{str picname}|{int4 foundeddate}|{int4 disbandeddate}|{int2 dateflags}|{int4 lastreleasedate}|{int4 lastactivitydate}|{list grouprelations}<br />
* 350 NO SUCH GROUP<br />
<br />
'''Info:'''<br />
* Requires login<br />
* ''gname'' is an exact match of either a group name or short name<br />
* As either name and short names are unique if there is a result from GROUP request by name that will be the only match<br />
* ''dateflags'' values:<br />
** bit0 set == Foundeddate, Unknown Day<br />
** bit1 set == Foundeddate, Unknown Month, Day<br />
** bit2 set == Disbandeddate, Unknown Day<br />
** bit3 set == Disbandeddate, Unknown Month, Day<br />
** bit5 set == Foundeddate, Unknown Year<br />
** bit6 set == Disbandeddate, Unknown Year<br />
* ''releasedate'' and ''activitydate'' are distinct. ''releasedate'' is the date a file was actually released by the group, where ''activitydate'' is the date of a file being added to AniDB. As such, lastrelease may very well be much older than lastactivity.<br />
* ''groupreleations'' is a list of apostrophe-separated pairs, where each pair consists of {int4 othergroupid},{int2 relationtype}<br />
** relationtype:<br />
*** 1 => "Participant in"<br />
*** 2 => "Parent of"<br />
*** 4 => "Merged from"<br />
*** 5 => "Now known as"<br />
*** 6 => "Other"<br />
<br />
'''Example:'''<br />
> GROUP gid=7091&s=bunny<br />
< 250 GROUP<br />
7091|832|1445|43|566|Frostii|Frostii|#frostii|irc.rizon.net|http://frostii.com|15844.jpg|1228089600|0|1|1301875200|1304222640|7255,1'3097,4'748,4'8106,1'8159,2'8402,1'8696,1'9022,1<br />
<br />
----<br />
<br />
=== GROUPSTATUS: Get Completed Episode ===<br />
Returns a list of group names and ranges of episodes released by the group for a given anime.<br />
<br />
'''Command String:'''<br />
* GROUPSTATUS aid={int animeid}[&state={int completion_state}]<br />
<br />
'''Possible Replies:'''<br />
* 225 GROUPSTATUS<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: ... (repeated)<br />
<br />
* 325 NO SUCH GROUPS FOUND<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* The seven fields will be repeated as necessary, one for each group, separated by a new line character<br />
* Groups will be filtered by the languages selected in the user's profile<br />
* If ''state'' is not supplied, groups with a completion state of <i>'ongoing'</i>, <i>'finished'</i>, or <i>'complete'</i> are returned<br />
* Groups are returned in order of descending episode count<br />
* If there are more groups to return than can be stored in a UDP packet, additional groups will be silently discarded<br />
* ''state'' values: <br />
#ongoing<br />
#stalled<br />
#complete<br />
#dropped<br />
#finished<br />
#specials only<br />
<br />
'''Example:'''<br />
> GROUP GROUPSTATUS aid=8692&s=vLl1N<br />
< 225 GROUPSTATUS<br />
7407|Coalgirls|3|25|839|12|1-25<br />
9863|Hadena Subs|3|25|374|1|1-25<br />
11951|ChaosBlades|3|25|0|0|1-25<br />
[truncated]<br />
<br />
=== UPDATED: Get List of Updated Anime IDs ===<br />
Returns a list of AniDB anime ids of anime that have been updated in in a given time frame, ordered by descending age (oldest to newest change).<br />
<br />
'''Command String:'''<br />
* UPDATED entity=1&[age={int4 id}|time={int4 date}]<br />
<br />
'''Possible Replies:'''<br />
* 243 UPDATED<br />
{int entity}|{int total count}|{int last update date}|{list aid}<br />
<br />
* 343 NO UPDATES<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1<br />
* Either ''age'' OR ''time'' can be specified, but not both<br />
* ''age'' is specified in days.<br />
** eg: age=30 requests a list of aid values of anime that have changed in the past 30 days<br />
* ''time'' is specified in unix time.<br />
** eg: time=1264982400 requests a list of aid values of anime that have changed since 2010-02-01<br />
* A maximum of 200 values will be returned<br />
* ''count'' specifies the total number of items found for the given time period. In short, if this value is great than 200, you have not retrieved all applicable ids.<br />
* ''last update date'' will contain the AniDB update time of the ''last'' aid to appear on the list<br />
* A given list value will appear only once. If there have been multiple changes to an entity, its age will reflect the most recent change.<br />
<br />
'''An anime will be considered updated if:'''<br />
* A change is made to the anime record itself<br />
* An ''main'' or ''official'' anime title is added, edited, or deleted (not ''short'' or ''synonym'')<br />
* An episode for the anime is added, or delete (but NOT edited!)<br />
* An episode title is added, edited, or delete<br />
* An anime relation is added, or deleted<br />
<br />
== MyList Commands ==<br />
=== MYLIST: Retrieve MyList Data ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLIST lid={int4 lid}<br />
by fid:<br />
* MYLIST fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLIST size={int4 size}&ed2k={str ed2khash}<br />
by anime + group + epno<br />
* MYLIST aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 221 MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 312 MULTIPLE MYLIST ENTRIES<br />
: {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}<br />
* 321 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* The state field provides information about the location and sharing state of a file in MyList.<br />
* 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).<br />
* eps is a list of episodes, e.g. "1-12,14-16,T1"<br />
<br />
'''States:'''<br />
0 - unknown - state is unknown or the user doesn't want to provide this information<br />
1 - on hdd - the file is stored on hdd (but is not shared)<br />
2 - on cd - the file is stored on cd<br />
3 - deleted - the file has been deleted or is not available for other reasons (i.e. reencoded)<br />
<br />
'''Filestates:''' (for normal files, i.e. not generic)<br />
0 => normal/original<br />
1 => corrupted version/invalid crc<br />
2 => self edited<br />
10 => self ripped<br />
11 => on dvd<br />
12 => on vhs<br />
13 => on tv<br />
14 => in theaters<br />
15 => streamed<br />
100 => other<br />
<br />
'''Example:'''<br />
> MYLIST aname=gits sac&s=xxxxx<br />
< 322 MULTIPLE FILES FOUND<br />
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<br />
<br />
----<br />
=== MYLISTADD: Add file to MyList ===<br />
The command string for MYLISTADD is made of up two blocks: a 'fileinfo' block, which limits the command to a specific file, or an 'animeinfo'/'groupinfo'/'episodeinfo' block, which can be used to specify a range of files, including generics. Additionally, a number of optional parameters can be included with either set.<br />
<br />
'''Adding a single file to the MyList with the 'fileinfo' block'''<br />
<br />
* MYLISTADD fid={int4 fid}<br />
'''or'''<br />
* MYLISTADD size={int4 size}&ed2k={str ed2khash}<br />
'''or'''<br />
* MYLISTADD lid={int4 lid}&edit=1 (valid for edit only)<br />
<br />
'''Adding one or more files to the MyList with the 'animeinfo'/'groupinfo'/'episodeinfo' block'''<br />
<br />
Here, you have a number of options, depending on what data you have available. In brief, 'animeinfo' represents a choice between anime id and anime name. 'groupinfo' represents a choice between group id, group name, and generic=1. 'episodeinfo' represents a range of one or more episodes.<br />
<br />
* MYLISTADD aid={int4 aid}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&generic=1&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&generic=1&epno={int4 episode number}<br />
<br />
Each command listed can have, in addition, a number of optional components to provide further MyList details. Append these as desired.<br />
<br />
* &state={int2 state}<br />
* &viewed={boolean viewed}<br />
* &viewdate={int4 viewdate}<br />
* &source={str source}<br />
* &storage={str storage}<br />
* &other={str other}<br />
<br />
Finally, edit=1 can be included to edit a MyList entry instead of creating a new one. When editing, optional values that are not supplied retain their original value. That is, they are ''not'' replaced with default or empty values. Only values supplied are updated.<br />
<br />
'''Possible Replies:'''<br />
* 320 NO SUCH FILE<br />
* 330 NO SUCH ANIME<br />
* 350 NO SUCH GROUP<br />
when edit=0 and adding by fid, size/ed2k<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 mylist id of new entry}<br />
when edit=0 and adding by aname, aid<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 number of entries added}<br />
* 310 FILE ALREADY IN MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 1}|{int4 fid 2}|...|{int4 fid n}<br />
when edit=1<br />
* 311 MYLIST ENTRY EDITED<br />
* 311 MYLIST ENTRY EDITED<br />
: {int4 number of entries edited}<br />
* 411 NO SUCH MYLIST ENTRY<br />
<br />
'''Info:'''<br />
* All data except lid/fid/size+hash/generic is optional.<br />
* Viewed should be 0 for unwatched files and 1 for watched files.<br />
* If viewdate is not specified, the current time will be used. The field will be disregarded if viewed=0.<br />
* Other is the only field which may contain newlines, but they have to be stored as &lt;br /&gt;<br />
* For state values refer to: '''MYLIST'''<br />
* If you want to change an existing entry and already know its MyList id (lid) please use the lid-version of this command. It put less load on the server.<br />
* epno=0 means all eps (default), negative numbers means upto. (-12 -> upto 12)<br />
* group is optional only when edit=1, meaning you can't add every file for an anime<br />
* If the file already exists (response code 310), the ''current'' record will be returned, in the same format as the MYLIST response.<br />
----<br />
<br />
=== MYLISTDEL: Remove file from MyList ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLISTDEL lid={int4 lid}<br />
by fid:<br />
* MYLISTDEL fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLISTDEL size={int4 size}&ed2k={str ed2k hash}<br />
by anime + group + epno<br />
* MYLISTDEL aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 211 MYLIST ENTRY DELETED<br />
: {int4 number of entries}<br />
* 411 NO SUCH MYLIST ENTRY<br />
'''Info:'''<br />
* group is optional<br />
* command will delete all enties found<br />
<br />
----<br />
=== MYLISTSTATS : Retrieve MyList stats ===<br />
'''Command String:'''<br />
* MYLISTSTATS<br />
'''Possible Replies:'''<br />
* 222 MYLIST STATS<br />
{animes}|{eps}|{files}|{size of files}|{added animes}|{added eps}|{added files}|{added groups}|{leech %}|{glory %}|{viewed % of db}|{mylist % of db}|{viewed % of mylist}|{number of viewed eps}|{votes}|{reviews}|{viewed length in minutes}<br />
<br />
'''Info:'''<br />
* All fields are int<br />
<br />
----<br />
<br />
=== VOTE: Vote for specified anime/episode/group ===<br />
'''Command String:'''<br><br />
by id<br />
* VOTE type={int2 type}&id={int4 id}[&value={int4 vote value}&epno={int4 episode number}]<br />
by name<br />
* VOTE type={int2 type}&name={string name}[&value={int4 vote value}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 260 VOTED<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 261 VOTE FOUND<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 262 VOTE UPDATED<br />
: {str entity name}|{old vote value}|{vote type}|{entity id}<br />
* 263 VOTE REVOKED<br />
: {str entity name}|{revoked vote value}|{vote type}|{entity id}<br />
* 360 NO SUCH VOTE<br />
: {str entity name}|0|{vote type}|{entity id}<br />
* 361 INVALID VOTE TYPE<br />
* 362 INVALID VOTE VALUE<br />
* 363 PERMVOTE NOT ALLOWED<br />
: {str aname}|{vote value}|{type}|{entity id}<br />
* 364 ALREADY PERMVOTED<br />
: {str entity name}|{existing vote value}|{vote type}|{entity id}<br />
<br />
'''Info:'''<br />
* type: 1=anime, 2=anime tmpvote, 3=group<br />
* entity: anime, episode, or group<br />
* for episode voting add epno on type=1<br />
* value: negative number means revoke, 0 means retrieve (default), 100-1000 are valid vote values, rest is illegal<br />
* votes will be updated automatically (no questions asked)<br />
* tmpvoting when there exist a perm vote is not possible<br />
<br />
----<br />
<br />
=== RANDOM: Get a random anime ===<br />
'''Command String:'''<br />
* RANDOMANIME type={int4 type}<br />
<br />
'''Possible Replies:'''<br />
* 230 ANIME ... (see ANIME)<br />
<br />
'''Info:'''<br />
* type: 0=from db, 1=watched, 2=unwatched, 3=all mylist<br />
<br />
== Misc Commands ==<br />
=== MYLISTEXPORT: Schedule a MyList Export ===<br />
Queues a {{AniDBLink|export|MyList Export}} by the AniDB Servers. As with a manual export request, exports are only done during periods when server load is low. As a result, exports may take up to 24 hours. The client submitting the request will receive an AniDB message when the export is ready to be collected.<br />
<br />
Only one export can be in the queue at a time.<br />
<br />
'''Command String:'''<br />
* MYLISTEXPORT [template={str template_name}|cancel=1]<br />
<br />
'''Possible Replies:'''<br />
* 217 EXPORT QUEUED<br />
* 218 EXPORT CANCELLED<br />
* 317 EXPORT NO SUCH TEMPLATE<br />
* 318 EXPORT ALREADY IN QUEUE<br />
* 319 EXPORT NO EXPORT QUEUED OR IS PROCESSING<br />
<br />
'''Info:'''<br />
* ''template_name'' must match an available export template on the {{AniDBLink|export|MyList Export}} page.<br />
* ''cancel'' will cancel any pending export request, queued either through UDP or the web server.<br />
* Clients can subscribe the message notifications if they wish to be notified when an export is complete.<br />
<br />
----<br />
<br />
=== PING: Ping Command ===<br />
'''Command String:'''<br />
* PING [nat=1]<br />
<br />
'''Possible Replies:'''<br />
* 300 PONG<br />
: {int4 port} ''(when nat=1)''<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* May be used by a frontend to determine if the API is still available.<br />
* May be executed even if not yet logged in.<br />
* The option <tt>nat=1</tt> provides an easy way to determine if the router has changed the outgoing port. ({{t|587}})<br />
<br />
----<br />
<br />
=== VERSION: Retrieve Server Version ===<br />
'''Command String:'''<br />
* VERSION<br />
<br />
'''Possible Replies:'''<br />
* 998 VERSION<br />
: {str server version}<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
<br />
----<br />
=== UPTIME: Retrieve Server Uptime ===<br />
'''Command String:'''<br />
* UPTIME<br />
<br />
'''Possible Replies:'''<br />
* 208 UPTIME<br />
: {int4 udpserver uptime in milliseconds}<br />
<br />
'''Info:'''<br />
* This command is the preferred way to check that the session is OK.<br />
<br />
----<br />
=== ENCODING: Change Encoding for Session ===<br />
Sets preferred [[Wikipedia:Character encoding|encoding]] per session. The preferred way to do this is to use the '''enc''' argument for AUTH. This command is mostly for testing.<br />
<br />
'''Command String:'''<br />
* ENCODING name={str encoding name}<br />
<br />
'''Possible Replies:'''<br />
* 219 ENCODING CHANGED<br />
* 519 ENCODING NOT SUPPORTED<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* Supported encodings: http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html<br />
* Default: ASCII.<br />
* Resets to default on logout.<br />
<br />
----<br />
<br />
=== SENDMSG: Send Message ===<br />
'''Command String:'''<br />
* SENDMSG to={str username}&title={str title}&body={str body}<br />
<br />
'''Possible Replies:'''<br />
* 294 SENDMSG SUCCESSFUL<br />
* 394 NO SUCH USER<br />
* 501 LOGIN FIRST<br />
<br />
'''Note:'''<br />
* This command allows you to send an AniDB message.<br />
{{eyecatch|Important|<br />
title must not be longer than 50 chars.<br><br />
body must not be longer than 900 chars.<br />
}}<br />
<br />
----<br />
=== USER: Retrieve User UID ===<br />
'''Command String:'''<br />
* USER [user={str user name}|uid={int user id}]<br />
<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 295 USER<br />
: {int4 uid}|{str username}<br />
<br />
----<br />
<br />
=== STATS [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* STATS<br />
<br />
'''Possible Replies:'''<br />
* 206 STATS<br />
: {int4 animes)|{int4 eps}|{int4 files}|{int4 groups}|{int4 users}|{int8 total file size in bytes}|{int4 open [[creq|creqs]]}<br />
<br />
----<br />
=== TOP [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* TOP<br />
<br />
'''Possible Replies:'''<br />
* 207 TOP<br />
: {str longest mylist}|{int count}<br />
: {str largest mylist}|{int count}<br />
: {str most lame files}|{int count}<br />
: {str most indep. user}|{int count}<br />
: {str biggest leecher}|{int count}<br />
: {str most anime added}|{int count}<br />
: {str most eps added}|{int count}<br />
: {str most files added}|{int count}<br />
: {str most groups added}|{int count}<br />
: {str most votes}|{int count}<br />
: {str most reviews}|{int count}<br />
<br />
'''Info:'''<br />
* All strings are user names.<br />
* 'Hide myself in IRC stats' applies for this too.<br />
<br />
== Fatal Errors ==<br />
At anypoint int the retrieval process you have to expect the following output:<br />
* 6xx INTERNAL SERVER ERROR<br />
: ERROR: {str errormessage}<br />
OR<br />
*6xx INTERNAL SERVER ERROR - {str errormessage}<br />
<br />
Such errors should be reported back to [[User:Ommina|Ommina]].<br />
(xx is a number between 00 and 99)<br />
<br />
If you supply an unknown or unimplemented command you will get an error:<br />
* 598 UNKNOWN COMMAND<br />
<br />
== Return Codes ==<br />
{{eyecatch|Note|While the names below '''are''' the actual code strings returned by the server, clients are nonetheless encouraged to work with the numeric codes instead. }}<br />
<pre><br />
LOGIN_ACCEPTED = 200<br />
LOGIN_ACCEPTED_NEW_VERSION = 201<br />
LOGGED_OUT = 203<br />
RESOURCE = 205<br />
STATS = 206<br />
TOP = 207<br />
UPTIME = 208<br />
ENCRYPTION_ENABLED = 209<br />
MYLIST_ENTRY_ADDED = 210<br />
MYLIST_ENTRY_DELETED = 211<br />
ADDED_FILE = 214<br />
ADDED_STREAM = 215<br />
EXPORT_QUEUED = 217<br />
EXPORT_CANCELLED = 218<br />
ENCODING_CHANGED = 219<br />
FILE = 220<br />
MYLIST = 221<br />
MYLIST_STATS = 222<br />
WISHLIST = 223<br />
NOTIFICATION = 224<br />
GROUP_STATUS = 225<br />
WISHLIST_ENTRY_ADDED = 226<br />
WISHLIST_ENTRY_DELETED = 227<br />
WISHLIST_ENTRY_UPDATED = 228<br />
MULTIPLE_WISHLIST = 229<br />
ANIME = 230<br />
ANIME_BEST_MATCH = 231<br />
RANDOM_ANIME = 232<br />
ANIME_DESCRIPTION = 233<br />
REVIEW = 234<br />
CHARACTER = 235<br />
SONG = 236<br />
ANIMETAG = 237<br />
CHARACTERTAG = 238<br />
EPISODE = 240<br />
UPDATED = 243<br />
TITLE = 244<br />
CREATOR = 245<br />
NOTIFICATION_ENTRY_ADDED = 246<br />
NOTIFICATION_ENTRY_DELETED = 247<br />
NOTIFICATION_ENTRY_UPDATE = 248<br />
MULTIPLE_NOTIFICATION = 249<br />
GROUP = 250<br />
CATEGORY = 251<br />
BUDDY_LIST = 253<br />
BUDDY_STATE = 254<br />
BUDDY_ADDED = 255<br />
BUDDY_DELETED = 256<br />
BUDDY_ACCEPTED = 257<br />
BUDDY_DENIED = 258<br />
VOTED = 260<br />
VOTE_FOUND = 261<br />
VOTE_UPDATED = 262<br />
VOTE_REVOKED = 263<br />
HOT_ANIME = 265<br />
RANDOM_RECOMMENDATION = 266<br />
RANDOM_SIMILAR = 267<br />
NOTIFICATION_ENABLED = 270<br />
NOTIFYACK_SUCCESSFUL_MESSAGE = 281<br />
NOTIFYACK_SUCCESSFUL_NOTIFIATION = 282<br />
NOTIFICATION_STATE = 290<br />
NOTIFYLIST = 291<br />
NOTIFYGET_MESSAGE = 292<br />
NOTIFYGET_NOTIFY = 293<br />
SENDMESSAGE_SUCCESSFUL = 294<br />
USER_ID = 295<br />
CALENDAR = 297<br />
<br />
PONG = 300<br />
AUTHPONG = 301<br />
NO_SUCH_RESOURCE = 305<br />
API_PASSWORD_NOT_DEFINED = 309<br />
FILE_ALREADY_IN_MYLIST = 310<br />
MYLIST_ENTRY_EDITED = 311<br />
MULTIPLE_MYLIST_ENTRIES = 312<br />
WATCHED = 313<br />
SIZE_HASH_EXISTS = 314<br />
INVALID_DATA = 315<br />
STREAMNOID_USED = 316<br />
EXPORT_NO_SUCH_TEMPLATE = 317<br />
EXPORT_ALREADY_IN_QUEUE = 318<br />
EXPORT_NO_EXPORT_QUEUED_OR_IS_PROCESSING = 319<br />
NO_SUCH_FILE = 320<br />
NO_SUCH_ENTRY = 321<br />
MULTIPLE_FILES_FOUND = 322<br />
NO_SUCH_WISHLIST = 323<br />
NO_SUCH_NOTIFICATION = 324<br />
NO_GROUPS_FOUND = 325<br />
NO_SUCH_ANIME = 330<br />
NO_SUCH_DESCRIPTION = 333<br />
NO_SUCH_REVIEW = 334<br />
NO_SUCH_CHARACTER = 335<br />
NO_SUCH_SONG = 336<br />
NO_SUCH_ANIMETAG = 337<br />
NO_SUCH_CHARACTERTAG = 338<br />
NO_SUCH_EPISODE = 340<br />
NO_SUCH_UPDATES = 343<br />
NO_SUCH_TITLES = 344<br />
NO_SUCH_CREATOR = 345<br />
NO_SUCH_GROUP = 350<br />
NO_SUCH_CATEGORY = 351<br />
BUDDY_ALREADY_ADDED = 355<br />
NO_SUCH_BUDDY = 356<br />
BUDDY_ALREADY_ACCEPTED = 357<br />
BUDDY_ALREADY_DENIED = 358<br />
NO_SUCH_VOTE = 360<br />
INVALID_VOTE_TYPE = 361<br />
INVALID_VOTE_VALUE = 362<br />
PERMVOTE_NOT_ALLOWED = 363<br />
ALREADY_PERMVOTED = 364<br />
HOT_ANIME_EMPTY = 365<br />
RANDOM_RECOMMENDATION_EMPTY = 366<br />
RANDOM_SIMILAR_EMPTY = 367<br />
NOTIFICATION_DISABLED = 370<br />
NO_SUCH_ENTRY_MESSAGE = 381<br />
NO_SUCH_ENTRY_NOTIFICATION = 382<br />
NO_SUCH_MESSAGE = 392<br />
NO_SUCH_NOTIFY = 393<br />
NO_SUCH_USER = 394<br />
CALENDAR_EMPTY = 397<br />
NO_CHANGES = 399<br />
<br />
NOT_LOGGED_IN = 403<br />
NO_SUCH_MYLIST_FILE = 410<br />
NO_SUCH_MYLIST_ENTRY = 411<br />
MYLIST_UNAVAILABLE = 412<br />
<br />
LOGIN_FAILED = 500<br />
LOGIN_FIRST = 501<br />
ACCESS_DENIED = 502<br />
CLIENT_VERSION_OUTDATED = 503<br />
CLIENT_BANNED = 504<br />
ILLEGAL_INPUT_OR_ACCESS_DENIED = 505<br />
INVALID_SESSION = 506<br />
NO_SUCH_ENCRYPTION_TYPE = 509<br />
ENCODING_NOT_SUPPORTED = 519<br />
BANNED = 555<br />
UNKNOWN_COMMAND = 598<br />
<br />
INTERNAL_SERVER_ERROR = 600<br />
ANIDB_OUT_OF_SERVICE = 601<br />
SERVER_BUSY = 602<br />
NO_DATA = 603<br />
TIMEOUT - DELAY AND RESUBMIT = 604<br />
API_VIOLATION = 666<br />
<br />
PUSHACK_CONFIRMED = 701<br />
NO_SUCH_PACKET_PENDING = 702<br />
<br />
VERSION = 998</pre><br />
<br />
[[Category:Development]]<br />
[[Category:UDP]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=UDP_API_Definition&diff=22789UDP API Definition2017-04-10T22:37:02Z<p>Ommina: /* PUSHACK: UDP Notification Acknowledge */</p>
<hr />
<div>{{TOCright}}<br />
<br />
== General Information ==<br />
'''Author:''' [[User:Exp|Exp]] & [[User:Epoximator|Epoximator]] & [[User:Ommina|Ommina]]<br><br />
'''Version:''' 0.03.730 (2015-03-25)<br><br />
'''Version number used for protover parameter:''' "3"<br />
<br />
'''IMPORTANT INFORMATION FOR ALL INTERESTED:'''<br />
* If you are mainly interested in notifications and private messaging, check out our [[Jabber]] and [[RSSRDF]] support first.<br />
* The UDP API is not an appropriate choice if you desire to download a local copy of the AniDB database.<br />
* If you want to create a client you have to register it {{AniDBLink|client|here}} and [[UDP Clients|here]].<br />
** Check out the clients that are being developed. There exists usable code in many different languages already.<br />
* If you have suggestions for improvements or new features use the [[UDP API DEV|development]] page.<br />
* Please also take a look at the [[API]] page.<br />
<br />
== Formats used in this Spec ==<br />
* {vartype varname} - Specifies what shall be inserted at this point and its type.<br />
* [...] - Everything between [ and ] is optional.<br />
<br />
=== Used types ===<br />
* ''int2'' - 2 byte Integer (in string representation)<br />
* ''int4'' - 4 byte Integer (in string representation)<br />
* ''boolean'' - true or false - use '1' for ''true'', '0' for ''false''<br />
* ''str'' - String (UDP packet length restricts string size to 1400 bytes)<br />
* ''hexstr'' -- a hex representation of a decimal value, two characters per byte. If multiple bytes are represented, byte one is the first two characters of the string, byte two the next two, and so on.<br />
<br />
=== Content Encoding ===<br />
* Default character encoding: ''ASCII''<br />
* Escape scheme for option values (to server): ''html form encoding'' + ''newline''<br />
** This means you have to encode at least <tt>&</tt> in your option values in html form encoding style (<tt>&amp;amp;</tt>) before sending them to the api server. All other html form encodings are optional.<br />
** All newlines should be replaced by &lt;br /&gt;<br />
* Escape scheme for returned data fields (from server): ', | and newline<br />
** Content newlines are encoded as &lt;br /&gt;, ' is encoded as ` and | is encoded as /.<br />
** Dates are returned in unix time (number of seconds elapsed since January 1, 1970 00:00:00 UTC)<br />
<br />
== Basics ==<br />
=== General ===<br />
The network communication is ''packet'' and ''line'' based. Each AniDB API command is exactly one UDP packet containing one line. Results are sent as one packet but may consist out of multiple lines. A return value always starts with a 3 byte result code followed by a human readable version of the result code. Be aware that important data fields may be returned directly after the return code (see: 200,201,209,271,272,504).<br />
The meaning for all result codes can be found in this document. If there is more than one entry returned, it's one entry per line. Lines are terminated by a <tt>\n</tt> (no dos linefeed <tt>\r</tt>). The elements of a format string are separated by a "|" character.<br />
<br />
<tt>{three digit return code} {str return string}\n</tt><br><br />
<tt>{data field 0}|{data field 1}|...|{data field n}</tt><br />
<br />
'''IMPORTANT:'''<br />
* All commands except PING, ENCRYPT, ENCODING, AUTH and VERSION '''requires''' login, meaning that the ''session tag'' must be set (<tt>s=xxxxx</tt>).<br />
* A client should ignore any additional trailing data fields it doesn't expect. Additional fields are going to be added to the output of some commands from time to time. Those additional fields will simply be appended to the end of the existing output. A client should be written in a way so that it is not affected by such new fields.<br />
* Due to the length constraints of an UDP package (over PPPoE) the replies from the server will never exceed 1400 bytes. String fields will be truncated if necessary to ensure this. No warnings are given when this happens.<br />
* A client should handle all possible return codes for each command.<br />
** Possible return codes for '''all commands''':<br />
*** 505 ILLEGAL INPUT OR ACCESS DENIED<br />
*** 555 BANNED<br />
***: {str reason}<br />
*** 598 UNKNOWN COMMAND<br />
*** 600 INTERNAL SERVER ERROR<br />
*** 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
*** 602 SERVER BUSY - TRY AGAIN LATER<br />
*** 604 TIMEOUT - DELAY AND RESUBMIT<br />
** Additional return codes for all commands that '''require login''':<br />
*** 501 LOGIN FIRST<br />
*** 502 ACCESS DENIED<br />
*** 506 INVALID SESSION<br />
<br />
{{eyecatch|Note|The '555 BANNED' message should not be expected by the client. This message is only enabled temporary to help developers understand what they are doing wrong.}}<br><br />
<br />
{{eyecatch|Note|<br />
While in daily maintenance the AniDB API will reply with<br />
<br />
601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
<br />
to all commands. If a client receives such a return value it should wait at least 30 minutes before trying again.}}<br />
<br />
=== Server / UDP Connection ===<br />
The Client has to send data packets to:<br />
* '''Server:''' api.anidb.net<br />
* '''Port:''' 9000/UDP<br />
The servername and port should not be hardcoded into a frontend but should be read from a configuration file.<br />
<br />
=== Server Errors ===<br />
* At any time the API might return a fatal error of the form:<br />
: <tt>6xx ERROR DESCRIPTION</tt><br />
* Possible codes are 600-699.<br />
* Occurrences of these errors (except 601 and 602) should be reported to [[User:Ommina|Ommina]].<br />
{{eyecatch|Note|6XX messages do not always return the tags given with the command which caused the error!}}<br />
<br />
=== Connection Problems ===<br />
There are many ways for a client to end up banned or the API might currently be handling too many concurrent connections.<br />
If a client does not get any reply to an AUTH command it should start to increase the retry delay exponentially with every failed login attempt. (i.e. try again after 30 seconds if the first login attempt failed, if the second fails too retry after 2 minutes, then 5 minutes, then 10 minutes, then 30 minutes, ... until you reach a retry delay of ~2-4h.)<br />
<br />
=== Local Port ===<br />
A client should select a fixed local port >1024 at install time and reuse it for local UDP Sockets. If the API sees too many different UDP Ports from one IP within ~1 hour it will ban the IP. (So make sure you're reusing your UDP ports also for testing/debugging!)<br />
<br />
The local port may be hardcoded, however, an option to manually specify another port should be offered.<br />
<br />
'''Note when behind a [[Wikipedia:Network address translation|NAT]]/masquerading router:'''<br><br />
A session between the server and a client is identified by the ''IP and port'' used by the client. So when the port (or IP) changes within a session the client has to authenticate again. If a client is behind a NAT router it can’t actually control the local port used for the connection. The router will normally ''translate'' the port to support several computers on a LAN to share the Internet connection. The public port (as determined by the router and seen by the server) which has been assigned to the connection will only be reserved for as long as it is in use. This means that the router will usually ''deallocate the port after a fixed timeout period'' (eg. five, ten or 15 minutes). Once that happens the client will no longer be able to receive UDP messages from the server (the messages will be discarded as undeliverable by the router) and a new port will be selected once the client tries to send a message to the server (which will result in a new connection session - '''Note:''' This could get you banned!, see above). So in order to keep a session over a NAT router alive, the client has to ping the server within the router's deallocation period to prevent a timeout.<br />
<br />
The client can decide whether it is behind a NAT router or not by adding <tt>nat=1</tt> to the AUTH command. This will cause the response to include the IP and port as seen by the server. If the port differs from the port reported by the local socket, the connection subject to NAT and the client should issue PING commands in regular intervals. Please do not send pings more often than is necessary to keep NAT connections alive.<br />
<br />
=== Flood Protection ===<br />
To prevent high server load the UDP API server enforces a strict flood protection policy.<br />
* Short Term:<br />
** A Client MUST NOT send more than 0.5 packets per second (that's one packet every two seconds, not two packets a second!)<br />
** The server will start to enforce the limit after the first 5 packets have been received.<br />
* Long Term:<br />
** A Client MUST NOT send more than one packet every four seconds over an extended amount of time.<br />
** ''An extended amount of time'' is not defined. Use common sense.<br />
<br />
Once a client exceeds a rate limit all further UDP packets from that client will be dropped without feedback until the client's packet rate is back down to acceptable levels.<br />
<br />
{{eyecatch|Note|Dropped packets are still taken into account for the packet rate. Meaning if you continuously send packets your client will be banned forever.}}<br />
<br />
Generally clients should be written in a way to minimize server and network load. You should always keep that in mind.<br />
<br />
Abusive clients may be banned completely.<br />
<br />
{{eyecatch|Note|<br />
If you suddenly stop getting replies from the AniDB API or you normally don't have a notable packetloss and from one point on you suddenly note a high packetloss percentage you have most likely entered a critical flood ratio.<br />
If the AniDB API isn't answering at all it might either be down or you have been banned, this is normally caused by violating the API specs (i.e. too many connections using different ports from one IP, too many auth failures, ...) (usually lasts 30 minutes).<br />
If you're experiencing packet loss you have probably reached the rate limit and the API starts to randomly drop incoming packets from your IP. (can be solved by enforcing a delay between multiple commands when you're sending a batch)}}<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Caching ===<br />
To minimize server and network load a client should use local caching in order to prevent repeated API requests for the same data.<br />
<br />
A client should locally cache FILE/EP/ANIME/GROUP/... info wherever possible for extended amounts of time.<br />
(I.e. if a client is used to scan a local folder with anime files and add them via API to a users MyList then it shall only ask for all files in the first run and cache the info for all files known to AniDB. If run again over the same folder it shall only check those files which were unknown to AniDB at the time of the last check.)<br />
<br />
Later versions of the API might enforce this by banning clients which ask for the same information more than once every week/month.<br />
<br />
=== Tag option ===<br />
The API will add a user defined string at the beginning of each reply line separated with a space, if desired.<br />
* To enable add the <tt>tag={str usertag}</tt> option to a command.<br />
* A tag is only valid for the command it was send with, meaning it is not persistent. If you want to have tags in front of all reply lines you will have to append the tag option to each command you send to the server.<br />
* Tags are meant to enable a client to handle more than one request/reply at a time.<br />
<br />
Usage example:<br />
AUTH user=baka&pass=baka&protover=25&client=someclient&clientver=1&tag=abc123<br />
abc123 200 Jxqxb LOGIN ACCEPTED<br />
or<br />
LOGOUT s=Jxqxb&tag=byebye<br />
byebye 203 LOGGED OUT<br />
<br />
{{eyecatch|Note|The tag option is valid for all api commands and is thus not explicitly listed in the description of each command.}}<br />
<br />
=== Data Indexes (fid,aid,eid,gid,lid) ===<br />
* All indexes start at 1 (not 0).<br />
* It is possible for table entries to have id fields with a value of 0 (i.e. gid). Those are to be interpreted as "NONE" or "NULL".<br />
* An ID is '''never''' reused. That means after an entry is deleted no new entry will ever have that ID again.<br />
* Mylist IDs (lid) are globally unique, not per-user unique.<br />
<br />
== Authing Commands ==<br />
{{eyecatch|Note|'''ANY''' command which requires parameters may return: 505 ILLEGAL INPUT OR ACCESS DENIED}}<br />
<br />
----<br />
=== AUTH: Authing to the AnimeDB ===<br />
'''Command String:'''<br />
* AUTH user={str username}&pass={str password}&protover={int4 apiversion}&client={str clientname}&clientver={int4 clientversion}[&nat=1&comp=1&enc={str encoding}&mtu{int4 mtu value}&imgserver=1]<br />
<br />
'''Possible Replies:'''<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
* 500 LOGIN FAILED<br />
* 503 CLIENT VERSION OUTDATED<br />
* 504 CLIENT BANNED - {str reason}<br />
* 505 ILLEGAL INPUT OR ACCESS DENIED<br />
* 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
when nat=1<br />
* 200 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED<br />
* 201 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
when imgserver=1<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
{str image server name}<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
{str image server name}<br />
<br />
'''Info:'''<br />
{{eyecatch|Note|The password is the normal AniDB website password! The password listed in the profile as API Password in only used for the optional encryption feature.}}<br />
* The ''session_key'' is a String containing only ''a-z,A-Z,0-9'' chars of a length of ''4-8'' characters.<br />
: It has to be stored by the client and needs to be sent as parameter with every command which requires the user to logged in.<br />
* The ''session_key'' String is appended as parameter "s", i.e. "PUSH notify=1&msg=1&s={str session_key}".<br />
* On a '''500 LOGIN FAILED''' message the client should request the user to enter username and password again.<br />
* In case of a '''501 LOGIN FIRST''' message the client should silently resend an auth command and send the failed command again.<br />
* A '''502 ACCESS DENIED''' message should abort the current action on the client side and display a message to the user.<br />
* A '''503 CLIENT VERSION OUTDATED''' message states that the udp server has been updated and does not support your client any longer. (protover is too low). A 201 message refers to a new version of the client software.<br />
* A '''506 INVALID SESSION''' means that either the session key parameter "s" was not provided with a command that requires it or the session key is no longer valid. The client should reissue an AUTH command.<br />
{{eyecatch|Note|A frontend shall expect 501 and 502 messages to be returned on ANY command.}}<br><br />
{{eyecatch|Note|AniDB usernames may only contain characters (a-z,A-Z), numbers (0-9), underscores (_) and hyphens (-).}}<br />
* The client should send the apiversion of the AnimeDB API version it supports as value of the protover parameter.<br />
* The client MAY NOT send anything but the version of the API Specs the author used to write the client! (as it is stated at the top of this file @ "Version number used for protover parameter")<br />
: The API will compare that value to it's own version of the API and if the version of the client is older the API will decide whether the changes were significant enough to deny the old client access to the DB.<br />
* The clientname shall be a lower-case string containing only the chars ''a-z'' of ''4-16 chars'' length which identifies the client. (i.e. mykickassclient)<br />
* The clientversion shall be a number starting with 1, increased on every change in the client.<br />
: clientname and clientversion might be used by the API to distinguish between different clients and client versions if that should ever become necessary.<br />
{{eyecatch|Important|<br />
* DO NOT use the clientname of an existing client. If you modify an existing client's code to meet your own needs, create a new client name for yourself.<br />
* ALWAYS increase the clientversion number if you release a new client version.}}<br />
* A Login and its assigned ''session_key'' is valid until the virtual UDP connection times out or until a LOGOUT command is issued.<br />
* The virtual UDP connection times out if no data was received from the client for '''35 minutes'''.<br />
* A client should issue a UPTIME command once every 30 minutes to keep the connection alive should that be required.<br />
* If the client does not use any of the notification/push features of the API it should NOT keep the connection alive, furthermore it should explicitly terminate the connection by issuing a LOGOUT command once it finished it's work.<br />
* If it is very likely that another command will be issued shortly (within the next 20 minutes) a client SHOULD keep the current connection open, by not sending a LOGOUT command.<br />
{{eyecatch|Important|<br />
* A client should NOT perform a full AUTH / command / LOGOUT cycle for each command it wants to send. Again, if another command is likely within 20 minutes, remain logged in.}}<br />
* The client shall notify the user if it received a 201 message at login.<br />
: This means a new version of the client is available, however the old version is still supported otherwise a client banned message would have been returned.<br />
* The user should get a pop-up message on 503 and 504 messages telling him to update his client software.<br />
: ('''Note:''' 504 means that this version of the client is banned, not the user!)<br />
* The 'nat' option makes the client able to detect whether it is behind a nat router or not. When the client is behind a nat router it should keep the "connection" alive with the PING command.<br />
{{eyecatch|Important|Make sure your client handles ALL possible AUTH return codes before giving out any versions!}}<br />
* When ''enc=x'' is defined the server will change the encoding used to x.<br />
**If the encoding is supported it will change right away (including the response) and be reset on logout/timeout.<br />
**If not supported then the argument will be silently ignored. Use ENCODING to test what works.<br />
**Supported encodings are [http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html these].<br />
* ''comp=1'' means that the client supports compression ([http://java.sun.com/j2se/1.5.0/docs/api/java/util/zip/Deflater.html DEFLATE]).<br />
**The server will compress (instead of truncating) the datagrams when needed if this option is enabled.<br />
**The first two bytes of compressed datagrams will always be set to zero. (So tags should never start with that.)<br />
* Default [[Wikipedia:MTU (networking)|''MTU'']] is 1400. Minimum allowed is 400, maximum 1400, due [[Wikipedia:Point-to-Point Protocol over Ethernet|PPPoE]].<br />
<br />
----<br />
<br />
=== LOGOUT: Logout ===<br />
'''Command String:'''<br />
* LOGOUT<br />
<br />
'''Possible Replies:'''<br />
* 203 LOGGED OUT<br />
* 403 NOT LOGGED IN<br />
<br />
'''Info:'''<br />
* This command only works if you are already logged in.<br />
* A logout should ALWAYS be issued if the client is currently logged in and is either exiting or not expecting to send/receive any AniDB API packets for the next >= 30 minutes.<br />
<br />
----<br />
=== ENCRYPT: Start Encrypted Session ===<br />
Will cause all future messages from the server, except the first (the reply to the ENCRYPT command itself), to be encrypted (128 bit [[Wikipedia:Advanced Encryption Standard|AES]]). The client will also have to encrypt all future requests sent to the server. All non-encrypted messages will be discarded by the server. The encryption key is the [[Wikipedia:MD5|MD5]] hash of a special ''UDP API Key'' (defined in the users profile) concatenated with the salt string as given in the reply to the ENCRYPT message. A normal AUTH message is still necessary to authenticate and should follow the ENCRYPT command once the API has acknowledged the encryption.<br />
<br />
'''Command String:'''<br />
* ENCRYPT user={str name}&type={int2 type}<br />
<br />
'''Possible Replies:'''<br />
* 209 {str salt} ENCRYPTION ENABLED<br />
* 309 API PASSWORD NOT DEFINED<br />
* 509 NO SUCH ENCRYPTION TYPE<br />
* 394 NO SUCH USER<br />
<br />
'''Info:'''<br />
* ''user'' is the user name.<br />
* ''type'' is the type of encryption; 1 => 128 bit AES (only one defined).<br />
* ''API Key'' is the one defined in the {{AniDBLink|profile|profile settings page}}.<br />
* It is not possible to disable the encryption once enabled while staying logged in.<br />
** A logout (the logout message needs to be correctly encrypted) or timeout will disable the encryption.<br />
* In order to minimize server load, encryption should be disabled by default and should have to be enabled manually by the user in the configuration options.<br />
* The encryption key is md5(api_key_of_user+''salt'').<br />
* Padding of the message needs to be done according to the PKCS5Padding scheme.<br />
<br />
== Notify Commands ==<br />
=== Introduction ===<br />
Broadly speaking, notifications provide an indication to the client that some event has occurred within the AniDB database.<br />
<br />
There are three types:<br />
* New file [[Notifications|notification]]. (Only anime type supported.)<br />
* New private message notification.<br />
* New buddy event notification.<br />
<br />
Note that, while a user can subscribe to multiple 'new file' events (see [[Notifications|notifications]]), at present, the UDP API only supports notifications of new files by anime. New files by group, or new files by producer, are NOT presently supported. Just the same, keeping in mind that the API is designed to potentially support such notifications in the future will help in understanding why some of the commands are structured the way they are.<br />
<br />
The word "notification" is also used a bit inconsistently in this document. An AniDB notification is originally a "new file [[Notifications|notification]]". It might be more correct to use the term "event" for the original "happening" and then "notification" as the means to notify the user (client). New-file, new-message, buddy-* and going-down are all events that results in notifications. Only the first two type of events are persistent, though, meaning they exist and remain in the same state until some user action affects them.<br />
<br />
=== Getting Notifications ===<br />
Clients that wish to receive notifications have two routes available to them. They are by no means mutually exclusive and selecting one does not imply a client is unable to use commands from another.<br />
<br />
'''Method One: Polling'''<br />
<br />
With this method, the client contacts the server at some interval (no more than once every 20 minutes) to see if there are new file notifications waiting. If there are, the client can the get further details of the files in question. This is analogous to checking an email server every half hour to see if new email has arrived.<br />
<br />
Its principal advantage is that it is easy to design and code. Blocking sockets are sufficient as the client can expect the reply received to correspond with the command sent.<br />
<br />
The disadvantage of this approach is that it introduces a delay and some uncertainty in receiving notifications. If, for example, the user clears the notification on the website before the client collects it, the client will not learn of the new file. Similarly, if the user does not dismiss notifications via the site, the client will have an increasing amount of stale data to work though. Finally, notifications cleared by the client also clears them from the website, so users will need to be made aware of what is going on.<br />
<br />
A polling HOWTO:<br />
<br />
* Use NOTIFY (no more than once every 20 minutes) to get the number of pending notifications<br />
* IF there are new notifications pending, use NOTIFYLIST to get a list of notification types and associated IDs.<br />
* Use NOTIFYGET to receive a notification, supplying the ID provided by NOTIFYLIST<br />
* Use NOTIFYACK to acknowledge a notification, supplying the ID provided by NOTIFYLIST (if desired)<br />
<br />
{{eyecatch|Note|The ID supplied by NOTIFYLIST will be the ID of the affected notification type. Since, at present, only the anime type is supported, this value is always an aid. In the future, it may represent a group or producer ID. In these cases, the str '''type''' value will indicate what entity the ID represents.}}<br />
<br />
'''Method Two: Server PUSH'''<br />
<br />
With this method, the server takes the active role in advising the client that a new file has arrived. The client must register with the server to receive further advice information, and will be responsible for keeping the login session from timing out, and any NAT router ports open. The UDP packet is sent to the ip and port from which the AUTH command was received.<br />
<br />
This method compensates for the disadvantages of the polling method, but is more difficult to code. Blocking sockets are no longer an option, nor can a client make any assumptions that an incoming packet will necessarily be a reply to the last command sent. The tag option may be helpful here.<br />
<br />
A PUSH HOWTO:<br />
<br />
* PUSH to register your client session.<br />
* Listen for 720-799 NOTIFICATIONs ('''not 290''').<br />
* Use PUSHACK to to acknowledge the notification using the nid supplied with NOTIFICATION<br />
* Use NOTIFYGET to receive a notification, suppling the relid provided by NOTIFICATION (NOT the packet ID)<br />
* Use NOTIFYACK to acknowledge a notification, suppling the relid provided by NOTIFICATION (if desired)<br />
* Use UPTIME (with an interval between 30 and 35 minutes) to keep login session valid<br />
<br />
It is probably a good idea to use tags to separate NOTIFICATIONs from the other communication. NOTIFICATIONs will '''never''' have tags.<br />
<br />
=== PUSH: UDP Notification Registration ===<br />
Register your client as an observer for AniDB notification events for the current user. If you are registered for one or more event types the AniDB server will send an UDP packet (format see below) on each change which affects the current user.<br />
<br />
'''Command String:'''<br />
* PUSH notify={boolean on_new_file}&msg={boolean on_new_private_message}[&buddy={boolean on_buddy_event}]<br />
<br />
'''Possible Replies:'''<br />
* 270 NOTIFICATION ENABLED<br />
OR (if both values are 0)<br />
* 370 NOTIFICATION DISABLED<br />
<br />
'''Info:'''<br />
* A client which has registered to receive UDP notification packets must:<br />
** Issue a PUSHACK command for each notification received with ''notify_packet_id'' provided in the notification packet.<br />
** Use PING to keep the connection alive (< 30 min).<br />
** Use UPTIME to ensure that the session is OK (>= 30 min).<br />
* Every notification generated is resent 3 times unless acknowledged. After that the client is logged out.<br />
<br />
=== NOTIFY: Notifications ===<br />
Get number of pending notifications (and number of online buddies).<br />
<br />
'''Command String:'''<br />
* NOTIFY [buddy=1]<br />
<br />
'''Possible Replies:'''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}<br />
when ''buddy=1''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}|{int4 number_of_online_buddies}<br />
<br />
'''Info:'''<br />
* If the client did send a NOTIFY within the last 35 minutes and it was confirmed by AniDB then receiving a 501 LOGIN FIRST message for the next NOTIFY command shows that AniDB logged the client out because it did not respond to a PUSH Notification packet.<br />
* There is no command to retrieve missed PUSH Notifications.<br />
{{eyecatch|Note|This command MUST NOT be issued more than once every 20 minutes.}}<br />
<br />
----<br />
=== NOTIFYLIST: List Notification/Message IDs ===<br />
List id of all pending (not acknowledged) ''new private message'' and ''new file'' notifications. Buddy events cannot be acknowledged.<br />
<br />
'''Command String:'''<br />
* NOTIFYLIST<br />
<br />
'''Possible Replies:'''<br />
*291 NOTIFYLIST<br />
: {str type}|{int4 id}<br />
: {str type}|{int4 id}<br />
: ...<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as required by NOTIFYGET. For messages it is the actual message id, for notifications it is the id of the related type; anime, group or producer. Since only file notifications related to anime is implemented atm, it is the anime id (aid).<br />
* NOTIFYLIST returns one line per entry, if no entries are available only the first line of the reply is returned.<br />
{{eyecatch|Note|This command MUST NOT be issued regularly but should only be triggered by either a push message received by the client or a reply to a NOTIFY command which tells you that there are messages/notifications waiting.}}<br />
<br />
----<br />
=== NOTIFYGET: Get Notification/Message ===<br />
Receive private message or file notification.<br />
<br />
'''Command String:'''<br />
* NOTIFYGET type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 292 NOTIFYGET<br />
: {int4 id}|{int4 from_user_id}|{str from_user_name}|{int4 date}|{int4 type}|{str title}|{str body}<br />
* 392 NO SUCH ENTRY<br />
when type = N<br />
* 293 NOTIFYGET<br />
: {int4 relid}|{int4 type}|{int2 count}|{int4 date}|{str relidname}|{str fids}<br />
* 393 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as given by NOTIFYLIST (or ''relid'' from 271 NOTIFICATION and mid from 272 NOTIFICATION)<br />
* for message entries (M):<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: type is the type of the message (0=normal msg, 1=annonymous, 2=system msg, 3=mod msg)<br />
* for notification entries (N):<br />
: relid is the id of the related type (anime)<br />
: relname is the name of the related type (anime)<br />
: type is the notification type (0=all, 1=new, 2=group, 3=complete)<br />
: count is the number of events pending for this subscription<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: fids is a comma separated list with the affected file ids<br />
<br />
----<br />
=== NOTIFYACK: Acknowledge Notification/Message ===<br />
This command will mark a message read or clear a ''new file'' notification. Buddy events are not acknowledgeable.<br />
<br />
'''Command String:'''<br />
* NOTIFYACK type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 281 NOTIFYACK SUCCESSFUL<br />
* 381 NO SUCH ENTRY<br />
when type = N<br />
* 282 NOTIFYACK SUCCESSFUL<br />
* 382 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
<br />
====Notification Packet Format====<br />
'''New File Notify:'''<br />
<br />
720 {int4 notify_packet_id} NOTIFICATION - NEW FILE<br />
{int4 fidlist}|{int2 reltype}|{int2 priority}<br />
<br />
* fidlist is a comma separated list of file ids<br />
* reltype is: 1 = anime, 2 = group, 3 = producer<br />
* priority is: 0 = low, 1 = medium, 2 = high<br />
* new file notifications are created as a batch, so it is not unusual to get several new files for a particular anime at once. It is in this case that a comma separated list of fids will be returned<br />
<br />
{{eyecatch|Note|Group (and producer) related file notifications are not implemented yet.}}<br />
<br />
<br />
'''New Private Message Notify:'''<br />
<br />
794 {int4 notify_packet_id} NOTIFICATION - NEW MESSAGE<br />
{int2 type}|{int4 date}|{int4 sent_by_uid}|{str sent_by_name}|{str subject}|{str body}|{int mid}<br />
<br />
* type is the type of the message (0=normal msg, 1=anonymous, 2=system msg, 3=mod msg)<br />
* date is the time the message was sent (in seconds since 1.1.1970)<br />
* sender uid/sender name are the user id and user name of the sender<br />
* subject is the message subject<br />
* body is message body (can be truncated)<br />
* mid is message id and can be used with NOTIFYACK<br />
<br />
'''Buddy Event Notify:'''<br />
753 {int4 notify_packet_id} NOTIFICATION - BUDDY<br />
{int4 buddy uid}|{int2 event type}<br />
* Possible event types:<br />
** 0 => LOGIN<br />
** 1 => LOGOUT<br />
** 2 => ACCEPTED<br />
** 3 => ADDED<br />
<br />
<br />
'''Going Down Event Notify:'''<br />
799 {int4 notify_packet_id} NOTIFICATION - SHUTTING DOWN<br />
{int4 time offline}|{int4 comment}<br />
<br />
* Clients with any notification on will receive the SHUTTING DOWN message before the API goes offline.<br />
* Time offline is the time in minutes the API will be down, 0 if indefinite (client can direct user to the AniDB site for status updates).<br />
* The comment is a short explanation for the downtime.<br />
* Only one datagram will be sent, and the server will not listen for replies.<br />
<br />
<br />
=== PUSHACK: UDP Notification Acknowledge ===<br />
Used to acknowledge notification packets (720-799). A client must be prepared to issue this command before using '''PUSH'''.<br />
<br />
'''Command String:'''<br />
* PUSHACK nid={int4 notify_packet_id}<br />
<br />
'''Possible Replies:'''<br />
* 701 PUSHACK CONFIRMED<br />
* 702 NO SUCH PACKET PENDING<br />
<br />
'''Info:'''<br />
* See: '''PUSH'''<br />
<br />
=== NOTIFICATIONADD: Add Anime or Group to Notify List ===<br />
<br />
'''Command String:'''<br><br />
<br />
by anime id:<br />
* NOTIFICATIONADD aid={int4 aid}&type={int2 type}&priority={int2 priority}<br />
by group id:<br />
* NOTIFICATIONADD gid={int4 gid}&type={int2 type}&priority={int2 priority}<br />
<br><br />
'''Possible Replies:'''<br />
<br />
* 246 NOTIFICATION ITEM ADDED<br />
: {int4 notification id}<br />
* 248 NOTIFICATION ITEM UPDATED<br />
: {int4 notification id}<br />
* 399 NO CHANGES<br />
<br><br />
'''Info:'''<br />
* ''Priority'' values are 0: low, 1: medium, 2: high<br />
* ''Type'' values are 0: all, 1: new, 2: group, 3: complete<br />
<br />
=== NOTIFICATIONDEL: Remove Anime or Group from Notify List ===<br />
<br />
'''Command String:'''<br><br />
<br />
by anime id:<br />
* NOTIFICATIONDEL aid={int4 aid}<br />
by group id:<br />
* NOTIFICATIONDEL gid={int4 gid}<br />
<br><br />
'''Possible Replies:'''<br />
<br />
* 247 NOTIFICATION ITEM DELETED<br />
: {int4 notification_table}|{int4 relid}<br />
* 324 NO SUCH NOTIFICATION ITEM<br />
<br />
<br><br />
'''Info:'''<br />
* ''notification_table'' values are 1: anime, 2: group<br />
* ''relid'' value matches the aid/gid supplied<br />
<br />
== Buddy Commands ==<br />
Group of commands used to administrate your buddylist.<br />
<br />
=== BUDDYADD: Add a user to Buddy List ===<br />
'''Command String:'''<br />
* BUDDYADD uid={int4 buddy uid}<br />
* BUDDYADD uname={int4 buddy name}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 255 BUDDY ADDED<br />
* 355 BUDDY ALREADY ADDED<br />
<br />
----<br />
=== BUDDYDEL: Remove a user from Buddy List ===<br />
'''Command String:'''<br />
* BUDDYDEL uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 256 BUDDY DELETED<br />
<br />
----<br />
=== BUDDYACCEPT: Accept user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYACCEPT uid={int4 user uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 257 BUDDY ACCEPTED<br />
* 357 BUDDY ALREADY ACCEPTED<br />
<br />
----<br />
=== BUDDYDENY: Deny user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYDENY uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 258 BUDDY DENIED<br />
* 358 BUDDY ALREADY DENIED<br />
<br />
----<br />
=== BUDDYLIST: Retrieve Buddy List ===<br />
'''Command String:'''<br />
* BUDDYLIST startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 253 {int2 start} {int2 end} {int2 total} BUDDY LIST<br />
: {int4 uid}|{str username}|{int2 state}<br />
: ...<br />
'''Info:'''<br />
* state is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = this user is in your buddylist<br />
* bit 2 = this user has accepted you<br />
* bit 3 = this user is waiting for your approval<br />
<br />
----<br />
=== BUDDYSTATE: Retrieve Buddy States===<br />
'''Command String:'''<br />
* BUDDYSTATE startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 254 {int2 start} {int2 end} {int2 total} BUDDY STATE<br />
: {int4 uid}|{int2 onlinestate}<br />
: ...<br />
<br />
'''Info:'''<br />
* onlinestate is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = http online (user has issued a HTTP request within the last 10 minutes)<br />
* bit 2 = udp api online (user is currently connected to the udp api server)<br />
* example: 0=offline, 1=http online, 2=udp api online, 3=http&udp api online<br />
<br />
== Data Commands ==<br />
=== ANIME: Retrieve Anime Data ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIME aid={int4 id}[&amask={hexstr}]<br />
by name<br />
* ANIME aname={str anime name}[&amask={hexstr}]<br />
<br />
'''Possible Replies:'''<br />
<br />
If no ''amask'' is provided:<br />
* 230 ANIME<br />
: {int4 aid}|{int4 eps}|{int4 ep count}|{int4 special cnt}|{int4 rating}|{int4 votes}|{int4 tmprating}|{int4 tmpvotes}|{int4 review rating average}|{int4 reviews}|{str year}|{str type}|{str romaji}|{str kanji}|{str english}|{str other}|{str short names}|{str synonyms}|{str category list}<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* Fields are returned in the same order they appear in the ''amask'' field list: byte 1, bit 7 first<br />
* Synonyms and short names are separated with '<br />
* Category fields are separated with ',' and ordered by weight (desc). ''However'', be aware that categories are no longer used nor updated internally, and category responses are only returned to avoid breaking older clients. Use tags as a replacement. <br />
* By name: must be perfect match of romaji/kanji/english/other/synonym/short name.<br />
* 'Producer id list' and 'producer name list' match the data returned by the former producer bits (but using the revised creator ids)<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
* '''Note:''' The character id list is the first data to be truncated if needed. And then: tag list, synonym list, short name list. This applies to the FILE command too.<br />
* Selecting an 'unused' or 'reserved' bit will return an "illegal input" (505) response.<br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="5" align="center"><b>amask</b></td></tr><br />
<tr><br />
<td align="center"><b>Byte 1</b></td><br />
<td align="center"><b>Byte 2</b></td><br />
<td align="center"><b>Byte 3</b></td><br />
<td align="center"><b>Byte 4</b></td><br />
<td align="center"><b>Byte 5</b></td><br />
<td align="center"><b>Byte 6</b></td><br />
<td align="center"><b>Byte 7</b></td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int aid</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int dateflags</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 special ep count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int air date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int end date</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str url</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str picname</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int vote count</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 temp rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int temp vote count</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 average review rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int review count</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str award list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>bool is 18+ restricted</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int ANN id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int allcinema id</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str AnimeNfo id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str tag name list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int tag id list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>int tag weight list</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int date record updated</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int character id list</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 specials count</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 credits count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 other count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 trailer count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 parody count</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<br />
'''Related aid type (Byte 1, Bit 2):'''<br />
<pre><br />
value meaning<br />
<br />
1 sequel<br />
2 prequel<br />
11 same setting<br />
12 alternative setting<br />
32 alternative version<br />
41 music video<br />
42 character<br />
51 side story<br />
52 parent story<br />
61 summary<br />
62 full story<br />
100 other<br />
</pre><br />
<br />
'''Examples:''' (note that the given amask gives the same result as the default request)<br />
> ANIME aid=1&amask=b2f0e0fc000000&s=xxxxx<br />
< 230 ANIME<br />
1|1999-1999|TV Series|Space,Future,Plot Continuity,SciFi,Space Travel,Shipboard,Other Planet,Novel,Genetic Modification,Action,Romance,Military,Large Breasts,Gunfights,Adventure,Human Enhancement,Nudity|Seikai no Monshou|星界の紋章|Crest of the Stars||13|13|3|853|3225|756|110|875|11<br />
<br />
<br />
----<br />
<br />
=== ANIMEDESC: Retrieve Anime Description ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIMEDESC aid={int4 id}&part={int4 partno}<br />
<br />
'''Possible Replies:'''<br />
* 233 ANIMEDESC<br />
: {int4 current part}|{int4 max parts}|{str description}<br />
* 330 NO SUCH ANIME<br />
* 333 NO SUCH DESCRIPTION<br />
<br />
'''Info:'''<br />
* The maximum length of the anime description is roughly 5000 characters, but the maximum length of a UDP packet is 1400 bytes<br />
* Multiple calls to ANIMEDESC may be necessary to retrieve the complete text, retrieving separate 1400 byte parts with each call<br />
* ''part'' is zero-based<br />
* '''Note:''' No support, at present, for retrieving descriptions by title. ''aid'' only<br />
<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> ANIMEDESC aid=3169&part=0&s=xxxxx<br />
< 233 ANIMEDESC<br />
0|1|As summer break arrives for the students, Jun Sakurada is busily studying on his own in the library, making up for time lost <cut><br />
<br />
----<br />
=== CALENDAR: Get Upcoming Titles ===<br />
Returns the anime ids of the 25 most recently aired / released anime, directly followed by the next 25 anime due to be aired / released, ordered by start date.<br />
<br />
'''Command String:'''<br />
* CALENDAR<br />
<br />
'''Possible Replies:'''<br />
* 297 CALENDAR<br />
{int aid}|{int startdate}|{int dateflags}/n<br />
<br />
..repeated n times<br />
<br />
* 397 CALENDAR EMPTY<br />
<br />
'''Info:'''<br />
* Takes no parameters (other than the session string)<br />
* Titles returned are filtered by the 'show adult' preference of the logged in user. That is, users who have elected to hide adult content will have it hidden here as well.<br />
* Do not depend on the command always returning exactly 50 titles; there may not always be 25 future titles pending, depending on the user's 'adult' preferences, and the date in relation to the relation to the current anime season.<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
<br />
----<br />
=== CHARACTER: Get Character Information ===<br />
Returns character details associated with a given character ID, including associated anime ids, episode ids, and seiyuu.<br />
<br />
'''Command String:'''<br />
* CHARACTER charid={int characterid}<br />
<br />
'''Possible Replies:'''<br />
* 235 CHARACTER<br />
: {int charid}|{str character name kanji}|{str character name transcription}|{str pic}|{anime blocks}|{int episode list}|{int last update date}|{int2 type}|{str gender}<br />
<br />
: An 'anime block' is {int anime id},{int appearance},{int creatorid},{boolean is_main_seiyuu} repeated as many times as necessary, separated by a single quote ( ' ). <br />
<br />
* 335 NO SUCH CHARACTER<br />
<br />
'''Info:'''<br />
* If no seiyuu is associated with the character for a given aid, the 'creatorid' and 'is_main_seiyuu' fields will be empty, but the commas will remain.<br />
* An empty episode list is "undefined": no episode values have been added.<br />
* ''appearance'' values: 0='appears in', 1='cameo appearance in', 2='main character in', 3='secondary cast in'<br />
* ''type'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** 1 => 'Character'<br />
** 2 => 'Mecha'<br />
** 3 => 'Organisation'<br />
** 4 => 'Vessel' <br />
* ''gender'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** "M" => 'Male'<br />
** "F" => 'Female'<br />
** "I" => 'Intersexual'<br />
** "D" => 'Dimorphic'<br />
** "-" => 'none/does not apply'<br />
** "?" => 'unknown'<br />
<br />
'''Example:'''<br />
<br />
CHARACTER charid=488&s=DChan<br />
235 CHARACTER<br />
488|ニコ・ロビン|Nico Robin|14789.jpg|4097,2,1900,1'69,2,1901,0'6199,0,1900,1'5691,0,1900,1'2644,0,,'4851,0,1900,1||1236938094<br />
<br />
=== CREATOR: Get Creator Information ===<br />
<br />
'''Command String:'''<br />
* CREATOR creatorid={int creatorid}<br />
<br />
'''Possible Replies:'''<br />
* 245 CREATOR<br />
: {int creatorid}|{str creator name kanji}|{str creator name transcription}|{int type}|{str pic_name}|{str url_english}|{str url_japanese}|{str wiki_url_english}|{str wiki_url_japanese}|{int last update date}<br />
<br />
* 345 NO SUCH CREATOR<br />
<br />
'''Info:'''<br />
* ANIME AMASK byte6, bit5<br />
* ''type'' values: 1='person', 2='company', 3='collaboration'<br />
<br />
Example:<br />
<br />
245 CREATOR<br />
718|GAINAX|Gainax|2|10092.png||http://www.gainax.co.jp/|Gainax|Gainax|1237048093<br />
<br />
=== EPISODE: Retrieve Episode Data ===<br />
'''Command String:'''<br><br />
by eid<br />
* EPISODE eid={int eid}<br />
by anime and episode number<br />
* EPISODE aname={str anime name}&epno={int4 episode number}<br />
* EPISODE aid={int anime id}&epno={int4 episode number}<br />
<br />
'''Possible Replies:'''<br />
* 240 EPISODE<br />
: {int eid}|{int aid}|{int4 length}|{int4 rating}|{int votes}|{str epno}|{str eng}|{str romaji}|{str kanji}|{int aired}|{int type}<br />
* 340 NO SUCH EPISODE<br />
<br />
'''Info:'''<br />
* length is in minutes<br />
* Returned 'epno' includes special character (only if special) and padding (only if normal).<br />
** Special characters are S(special), C(credits), T(trailer), P(parody), O(other).<br />
* The ''type'' is the raw episode type, used to indicate numerically what the special character will be<br />
** 1: regular episode (no prefix), 2: special ("S"), 3: credit ("C"), 4: trailer ("T"), 5: parody ("P"), 6: other ("O")<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> EPISODE eid=1&s=xxxxx<br />
< 240 EPISODE<br />
1|1|24|400|4|01|Invasion|shinryaku|??<br />
<br />
> EPISODE aname=Seikai no Monshou&epno=2&s=xxxxx<br />
< 240 EPISODE<br />
2|1|24|750|2|02|Kin of the Stars|Hoshi-tachi no Kenzoku|??????|1295059229|1<br />
<br />
----<br />
<br />
=== FILE: Retrieve File Data ===<br />
'''Command String:'''<br><br />
by fid:<br />
* FILE fid={int4 id}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by size+ed2k hash:<br />
* FILE size={int8 size}&ed2k={str ed2khash}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by anime, group and epno<br />
* FILE aname={str anime name}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aname={str anime name}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
<br />
'''Possible Replies:'''<br />
* 220 FILE<br />
: {int4 fid}|{int4 aid}|{int4 eid}|{int4 gid}|{int4 state}|{int8 size}|{str ed2k}|{str anidbfilename}<br />
* 220 FILE<br />
: {int4 fid}|...(data list)<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 0}|{int4 fid 1}|...|{int4 fid n}<br />
* 320 NO SUCH FILE<br />
<br />
'''Info:'''<br />
* fid, aid, eid, gid are the unique ids for the file, anime, ep, group entries at AniDB.<br />
: You can use those to create links to the corresponding pages at AniDB.<br />
* anidbfilename is the AniDB filename for the file.<br />
: However this name does not contain all the extra information of the filenames on AniDB and might be composed slightly different.<br />
* fmask and amask are hexidecimal strings where each bit corresponds to a data field related to the specified file (see below). The data list received is sorted and returned in the same order as the tables: top to bottom, left to right, with fmask preceding amask. There is '''no''' provision to retrieve all fields. Further, requesting a 'unusued' or 'reserved' bit will return an "illegal input" error.<br />
* fid is always returned as the first value, regardless of what masks are provided.<br />
* Only the first matching file is returned when aname, gname and epno is used.<br />
* "audio codec" and "audio bitrate" will return multiple values if there are multiple audio streams present in the file. Values will be separated by a single quote. <br />
* For byte 1, bit 2 (other episodes): episode IDs will be followed by an integer '''percentage''' that indicate the percentage of the related episode this file covers. Typically 100%, there are cases where it will be 50, 30, or other values. This value provides no indication where, within an episode, the file represents. That is, 50% could mean the file covers the first half of the episode, the second half, or some 50% range in between.<br />
'''State:'''<br />
<pre><br />
bit / int value meaning<br />
1 / 1 FILE_CRCOK: file matched official CRC (displayed with green background in AniDB)<br />
2 / 2 FILE_CRCERR: file DID NOT match official CRC (displayed with red background in AniDB)<br />
3 / 4 FILE_ISV2: file is version 2<br />
4 / 8 FILE_ISV3: file is version 3<br />
5 / 16 FILE_ISV4: file is version 4<br />
6 / 32 FILE_ISV5: file is version 5<br />
7 / 64 FILE_UNC: file is uncensored<br />
8 / 128 FILE_CEN: file is censored<br />
<br />
examples:<br />
state ==== 9 ==> FILE_CRCOK+FILE_ISV3 ==> file matched official CRC and is version 3<br />
state ==== 0 ==> - ==> file was not crc checked and is version 1<br />
state ==== 34 ==> FILE_CRCERR+FILE_ISV5 ==> file DID NOT match official CRC and is version 5<br />
state ==== 1 ==> FILE_CRCOK ==> file matched official CRC and is version 1<br />
state ==== 8 ==> FILE_ISV3 ==> file was not CRC checked and is version 3<br />
</pre><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''fmask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
<td align="center">'''Byte 5'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 aid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 eid</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 gid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 mylist id</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>list other episodes</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>int2 IsDeprecated</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int2 state</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int8 size</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ed2k</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str md5</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str sha1</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str crc32</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>video colour depth</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str quality</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str audio codec list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 audio bitrate list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str video codec</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 video bitrate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str video resolution</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str file type (extension)</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str dub language</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str sub language</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 length in seconds</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str description</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 aired date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str anidb file name</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 mylist state</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 mylist filestate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 mylist viewed</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 mylist viewdate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str mylist storage</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str mylist source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str mylist other</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''amask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 anime total episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str category list</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str epno</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ep name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str ep romaji name</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str ep kanji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 episode rating</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 episode vote count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str group name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str group short name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int4 date aid record updated</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
'''Examples:''' (html escaped code intended)<br />
> FILE size=177747474&ed2k=70cd93fd3981cc80a8ea6a646ff805c9&fmask=7FF8FEF8&amask=C000F0C0&s=xxxxx<br />
< 220 FILE<br />
312498|4688|69260|4243|0||0|1|177747474|70cd93fd3981cc80a8ea6a646ff805c9|b2a7c7d591333e20495de3571b235c28|7af9b962c17ff729baeee67533e5219526cd5095|a200fe73|high|DTV|Vorbis (Ogg Vorbis)|104|H264/AVC|800|704x400|japanese|english'english'english|1560||1175472000|26|26|01|The Wings to the Sky|Sora he no Tsubasa|????|#nanoha-DamagedGoodz|Nanoha-DGz<br />
<br />
----<br />
<br />
=== GROUP: Retrieve Group Data ===<br />
'''Command String:'''<br><br />
by gid<br />
* GROUP gid={int gid}<br />
by name/shortname<br />
* GROUP gname={str group name}<br />
<br />
'''Possible Replies:'''<br />
* 250 GROUP<br />
: {int gid}|{int4 rating}|{int votes}|{int4 acount}|{int fcount}|{str name}|{str short}|{str irc channel}|{str irc server}|{str url}|{str picname}|{int4 foundeddate}|{int4 disbandeddate}|{int2 dateflags}|{int4 lastreleasedate}|{int4 lastactivitydate}|{list grouprelations}<br />
* 350 NO SUCH GROUP<br />
<br />
'''Info:'''<br />
* Requires login<br />
* ''gname'' is an exact match of either a group name or short name<br />
* As either name and short names are unique if there is a result from GROUP request by name that will be the only match<br />
* ''dateflags'' values:<br />
** bit0 set == Foundeddate, Unknown Day<br />
** bit1 set == Foundeddate, Unknown Month, Day<br />
** bit2 set == Disbandeddate, Unknown Day<br />
** bit3 set == Disbandeddate, Unknown Month, Day<br />
** bit5 set == Foundeddate, Unknown Year<br />
** bit6 set == Disbandeddate, Unknown Year<br />
* ''releasedate'' and ''activitydate'' are distinct. ''releasedate'' is the date a file was actually released by the group, where ''activitydate'' is the date of a file being added to AniDB. As such, lastrelease may very well be much older than lastactivity.<br />
* ''groupreleations'' is a list of apostrophe-separated pairs, where each pair consists of {int4 othergroupid},{int2 relationtype}<br />
** relationtype:<br />
*** 1 => "Participant in"<br />
*** 2 => "Parent of"<br />
*** 4 => "Merged from"<br />
*** 5 => "Now known as"<br />
*** 6 => "Other"<br />
<br />
'''Example:'''<br />
> GROUP gid=7091&s=bunny<br />
< 250 GROUP<br />
7091|832|1445|43|566|Frostii|Frostii|#frostii|irc.rizon.net|http://frostii.com|15844.jpg|1228089600|0|1|1301875200|1304222640|7255,1'3097,4'748,4'8106,1'8159,2'8402,1'8696,1'9022,1<br />
<br />
----<br />
<br />
=== GROUPSTATUS: Get Completed Episode ===<br />
Returns a list of group names and ranges of episodes released by the group for a given anime.<br />
<br />
'''Command String:'''<br />
* GROUPSTATUS aid={int animeid}[&state={int completion_state}]<br />
<br />
'''Possible Replies:'''<br />
* 225 GROUPSTATUS<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: ... (repeated)<br />
<br />
* 325 NO SUCH GROUPS FOUND<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* The seven fields will be repeated as necessary, one for each group, separated by a new line character<br />
* Groups will be filtered by the languages selected in the user's profile<br />
* If ''state'' is not supplied, groups with a completion state of <i>'ongoing'</i>, <i>'finished'</i>, or <i>'complete'</i> are returned<br />
* Groups are returned in order of descending episode count<br />
* If there are more groups to return than can be stored in a UDP packet, additional groups will be silently discarded<br />
* ''state'' values: <br />
#ongoing<br />
#stalled<br />
#complete<br />
#dropped<br />
#finished<br />
#specials only<br />
<br />
'''Example:'''<br />
> GROUP GROUPSTATUS aid=8692&s=vLl1N<br />
< 225 GROUPSTATUS<br />
7407|Coalgirls|3|25|839|12|1-25<br />
9863|Hadena Subs|3|25|374|1|1-25<br />
11951|ChaosBlades|3|25|0|0|1-25<br />
[truncated]<br />
<br />
=== UPDATED: Get List of Updated Anime IDs ===<br />
Returns a list of AniDB anime ids of anime that have been updated in in a given time frame, ordered by descending age (oldest to newest change).<br />
<br />
'''Command String:'''<br />
* UPDATED entity=1&[age={int4 id}|time={int4 date}]<br />
<br />
'''Possible Replies:'''<br />
* 243 UPDATED<br />
{int entity}|{int total count}|{int last update date}|{list aid}<br />
<br />
* 343 NO UPDATES<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1<br />
* Either ''age'' OR ''time'' can be specified, but not both<br />
* ''age'' is specified in days.<br />
** eg: age=30 requests a list of aid values of anime that have changed in the past 30 days<br />
* ''time'' is specified in unix time.<br />
** eg: time=1264982400 requests a list of aid values of anime that have changed since 2010-02-01<br />
* A maximum of 200 values will be returned<br />
* ''count'' specifies the total number of items found for the given time period. In short, if this value is great than 200, you have not retrieved all applicable ids.<br />
* ''last update date'' will contain the AniDB update time of the ''last'' aid to appear on the list<br />
* A given list value will appear only once. If there have been multiple changes to an entity, its age will reflect the most recent change.<br />
<br />
'''An anime will be considered updated if:'''<br />
* A change is made to the anime record itself<br />
* An ''main'' or ''official'' anime title is added, edited, or deleted (not ''short'' or ''synonym'')<br />
* An episode for the anime is added, or delete (but NOT edited!)<br />
* An episode title is added, edited, or delete<br />
* An anime relation is added, or deleted<br />
<br />
== MyList Commands ==<br />
=== MYLIST: Retrieve MyList Data ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLIST lid={int4 lid}<br />
by fid:<br />
* MYLIST fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLIST size={int4 size}&ed2k={str ed2khash}<br />
by anime + group + epno<br />
* MYLIST aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 221 MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 312 MULTIPLE MYLIST ENTRIES<br />
: {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}<br />
* 321 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* The state field provides information about the location and sharing state of a file in MyList.<br />
* 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).<br />
* eps is a list of episodes, e.g. "1-12,14-16,T1"<br />
<br />
'''States:'''<br />
0 - unknown - state is unknown or the user doesn't want to provide this information<br />
1 - on hdd - the file is stored on hdd (but is not shared)<br />
2 - on cd - the file is stored on cd<br />
3 - deleted - the file has been deleted or is not available for other reasons (i.e. reencoded)<br />
<br />
'''Filestates:''' (for normal files, i.e. not generic)<br />
0 => normal/original<br />
1 => corrupted version/invalid crc<br />
2 => self edited<br />
10 => self ripped<br />
11 => on dvd<br />
12 => on vhs<br />
13 => on tv<br />
14 => in theaters<br />
15 => streamed<br />
100 => other<br />
<br />
'''Example:'''<br />
> MYLIST aname=gits sac&s=xxxxx<br />
< 322 MULTIPLE FILES FOUND<br />
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<br />
<br />
----<br />
=== MYLISTADD: Add file to MyList ===<br />
The command string for MYLISTADD is made of up two blocks: a 'fileinfo' block, which limits the command to a specific file, or an 'animeinfo'/'groupinfo'/'episodeinfo' block, which can be used to specify a range of files, including generics. Additionally, a number of optional parameters can be included with either set.<br />
<br />
'''Adding a single file to the MyList with the 'fileinfo' block'''<br />
<br />
* MYLISTADD fid={int4 fid}<br />
'''or'''<br />
* MYLISTADD size={int4 size}&ed2k={str ed2khash}<br />
'''or'''<br />
* MYLISTADD lid={int4 lid}&edit=1 (valid for edit only)<br />
<br />
'''Adding one or more files to the MyList with the 'animeinfo'/'groupinfo'/'episodeinfo' block'''<br />
<br />
Here, you have a number of options, depending on what data you have available. In brief, 'animeinfo' represents a choice between anime id and anime name. 'groupinfo' represents a choice between group id, group name, and generic=1. 'episodeinfo' represents a range of one or more episodes.<br />
<br />
* MYLISTADD aid={int4 aid}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&generic=1&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&generic=1&epno={int4 episode number}<br />
<br />
Each command listed can have, in addition, a number of optional components to provide further MyList details. Append these as desired.<br />
<br />
* &state={int2 state}<br />
* &viewed={boolean viewed}<br />
* &viewdate={int4 viewdate}<br />
* &source={str source}<br />
* &storage={str storage}<br />
* &other={str other}<br />
<br />
Finally, edit=1 can be included to edit a MyList entry instead of creating a new one. When editing, optional values that are not supplied retain their original value. That is, they are ''not'' replaced with default or empty values. Only values supplied are updated.<br />
<br />
'''Possible Replies:'''<br />
* 320 NO SUCH FILE<br />
* 330 NO SUCH ANIME<br />
* 350 NO SUCH GROUP<br />
when edit=0 and adding by fid, size/ed2k<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 mylist id of new entry}<br />
when edit=0 and adding by aname, aid<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 number of entries added}<br />
* 310 FILE ALREADY IN MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 1}|{int4 fid 2}|...|{int4 fid n}<br />
when edit=1<br />
* 311 MYLIST ENTRY EDITED<br />
* 311 MYLIST ENTRY EDITED<br />
: {int4 number of entries edited}<br />
* 411 NO SUCH MYLIST ENTRY<br />
<br />
'''Info:'''<br />
* All data except lid/fid/size+hash/generic is optional.<br />
* Viewed should be 0 for unwatched files and 1 for watched files.<br />
* If viewdate is not specified, the current time will be used. The field will be disregarded if viewed=0.<br />
* Other is the only field which may contain newlines, but they have to be stored as &lt;br /&gt;<br />
* For state values refer to: '''MYLIST'''<br />
* If you want to change an existing entry and already know its MyList id (lid) please use the lid-version of this command. It put less load on the server.<br />
* epno=0 means all eps (default), negative numbers means upto. (-12 -> upto 12)<br />
* group is optional only when edit=1, meaning you can't add every file for an anime<br />
* If the file already exists (response code 310), the ''current'' record will be returned, in the same format as the MYLIST response.<br />
----<br />
<br />
=== MYLISTDEL: Remove file from MyList ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLISTDEL lid={int4 lid}<br />
by fid:<br />
* MYLISTDEL fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLISTDEL size={int4 size}&ed2k={str ed2k hash}<br />
by anime + group + epno<br />
* MYLISTDEL aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 211 MYLIST ENTRY DELETED<br />
: {int4 number of entries}<br />
* 411 NO SUCH MYLIST ENTRY<br />
'''Info:'''<br />
* group is optional<br />
* command will delete all enties found<br />
<br />
----<br />
=== MYLISTSTATS : Retrieve MyList stats ===<br />
'''Command String:'''<br />
* MYLISTSTATS<br />
'''Possible Replies:'''<br />
* 222 MYLIST STATS<br />
{animes}|{eps}|{files}|{size of files}|{added animes}|{added eps}|{added files}|{added groups}|{leech %}|{glory %}|{viewed % of db}|{mylist % of db}|{viewed % of mylist}|{number of viewed eps}|{votes}|{reviews}|{viewed length in minutes}<br />
<br />
'''Info:'''<br />
* All fields are int<br />
<br />
----<br />
<br />
=== VOTE: Vote for specified anime/episode/group ===<br />
'''Command String:'''<br><br />
by id<br />
* VOTE type={int2 type}&id={int4 id}[&value={int4 vote value}&epno={int4 episode number}]<br />
by name<br />
* VOTE type={int2 type}&name={string name}[&value={int4 vote value}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 260 VOTED<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 261 VOTE FOUND<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 262 VOTE UPDATED<br />
: {str entity name}|{old vote value}|{vote type}|{entity id}<br />
* 263 VOTE REVOKED<br />
: {str entity name}|{revoked vote value}|{vote type}|{entity id}<br />
* 360 NO SUCH VOTE<br />
: {str entity name}|0|{vote type}|{entity id}<br />
* 361 INVALID VOTE TYPE<br />
* 362 INVALID VOTE VALUE<br />
* 363 PERMVOTE NOT ALLOWED<br />
: {str aname}|{vote value}|{type}|{entity id}<br />
* 364 ALREADY PERMVOTED<br />
: {str entity name}|{existing vote value}|{vote type}|{entity id}<br />
<br />
'''Info:'''<br />
* type: 1=anime, 2=anime tmpvote, 3=group<br />
* entity: anime, episode, or group<br />
* for episode voting add epno on type=1<br />
* value: negative number means revoke, 0 means retrieve (default), 100-1000 are valid vote values, rest is illegal<br />
* votes will be updated automatically (no questions asked)<br />
* tmpvoting when there exist a perm vote is not possible<br />
<br />
----<br />
<br />
=== RANDOM: Get a random anime ===<br />
'''Command String:'''<br />
* RANDOMANIME type={int4 type}<br />
<br />
'''Possible Replies:'''<br />
* 230 ANIME ... (see ANIME)<br />
<br />
'''Info:'''<br />
* type: 0=from db, 1=watched, 2=unwatched, 3=all mylist<br />
<br />
== Misc Commands ==<br />
=== MYLISTEXPORT: Schedule a MyList Export ===<br />
Queues a {{AniDBLink|export|MyList Export}} by the AniDB Servers. As with a manual export request, exports are only done during periods when server load is low. As a result, exports may take up to 24 hours. The client submitting the request will receive an AniDB message when the export is ready to be collected.<br />
<br />
Only one export can be in the queue at a time.<br />
<br />
'''Command String:'''<br />
* MYLISTEXPORT [template={str template_name}|cancel=1]<br />
<br />
'''Possible Replies:'''<br />
* 217 EXPORT QUEUED<br />
* 218 EXPORT CANCELLED<br />
* 317 EXPORT NO SUCH TEMPLATE<br />
* 318 EXPORT ALREADY IN QUEUE<br />
* 319 EXPORT NO EXPORT QUEUED OR IS PROCESSING<br />
<br />
'''Info:'''<br />
* ''template_name'' must match an available export template on the {{AniDBLink|export|MyList Export}} page.<br />
* ''cancel'' will cancel any pending export request, queued either through UDP or the web server.<br />
* Clients can subscribe the message notifications if they wish to be notified when an export is complete.<br />
<br />
----<br />
<br />
=== PING: Ping Command ===<br />
'''Command String:'''<br />
* PING [nat=1]<br />
<br />
'''Possible Replies:'''<br />
* 300 PONG<br />
: {int4 port} ''(when nat=1)''<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* May be used by a frontend to determine if the API is still available.<br />
* May be executed even if not yet logged in.<br />
* The option <tt>nat=1</tt> provides an easy way to determine if the router has changed the outgoing port. ({{t|587}})<br />
<br />
----<br />
<br />
=== VERSION: Retrieve Server Version ===<br />
'''Command String:'''<br />
* VERSION<br />
<br />
'''Possible Replies:'''<br />
* 998 VERSION<br />
: {str server version}<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
<br />
----<br />
=== UPTIME: Retrieve Server Uptime ===<br />
'''Command String:'''<br />
* UPTIME<br />
<br />
'''Possible Replies:'''<br />
* 208 UPTIME<br />
: {int4 udpserver uptime in milliseconds}<br />
<br />
'''Info:'''<br />
* This command is the preferred way to check that the session is OK.<br />
<br />
----<br />
=== ENCODING: Change Encoding for Session ===<br />
Sets preferred [[Wikipedia:Character encoding|encoding]] per session. The preferred way to do this is to use the '''enc''' argument for AUTH. This command is mostly for testing.<br />
<br />
'''Command String:'''<br />
* ENCODING name={str encoding name}<br />
<br />
'''Possible Replies:'''<br />
* 219 ENCODING CHANGED<br />
* 519 ENCODING NOT SUPPORTED<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* Supported encodings: http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html<br />
* Default: ASCII.<br />
* Resets to default on logout.<br />
<br />
----<br />
<br />
=== SENDMSG: Send Message ===<br />
'''Command String:'''<br />
* SENDMSG to={str username}&title={str title}&body={str body}<br />
<br />
'''Possible Replies:'''<br />
* 294 SENDMSG SUCCESSFUL<br />
* 394 NO SUCH USER<br />
* 501 LOGIN FIRST<br />
<br />
'''Note:'''<br />
* This command allows you to send an AniDB message.<br />
{{eyecatch|Important|<br />
title must not be longer than 50 chars.<br><br />
body must not be longer than 900 chars.<br />
}}<br />
<br />
----<br />
=== USER: Retrieve User UID ===<br />
'''Command String:'''<br />
* USER [user={str user name}|uid={int user id}]<br />
<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 295 USER<br />
: {int4 uid}|{str username}<br />
<br />
----<br />
<br />
=== STATS [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* STATS<br />
<br />
'''Possible Replies:'''<br />
* 206 STATS<br />
: {int4 animes)|{int4 eps}|{int4 files}|{int4 groups}|{int4 users}|{int8 total file size in bytes}|{int4 open [[creq|creqs]]}<br />
<br />
----<br />
=== TOP [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* TOP<br />
<br />
'''Possible Replies:'''<br />
* 207 TOP<br />
: {str longest mylist}|{int count}<br />
: {str largest mylist}|{int count}<br />
: {str most lame files}|{int count}<br />
: {str most indep. user}|{int count}<br />
: {str biggest leecher}|{int count}<br />
: {str most anime added}|{int count}<br />
: {str most eps added}|{int count}<br />
: {str most files added}|{int count}<br />
: {str most groups added}|{int count}<br />
: {str most votes}|{int count}<br />
: {str most reviews}|{int count}<br />
<br />
'''Info:'''<br />
* All strings are user names.<br />
* 'Hide myself in IRC stats' applies for this too.<br />
<br />
== Fatal Errors ==<br />
At anypoint int the retrieval process you have to expect the following output:<br />
* 6xx INTERNAL SERVER ERROR<br />
: ERROR: {str errormessage}<br />
OR<br />
*6xx INTERNAL SERVER ERROR - {str errormessage}<br />
<br />
Such errors should be reported back to [[User:Ommina|Ommina]].<br />
(xx is a number between 00 and 99)<br />
<br />
If you supply an unknown or unimplemented command you will get an error:<br />
* 598 UNKNOWN COMMAND<br />
<br />
== Return Codes ==<br />
{{eyecatch|Note|While the names below '''are''' the actual code strings returned by the server, clients are nonetheless encouraged to work with the numeric codes instead. }}<br />
<pre><br />
LOGIN_ACCEPTED = 200<br />
LOGIN_ACCEPTED_NEW_VERSION = 201<br />
LOGGED_OUT = 203<br />
RESOURCE = 205<br />
STATS = 206<br />
TOP = 207<br />
UPTIME = 208<br />
ENCRYPTION_ENABLED = 209<br />
MYLIST_ENTRY_ADDED = 210<br />
MYLIST_ENTRY_DELETED = 211<br />
ADDED_FILE = 214<br />
ADDED_STREAM = 215<br />
EXPORT_QUEUED = 217<br />
EXPORT_CANCELLED = 218<br />
ENCODING_CHANGED = 219<br />
FILE = 220<br />
MYLIST = 221<br />
MYLIST_STATS = 222<br />
WISHLIST = 223<br />
NOTIFICATION = 224<br />
GROUP_STATUS = 225<br />
WISHLIST_ENTRY_ADDED = 226<br />
WISHLIST_ENTRY_DELETED = 227<br />
WISHLIST_ENTRY_UPDATED = 228<br />
MULTIPLE_WISHLIST = 229<br />
ANIME = 230<br />
ANIME_BEST_MATCH = 231<br />
RANDOM_ANIME = 232<br />
ANIME_DESCRIPTION = 233<br />
REVIEW = 234<br />
CHARACTER = 235<br />
SONG = 236<br />
ANIMETAG = 237<br />
CHARACTERTAG = 238<br />
EPISODE = 240<br />
UPDATED = 243<br />
TITLE = 244<br />
CREATOR = 245<br />
NOTIFICATION_ENTRY_ADDED = 246<br />
NOTIFICATION_ENTRY_DELETED = 247<br />
NOTIFICATION_ENTRY_UPDATE = 248<br />
MULTIPLE_NOTIFICATION = 249<br />
GROUP = 250<br />
CATEGORY = 251<br />
BUDDY_LIST = 253<br />
BUDDY_STATE = 254<br />
BUDDY_ADDED = 255<br />
BUDDY_DELETED = 256<br />
BUDDY_ACCEPTED = 257<br />
BUDDY_DENIED = 258<br />
VOTED = 260<br />
VOTE_FOUND = 261<br />
VOTE_UPDATED = 262<br />
VOTE_REVOKED = 263<br />
HOT_ANIME = 265<br />
RANDOM_RECOMMENDATION = 266<br />
RANDOM_SIMILAR = 267<br />
NOTIFICATION_ENABLED = 270<br />
NOTIFYACK_SUCCESSFUL_MESSAGE = 281<br />
NOTIFYACK_SUCCESSFUL_NOTIFIATION = 282<br />
NOTIFICATION_STATE = 290<br />
NOTIFYLIST = 291<br />
NOTIFYGET_MESSAGE = 292<br />
NOTIFYGET_NOTIFY = 293<br />
SENDMESSAGE_SUCCESSFUL = 294<br />
USER_ID = 295<br />
CALENDAR = 297<br />
<br />
PONG = 300<br />
AUTHPONG = 301<br />
NO_SUCH_RESOURCE = 305<br />
API_PASSWORD_NOT_DEFINED = 309<br />
FILE_ALREADY_IN_MYLIST = 310<br />
MYLIST_ENTRY_EDITED = 311<br />
MULTIPLE_MYLIST_ENTRIES = 312<br />
WATCHED = 313<br />
SIZE_HASH_EXISTS = 314<br />
INVALID_DATA = 315<br />
STREAMNOID_USED = 316<br />
EXPORT_NO_SUCH_TEMPLATE = 317<br />
EXPORT_ALREADY_IN_QUEUE = 318<br />
EXPORT_NO_EXPORT_QUEUED_OR_IS_PROCESSING = 319<br />
NO_SUCH_FILE = 320<br />
NO_SUCH_ENTRY = 321<br />
MULTIPLE_FILES_FOUND = 322<br />
NO_SUCH_WISHLIST = 323<br />
NO_SUCH_NOTIFICATION = 324<br />
NO_GROUPS_FOUND = 325<br />
NO_SUCH_ANIME = 330<br />
NO_SUCH_DESCRIPTION = 333<br />
NO_SUCH_REVIEW = 334<br />
NO_SUCH_CHARACTER = 335<br />
NO_SUCH_SONG = 336<br />
NO_SUCH_ANIMETAG = 337<br />
NO_SUCH_CHARACTERTAG = 338<br />
NO_SUCH_EPISODE = 340<br />
NO_SUCH_UPDATES = 343<br />
NO_SUCH_TITLES = 344<br />
NO_SUCH_CREATOR = 345<br />
NO_SUCH_GROUP = 350<br />
NO_SUCH_CATEGORY = 351<br />
BUDDY_ALREADY_ADDED = 355<br />
NO_SUCH_BUDDY = 356<br />
BUDDY_ALREADY_ACCEPTED = 357<br />
BUDDY_ALREADY_DENIED = 358<br />
NO_SUCH_VOTE = 360<br />
INVALID_VOTE_TYPE = 361<br />
INVALID_VOTE_VALUE = 362<br />
PERMVOTE_NOT_ALLOWED = 363<br />
ALREADY_PERMVOTED = 364<br />
HOT_ANIME_EMPTY = 365<br />
RANDOM_RECOMMENDATION_EMPTY = 366<br />
RANDOM_SIMILAR_EMPTY = 367<br />
NOTIFICATION_DISABLED = 370<br />
NO_SUCH_ENTRY_MESSAGE = 381<br />
NO_SUCH_ENTRY_NOTIFICATION = 382<br />
NO_SUCH_MESSAGE = 392<br />
NO_SUCH_NOTIFY = 393<br />
NO_SUCH_USER = 394<br />
CALENDAR_EMPTY = 397<br />
NO_CHANGES = 399<br />
<br />
NOT_LOGGED_IN = 403<br />
NO_SUCH_MYLIST_FILE = 410<br />
NO_SUCH_MYLIST_ENTRY = 411<br />
MYLIST_UNAVAILABLE = 412<br />
<br />
LOGIN_FAILED = 500<br />
LOGIN_FIRST = 501<br />
ACCESS_DENIED = 502<br />
CLIENT_VERSION_OUTDATED = 503<br />
CLIENT_BANNED = 504<br />
ILLEGAL_INPUT_OR_ACCESS_DENIED = 505<br />
INVALID_SESSION = 506<br />
NO_SUCH_ENCRYPTION_TYPE = 509<br />
ENCODING_NOT_SUPPORTED = 519<br />
BANNED = 555<br />
UNKNOWN_COMMAND = 598<br />
<br />
INTERNAL_SERVER_ERROR = 600<br />
ANIDB_OUT_OF_SERVICE = 601<br />
SERVER_BUSY = 602<br />
NO_DATA = 603<br />
TIMEOUT - DELAY AND RESUBMIT = 604<br />
API_VIOLATION = 666<br />
<br />
PUSHACK_CONFIRMED = 701<br />
NO_SUCH_PACKET_PENDING = 702<br />
<br />
VERSION = 998</pre><br />
<br />
[[Category:Development]]<br />
[[Category:UDP]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=User:Ommina&diff=22788User:Ommina2017-04-10T22:34:40Z<p>Ommina: /* NOTIFICATIONDEL: Remove Anime or Group from Notify List */</p>
<hr />
<div>{{TOCright}}<br />
<br />
--> Edit FILE docs to include MyList data block <--<br />
<br />
=== CATEGORY: Retrieve Category Data ===<br />
<br />
=== SIMILAR: Approve or Disapprove of a Similar Pairing ===<br />
<br />
'''Command String:'''<br />
* SIMILAR entity=1&id1={int4 id}&id2={int4 id}[&approve={str [y|n|r]}]<br />
<br />
'''Possible Replies:'''<br />
* 275 SIMILAR APPROVAL<br />
{int entity}|{int sid}|{int id1}|{int id2}|{int total}|{int approved}|{str [y|n]}<br />
* 276 SIMILAR APPROVAL FOUND<br />
{int entity}|{int sid}|{int id1}|{int id2}|{int total}|{int approved}|{str [y|n]}<br />
* 277 SIMILAR APPROVAL UPDATED<br />
{int entity}|{int sid}|{int id1}|{int id2}|{int total}|{int approved}|{str [y|n]}<br />
* 278 SIMILAR APPROVAL REVOKED<br />
{int entity}|{int sid}|{int id1}|{int id2}|{int total}|{int approved}|{str r}<br />
<br />
* 375 NO SUCH SIMILAR PAIRING<br />
{int entity}|{int id1}|{int id2}<br />
* 376 NO SUCH SIMILAR PAIRING APPROVAL<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1.<br />
* ''id1'' and ''id2'' represent an ''existing'' pair of ids. There are no provisions for ''adding'' new similar pairs<br />
* Which id is assigned to ''id1'' and which id is assigned to ''id2'' is irrelevant<br />
* Use ''approval=y'' to approve the pair, ''approve=n'' to disapprove, and ''approve=r'' to revoke (delete) an existing approval/disapproval.<br />
* If an approval vote is already assigned, submitting a new ''y''/''n'' value will replace the old vote.<br />
<br />
=== UPDATED: Get List of Updated Anime IDs ===<br />
Returns a list of AniDB anime ids of anime that have been updated in in a given time frame, ordered by descending date.<br />
<br />
'''Command String:'''<br />
* UPDATED entity=1&[age={int4 id}|time={int4 date}]<br />
<br />
'''Possible Replies:'''<br />
* 243 UPDATED<br />
{int entity}|{int total count}|{int last update date}|{list aid}<br />
<br />
* 343 NO UPDATES<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1<br />
* Either ''age'' OR ''time'' can be specified, but not both<br />
* ''age'' is specified in days.<br />
** eg: age=30 requests a list of aid values of anime that have changed in the past 30 days<br />
* ''time'' is specified in unix time.<br />
** eg: time=1264982400 requests a list of aid values of anime that have changed since 2010-02-01<br />
* A maximum of 200 values will be returned<br />
* ''count'' specifies the total number of items found for the given time period. In short, if this value is great than 200, you have not retrieved all applicable ids.<br />
* ''last update date'' will contain the AniDB update time of the ''last'' aid to appear on the list<br />
<br />
'''An anime will be considered updated if:'''<br />
* A change is made to the anime record itself<br />
* An ''main'' or ''official'' anime title is added, edited, or deleted (not ''short'' or ''synonym'')<br />
* An episode for the anime is added, or delete (but NOT edited!) ( --> But perhaps airdate changes should <-- )<br />
* An episode title is added, edited, or delete<br />
* An anime category is added, or deleted (but NOT edited: eg, weight change)<br />
* An anime relation is added, or deleted<br />
<br />
=== REVIEW: Get Anime Review ===<br />
Retrieves the review scores and text for an anime review. Like ANIMEDESC, it will likely take multiple calls to this comment to retrieve a complete review - almost all reviews will overflow the size limits of a UDP packet.<br />
<br />
'''Command String:'''<br />
* REVIEW rid={int4 id}<br />
<br />
'''Possible Replies:'''<br />
* 234 REVIEW<br />
: {int4 current part}|{int4 max parts}|{int4 review id}|{int4 author uid}|{int4 score_animation}|{int4 score_sound}|{int4 score_story}|{int4 score_character}|{int4 score_value}|{int4 score_enjoyment}|{str review_text}<br />
* 234 REVIEW<br />
: {int4 current part}|{int4 max parts}|{str review_text}<br />
<br />
* 334 NO SUCH REVIEW<br />
<br />
'''Info:'''<br />
* IDs and scores are returned with part zero only. Parts one through max exclude the scores and return the text block only.<br />
<br />
<br />
<br />
<br />
<br />
[Maybe exchange author uid for author name. Or a uid->name lookup via USER?]<br />
<br />
=== WISHLIST: Retrieve Wishlist Data ===<br />
<br />
Retrieve wishlist data.<br />
<br />
'''Command String:'''<br><br />
full list:<br />
* WISHLIST<br />
by aid:<br />
* WISHLIST aid={int4 aid}<br />
by wishlist id:<br />
* WISHLIST lid={int4 lid}<br />
by priority:<br />
* WISHLIST priority={int4 priority}<br />
<br><br />
'''Possible Replies:'''<br><br />
<br><br />
by aid, lid:<br />
*223 WISHLIST<br />
: {int4 lid}|{int4 aid}|{int2 type}|{int2 priority}|{int4 fromuid}|{str comment}|{int4 adddate}<br />
<br><br />
full list, by priority:<br />
<br />
*229 MULTIPLE WISHLIST ITEMS<br />
: {int4 aid}|{int4 type}|{int4 priority}/n<br />
: {int4 aid}|{int4 type}|{int4 priority}/n<br />
..repeated n times<br />
<br><br><br />
*323 NO SUCH WISHLIST ITEM<br />
<br><br />
'''Info:'''<br />
* ''Priority'' values are 0: low, 1: medium, 2: high<br />
* ''Type'' values are 1: to watch, 2: to get<br />
* Multiple items are returned in descending priority (high priority first)<br />
* The ''fromuid'' field represents the uid of the user that created the wishlist entry. Typically this is the actual user, but could be a buddy.<br />
<br />
=== WISHLISTADD: Add Anime to Wishlist ===<br />
<br />
'''Command String:'''<br><br />
<br />
* WISHLISTADD aid={int4 aid}&type={int2 type}&priority={int2 priority}[&comment={str comment}]<br />
<br />
<br />
* 226 WISHLIST ITEM ADDED<br />
: {int4 wishlist id}<br />
* 228 WISHLIST ITEM UPDATED<br />
: {int4 wishlist id}<br />
<br />
=== WISHLISTDEL: Remove Anime from Wishlist ===<br />
<br />
=== NOTIFICATION: Retrieve Notification Date ===<br />
<br />
=== NOTIFICATIONADD: Add Anime or Group to Notify List ===<br />
<br />
'''Command String:'''<br><br />
<br />
by anime id:<br />
* NOTIFICATIONADD aid={int4 aid}&type={int2 type}&priority={int2 priority}<br />
by group id:<br />
* NOTIFICATIONADD gid={int4 gid}&type={int2 type}&priority={int2 priority}<br />
<br><br />
'''Possible Replies:'''<br />
<br />
* 246 NOTIFICATION ITEM ADDED<br />
: {int4 notification id}<br />
* 248 NOTIFICATION ITEM UPDATED<br />
: {int4 notification id}<br />
* 399 NO CHANGES<br />
<br><br />
'''Info:'''<br />
* ''Priority'' values are 0: low, 1: medium, 2: high<br />
* ''Type'' values are 0: all, 1: new, 2: group, 3: complete<br />
<br />
=== NOTIFICATIONDEL: Remove Anime or Group from Notify List ===<br />
<br />
'''Command String:'''<br><br />
<br />
by anime id:<br />
* NOTIFICATIONDEL aid={int4 aid}<br />
by group id:<br />
* NOTIFICATIONDEL gid={int4 gid}<br />
<br><br />
'''Possible Replies:'''<br />
<br />
* 247 NOTIFICATION ITEM DELETED<br />
: {int4 notification_table}|{int4 relid}<br />
* 324 NO SUCH NOTIFICATION ITEM<br />
<br />
<br><br />
'''Info:'''<br />
* ''notification_table'' values are 1: anime, 2: group<br />
* ''relid'' value matches the aid/gid supplied<br />
<br />
=== Empty Table === <br />
<br />
<table><br />
<tr><br />
<td colspan="3" align="center">Byte 1</td><br />
</tr><br />
<tr><br />
<td>Bit</td><br />
<td>Decimal</td><br />
<td>Data Field</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>String</td><br />
</tr><br />
</table><br />
<br />
=== Permissions (badges) ===<br />
<br />
<pre>[22 Jan 12 16:57] * Ommina: baka gives good advice. Let's get the permission thing fully figured out. If I'm going to stop playing minecraft, I don't want to have to redo stuff. (and now gone for food.)<br />
[22 Jan 12 17:04] * worf: well ... what do we have<br />
[22 Jan 12 17:04] * worf: we have a set of personal settings that only affect you<br />
[22 Jan 12 17:05] * worf: hiding thumbnails, hiding all images, hiding porn images, hiding all porn<br />
[22 Jan 12 17:06] * worf: but those dont need to be considered in the xml<br />
[22 Jan 12 17:07] * worf: and then we have the permissions <br />
[22 Jan 12 17:07] * worf: see me in user list, see my anime list, see storage info, see source info, see viewed info, see ep info, see file info, see state info, see my votes, see my wishlist, see my userpage, see my porn<br />
[22 Jan 12 17:08] * worf: see my porn - obviously would apply to the hentai badge<br />
[22 Jan 12 17:09] * worf: see my anime list - should apply to all anime and creator badges<br />
[22 Jan 12 17:09] * DerIdiot: see my anime list/see viewed info/see ep info/see my votes are the ones that matter<br />
[22 Jan 12 17:11] * worf: see my votes shouldnt matter<br />
[22 Jan 12 17:11] * DerIdiot: wasn't sure if you have some badge with them<br />
[22 Jan 12 17:11] * DerIdiot: if not then yes it doesn't<br />
[22 Jan 12 17:11] * worf: there is a counter badge<br />
[22 Jan 12 17:11] * worf: but we are already displaying the number of votes on the userpage anyway<br />
[22 Jan 12 17:12] * worf: i dont think that permission hides the counter either<br />
[22 Jan 12 17:12] * DerIdiot: i'm not 100% sure, but if not then yes you cna ignore it<br />
[22 Jan 12 17:14] * worf: the only usage of PERM_SEEVOTES on the userpage appears to be for hiding the latest votes<br />
[22 Jan 12 17:17] * worf: so ... <br />
[22 Jan 12 17:17] * worf: PERM_SEEMYPORN for the hentai badge<br />
[22 Jan 12 17:18] * worf: PERM_SHOWMYLIST for all anime and creator based badges including the hentai badge<br />
[22 Jan 12 17:18] * worf: PERM_VIEWEDINFO same as the above i guess<br />
[22 Jan 12 17:20] * worf: PERM_EPINFO shouldnt apply since we arent displaying which episodes have been watched. just how many<br />
[22 Jan 12 17:22] * DerIdiot: PERM_EPINFO says that somethign is in mylist; PERM_VIEWEDINFO does the same + says that it's watched<br />
[22 Jan 12 17:25] * worf: if you have PERM_SHOWMYLIST on "everyone" and PERM_EPINFO on "no one" then you can only see which anime a person has but not which episodes<br />
[22 Jan 12 17:25] * DerIdiot: yes<br />
[22 Jan 12 17:25] * worf: hm, ok<br />
[22 Jan 12 17:25] * worf: it hides the counts too<br />
[22 Jan 12 17:26] * worf: k<br />
[22 Jan 12 17:26] * DerIdiot: but you only got watched badges not collecting ones right?<br />
[22 Jan 12 17:26] * worf: yes<br />
[22 Jan 12 17:26] * DerIdiot: then PERM_VIEWEDINFO is enough<br />
[22 Jan 12 17:26] * DerIdiot: should prolly have PERM_SHOWMYLIST and PERM_VIEWEDINFO<br />
[22 Jan 12 17:27] * worf: hmm<br />
</pre></div>Omminahttps://wiki.anidb.net/index.php?title=UDP_API_Definition&diff=22508UDP API Definition2016-03-16T17:57:13Z<p>Ommina: /* ANIME: Retrieve Anime Data */</p>
<hr />
<div>{{TOCright}}<br />
<br />
== General Information ==<br />
'''Author:''' [[User:Exp|Exp]] & [[User:Epoximator|Epoximator]] & [[User:Ommina|Ommina]]<br><br />
'''Version:''' 0.03.730 (2015-03-25)<br><br />
'''Version number used for protover parameter:''' "3"<br />
<br />
'''IMPORTANT INFORMATION FOR ALL INTERESTED:'''<br />
* If you are mainly interested in notifications and private messaging, check out our [[Jabber]] and [[RSSRDF]] support first.<br />
* The UDP API is not an appropriate choice if you desire to download a local copy of the AniDB database.<br />
* If you want to create a client you have to register it {{AniDBLink|client|here}} and [[UDP Clients|here]].<br />
** Check out the clients that are being developed. There exists usable code in many different languages already.<br />
* If you have suggestions for improvements or new features use the [[UDP API DEV|development]] page.<br />
* Please also take a look at the [[API]] page.<br />
<br />
== Formats used in this Spec ==<br />
* {vartype varname} - Specifies what shall be inserted at this point and its type.<br />
* [...] - Everything between [ and ] is optional.<br />
<br />
=== Used types ===<br />
* ''int2'' - 2 byte Integer (in string representation)<br />
* ''int4'' - 4 byte Integer (in string representation)<br />
* ''boolean'' - true or false - use '1' for ''true'', '0' for ''false''<br />
* ''str'' - String (UDP packet length restricts string size to 1400 bytes)<br />
* ''hexstr'' -- a hex representation of a decimal value, two characters per byte. If multiple bytes are represented, byte one is the first two characters of the string, byte two the next two, and so on.<br />
<br />
=== Content Encoding ===<br />
* Default character encoding: ''ASCII''<br />
* Escape scheme for option values (to server): ''html form encoding'' + ''newline''<br />
** This means you have to encode at least <tt>&</tt> in your option values in html form encoding style (<tt>&amp;amp;</tt>) before sending them to the api server. All other html form encodings are optional.<br />
** All newlines should be replaced by &lt;br /&gt;<br />
* Escape scheme for returned data fields (from server): ', | and newline<br />
** Content newlines are encoded as &lt;br /&gt;, ' is encoded as ` and | is encoded as /.<br />
** Dates are returned in unix time (number of seconds elapsed since January 1, 1970 00:00:00 UTC)<br />
<br />
== Basics ==<br />
=== General ===<br />
The network communication is ''packet'' and ''line'' based. Each AniDB API command is exactly one UDP packet containing one line. Results are sent as one packet but may consist out of multiple lines. A return value always starts with a 3 byte result code followed by a human readable version of the result code. Be aware that important data fields may be returned directly after the return code (see: 200,201,209,271,272,504).<br />
The meaning for all result codes can be found in this document. If there is more than one entry returned, it's one entry per line. Lines are terminated by a <tt>\n</tt> (no dos linefeed <tt>\r</tt>). The elements of a format string are separated by a "|" character.<br />
<br />
<tt>{three digit return code} {str return string}\n</tt><br><br />
<tt>{data field 0}|{data field 1}|...|{data field n}</tt><br />
<br />
'''IMPORTANT:'''<br />
* All commands except PING, ENCRYPT, ENCODING, AUTH and VERSION '''requires''' login, meaning that the ''session tag'' must be set (<tt>s=xxxxx</tt>).<br />
* A client should ignore any additional trailing data fields it doesn't expect. Additional fields are going to be added to the output of some commands from time to time. Those additional fields will simply be appended to the end of the existing output. A client should be written in a way so that it is not affected by such new fields.<br />
* Due to the length constraints of an UDP package (over PPPoE) the replies from the server will never exceed 1400 bytes. String fields will be truncated if necessary to ensure this. No warnings are given when this happens.<br />
* A client should handle all possible return codes for each command.<br />
** Possible return codes for '''all commands''':<br />
*** 505 ILLEGAL INPUT OR ACCESS DENIED<br />
*** 555 BANNED<br />
***: {str reason}<br />
*** 598 UNKNOWN COMMAND<br />
*** 600 INTERNAL SERVER ERROR<br />
*** 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
*** 602 SERVER BUSY - TRY AGAIN LATER<br />
*** 604 TIMEOUT - DELAY AND RESUBMIT<br />
** Additional return codes for all commands that '''require login''':<br />
*** 501 LOGIN FIRST<br />
*** 502 ACCESS DENIED<br />
*** 506 INVALID SESSION<br />
<br />
{{eyecatch|Note|The '555 BANNED' message should not be expected by the client. This message is only enabled temporary to help developers understand what they are doing wrong.}}<br><br />
<br />
{{eyecatch|Note|<br />
While in daily maintenance the AniDB API will reply with<br />
<br />
601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
<br />
to all commands. If a client receives such a return value it should wait at least 30 minutes before trying again.}}<br />
<br />
=== Server / UDP Connection ===<br />
The Client has to send data packets to:<br />
* '''Server:''' api.anidb.net<br />
* '''Port:''' 9000/UDP<br />
The servername and port should not be hardcoded into a frontend but should be read from a configuration file.<br />
<br />
=== Server Errors ===<br />
* At any time the API might return a fatal error of the form:<br />
: <tt>6xx ERROR DESCRIPTION</tt><br />
* Possible codes are 600-699.<br />
* Occurrences of these errors (except 601 and 602) should be reported to [[User:Ommina|Ommina]].<br />
{{eyecatch|Note|6XX messages do not always return the tags given with the command which caused the error!}}<br />
<br />
=== Connection Problems ===<br />
There are many ways for a client to end up banned or the API might currently be handling too many concurrent connections.<br />
If a client does not get any reply to an AUTH command it should start to increase the retry delay exponentially with every failed login attempt. (i.e. try again after 30 seconds if the first login attempt failed, if the second fails too retry after 2 minutes, then 5 minutes, then 10 minutes, then 30 minutes, ... until you reach a retry delay of ~2-4h.)<br />
<br />
=== Local Port ===<br />
A client should select a fixed local port >1024 at install time and reuse it for local UDP Sockets. If the API sees too many different UDP Ports from one IP within ~1 hour it will ban the IP. (So make sure you're reusing your UDP ports also for testing/debugging!)<br />
<br />
The local port may be hardcoded, however, an option to manually specify another port should be offered.<br />
<br />
'''Note when behind a [[Wikipedia:Network address translation|NAT]]/masquerading router:'''<br><br />
A session between the server and a client is identified by the ''IP and port'' used by the client. So when the port (or IP) changes within a session the client has to authenticate again. If a client is behind a NAT router it can’t actually control the local port used for the connection. The router will normally ''translate'' the port to support several computers on a LAN to share the Internet connection. The public port (as determined by the router and seen by the server) which has been assigned to the connection will only be reserved for as long as it is in use. This means that the router will usually ''deallocate the port after a fixed timeout period'' (eg. five, ten or 15 minutes). Once that happens the client will no longer be able to receive UDP messages from the server (the messages will be discarded as undeliverable by the router) and a new port will be selected once the client tries to send a message to the server (which will result in a new connection session - '''Note:''' This could get you banned!, see above). So in order to keep a session over a NAT router alive, the client has to ping the server within the router's deallocation period to prevent a timeout.<br />
<br />
The client can decide whether it is behind a NAT router or not by adding <tt>nat=1</tt> to the AUTH command. This will cause the response to include the IP and port as seen by the server. If the port differs from the port reported by the local socket, the connection subject to NAT and the client should issue PING commands in regular intervals. Please do not send pings more often than is necessary to keep NAT connections alive.<br />
<br />
=== Flood Protection ===<br />
To prevent high server load the UDP API server enforces a strict flood protection policy.<br />
* Short Term:<br />
** A Client MUST NOT send more than 0.5 packets per second (that's one packet every two seconds, not two packets a second!)<br />
** The server will start to enforce the limit after the first 5 packets have been received.<br />
* Long Term:<br />
** A Client MUST NOT send more than one packet every four seconds over an extended amount of time.<br />
** ''An extended amount of time'' is not defined. Use common sense.<br />
<br />
Once a client exceeds a rate limit all further UDP packets from that client will be dropped without feedback until the client's packet rate is back down to acceptable levels.<br />
<br />
{{eyecatch|Note|Dropped packets are still taken into account for the packet rate. Meaning if you continuously send packets your client will be banned forever.}}<br />
<br />
Generally clients should be written in a way to minimize server and network load. You should always keep that in mind.<br />
<br />
Abusive clients may be banned completely.<br />
<br />
{{eyecatch|Note|<br />
If you suddenly stop getting replies from the AniDB API or you normally don't have a notable packetloss and from one point on you suddenly note a high packetloss percentage you have most likely entered a critical flood ratio.<br />
If the AniDB API isn't answering at all it might either be down or you have been banned, this is normally caused by violating the API specs (i.e. too many connections using different ports from one IP, too many auth failures, ...) (usually lasts 30 minutes).<br />
If you're experiencing packet loss you have probably reached the rate limit and the API starts to randomly drop incoming packets from your IP. (can be solved by enforcing a delay between multiple commands when you're sending a batch)}}<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Caching ===<br />
To minimize server and network load a client should use local caching in order to prevent repeated API requests for the same data.<br />
<br />
A client should locally cache FILE/EP/ANIME/GROUP/... info wherever possible for extended amounts of time.<br />
(I.e. if a client is used to scan a local folder with anime files and add them via API to a users MyList then it shall only ask for all files in the first run and cache the info for all files known to AniDB. If run again over the same folder it shall only check those files which were unknown to AniDB at the time of the last check.)<br />
<br />
Later versions of the API might enforce this by banning clients which ask for the same information more than once every week/month.<br />
<br />
=== Tag option ===<br />
The API will add a user defined string at the beginning of each reply line separated with a space, if desired.<br />
* To enable add the <tt>tag={str usertag}</tt> option to a command.<br />
* A tag is only valid for the command it was send with, meaning it is not persistent. If you want to have tags in front of all reply lines you will have to append the tag option to each command you send to the server.<br />
* Tags are meant to enable a client to handle more than one request/reply at a time.<br />
<br />
Usage example:<br />
AUTH user=baka&pass=baka&protover=25&client=someclient&clientver=1&tag=abc123<br />
abc123 200 Jxqxb LOGIN ACCEPTED<br />
or<br />
LOGOUT s=Jxqxb&tag=byebye<br />
byebye 203 LOGGED OUT<br />
<br />
{{eyecatch|Note|The tag option is valid for all api commands and is thus not explicitly listed in the description of each command.}}<br />
<br />
=== Data Indexes (fid,aid,eid,gid,lid) ===<br />
* All indexes start at 1 (not 0).<br />
* It is possible for table entries to have id fields with a value of 0 (i.e. gid). Those are to be interpreted as "NONE" or "NULL".<br />
* An ID is '''never''' reused. That means after an entry is deleted no new entry will ever have that ID again.<br />
* Mylist IDs (lid) are globally unique, not per-user unique.<br />
<br />
== Authing Commands ==<br />
{{eyecatch|Note|'''ANY''' command which requires parameters may return: 505 ILLEGAL INPUT OR ACCESS DENIED}}<br />
<br />
----<br />
=== AUTH: Authing to the AnimeDB ===<br />
'''Command String:'''<br />
* AUTH user={str username}&pass={str password}&protover={int4 apiversion}&client={str clientname}&clientver={int4 clientversion}[&nat=1&comp=1&enc={str encoding}&mtu{int4 mtu value}&imgserver=1]<br />
<br />
'''Possible Replies:'''<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
* 500 LOGIN FAILED<br />
* 503 CLIENT VERSION OUTDATED<br />
* 504 CLIENT BANNED - {str reason}<br />
* 505 ILLEGAL INPUT OR ACCESS DENIED<br />
* 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
when nat=1<br />
* 200 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED<br />
* 201 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
when imgserver=1<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
{str image server name}<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
{str image server name}<br />
<br />
'''Info:'''<br />
{{eyecatch|Note|The password is the normal AniDB website password! The password listed in the profile as API Password in only used for the optional encryption feature.}}<br />
* The ''session_key'' is a String containing only ''a-z,A-Z,0-9'' chars of a length of ''4-8'' characters.<br />
: It has to be stored by the client and needs to be sent as parameter with every command which requires the user to logged in.<br />
* The ''session_key'' String is appended as parameter "s", i.e. "PUSH notify=1&msg=1&s={str session_key}".<br />
* On a '''500 LOGIN FAILED''' message the client should request the user to enter username and password again.<br />
* In case of a '''501 LOGIN FIRST''' message the client should silently resend an auth command and send the failed command again.<br />
* A '''502 ACCESS DENIED''' message should abort the current action on the client side and display a message to the user.<br />
* A '''503 CLIENT VERSION OUTDATED''' message states that the udp server has been updated and does not support your client any longer. (protover is too low). A 201 message refers to a new version of the client software.<br />
* A '''506 INVALID SESSION''' means that either the session key parameter "s" was not provided with a command that requires it or the session key is no longer valid. The client should reissue an AUTH command.<br />
{{eyecatch|Note|A frontend shall expect 501 and 502 messages to be returned on ANY command.}}<br><br />
{{eyecatch|Note|AniDB usernames may only contain characters (a-z,A-Z), numbers (0-9), underscores (_) and hyphens (-).}}<br />
* The client should send the apiversion of the AnimeDB API version it supports as value of the protover parameter.<br />
* The client MAY NOT send anything but the version of the API Specs the author used to write the client! (as it is stated at the top of this file @ "Version number used for protover parameter")<br />
: The API will compare that value to it's own version of the API and if the version of the client is older the API will decide whether the changes were significant enough to deny the old client access to the DB.<br />
* The clientname shall be a lower-case string containing only the chars ''a-z'' of ''4-16 chars'' length which identifies the client. (i.e. mykickassclient)<br />
* The clientversion shall be a number starting with 1, increased on every change in the client.<br />
: clientname and clientversion might be used by the API to distinguish between different clients and client versions if that should ever become necessary.<br />
{{eyecatch|Important|<br />
* DO NOT use the clientname of an existing client. If you modify an existing client's code to meet your own needs, create a new client name for yourself.<br />
* ALWAYS increase the clientversion number if you release a new client version.}}<br />
* A Login and its assigned ''session_key'' is valid until the virtual UDP connection times out or until a LOGOUT command is issued.<br />
* The virtual UDP connection times out if no data was received from the client for '''35 minutes'''.<br />
* A client should issue a UPTIME command once every 30 minutes to keep the connection alive should that be required.<br />
* If the client does not use any of the notification/push features of the API it should NOT keep the connection alive, furthermore it should explicitly terminate the connection by issuing a LOGOUT command once it finished it's work.<br />
* If it is very likely that another command will be issued shortly (within the next 20 minutes) a client SHOULD keep the current connection open, by not sending a LOGOUT command.<br />
{{eyecatch|Important|<br />
* A client should NOT perform a full AUTH / command / LOGOUT cycle for each command it wants to send. Again, if another command is likely within 20 minutes, remain logged in.}}<br />
* The client shall notify the user if it received a 201 message at login.<br />
: This means a new version of the client is available, however the old version is still supported otherwise a client banned message would have been returned.<br />
* The user should get a pop-up message on 503 and 504 messages telling him to update his client software.<br />
: ('''Note:''' 504 means that this version of the client is banned, not the user!)<br />
* The 'nat' option makes the client able to detect whether it is behind a nat router or not. When the client is behind a nat router it should keep the "connection" alive with the PING command.<br />
{{eyecatch|Important|Make sure your client handles ALL possible AUTH return codes before giving out any versions!}}<br />
* When ''enc=x'' is defined the server will change the encoding used to x.<br />
**If the encoding is supported it will change right away (including the response) and be reset on logout/timeout.<br />
**If not supported then the argument will be silently ignored. Use ENCODING to test what works.<br />
**Supported encodings are [http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html these].<br />
* ''comp=1'' means that the client supports compression ([http://java.sun.com/j2se/1.5.0/docs/api/java/util/zip/Deflater.html DEFLATE]).<br />
**The server will compress (instead of truncating) the datagrams when needed if this option is enabled.<br />
**The first two bytes of compressed datagrams will always be set to zero. (So tags should never start with that.)<br />
* Default [[Wikipedia:MTU (networking)|''MTU'']] is 1400. Minimum allowed is 400, maximum 1400, due [[Wikipedia:Point-to-Point Protocol over Ethernet|PPPoE]].<br />
<br />
----<br />
<br />
=== LOGOUT: Logout ===<br />
'''Command String:'''<br />
* LOGOUT<br />
<br />
'''Possible Replies:'''<br />
* 203 LOGGED OUT<br />
* 403 NOT LOGGED IN<br />
<br />
'''Info:'''<br />
* This command only works if you are already logged in.<br />
* A logout should ALWAYS be issued if the client is currently logged in and is either exiting or not expecting to send/receive any AniDB API packets for the next >= 30 minutes.<br />
<br />
----<br />
=== ENCRYPT: Start Encrypted Session ===<br />
Will cause all future messages from the server, except the first (the reply to the ENCRYPT command itself), to be encrypted (128 bit [[Wikipedia:Advanced Encryption Standard|AES]]). The client will also have to encrypt all future requests sent to the server. All non-encrypted messages will be discarded by the server. The encryption key is the [[Wikipedia:MD5|MD5]] hash of a special ''UDP API Key'' (defined in the users profile) concatenated with the salt string as given in the reply to the ENCRYPT message. A normal AUTH message is still necessary to authenticate and should follow the ENCRYPT command once the API has acknowledged the encryption.<br />
<br />
'''Command String:'''<br />
* ENCRYPT user={str name}&type={int2 type}<br />
<br />
'''Possible Replies:'''<br />
* 209 {str salt} ENCRYPTION ENABLED<br />
* 309 API PASSWORD NOT DEFINED<br />
* 509 NO SUCH ENCRYPTION TYPE<br />
* 394 NO SUCH USER<br />
<br />
'''Info:'''<br />
* ''user'' is the user name.<br />
* ''type'' is the type of encryption; 1 => 128 bit AES (only one defined).<br />
* ''API Key'' is the one defined in the {{AniDBLink|profile|profile settings page}}.<br />
* It is not possible to disable the encryption once enabled while staying logged in.<br />
** A logout (the logout message needs to be correctly encrypted) or timeout will disable the encryption.<br />
* In order to minimize server load, encryption should be disabled by default and should have to be enabled manually by the user in the configuration options.<br />
* The encryption key is md5(api_key_of_user+''salt'').<br />
* Padding of the message needs to be done according to the PKCS5Padding scheme.<br />
<br />
== Notify Commands ==<br />
=== Introduction ===<br />
Broadly speaking, notifications provide an indication to the client that some event has occurred within the AniDB database.<br />
<br />
There are three types:<br />
* New file [[Notifications|notification]]. (Only anime type supported.)<br />
* New private message notification.<br />
* New buddy event notification.<br />
<br />
Note that, while a user can subscribe to multiple 'new file' events (see [[Notifications|notifications]]), at present, the UDP API only supports notifications of new files by anime. New files by group, or new files by producer, are NOT presently supported. Just the same, keeping in mind that the API is designed to potentially support such notifications in the future will help in understanding why some of the commands are structured the way they are.<br />
<br />
The word "notification" is also used a bit inconsistently in this document. An AniDB notification is originally a "new file [[Notifications|notification]]". It might be more correct to use the term "event" for the original "happening" and then "notification" as the means to notify the user (client). New-file, new-message, buddy-* and going-down are all events that results in notifications. Only the first two type of events are persistent, though, meaning they exist and remain in the same state until some user action affects them.<br />
<br />
=== Getting Notifications ===<br />
Clients that wish to receive notifications have two routes available to them. They are by no means mutually exclusive and selecting one does not imply a client is unable to use commands from another.<br />
<br />
'''Method One: Polling'''<br />
<br />
With this method, the client contacts the server at some interval (no more than once every 20 minutes) to see if there are new file notifications waiting. If there are, the client can the get further details of the files in question. This is analogous to checking an email server every half hour to see if new email has arrived.<br />
<br />
Its principal advantage is that it is easy to design and code. Blocking sockets are sufficient as the client can expect the reply received to correspond with the command sent.<br />
<br />
The disadvantage of this approach is that it introduces a delay and some uncertainty in receiving notifications. If, for example, the user clears the notification on the website before the client collects it, the client will not learn of the new file. Similarly, if the user does not dismiss notifications via the site, the client will have an increasing amount of stale data to work though. Finally, notifications cleared by the client also clears them from the website, so users will need to be made aware of what is going on.<br />
<br />
A polling HOWTO:<br />
<br />
* Use NOTIFY (no more than once every 20 minutes) to get the number of pending notifications<br />
* IF there are new notifications pending, use NOTIFYLIST to get a list of notification types and associated IDs.<br />
* Use NOTIFYGET to receive a notification, supplying the ID provided by NOTIFYLIST<br />
* Use NOTIFYACK to acknowledge a notification, supplying the ID provided by NOTIFYLIST (if desired)<br />
<br />
{{eyecatch|Note|The ID supplied by NOTIFYLIST will be the ID of the affected notification type. Since, at present, only the anime type is supported, this value is always an aid. In the future, it may represent a group or producer ID. In these cases, the str '''type''' value will indicate what entity the ID represents.}}<br />
<br />
'''Method Two: Server PUSH'''<br />
<br />
With this method, the server takes the active role in advising the client that a new file has arrived. The client must register with the server to receive further advice information, and will be responsible for keeping the login session from timing out, and any NAT router ports open. The UDP packet is sent to the ip and port from which the AUTH command was received.<br />
<br />
This method compensates for the disadvantages of the polling method, but is more difficult to code. Blocking sockets are no longer an option, nor can a client make any assumptions that an incoming packet will necessarily be a reply to the last command sent. The tag option may be helpful here.<br />
<br />
A PUSH HOWTO:<br />
<br />
* PUSH to register your client session.<br />
* Listen for 720-799 NOTIFICATIONs ('''not 290''').<br />
* Use PUSHACK to to acknowledge the notification using the nid supplied with NOTIFICATION<br />
* Use NOTIFYGET to receive a notification, suppling the relid provided by NOTIFICATION (NOT the packet ID)<br />
* Use NOTIFYACK to acknowledge a notification, suppling the relid provided by NOTIFICATION (if desired)<br />
* Use UPTIME (with an interval between 30 and 35 minutes) to keep login session valid<br />
<br />
It is probably a good idea to use tags to separate NOTIFICATIONs from the other communication. NOTIFICATIONs will '''never''' have tags.<br />
<br />
=== PUSH: UDP Notification Registration ===<br />
Register your client as an observer for AniDB notification events for the current user. If you are registered for one or more event types the AniDB server will send an UDP packet (format see below) on each change which affects the current user.<br />
<br />
'''Command String:'''<br />
* PUSH notify={boolean on_new_file}&msg={boolean on_new_private_message}[&buddy={boolean on_buddy_event}]<br />
<br />
'''Possible Replies:'''<br />
* 270 NOTIFICATION ENABLED<br />
OR (if both values are 0)<br />
* 370 NOTIFICATION DISABLED<br />
<br />
'''Info:'''<br />
* A client which has registered to receive UDP notification packets must:<br />
** Issue a PUSHACK command for each notification received with ''notify_packet_id'' provided in the notification packet.<br />
** Use PING to keep the connection alive (< 30 min).<br />
** Use UPTIME to ensure that the session is OK (>= 30 min).<br />
* Every notification generated is resent 3 times unless acknowledged. After that the client is logged out.<br />
<br />
=== NOTIFY: Notifications ===<br />
Get number of pending notifications (and number of online buddies).<br />
<br />
'''Command String:'''<br />
* NOTIFY [buddy=1]<br />
<br />
'''Possible Replies:'''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}<br />
when ''buddy=1''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}|{int4 number_of_online_buddies}<br />
<br />
'''Info:'''<br />
* If the client did send a NOTIFY within the last 35 minutes and it was confirmed by AniDB then receiving a 501 LOGIN FIRST message for the next NOTIFY command shows that AniDB logged the client out because it did not respond to a PUSH Notification packet.<br />
* There is no command to retrieve missed PUSH Notifications.<br />
{{eyecatch|Note|This command MUST NOT be issued more than once every 20 minutes.}}<br />
<br />
----<br />
=== NOTIFYLIST: List Notification/Message IDs ===<br />
List id of all pending (not acknowledged) ''new private message'' and ''new file'' notifications. Buddy events cannot be acknowledged.<br />
<br />
'''Command String:'''<br />
* NOTIFYLIST<br />
<br />
'''Possible Replies:'''<br />
*291 NOTIFYLIST<br />
: {str type}|{int4 id}<br />
: {str type}|{int4 id}<br />
: ...<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as required by NOTIFYGET. For messages it is the actual message id, for notifications it is the id of the related type; anime, group or producer. Since only file notifications related to anime is implemented atm, it is the anime id (aid).<br />
* NOTIFYLIST returns one line per entry, if no entries are available only the first line of the reply is returned.<br />
{{eyecatch|Note|This command MUST NOT be issued regularly but should only be triggered by either a push message received by the client or a reply to a NOTIFY command which tells you that there are messages/notifications waiting.}}<br />
<br />
----<br />
=== NOTIFYGET: Get Notification/Message ===<br />
Receive private message or file notification.<br />
<br />
'''Command String:'''<br />
* NOTIFYGET type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 292 NOTIFYGET<br />
: {int4 id}|{int4 from_user_id}|{str from_user_name}|{int4 date}|{int4 type}|{str title}|{str body}<br />
* 392 NO SUCH ENTRY<br />
when type = N<br />
* 293 NOTIFYGET<br />
: {int4 relid}|{int4 type}|{int2 count}|{int4 date}|{str relidname}|{str fids}<br />
* 393 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as given by NOTIFYLIST (or ''relid'' from 271 NOTIFICATION and mid from 272 NOTIFICATION)<br />
* for message entries (M):<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: type is the type of the message (0=normal msg, 1=annonymous, 2=system msg, 3=mod msg)<br />
* for notification entries (N):<br />
: relid is the id of the related type (anime)<br />
: relname is the name of the related type (anime)<br />
: type is the notification type (0=all, 1=new, 2=group, 3=complete)<br />
: count is the number of events pending for this subscription<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: fids is a comma separated list with the affected file ids<br />
<br />
----<br />
=== NOTIFYACK: Acknowledge Notification/Message ===<br />
This command will mark a message read or clear a ''new file'' notification. Buddy events are not acknowledgeable.<br />
<br />
'''Command String:'''<br />
* NOTIFYACK type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 281 NOTIFYACK SUCCESSFUL<br />
* 381 NO SUCH ENTRY<br />
when type = N<br />
* 282 NOTIFYACK SUCCESSFUL<br />
* 382 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
<br />
====Notification Packet Format====<br />
'''New File Notify:'''<br />
<br />
720 {int4 notify_packet_id} NOTIFICATION - NEW FILE<br />
{int4 fidlist}|{int2 reltype}|{int2 priority}<br />
<br />
* fidlist is a comma separated list of file ids<br />
* reltype is: 1 = anime, 2 = group, 3 = producer<br />
* priority is: 0 = low, 1 = medium, 2 = high<br />
* new file notifications are created as a batch, so it is not unusual to get several new files for a particular anime at once. It is in this case that a comma separated list of fids will be returned<br />
<br />
{{eyecatch|Note|Group (and producer) related file notifications are not implemented yet.}}<br />
<br />
<br />
'''New Private Message Notify:'''<br />
<br />
794 {int4 notify_packet_id} NOTIFICATION - NEW MESSAGE<br />
{int2 type}|{int4 date}|{int4 sent_by_uid}|{str sent_by_name}|{str subject}|{str body}|{int mid}<br />
<br />
* type is the type of the message (0=normal msg, 1=anonymous, 2=system msg, 3=mod msg)<br />
* date is the time the message was sent (in seconds since 1.1.1970)<br />
* sender uid/sender name are the user id and user name of the sender<br />
* subject is the message subject<br />
* body is message body (can be truncated)<br />
* mid is message id and can be used with NOTIFYACK<br />
<br />
'''Buddy Event Notify:'''<br />
753 {int4 notify_packet_id} NOTIFICATION - BUDDY<br />
{int4 buddy uid}|{int2 event type}<br />
* Possible event types:<br />
** 0 => LOGIN<br />
** 1 => LOGOUT<br />
** 2 => ACCEPTED<br />
** 3 => ADDED<br />
<br />
<br />
'''Going Down Event Notify:'''<br />
799 {int4 notify_packet_id} NOTIFICATION - SHUTTING DOWN<br />
{int4 time offline}|{int4 comment}<br />
<br />
* Clients with any notification on will receive the SHUTTING DOWN message before the API goes offline.<br />
* Time offline is the time in minutes the API will be down, 0 if indefinite (client can direct user to the AniDB site for status updates).<br />
* The comment is a short explanation for the downtime.<br />
* Only one datagram will be sent, and the server will not listen for replies.<br />
<br />
<br />
=== PUSHACK: UDP Notification Acknowledge ===<br />
Used to acknowledge notification packets (720-799). A client must be prepared to issue this command before using '''PUSH'''.<br />
<br />
'''Command String:'''<br />
* PUSHACK nid={int4 notify_packet_id}<br />
<br />
'''Possible Replies:'''<br />
* 701 PUSHACK CONFIRMED<br />
* 702 NO SUCH PACKET PENDING<br />
<br />
'''Info:'''<br />
* See: '''PUSH'''<br />
<br />
== Buddy Commands ==<br />
Group of commands used to administrate your buddylist.<br />
<br />
=== BUDDYADD: Add a user to Buddy List ===<br />
'''Command String:'''<br />
* BUDDYADD uid={int4 buddy uid}<br />
* BUDDYADD uname={int4 buddy name}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 255 BUDDY ADDED<br />
* 355 BUDDY ALREADY ADDED<br />
<br />
----<br />
=== BUDDYDEL: Remove a user from Buddy List ===<br />
'''Command String:'''<br />
* BUDDYDEL uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 256 BUDDY DELETED<br />
<br />
----<br />
=== BUDDYACCEPT: Accept user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYACCEPT uid={int4 user uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 257 BUDDY ACCEPTED<br />
* 357 BUDDY ALREADY ACCEPTED<br />
<br />
----<br />
=== BUDDYDENY: Deny user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYDENY uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 258 BUDDY DENIED<br />
* 358 BUDDY ALREADY DENIED<br />
<br />
----<br />
=== BUDDYLIST: Retrieve Buddy List ===<br />
'''Command String:'''<br />
* BUDDYLIST startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 253 {int2 start} {int2 end} {int2 total} BUDDY LIST<br />
: {int4 uid}|{str username}|{int2 state}<br />
: ...<br />
'''Info:'''<br />
* state is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = this user is in your buddylist<br />
* bit 2 = this user has accepted you<br />
* bit 3 = this user is waiting for your approval<br />
<br />
----<br />
=== BUDDYSTATE: Retrieve Buddy States===<br />
'''Command String:'''<br />
* BUDDYSTATE startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 254 {int2 start} {int2 end} {int2 total} BUDDY STATE<br />
: {int4 uid}|{int2 onlinestate}<br />
: ...<br />
<br />
'''Info:'''<br />
* onlinestate is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = http online (user has issued a HTTP request within the last 10 minutes)<br />
* bit 2 = udp api online (user is currently connected to the udp api server)<br />
* example: 0=offline, 1=http online, 2=udp api online, 3=http&udp api online<br />
<br />
== Data Commands ==<br />
=== ANIME: Retrieve Anime Data ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIME aid={int4 id}[&amask={hexstr}]<br />
by name<br />
* ANIME aname={str anime name}[&amask={hexstr}]<br />
<br />
'''Possible Replies:'''<br />
<br />
If no ''amask'' is provided:<br />
* 230 ANIME<br />
: {int4 aid}|{int4 eps}|{int4 ep count}|{int4 special cnt}|{int4 rating}|{int4 votes}|{int4 tmprating}|{int4 tmpvotes}|{int4 review rating average}|{int4 reviews}|{str year}|{str type}|{str romaji}|{str kanji}|{str english}|{str other}|{str short names}|{str synonyms}|{str category list}<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* Fields are returned in the same order they appear in the ''amask'' field list: byte 1, bit 7 first<br />
* Synonyms and short names are separated with '<br />
* Category fields are separated with ',' and ordered by weight (desc). ''However'', be aware that categories are no longer used nor updated internally, and category responses are only returned to avoid breaking older clients. Use tags as a replacement. <br />
* By name: must be perfect match of romaji/kanji/english/other/synonym/short name.<br />
* 'Producer id list' and 'producer name list' match the data returned by the former producer bits (but using the revised creator ids)<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
* '''Note:''' The character id list is the first data to be truncated if needed. And then: tag list, synonym list, short name list. This applies to the FILE command too.<br />
* Selecting an 'unused' or 'reserved' bit will return an "illegal input" (505) response.<br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="5" align="center"><b>amask</b></td></tr><br />
<tr><br />
<td align="center"><b>Byte 1</b></td><br />
<td align="center"><b>Byte 2</b></td><br />
<td align="center"><b>Byte 3</b></td><br />
<td align="center"><b>Byte 4</b></td><br />
<td align="center"><b>Byte 5</b></td><br />
<td align="center"><b>Byte 6</b></td><br />
<td align="center"><b>Byte 7</b></td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int aid</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int dateflags</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 special ep count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int air date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int end date</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str url</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str picname</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int vote count</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 temp rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int temp vote count</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 average review rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int review count</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str award list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>bool is 18+ restricted</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int ANN id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int allcinema id</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str AnimeNfo id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str tag name list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int tag id list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>int tag weight list</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int date record updated</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int character id list</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 specials count</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 credits count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 other count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 trailer count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 parody count</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<br />
'''Related aid type (Byte 1, Bit 2):'''<br />
<pre><br />
value meaning<br />
<br />
1 sequel<br />
2 prequel<br />
11 same setting<br />
12 alternative setting<br />
32 alternative version<br />
41 music video<br />
42 character<br />
51 side story<br />
52 parent story<br />
61 summary<br />
62 full story<br />
100 other<br />
</pre><br />
<br />
'''Examples:''' (note that the given amask gives the same result as the default request)<br />
> ANIME aid=1&amask=b2f0e0fc000000&s=xxxxx<br />
< 230 ANIME<br />
1|1999-1999|TV Series|Space,Future,Plot Continuity,SciFi,Space Travel,Shipboard,Other Planet,Novel,Genetic Modification,Action,Romance,Military,Large Breasts,Gunfights,Adventure,Human Enhancement,Nudity|Seikai no Monshou|星界の紋章|Crest of the Stars||13|13|3|853|3225|756|110|875|11<br />
<br />
<br />
----<br />
<br />
=== ANIMEDESC: Retrieve Anime Description ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIMEDESC aid={int4 id}&part={int4 partno}<br />
<br />
'''Possible Replies:'''<br />
* 233 ANIMEDESC<br />
: {int4 current part}|{int4 max parts}|{str description}<br />
* 330 NO SUCH ANIME<br />
* 333 NO SUCH DESCRIPTION<br />
<br />
'''Info:'''<br />
* The maximum length of the anime description is roughly 5000 characters, but the maximum length of a UDP packet is 1400 bytes<br />
* Multiple calls to ANIMEDESC may be necessary to retrieve the complete text, retrieving separate 1400 byte parts with each call<br />
* ''part'' is zero-based<br />
* '''Note:''' No support, at present, for retrieving descriptions by title. ''aid'' only<br />
<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> ANIMEDESC aid=3169&part=0&s=xxxxx<br />
< 233 ANIMEDESC<br />
0|1|As summer break arrives for the students, Jun Sakurada is busily studying on his own in the library, making up for time lost <cut><br />
<br />
----<br />
=== CALENDAR: Get Upcoming Titles ===<br />
Returns the anime ids of the 25 most recently aired / released anime, directly followed by the next 25 anime due to be aired / released, ordered by start date.<br />
<br />
'''Command String:'''<br />
* CALENDAR<br />
<br />
'''Possible Replies:'''<br />
* 297 CALENDAR<br />
{int aid}|{int startdate}|{int dateflags}/n<br />
<br />
..repeated n times<br />
<br />
* 397 CALENDAR EMPTY<br />
<br />
'''Info:'''<br />
* Takes no parameters (other than the session string)<br />
* Titles returned are filtered by the 'show adult' preference of the logged in user. That is, users who have elected to hide adult content will have it hidden here as well.<br />
* Do not depend on the command always returning exactly 50 titles; there may not always be 25 future titles pending, depending on the user's 'adult' preferences, and the date in relation to the relation to the current anime season.<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
<br />
----<br />
=== CHARACTER: Get Character Information ===<br />
Returns character details associated with a given character ID, including associated anime ids, episode ids, and seiyuu.<br />
<br />
'''Command String:'''<br />
* CHARACTER charid={int characterid}<br />
<br />
'''Possible Replies:'''<br />
* 235 CHARACTER<br />
: {int charid}|{str character name kanji}|{str character name transcription}|{str pic}|{anime blocks}|{int episode list}|{int last update date}|{int2 type}|{str gender}<br />
<br />
: An 'anime block' is {int anime id},{int appearance},{int creatorid},{boolean is_main_seiyuu} repeated as many times as necessary, separated by a single quote ( ' ). <br />
<br />
* 335 NO SUCH CHARACTER<br />
<br />
'''Info:'''<br />
* If no seiyuu is associated with the character for a given aid, the 'creatorid' and 'is_main_seiyuu' fields will be empty, but the commas will remain.<br />
* An empty episode list is "undefined": no episode values have been added.<br />
* ''appearance'' values: 0='appears in', 1='cameo appearance in', 2='main character in', 3='secondary cast in'<br />
* ''type'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** 1 => 'Character'<br />
** 2 => 'Mecha'<br />
** 3 => 'Organisation'<br />
** 4 => 'Vessel' <br />
* ''gender'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** "M" => 'Male'<br />
** "F" => 'Female'<br />
** "I" => 'Intersexual'<br />
** "D" => 'Dimorphic'<br />
** "-" => 'none/does not apply'<br />
** "?" => 'unknown'<br />
<br />
'''Example:'''<br />
<br />
CHARACTER charid=488&s=DChan<br />
235 CHARACTER<br />
488|ニコ・ロビン|Nico Robin|14789.jpg|4097,2,1900,1'69,2,1901,0'6199,0,1900,1'5691,0,1900,1'2644,0,,'4851,0,1900,1||1236938094<br />
<br />
=== CREATOR: Get Creator Information ===<br />
<br />
'''Command String:'''<br />
* CREATOR creatorid={int creatorid}<br />
<br />
'''Possible Replies:'''<br />
* 245 CREATOR<br />
: {int creatorid}|{str creator name kanji}|{str creator name transcription}|{int type}|{str pic_name}|{str url_english}|{str url_japanese}|{str wiki_url_english}|{str wiki_url_japanese}|{int last update date}<br />
<br />
* 345 NO SUCH CREATOR<br />
<br />
'''Info:'''<br />
* ANIME AMASK byte6, bit5<br />
* ''type'' values: 1='person', 2='company', 3='collaboration'<br />
<br />
Example:<br />
<br />
245 CREATOR<br />
718|GAINAX|Gainax|2|10092.png||http://www.gainax.co.jp/|Gainax|Gainax|1237048093<br />
<br />
=== EPISODE: Retrieve Episode Data ===<br />
'''Command String:'''<br><br />
by eid<br />
* EPISODE eid={int eid}<br />
by anime and episode number<br />
* EPISODE aname={str anime name}&epno={int4 episode number}<br />
* EPISODE aid={int anime id}&epno={int4 episode number}<br />
<br />
'''Possible Replies:'''<br />
* 240 EPISODE<br />
: {int eid}|{int aid}|{int4 length}|{int4 rating}|{int votes}|{str epno}|{str eng}|{str romaji}|{str kanji}|{int aired}|{int type}<br />
* 340 NO SUCH EPISODE<br />
<br />
'''Info:'''<br />
* length is in minutes<br />
* Returned 'epno' includes special character (only if special) and padding (only if normal).<br />
** Special characters are S(special), C(credits), T(trailer), P(parody), O(other).<br />
* The ''type'' is the raw episode type, used to indicate numerically what the special character will be<br />
** 1: regular episode (no prefix), 2: special ("S"), 3: credit ("C"), 4: trailer ("T"), 5: parody ("P"), 6: other ("O")<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> EPISODE eid=1&s=xxxxx<br />
< 240 EPISODE<br />
1|1|24|400|4|01|Invasion|shinryaku|??<br />
<br />
> EPISODE aname=Seikai no Monshou&epno=2&s=xxxxx<br />
< 240 EPISODE<br />
2|1|24|750|2|02|Kin of the Stars|Hoshi-tachi no Kenzoku|??????|1295059229|1<br />
<br />
----<br />
<br />
=== FILE: Retrieve File Data ===<br />
'''Command String:'''<br><br />
by fid:<br />
* FILE fid={int4 id}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by size+ed2k hash:<br />
* FILE size={int8 size}&ed2k={str ed2khash}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by anime, group and epno<br />
* FILE aname={str anime name}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aname={str anime name}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
<br />
'''Possible Replies:'''<br />
* 220 FILE<br />
: {int4 fid}|{int4 aid}|{int4 eid}|{int4 gid}|{int4 state}|{int8 size}|{str ed2k}|{str anidbfilename}<br />
* 220 FILE<br />
: {int4 fid}|...(data list)<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 0}|{int4 fid 1}|...|{int4 fid n}<br />
* 320 NO SUCH FILE<br />
<br />
'''Info:'''<br />
* fid, aid, eid, gid are the unique ids for the file, anime, ep, group entries at AniDB.<br />
: You can use those to create links to the corresponding pages at AniDB.<br />
* anidbfilename is the AniDB filename for the file.<br />
: However this name does not contain all the extra information of the filenames on AniDB and might be composed slightly different.<br />
* fmask and amask are hexidecimal strings where each bit corresponds to a data field related to the specified file (see below). The data list received is sorted and returned in the same order as the tables: top to bottom, left to right, with fmask preceding amask. There is '''no''' provision to retrieve all fields. Further, requesting a 'unusued' or 'reserved' bit will return an "illegal input" error.<br />
* fid is always returned as the first value, regardless of what masks are provided.<br />
* Only the first matching file is returned when aname, gname and epno is used.<br />
* "audio codec" and "audio bitrate" will return multiple values if there are multiple audio streams present in the file. Values will be separated by a single quote. <br />
* For byte 1, bit 2 (other episodes): episode IDs will be followed by an integer '''percentage''' that indicate the percentage of the related episode this file covers. Typically 100%, there are cases where it will be 50, 30, or other values. This value provides no indication where, within an episode, the file represents. That is, 50% could mean the file covers the first half of the episode, the second half, or some 50% range in between.<br />
'''State:'''<br />
<pre><br />
bit / int value meaning<br />
1 / 1 FILE_CRCOK: file matched official CRC (displayed with green background in AniDB)<br />
2 / 2 FILE_CRCERR: file DID NOT match official CRC (displayed with red background in AniDB)<br />
3 / 4 FILE_ISV2: file is version 2<br />
4 / 8 FILE_ISV3: file is version 3<br />
5 / 16 FILE_ISV4: file is version 4<br />
6 / 32 FILE_ISV5: file is version 5<br />
7 / 64 FILE_UNC: file is uncensored<br />
8 / 128 FILE_CEN: file is censored<br />
<br />
examples:<br />
state ==== 9 ==> FILE_CRCOK+FILE_ISV3 ==> file matched official CRC and is version 3<br />
state ==== 0 ==> - ==> file was not crc checked and is version 1<br />
state ==== 34 ==> FILE_CRCERR+FILE_ISV5 ==> file DID NOT match official CRC and is version 5<br />
state ==== 1 ==> FILE_CRCOK ==> file matched official CRC and is version 1<br />
state ==== 8 ==> FILE_ISV3 ==> file was not CRC checked and is version 3<br />
</pre><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''fmask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
<td align="center">'''Byte 5'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 aid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 eid</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 gid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 mylist id</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>list other episodes</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>int2 IsDeprecated</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int2 state</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int8 size</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ed2k</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str md5</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str sha1</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str crc32</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>video colour depth</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str quality</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str audio codec list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 audio bitrate list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str video codec</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 video bitrate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str video resolution</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str file type (extension)</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str dub language</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str sub language</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 length in seconds</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str description</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 aired date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str anidb file name</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 mylist state</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 mylist filestate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 mylist viewed</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 mylist viewdate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str mylist storage</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str mylist source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str mylist other</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''amask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 anime total episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str category list</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str epno</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ep name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str ep romaji name</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str ep kanji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 episode rating</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 episode vote count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str group name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str group short name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int4 date aid record updated</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
'''Examples:''' (html escaped code intended)<br />
> FILE size=177747474&ed2k=70cd93fd3981cc80a8ea6a646ff805c9&fmask=7FF8FEF8&amask=C000F0C0&s=xxxxx<br />
< 220 FILE<br />
312498|4688|69260|4243|0||0|1|177747474|70cd93fd3981cc80a8ea6a646ff805c9|b2a7c7d591333e20495de3571b235c28|7af9b962c17ff729baeee67533e5219526cd5095|a200fe73|high|DTV|Vorbis (Ogg Vorbis)|104|H264/AVC|800|704x400|japanese|english'english'english|1560||1175472000|26|26|01|The Wings to the Sky|Sora he no Tsubasa|????|#nanoha-DamagedGoodz|Nanoha-DGz<br />
<br />
----<br />
<br />
=== GROUP: Retrieve Group Data ===<br />
'''Command String:'''<br><br />
by gid<br />
* GROUP gid={int gid}<br />
by name/shortname<br />
* GROUP gname={str group name}<br />
<br />
'''Possible Replies:'''<br />
* 250 GROUP<br />
: {int gid}|{int4 rating}|{int votes}|{int4 acount}|{int fcount}|{str name}|{str short}|{str irc channel}|{str irc server}|{str url}|{str picname}|{int4 foundeddate}|{int4 disbandeddate}|{int2 dateflags}|{int4 lastreleasedate}|{int4 lastactivitydate}|{list grouprelations}<br />
* 350 NO SUCH GROUP<br />
<br />
'''Info:'''<br />
* Requires login<br />
* ''gname'' is an exact match of either a group name or short name<br />
* As either name and short names are unique if there is a result from GROUP request by name that will be the only match<br />
* ''dateflags'' values:<br />
** bit0 set == Foundeddate, Unknown Day<br />
** bit1 set == Foundeddate, Unknown Month, Day<br />
** bit2 set == Disbandeddate, Unknown Day<br />
** bit3 set == Disbandeddate, Unknown Month, Day<br />
** bit5 set == Foundeddate, Unknown Year<br />
** bit6 set == Disbandeddate, Unknown Year<br />
* ''releasedate'' and ''activitydate'' are distinct. ''releasedate'' is the date a file was actually released by the group, where ''activitydate'' is the date of a file being added to AniDB. As such, lastrelease may very well be much older than lastactivity.<br />
* ''groupreleations'' is a list of apostrophe-separated pairs, where each pair consists of {int4 othergroupid},{int2 relationtype}<br />
** relationtype:<br />
*** 1 => "Participant in"<br />
*** 2 => "Parent of"<br />
*** 4 => "Merged from"<br />
*** 5 => "Now known as"<br />
*** 6 => "Other"<br />
<br />
'''Example:'''<br />
> GROUP gid=7091&s=bunny<br />
< 250 GROUP<br />
7091|832|1445|43|566|Frostii|Frostii|#frostii|irc.rizon.net|http://frostii.com|15844.jpg|1228089600|0|1|1301875200|1304222640|7255,1'3097,4'748,4'8106,1'8159,2'8402,1'8696,1'9022,1<br />
<br />
----<br />
<br />
=== GROUPSTATUS: Get Completed Episode ===<br />
Returns a list of group names and ranges of episodes released by the group for a given anime.<br />
<br />
'''Command String:'''<br />
* GROUPSTATUS aid={int animeid}[&state={int completion_state}]<br />
<br />
'''Possible Replies:'''<br />
* 225 GROUPSTATUS<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: ... (repeated)<br />
<br />
* 325 NO SUCH GROUPS FOUND<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* The seven fields will be repeated as necessary, one for each group, separated by a new line character<br />
* Groups will be filtered by the languages selected in the user's profile<br />
* If ''state'' is not supplied, groups with a completion state of <i>'ongoing'</i>, <i>'finished'</i>, or <i>'complete'</i> are returned<br />
* Groups are returned in order of descending episode count<br />
* If there are more groups to return than can be stored in a UDP packet, additional groups will be silently discarded<br />
* ''state'' values: <br />
#ongoing<br />
#stalled<br />
#complete<br />
#dropped<br />
#finished<br />
#specials only<br />
<br />
'''Example:'''<br />
> GROUP GROUPSTATUS aid=8692&s=vLl1N<br />
< 225 GROUPSTATUS<br />
7407|Coalgirls|3|25|839|12|1-25<br />
9863|Hadena Subs|3|25|374|1|1-25<br />
11951|ChaosBlades|3|25|0|0|1-25<br />
[truncated]<br />
<br />
=== UPDATED: Get List of Updated Anime IDs ===<br />
Returns a list of AniDB anime ids of anime that have been updated in in a given time frame, ordered by descending age (oldest to newest change).<br />
<br />
'''Command String:'''<br />
* UPDATED entity=1&[age={int4 id}|time={int4 date}]<br />
<br />
'''Possible Replies:'''<br />
* 243 UPDATED<br />
{int entity}|{int total count}|{int last update date}|{list aid}<br />
<br />
* 343 NO UPDATES<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1<br />
* Either ''age'' OR ''time'' can be specified, but not both<br />
* ''age'' is specified in days.<br />
** eg: age=30 requests a list of aid values of anime that have changed in the past 30 days<br />
* ''time'' is specified in unix time.<br />
** eg: time=1264982400 requests a list of aid values of anime that have changed since 2010-02-01<br />
* A maximum of 200 values will be returned<br />
* ''count'' specifies the total number of items found for the given time period. In short, if this value is great than 200, you have not retrieved all applicable ids.<br />
* ''last update date'' will contain the AniDB update time of the ''last'' aid to appear on the list<br />
* A given list value will appear only once. If there have been multiple changes to an entity, its age will reflect the most recent change.<br />
<br />
'''An anime will be considered updated if:'''<br />
* A change is made to the anime record itself<br />
* An ''main'' or ''official'' anime title is added, edited, or deleted (not ''short'' or ''synonym'')<br />
* An episode for the anime is added, or delete (but NOT edited!)<br />
* An episode title is added, edited, or delete<br />
* An anime relation is added, or deleted<br />
<br />
== MyList Commands ==<br />
=== MYLIST: Retrieve MyList Data ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLIST lid={int4 lid}<br />
by fid:<br />
* MYLIST fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLIST size={int4 size}&ed2k={str ed2khash}<br />
by anime + group + epno<br />
* MYLIST aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 221 MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 312 MULTIPLE MYLIST ENTRIES<br />
: {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}<br />
* 321 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* The state field provides information about the location and sharing state of a file in MyList.<br />
* 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).<br />
* eps is a list of episodes, e.g. "1-12,14-16,T1"<br />
<br />
'''States:'''<br />
0 - unknown - state is unknown or the user doesn't want to provide this information<br />
1 - on hdd - the file is stored on hdd (but is not shared)<br />
2 - on cd - the file is stored on cd<br />
3 - deleted - the file has been deleted or is not available for other reasons (i.e. reencoded)<br />
<br />
'''Filestates:''' (for normal files, i.e. not generic)<br />
0 => normal/original<br />
1 => corrupted version/invalid crc<br />
2 => self edited<br />
10 => self ripped<br />
11 => on dvd<br />
12 => on vhs<br />
13 => on tv<br />
14 => in theaters<br />
15 => streamed<br />
100 => other<br />
<br />
'''Example:'''<br />
> MYLIST aname=gits sac&s=xxxxx<br />
< 322 MULTIPLE FILES FOUND<br />
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<br />
<br />
----<br />
=== MYLISTADD: Add file to MyList ===<br />
The command string for MYLISTADD is made of up two blocks: a 'fileinfo' block, which limits the command to a specific file, or an 'animeinfo'/'groupinfo'/'episodeinfo' block, which can be used to specify a range of files, including generics. Additionally, a number of optional parameters can be included with either set.<br />
<br />
'''Adding a single file to the MyList with the 'fileinfo' block'''<br />
<br />
* MYLISTADD fid={int4 fid}<br />
'''or'''<br />
* MYLISTADD size={int4 size}&ed2k={str ed2khash}<br />
'''or'''<br />
* MYLISTADD lid={int4 lid}&edit=1 (valid for edit only)<br />
<br />
'''Adding one or more files to the MyList with the 'animeinfo'/'groupinfo'/'episodeinfo' block'''<br />
<br />
Here, you have a number of options, depending on what data you have available. In brief, 'animeinfo' represents a choice between anime id and anime name. 'groupinfo' represents a choice between group id, group name, and generic=1. 'episodeinfo' represents a range of one or more episodes.<br />
<br />
* MYLISTADD aid={int4 aid}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&generic=1&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&generic=1&epno={int4 episode number}<br />
<br />
Each command listed can have, in addition, a number of optional components to provide further MyList details. Append these as desired.<br />
<br />
* &state={int2 state}<br />
* &viewed={boolean viewed}<br />
* &viewdate={int4 viewdate}<br />
* &source={str source}<br />
* &storage={str storage}<br />
* &other={str other}<br />
<br />
Finally, edit=1 can be included to edit a MyList entry instead of creating a new one. When editing, optional values that are not supplied retain their original value. That is, they are ''not'' replaced with default or empty values. Only values supplied are updated.<br />
<br />
'''Possible Replies:'''<br />
* 320 NO SUCH FILE<br />
* 330 NO SUCH ANIME<br />
* 350 NO SUCH GROUP<br />
when edit=0 and adding by fid, size/ed2k<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 mylist id of new entry}<br />
when edit=0 and adding by aname, aid<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 number of entries added}<br />
* 310 FILE ALREADY IN MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 1}|{int4 fid 2}|...|{int4 fid n}<br />
when edit=1<br />
* 311 MYLIST ENTRY EDITED<br />
* 311 MYLIST ENTRY EDITED<br />
: {int4 number of entries edited}<br />
* 411 NO SUCH MYLIST ENTRY<br />
<br />
'''Info:'''<br />
* All data except lid/fid/size+hash/generic is optional.<br />
* Viewed should be 0 for unwatched files and 1 for watched files.<br />
* If viewdate is not specified, the current time will be used. The field will be disregarded if viewed=0.<br />
* Other is the only field which may contain newlines, but they have to be stored as &lt;br /&gt;<br />
* For state values refer to: '''MYLIST'''<br />
* If you want to change an existing entry and already know its MyList id (lid) please use the lid-version of this command. It put less load on the server.<br />
* epno=0 means all eps (default), negative numbers means upto. (-12 -> upto 12)<br />
* group is optional only when edit=1, meaning you can't add every file for an anime<br />
* If the file already exists (response code 310), the ''current'' record will be returned, in the same format as the MYLIST response.<br />
----<br />
<br />
=== MYLISTDEL: Remove file from MyList ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLISTDEL lid={int4 lid}<br />
by fid:<br />
* MYLISTDEL fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLISTDEL size={int4 size}&ed2k={str ed2k hash}<br />
by anime + group + epno<br />
* MYLISTDEL aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 211 MYLIST ENTRY DELETED<br />
: {int4 number of entries}<br />
* 411 NO SUCH MYLIST ENTRY<br />
'''Info:'''<br />
* group is optional<br />
* command will delete all enties found<br />
<br />
----<br />
=== MYLISTSTATS : Retrieve MyList stats ===<br />
'''Command String:'''<br />
* MYLISTSTATS<br />
'''Possible Replies:'''<br />
* 222 MYLIST STATS<br />
{animes}|{eps}|{files}|{size of files}|{added animes}|{added eps}|{added files}|{added groups}|{leech %}|{glory %}|{viewed % of db}|{mylist % of db}|{viewed % of mylist}|{number of viewed eps}|{votes}|{reviews}|{viewed length in minutes}<br />
<br />
'''Info:'''<br />
* All fields are int<br />
<br />
----<br />
<br />
=== VOTE: Vote for specified anime/episode/group ===<br />
'''Command String:'''<br><br />
by id<br />
* VOTE type={int2 type}&id={int4 id}[&value={int4 vote value}&epno={int4 episode number}]<br />
by name<br />
* VOTE type={int2 type}&name={string name}[&value={int4 vote value}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 260 VOTED<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 261 VOTE FOUND<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 262 VOTE UPDATED<br />
: {str entity name}|{old vote value}|{vote type}|{entity id}<br />
* 263 VOTE REVOKED<br />
: {str entity name}|{revoked vote value}|{vote type}|{entity id}<br />
* 360 NO SUCH VOTE<br />
: {str entity name}|0|{vote type}|{entity id}<br />
* 361 INVALID VOTE TYPE<br />
* 362 INVALID VOTE VALUE<br />
* 363 PERMVOTE NOT ALLOWED<br />
: {str aname}|{vote value}|{type}|{entity id}<br />
* 364 ALREADY PERMVOTED<br />
: {str entity name}|{existing vote value}|{vote type}|{entity id}<br />
<br />
'''Info:'''<br />
* type: 1=anime, 2=anime tmpvote, 3=group<br />
* entity: anime, episode, or group<br />
* for episode voting add epno on type=1<br />
* value: negative number means revoke, 0 means retrieve (default), 100-1000 are valid vote values, rest is illegal<br />
* votes will be updated automatically (no questions asked)<br />
* tmpvoting when there exist a perm vote is not possible<br />
<br />
----<br />
<br />
=== RANDOM: Get a random anime ===<br />
'''Command String:'''<br />
* RANDOMANIME type={int4 type}<br />
<br />
'''Possible Replies:'''<br />
* 230 ANIME ... (see ANIME)<br />
<br />
'''Info:'''<br />
* type: 0=from db, 1=watched, 2=unwatched, 3=all mylist<br />
<br />
== Misc Commands ==<br />
=== MYLISTEXPORT: Schedule a MyList Export ===<br />
Queues a {{AniDBLink|export|MyList Export}} by the AniDB Servers. As with a manual export request, exports are only done during periods when server load is low. As a result, exports may take up to 24 hours. The client submitting the request will receive an AniDB message when the export is ready to be collected.<br />
<br />
Only one export can be in the queue at a time.<br />
<br />
'''Command String:'''<br />
* MYLISTEXPORT [template={str template_name}|cancel=1]<br />
<br />
'''Possible Replies:'''<br />
* 217 EXPORT QUEUED<br />
* 218 EXPORT CANCELLED<br />
* 317 EXPORT NO SUCH TEMPLATE<br />
* 318 EXPORT ALREADY IN QUEUE<br />
* 319 EXPORT NO EXPORT QUEUED OR IS PROCESSING<br />
<br />
'''Info:'''<br />
* ''template_name'' must match an available export template on the {{AniDBLink|export|MyList Export}} page.<br />
* ''cancel'' will cancel any pending export request, queued either through UDP or the web server.<br />
* Clients can subscribe the message notifications if they wish to be notified when an export is complete.<br />
<br />
----<br />
<br />
=== PING: Ping Command ===<br />
'''Command String:'''<br />
* PING [nat=1]<br />
<br />
'''Possible Replies:'''<br />
* 300 PONG<br />
: {int4 port} ''(when nat=1)''<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* May be used by a frontend to determine if the API is still available.<br />
* May be executed even if not yet logged in.<br />
* The option <tt>nat=1</tt> provides an easy way to determine if the router has changed the outgoing port. ({{t|587}})<br />
<br />
----<br />
<br />
=== VERSION: Retrieve Server Version ===<br />
'''Command String:'''<br />
* VERSION<br />
<br />
'''Possible Replies:'''<br />
* 998 VERSION<br />
: {str server version}<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
<br />
----<br />
=== UPTIME: Retrieve Server Uptime ===<br />
'''Command String:'''<br />
* UPTIME<br />
<br />
'''Possible Replies:'''<br />
* 208 UPTIME<br />
: {int4 udpserver uptime in milliseconds}<br />
<br />
'''Info:'''<br />
* This command is the preferred way to check that the session is OK.<br />
<br />
----<br />
=== ENCODING: Change Encoding for Session ===<br />
Sets preferred [[Wikipedia:Character encoding|encoding]] per session. The preferred way to do this is to use the '''enc''' argument for AUTH. This command is mostly for testing.<br />
<br />
'''Command String:'''<br />
* ENCODING name={str encoding name}<br />
<br />
'''Possible Replies:'''<br />
* 219 ENCODING CHANGED<br />
* 519 ENCODING NOT SUPPORTED<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* Supported encodings: http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html<br />
* Default: ASCII.<br />
* Resets to default on logout.<br />
<br />
----<br />
<br />
=== SENDMSG: Send Message ===<br />
'''Command String:'''<br />
* SENDMSG to={str username}&title={str title}&body={str body}<br />
<br />
'''Possible Replies:'''<br />
* 294 SENDMSG SUCCESSFUL<br />
* 394 NO SUCH USER<br />
* 501 LOGIN FIRST<br />
<br />
'''Note:'''<br />
* This command allows you to send an AniDB message.<br />
{{eyecatch|Important|<br />
title must not be longer than 50 chars.<br><br />
body must not be longer than 900 chars.<br />
}}<br />
<br />
----<br />
=== USER: Retrieve User UID ===<br />
'''Command String:'''<br />
* USER [user={str user name}|uid={int user id}]<br />
<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 295 USER<br />
: {int4 uid}|{str username}<br />
<br />
----<br />
<br />
=== STATS [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* STATS<br />
<br />
'''Possible Replies:'''<br />
* 206 STATS<br />
: {int4 animes)|{int4 eps}|{int4 files}|{int4 groups}|{int4 users}|{int8 total file size in bytes}|{int4 open [[creq|creqs]]}<br />
<br />
----<br />
=== TOP [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* TOP<br />
<br />
'''Possible Replies:'''<br />
* 207 TOP<br />
: {str longest mylist}|{int count}<br />
: {str largest mylist}|{int count}<br />
: {str most lame files}|{int count}<br />
: {str most indep. user}|{int count}<br />
: {str biggest leecher}|{int count}<br />
: {str most anime added}|{int count}<br />
: {str most eps added}|{int count}<br />
: {str most files added}|{int count}<br />
: {str most groups added}|{int count}<br />
: {str most votes}|{int count}<br />
: {str most reviews}|{int count}<br />
<br />
'''Info:'''<br />
* All strings are user names.<br />
* 'Hide myself in IRC stats' applies for this too.<br />
<br />
== Fatal Errors ==<br />
At anypoint int the retrieval process you have to expect the following output:<br />
* 6xx INTERNAL SERVER ERROR<br />
: ERROR: {str errormessage}<br />
OR<br />
*6xx INTERNAL SERVER ERROR - {str errormessage}<br />
<br />
Such errors should be reported back to [[User:Ommina|Ommina]].<br />
(xx is a number between 00 and 99)<br />
<br />
If you supply an unknown or unimplemented command you will get an error:<br />
* 598 UNKNOWN COMMAND<br />
<br />
== Return Codes ==<br />
{{eyecatch|Note|While the names below '''are''' the actual code strings returned by the server, clients are nonetheless encouraged to work with the numeric codes instead. }}<br />
<pre><br />
LOGIN_ACCEPTED = 200<br />
LOGIN_ACCEPTED_NEW_VERSION = 201<br />
LOGGED_OUT = 203<br />
RESOURCE = 205<br />
STATS = 206<br />
TOP = 207<br />
UPTIME = 208<br />
ENCRYPTION_ENABLED = 209<br />
MYLIST_ENTRY_ADDED = 210<br />
MYLIST_ENTRY_DELETED = 211<br />
ADDED_FILE = 214<br />
ADDED_STREAM = 215<br />
EXPORT_QUEUED = 217<br />
EXPORT_CANCELLED = 218<br />
ENCODING_CHANGED = 219<br />
FILE = 220<br />
MYLIST = 221<br />
MYLIST_STATS = 222<br />
WISHLIST = 223<br />
NOTIFICATION = 224<br />
GROUP_STATUS = 225<br />
WISHLIST_ENTRY_ADDED = 226<br />
WISHLIST_ENTRY_DELETED = 227<br />
WISHLIST_ENTRY_UPDATED = 228<br />
MULTIPLE_WISHLIST = 229<br />
ANIME = 230<br />
ANIME_BEST_MATCH = 231<br />
RANDOM_ANIME = 232<br />
ANIME_DESCRIPTION = 233<br />
REVIEW = 234<br />
CHARACTER = 235<br />
SONG = 236<br />
ANIMETAG = 237<br />
CHARACTERTAG = 238<br />
EPISODE = 240<br />
UPDATED = 243<br />
TITLE = 244<br />
CREATOR = 245<br />
NOTIFICATION_ENTRY_ADDED = 246<br />
NOTIFICATION_ENTRY_DELETED = 247<br />
NOTIFICATION_ENTRY_UPDATE = 248<br />
MULTIPLE_NOTIFICATION = 249<br />
GROUP = 250<br />
CATEGORY = 251<br />
BUDDY_LIST = 253<br />
BUDDY_STATE = 254<br />
BUDDY_ADDED = 255<br />
BUDDY_DELETED = 256<br />
BUDDY_ACCEPTED = 257<br />
BUDDY_DENIED = 258<br />
VOTED = 260<br />
VOTE_FOUND = 261<br />
VOTE_UPDATED = 262<br />
VOTE_REVOKED = 263<br />
HOT_ANIME = 265<br />
RANDOM_RECOMMENDATION = 266<br />
RANDOM_SIMILAR = 267<br />
NOTIFICATION_ENABLED = 270<br />
NOTIFYACK_SUCCESSFUL_MESSAGE = 281<br />
NOTIFYACK_SUCCESSFUL_NOTIFIATION = 282<br />
NOTIFICATION_STATE = 290<br />
NOTIFYLIST = 291<br />
NOTIFYGET_MESSAGE = 292<br />
NOTIFYGET_NOTIFY = 293<br />
SENDMESSAGE_SUCCESSFUL = 294<br />
USER_ID = 295<br />
CALENDAR = 297<br />
<br />
PONG = 300<br />
AUTHPONG = 301<br />
NO_SUCH_RESOURCE = 305<br />
API_PASSWORD_NOT_DEFINED = 309<br />
FILE_ALREADY_IN_MYLIST = 310<br />
MYLIST_ENTRY_EDITED = 311<br />
MULTIPLE_MYLIST_ENTRIES = 312<br />
WATCHED = 313<br />
SIZE_HASH_EXISTS = 314<br />
INVALID_DATA = 315<br />
STREAMNOID_USED = 316<br />
EXPORT_NO_SUCH_TEMPLATE = 317<br />
EXPORT_ALREADY_IN_QUEUE = 318<br />
EXPORT_NO_EXPORT_QUEUED_OR_IS_PROCESSING = 319<br />
NO_SUCH_FILE = 320<br />
NO_SUCH_ENTRY = 321<br />
MULTIPLE_FILES_FOUND = 322<br />
NO_SUCH_WISHLIST = 323<br />
NO_SUCH_NOTIFICATION = 324<br />
NO_GROUPS_FOUND = 325<br />
NO_SUCH_ANIME = 330<br />
NO_SUCH_DESCRIPTION = 333<br />
NO_SUCH_REVIEW = 334<br />
NO_SUCH_CHARACTER = 335<br />
NO_SUCH_SONG = 336<br />
NO_SUCH_ANIMETAG = 337<br />
NO_SUCH_CHARACTERTAG = 338<br />
NO_SUCH_EPISODE = 340<br />
NO_SUCH_UPDATES = 343<br />
NO_SUCH_TITLES = 344<br />
NO_SUCH_CREATOR = 345<br />
NO_SUCH_GROUP = 350<br />
NO_SUCH_CATEGORY = 351<br />
BUDDY_ALREADY_ADDED = 355<br />
NO_SUCH_BUDDY = 356<br />
BUDDY_ALREADY_ACCEPTED = 357<br />
BUDDY_ALREADY_DENIED = 358<br />
NO_SUCH_VOTE = 360<br />
INVALID_VOTE_TYPE = 361<br />
INVALID_VOTE_VALUE = 362<br />
PERMVOTE_NOT_ALLOWED = 363<br />
ALREADY_PERMVOTED = 364<br />
HOT_ANIME_EMPTY = 365<br />
RANDOM_RECOMMENDATION_EMPTY = 366<br />
RANDOM_SIMILAR_EMPTY = 367<br />
NOTIFICATION_DISABLED = 370<br />
NO_SUCH_ENTRY_MESSAGE = 381<br />
NO_SUCH_ENTRY_NOTIFICATION = 382<br />
NO_SUCH_MESSAGE = 392<br />
NO_SUCH_NOTIFY = 393<br />
NO_SUCH_USER = 394<br />
CALENDAR_EMPTY = 397<br />
NO_CHANGES = 399<br />
<br />
NOT_LOGGED_IN = 403<br />
NO_SUCH_MYLIST_FILE = 410<br />
NO_SUCH_MYLIST_ENTRY = 411<br />
MYLIST_UNAVAILABLE = 412<br />
<br />
LOGIN_FAILED = 500<br />
LOGIN_FIRST = 501<br />
ACCESS_DENIED = 502<br />
CLIENT_VERSION_OUTDATED = 503<br />
CLIENT_BANNED = 504<br />
ILLEGAL_INPUT_OR_ACCESS_DENIED = 505<br />
INVALID_SESSION = 506<br />
NO_SUCH_ENCRYPTION_TYPE = 509<br />
ENCODING_NOT_SUPPORTED = 519<br />
BANNED = 555<br />
UNKNOWN_COMMAND = 598<br />
<br />
INTERNAL_SERVER_ERROR = 600<br />
ANIDB_OUT_OF_SERVICE = 601<br />
SERVER_BUSY = 602<br />
NO_DATA = 603<br />
TIMEOUT - DELAY AND RESUBMIT = 604<br />
API_VIOLATION = 666<br />
<br />
PUSHACK_CONFIRMED = 701<br />
NO_SUCH_PACKET_PENDING = 702<br />
<br />
VERSION = 998</pre><br />
<br />
[[Category:Development]]<br />
[[Category:UDP]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=UDP_API_Definition&diff=22506UDP API Definition2016-03-16T08:46:05Z<p>Ommina: /* ANIME: Retrieve Anime Data */</p>
<hr />
<div>{{TOCright}}<br />
<br />
== General Information ==<br />
'''Author:''' [[User:Exp|Exp]] & [[User:Epoximator|Epoximator]] & [[User:Ommina|Ommina]]<br><br />
'''Version:''' 0.03.730 (2015-03-25)<br><br />
'''Version number used for protover parameter:''' "3"<br />
<br />
'''IMPORTANT INFORMATION FOR ALL INTERESTED:'''<br />
* If you are mainly interested in notifications and private messaging, check out our [[Jabber]] and [[RSSRDF]] support first.<br />
* The UDP API is not an appropriate choice if you desire to download a local copy of the AniDB database.<br />
* If you want to create a client you have to register it {{AniDBLink|client|here}} and [[UDP Clients|here]].<br />
** Check out the clients that are being developed. There exists usable code in many different languages already.<br />
* If you have suggestions for improvements or new features use the [[UDP API DEV|development]] page.<br />
* Please also take a look at the [[API]] page.<br />
<br />
== Formats used in this Spec ==<br />
* {vartype varname} - Specifies what shall be inserted at this point and its type.<br />
* [...] - Everything between [ and ] is optional.<br />
<br />
=== Used types ===<br />
* ''int2'' - 2 byte Integer (in string representation)<br />
* ''int4'' - 4 byte Integer (in string representation)<br />
* ''boolean'' - true or false - use '1' for ''true'', '0' for ''false''<br />
* ''str'' - String (UDP packet length restricts string size to 1400 bytes)<br />
* ''hexstr'' -- a hex representation of a decimal value, two characters per byte. If multiple bytes are represented, byte one is the first two characters of the string, byte two the next two, and so on.<br />
<br />
=== Content Encoding ===<br />
* Default character encoding: ''ASCII''<br />
* Escape scheme for option values (to server): ''html form encoding'' + ''newline''<br />
** This means you have to encode at least <tt>&</tt> in your option values in html form encoding style (<tt>&amp;amp;</tt>) before sending them to the api server. All other html form encodings are optional.<br />
** All newlines should be replaced by &lt;br /&gt;<br />
* Escape scheme for returned data fields (from server): ', | and newline<br />
** Content newlines are encoded as &lt;br /&gt;, ' is encoded as ` and | is encoded as /.<br />
** Dates are returned in unix time (number of seconds elapsed since January 1, 1970 00:00:00 UTC)<br />
<br />
== Basics ==<br />
=== General ===<br />
The network communication is ''packet'' and ''line'' based. Each AniDB API command is exactly one UDP packet containing one line. Results are sent as one packet but may consist out of multiple lines. A return value always starts with a 3 byte result code followed by a human readable version of the result code. Be aware that important data fields may be returned directly after the return code (see: 200,201,209,271,272,504).<br />
The meaning for all result codes can be found in this document. If there is more than one entry returned, it's one entry per line. Lines are terminated by a <tt>\n</tt> (no dos linefeed <tt>\r</tt>). The elements of a format string are separated by a "|" character.<br />
<br />
<tt>{three digit return code} {str return string}\n</tt><br><br />
<tt>{data field 0}|{data field 1}|...|{data field n}</tt><br />
<br />
'''IMPORTANT:'''<br />
* All commands except PING, ENCRYPT, ENCODING, AUTH and VERSION '''requires''' login, meaning that the ''session tag'' must be set (<tt>s=xxxxx</tt>).<br />
* A client should ignore any additional trailing data fields it doesn't expect. Additional fields are going to be added to the output of some commands from time to time. Those additional fields will simply be appended to the end of the existing output. A client should be written in a way so that it is not affected by such new fields.<br />
* Due to the length constraints of an UDP package (over PPPoE) the replies from the server will never exceed 1400 bytes. String fields will be truncated if necessary to ensure this. No warnings are given when this happens.<br />
* A client should handle all possible return codes for each command.<br />
** Possible return codes for '''all commands''':<br />
*** 505 ILLEGAL INPUT OR ACCESS DENIED<br />
*** 555 BANNED<br />
***: {str reason}<br />
*** 598 UNKNOWN COMMAND<br />
*** 600 INTERNAL SERVER ERROR<br />
*** 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
*** 602 SERVER BUSY - TRY AGAIN LATER<br />
*** 604 TIMEOUT - DELAY AND RESUBMIT<br />
** Additional return codes for all commands that '''require login''':<br />
*** 501 LOGIN FIRST<br />
*** 502 ACCESS DENIED<br />
*** 506 INVALID SESSION<br />
<br />
{{eyecatch|Note|The '555 BANNED' message should not be expected by the client. This message is only enabled temporary to help developers understand what they are doing wrong.}}<br><br />
<br />
{{eyecatch|Note|<br />
While in daily maintenance the AniDB API will reply with<br />
<br />
601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
<br />
to all commands. If a client receives such a return value it should wait at least 30 minutes before trying again.}}<br />
<br />
=== Server / UDP Connection ===<br />
The Client has to send data packets to:<br />
* '''Server:''' api.anidb.net<br />
* '''Port:''' 9000/UDP<br />
The servername and port should not be hardcoded into a frontend but should be read from a configuration file.<br />
<br />
=== Server Errors ===<br />
* At any time the API might return a fatal error of the form:<br />
: <tt>6xx ERROR DESCRIPTION</tt><br />
* Possible codes are 600-699.<br />
* Occurrences of these errors (except 601 and 602) should be reported to [[User:Ommina|Ommina]].<br />
{{eyecatch|Note|6XX messages do not always return the tags given with the command which caused the error!}}<br />
<br />
=== Connection Problems ===<br />
There are many ways for a client to end up banned or the API might currently be handling too many concurrent connections.<br />
If a client does not get any reply to an AUTH command it should start to increase the retry delay exponentially with every failed login attempt. (i.e. try again after 30 seconds if the first login attempt failed, if the second fails too retry after 2 minutes, then 5 minutes, then 10 minutes, then 30 minutes, ... until you reach a retry delay of ~2-4h.)<br />
<br />
=== Local Port ===<br />
A client should select a fixed local port >1024 at install time and reuse it for local UDP Sockets. If the API sees too many different UDP Ports from one IP within ~1 hour it will ban the IP. (So make sure you're reusing your UDP ports also for testing/debugging!)<br />
<br />
The local port may be hardcoded, however, an option to manually specify another port should be offered.<br />
<br />
'''Note when behind a [[Wikipedia:Network address translation|NAT]]/masquerading router:'''<br><br />
A session between the server and a client is identified by the ''IP and port'' used by the client. So when the port (or IP) changes within a session the client has to authenticate again. If a client is behind a NAT router it can’t actually control the local port used for the connection. The router will normally ''translate'' the port to support several computers on a LAN to share the Internet connection. The public port (as determined by the router and seen by the server) which has been assigned to the connection will only be reserved for as long as it is in use. This means that the router will usually ''deallocate the port after a fixed timeout period'' (eg. five, ten or 15 minutes). Once that happens the client will no longer be able to receive UDP messages from the server (the messages will be discarded as undeliverable by the router) and a new port will be selected once the client tries to send a message to the server (which will result in a new connection session - '''Note:''' This could get you banned!, see above). So in order to keep a session over a NAT router alive, the client has to ping the server within the router's deallocation period to prevent a timeout.<br />
<br />
The client can decide whether it is behind a NAT router or not by adding <tt>nat=1</tt> to the AUTH command. This will cause the response to include the IP and port as seen by the server. If the port differs from the port reported by the local socket, the connection subject to NAT and the client should issue PING commands in regular intervals. Please do not send pings more often than is necessary to keep NAT connections alive.<br />
<br />
=== Flood Protection ===<br />
To prevent high server load the UDP API server enforces a strict flood protection policy.<br />
* Short Term:<br />
** A Client MUST NOT send more than 0.5 packets per second (that's one packet every two seconds, not two packets a second!)<br />
** The server will start to enforce the limit after the first 5 packets have been received.<br />
* Long Term:<br />
** A Client MUST NOT send more than one packet every four seconds over an extended amount of time.<br />
** ''An extended amount of time'' is not defined. Use common sense.<br />
<br />
Once a client exceeds a rate limit all further UDP packets from that client will be dropped without feedback until the client's packet rate is back down to acceptable levels.<br />
<br />
{{eyecatch|Note|Dropped packets are still taken into account for the packet rate. Meaning if you continuously send packets your client will be banned forever.}}<br />
<br />
Generally clients should be written in a way to minimize server and network load. You should always keep that in mind.<br />
<br />
Abusive clients may be banned completely.<br />
<br />
{{eyecatch|Note|<br />
If you suddenly stop getting replies from the AniDB API or you normally don't have a notable packetloss and from one point on you suddenly note a high packetloss percentage you have most likely entered a critical flood ratio.<br />
If the AniDB API isn't answering at all it might either be down or you have been banned, this is normally caused by violating the API specs (i.e. too many connections using different ports from one IP, too many auth failures, ...) (usually lasts 30 minutes).<br />
If you're experiencing packet loss you have probably reached the rate limit and the API starts to randomly drop incoming packets from your IP. (can be solved by enforcing a delay between multiple commands when you're sending a batch)}}<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Caching ===<br />
To minimize server and network load a client should use local caching in order to prevent repeated API requests for the same data.<br />
<br />
A client should locally cache FILE/EP/ANIME/GROUP/... info wherever possible for extended amounts of time.<br />
(I.e. if a client is used to scan a local folder with anime files and add them via API to a users MyList then it shall only ask for all files in the first run and cache the info for all files known to AniDB. If run again over the same folder it shall only check those files which were unknown to AniDB at the time of the last check.)<br />
<br />
Later versions of the API might enforce this by banning clients which ask for the same information more than once every week/month.<br />
<br />
=== Tag option ===<br />
The API will add a user defined string at the beginning of each reply line separated with a space, if desired.<br />
* To enable add the <tt>tag={str usertag}</tt> option to a command.<br />
* A tag is only valid for the command it was send with, meaning it is not persistent. If you want to have tags in front of all reply lines you will have to append the tag option to each command you send to the server.<br />
* Tags are meant to enable a client to handle more than one request/reply at a time.<br />
<br />
Usage example:<br />
AUTH user=baka&pass=baka&protover=25&client=someclient&clientver=1&tag=abc123<br />
abc123 200 Jxqxb LOGIN ACCEPTED<br />
or<br />
LOGOUT s=Jxqxb&tag=byebye<br />
byebye 203 LOGGED OUT<br />
<br />
{{eyecatch|Note|The tag option is valid for all api commands and is thus not explicitly listed in the description of each command.}}<br />
<br />
=== Data Indexes (fid,aid,eid,gid,lid) ===<br />
* All indexes start at 1 (not 0).<br />
* It is possible for table entries to have id fields with a value of 0 (i.e. gid). Those are to be interpreted as "NONE" or "NULL".<br />
* An ID is '''never''' reused. That means after an entry is deleted no new entry will ever have that ID again.<br />
* Mylist IDs (lid) are globally unique, not per-user unique.<br />
<br />
== Authing Commands ==<br />
{{eyecatch|Note|'''ANY''' command which requires parameters may return: 505 ILLEGAL INPUT OR ACCESS DENIED}}<br />
<br />
----<br />
=== AUTH: Authing to the AnimeDB ===<br />
'''Command String:'''<br />
* AUTH user={str username}&pass={str password}&protover={int4 apiversion}&client={str clientname}&clientver={int4 clientversion}[&nat=1&comp=1&enc={str encoding}&mtu{int4 mtu value}&imgserver=1]<br />
<br />
'''Possible Replies:'''<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
* 500 LOGIN FAILED<br />
* 503 CLIENT VERSION OUTDATED<br />
* 504 CLIENT BANNED - {str reason}<br />
* 505 ILLEGAL INPUT OR ACCESS DENIED<br />
* 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
when nat=1<br />
* 200 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED<br />
* 201 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
when imgserver=1<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
{str image server name}<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
{str image server name}<br />
<br />
'''Info:'''<br />
{{eyecatch|Note|The password is the normal AniDB website password! The password listed in the profile as API Password in only used for the optional encryption feature.}}<br />
* The ''session_key'' is a String containing only ''a-z,A-Z,0-9'' chars of a length of ''4-8'' characters.<br />
: It has to be stored by the client and needs to be sent as parameter with every command which requires the user to logged in.<br />
* The ''session_key'' String is appended as parameter "s", i.e. "PUSH notify=1&msg=1&s={str session_key}".<br />
* On a '''500 LOGIN FAILED''' message the client should request the user to enter username and password again.<br />
* In case of a '''501 LOGIN FIRST''' message the client should silently resend an auth command and send the failed command again.<br />
* A '''502 ACCESS DENIED''' message should abort the current action on the client side and display a message to the user.<br />
* A '''503 CLIENT VERSION OUTDATED''' message states that the udp server has been updated and does not support your client any longer. (protover is too low). A 201 message refers to a new version of the client software.<br />
* A '''506 INVALID SESSION''' means that either the session key parameter "s" was not provided with a command that requires it or the session key is no longer valid. The client should reissue an AUTH command.<br />
{{eyecatch|Note|A frontend shall expect 501 and 502 messages to be returned on ANY command.}}<br><br />
{{eyecatch|Note|AniDB usernames may only contain characters (a-z,A-Z), numbers (0-9), underscores (_) and hyphens (-).}}<br />
* The client should send the apiversion of the AnimeDB API version it supports as value of the protover parameter.<br />
* The client MAY NOT send anything but the version of the API Specs the author used to write the client! (as it is stated at the top of this file @ "Version number used for protover parameter")<br />
: The API will compare that value to it's own version of the API and if the version of the client is older the API will decide whether the changes were significant enough to deny the old client access to the DB.<br />
* The clientname shall be a lower-case string containing only the chars ''a-z'' of ''4-16 chars'' length which identifies the client. (i.e. mykickassclient)<br />
* The clientversion shall be a number starting with 1, increased on every change in the client.<br />
: clientname and clientversion might be used by the API to distinguish between different clients and client versions if that should ever become necessary.<br />
{{eyecatch|Important|<br />
* DO NOT use the clientname of an existing client. If you modify an existing client's code to meet your own needs, create a new client name for yourself.<br />
* ALWAYS increase the clientversion number if you release a new client version.}}<br />
* A Login and its assigned ''session_key'' is valid until the virtual UDP connection times out or until a LOGOUT command is issued.<br />
* The virtual UDP connection times out if no data was received from the client for '''35 minutes'''.<br />
* A client should issue a UPTIME command once every 30 minutes to keep the connection alive should that be required.<br />
* If the client does not use any of the notification/push features of the API it should NOT keep the connection alive, furthermore it should explicitly terminate the connection by issuing a LOGOUT command once it finished it's work.<br />
* If it is very likely that another command will be issued shortly (within the next 20 minutes) a client SHOULD keep the current connection open, by not sending a LOGOUT command.<br />
{{eyecatch|Important|<br />
* A client should NOT perform a full AUTH / command / LOGOUT cycle for each command it wants to send. Again, if another command is likely within 20 minutes, remain logged in.}}<br />
* The client shall notify the user if it received a 201 message at login.<br />
: This means a new version of the client is available, however the old version is still supported otherwise a client banned message would have been returned.<br />
* The user should get a pop-up message on 503 and 504 messages telling him to update his client software.<br />
: ('''Note:''' 504 means that this version of the client is banned, not the user!)<br />
* The 'nat' option makes the client able to detect whether it is behind a nat router or not. When the client is behind a nat router it should keep the "connection" alive with the PING command.<br />
{{eyecatch|Important|Make sure your client handles ALL possible AUTH return codes before giving out any versions!}}<br />
* When ''enc=x'' is defined the server will change the encoding used to x.<br />
**If the encoding is supported it will change right away (including the response) and be reset on logout/timeout.<br />
**If not supported then the argument will be silently ignored. Use ENCODING to test what works.<br />
**Supported encodings are [http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html these].<br />
* ''comp=1'' means that the client supports compression ([http://java.sun.com/j2se/1.5.0/docs/api/java/util/zip/Deflater.html DEFLATE]).<br />
**The server will compress (instead of truncating) the datagrams when needed if this option is enabled.<br />
**The first two bytes of compressed datagrams will always be set to zero. (So tags should never start with that.)<br />
* Default [[Wikipedia:MTU (networking)|''MTU'']] is 1400. Minimum allowed is 400, maximum 1400, due [[Wikipedia:Point-to-Point Protocol over Ethernet|PPPoE]].<br />
<br />
----<br />
<br />
=== LOGOUT: Logout ===<br />
'''Command String:'''<br />
* LOGOUT<br />
<br />
'''Possible Replies:'''<br />
* 203 LOGGED OUT<br />
* 403 NOT LOGGED IN<br />
<br />
'''Info:'''<br />
* This command only works if you are already logged in.<br />
* A logout should ALWAYS be issued if the client is currently logged in and is either exiting or not expecting to send/receive any AniDB API packets for the next >= 30 minutes.<br />
<br />
----<br />
=== ENCRYPT: Start Encrypted Session ===<br />
Will cause all future messages from the server, except the first (the reply to the ENCRYPT command itself), to be encrypted (128 bit [[Wikipedia:Advanced Encryption Standard|AES]]). The client will also have to encrypt all future requests sent to the server. All non-encrypted messages will be discarded by the server. The encryption key is the [[Wikipedia:MD5|MD5]] hash of a special ''UDP API Key'' (defined in the users profile) concatenated with the salt string as given in the reply to the ENCRYPT message. A normal AUTH message is still necessary to authenticate and should follow the ENCRYPT command once the API has acknowledged the encryption.<br />
<br />
'''Command String:'''<br />
* ENCRYPT user={str name}&type={int2 type}<br />
<br />
'''Possible Replies:'''<br />
* 209 {str salt} ENCRYPTION ENABLED<br />
* 309 API PASSWORD NOT DEFINED<br />
* 509 NO SUCH ENCRYPTION TYPE<br />
* 394 NO SUCH USER<br />
<br />
'''Info:'''<br />
* ''user'' is the user name.<br />
* ''type'' is the type of encryption; 1 => 128 bit AES (only one defined).<br />
* ''API Key'' is the one defined in the {{AniDBLink|profile|profile settings page}}.<br />
* It is not possible to disable the encryption once enabled while staying logged in.<br />
** A logout (the logout message needs to be correctly encrypted) or timeout will disable the encryption.<br />
* In order to minimize server load, encryption should be disabled by default and should have to be enabled manually by the user in the configuration options.<br />
* The encryption key is md5(api_key_of_user+''salt'').<br />
* Padding of the message needs to be done according to the PKCS5Padding scheme.<br />
<br />
== Notify Commands ==<br />
=== Introduction ===<br />
Broadly speaking, notifications provide an indication to the client that some event has occurred within the AniDB database.<br />
<br />
There are three types:<br />
* New file [[Notifications|notification]]. (Only anime type supported.)<br />
* New private message notification.<br />
* New buddy event notification.<br />
<br />
Note that, while a user can subscribe to multiple 'new file' events (see [[Notifications|notifications]]), at present, the UDP API only supports notifications of new files by anime. New files by group, or new files by producer, are NOT presently supported. Just the same, keeping in mind that the API is designed to potentially support such notifications in the future will help in understanding why some of the commands are structured the way they are.<br />
<br />
The word "notification" is also used a bit inconsistently in this document. An AniDB notification is originally a "new file [[Notifications|notification]]". It might be more correct to use the term "event" for the original "happening" and then "notification" as the means to notify the user (client). New-file, new-message, buddy-* and going-down are all events that results in notifications. Only the first two type of events are persistent, though, meaning they exist and remain in the same state until some user action affects them.<br />
<br />
=== Getting Notifications ===<br />
Clients that wish to receive notifications have two routes available to them. They are by no means mutually exclusive and selecting one does not imply a client is unable to use commands from another.<br />
<br />
'''Method One: Polling'''<br />
<br />
With this method, the client contacts the server at some interval (no more than once every 20 minutes) to see if there are new file notifications waiting. If there are, the client can the get further details of the files in question. This is analogous to checking an email server every half hour to see if new email has arrived.<br />
<br />
Its principal advantage is that it is easy to design and code. Blocking sockets are sufficient as the client can expect the reply received to correspond with the command sent.<br />
<br />
The disadvantage of this approach is that it introduces a delay and some uncertainty in receiving notifications. If, for example, the user clears the notification on the website before the client collects it, the client will not learn of the new file. Similarly, if the user does not dismiss notifications via the site, the client will have an increasing amount of stale data to work though. Finally, notifications cleared by the client also clears them from the website, so users will need to be made aware of what is going on.<br />
<br />
A polling HOWTO:<br />
<br />
* Use NOTIFY (no more than once every 20 minutes) to get the number of pending notifications<br />
* IF there are new notifications pending, use NOTIFYLIST to get a list of notification types and associated IDs.<br />
* Use NOTIFYGET to receive a notification, supplying the ID provided by NOTIFYLIST<br />
* Use NOTIFYACK to acknowledge a notification, supplying the ID provided by NOTIFYLIST (if desired)<br />
<br />
{{eyecatch|Note|The ID supplied by NOTIFYLIST will be the ID of the affected notification type. Since, at present, only the anime type is supported, this value is always an aid. In the future, it may represent a group or producer ID. In these cases, the str '''type''' value will indicate what entity the ID represents.}}<br />
<br />
'''Method Two: Server PUSH'''<br />
<br />
With this method, the server takes the active role in advising the client that a new file has arrived. The client must register with the server to receive further advice information, and will be responsible for keeping the login session from timing out, and any NAT router ports open. The UDP packet is sent to the ip and port from which the AUTH command was received.<br />
<br />
This method compensates for the disadvantages of the polling method, but is more difficult to code. Blocking sockets are no longer an option, nor can a client make any assumptions that an incoming packet will necessarily be a reply to the last command sent. The tag option may be helpful here.<br />
<br />
A PUSH HOWTO:<br />
<br />
* PUSH to register your client session.<br />
* Listen for 720-799 NOTIFICATIONs ('''not 290''').<br />
* Use PUSHACK to to acknowledge the notification using the nid supplied with NOTIFICATION<br />
* Use NOTIFYGET to receive a notification, suppling the relid provided by NOTIFICATION (NOT the packet ID)<br />
* Use NOTIFYACK to acknowledge a notification, suppling the relid provided by NOTIFICATION (if desired)<br />
* Use UPTIME (with an interval between 30 and 35 minutes) to keep login session valid<br />
<br />
It is probably a good idea to use tags to separate NOTIFICATIONs from the other communication. NOTIFICATIONs will '''never''' have tags.<br />
<br />
=== PUSH: UDP Notification Registration ===<br />
Register your client as an observer for AniDB notification events for the current user. If you are registered for one or more event types the AniDB server will send an UDP packet (format see below) on each change which affects the current user.<br />
<br />
'''Command String:'''<br />
* PUSH notify={boolean on_new_file}&msg={boolean on_new_private_message}[&buddy={boolean on_buddy_event}]<br />
<br />
'''Possible Replies:'''<br />
* 270 NOTIFICATION ENABLED<br />
OR (if both values are 0)<br />
* 370 NOTIFICATION DISABLED<br />
<br />
'''Info:'''<br />
* A client which has registered to receive UDP notification packets must:<br />
** Issue a PUSHACK command for each notification received with ''notify_packet_id'' provided in the notification packet.<br />
** Use PING to keep the connection alive (< 30 min).<br />
** Use UPTIME to ensure that the session is OK (>= 30 min).<br />
* Every notification generated is resent 3 times unless acknowledged. After that the client is logged out.<br />
<br />
=== NOTIFY: Notifications ===<br />
Get number of pending notifications (and number of online buddies).<br />
<br />
'''Command String:'''<br />
* NOTIFY [buddy=1]<br />
<br />
'''Possible Replies:'''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}<br />
when ''buddy=1''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}|{int4 number_of_online_buddies}<br />
<br />
'''Info:'''<br />
* If the client did send a NOTIFY within the last 35 minutes and it was confirmed by AniDB then receiving a 501 LOGIN FIRST message for the next NOTIFY command shows that AniDB logged the client out because it did not respond to a PUSH Notification packet.<br />
* There is no command to retrieve missed PUSH Notifications.<br />
{{eyecatch|Note|This command MUST NOT be issued more than once every 20 minutes.}}<br />
<br />
----<br />
=== NOTIFYLIST: List Notification/Message IDs ===<br />
List id of all pending (not acknowledged) ''new private message'' and ''new file'' notifications. Buddy events cannot be acknowledged.<br />
<br />
'''Command String:'''<br />
* NOTIFYLIST<br />
<br />
'''Possible Replies:'''<br />
*291 NOTIFYLIST<br />
: {str type}|{int4 id}<br />
: {str type}|{int4 id}<br />
: ...<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as required by NOTIFYGET. For messages it is the actual message id, for notifications it is the id of the related type; anime, group or producer. Since only file notifications related to anime is implemented atm, it is the anime id (aid).<br />
* NOTIFYLIST returns one line per entry, if no entries are available only the first line of the reply is returned.<br />
{{eyecatch|Note|This command MUST NOT be issued regularly but should only be triggered by either a push message received by the client or a reply to a NOTIFY command which tells you that there are messages/notifications waiting.}}<br />
<br />
----<br />
=== NOTIFYGET: Get Notification/Message ===<br />
Receive private message or file notification.<br />
<br />
'''Command String:'''<br />
* NOTIFYGET type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 292 NOTIFYGET<br />
: {int4 id}|{int4 from_user_id}|{str from_user_name}|{int4 date}|{int4 type}|{str title}|{str body}<br />
* 392 NO SUCH ENTRY<br />
when type = N<br />
* 293 NOTIFYGET<br />
: {int4 relid}|{int4 type}|{int2 count}|{int4 date}|{str relidname}|{str fids}<br />
* 393 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as given by NOTIFYLIST (or ''relid'' from 271 NOTIFICATION and mid from 272 NOTIFICATION)<br />
* for message entries (M):<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: type is the type of the message (0=normal msg, 1=annonymous, 2=system msg, 3=mod msg)<br />
* for notification entries (N):<br />
: relid is the id of the related type (anime)<br />
: relname is the name of the related type (anime)<br />
: type is the notification type (0=all, 1=new, 2=group, 3=complete)<br />
: count is the number of events pending for this subscription<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: fids is a comma separated list with the affected file ids<br />
<br />
----<br />
=== NOTIFYACK: Acknowledge Notification/Message ===<br />
This command will mark a message read or clear a ''new file'' notification. Buddy events are not acknowledgeable.<br />
<br />
'''Command String:'''<br />
* NOTIFYACK type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 281 NOTIFYACK SUCCESSFUL<br />
* 381 NO SUCH ENTRY<br />
when type = N<br />
* 282 NOTIFYACK SUCCESSFUL<br />
* 382 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
<br />
====Notification Packet Format====<br />
'''New File Notify:'''<br />
<br />
720 {int4 notify_packet_id} NOTIFICATION - NEW FILE<br />
{int4 fidlist}|{int2 reltype}|{int2 priority}<br />
<br />
* fidlist is a comma separated list of file ids<br />
* reltype is: 1 = anime, 2 = group, 3 = producer<br />
* priority is: 0 = low, 1 = medium, 2 = high<br />
* new file notifications are created as a batch, so it is not unusual to get several new files for a particular anime at once. It is in this case that a comma separated list of fids will be returned<br />
<br />
{{eyecatch|Note|Group (and producer) related file notifications are not implemented yet.}}<br />
<br />
<br />
'''New Private Message Notify:'''<br />
<br />
794 {int4 notify_packet_id} NOTIFICATION - NEW MESSAGE<br />
{int2 type}|{int4 date}|{int4 sent_by_uid}|{str sent_by_name}|{str subject}|{str body}|{int mid}<br />
<br />
* type is the type of the message (0=normal msg, 1=anonymous, 2=system msg, 3=mod msg)<br />
* date is the time the message was sent (in seconds since 1.1.1970)<br />
* sender uid/sender name are the user id and user name of the sender<br />
* subject is the message subject<br />
* body is message body (can be truncated)<br />
* mid is message id and can be used with NOTIFYACK<br />
<br />
'''Buddy Event Notify:'''<br />
753 {int4 notify_packet_id} NOTIFICATION - BUDDY<br />
{int4 buddy uid}|{int2 event type}<br />
* Possible event types:<br />
** 0 => LOGIN<br />
** 1 => LOGOUT<br />
** 2 => ACCEPTED<br />
** 3 => ADDED<br />
<br />
<br />
'''Going Down Event Notify:'''<br />
799 {int4 notify_packet_id} NOTIFICATION - SHUTTING DOWN<br />
{int4 time offline}|{int4 comment}<br />
<br />
* Clients with any notification on will receive the SHUTTING DOWN message before the API goes offline.<br />
* Time offline is the time in minutes the API will be down, 0 if indefinite (client can direct user to the AniDB site for status updates).<br />
* The comment is a short explanation for the downtime.<br />
* Only one datagram will be sent, and the server will not listen for replies.<br />
<br />
<br />
=== PUSHACK: UDP Notification Acknowledge ===<br />
Used to acknowledge notification packets (720-799). A client must be prepared to issue this command before using '''PUSH'''.<br />
<br />
'''Command String:'''<br />
* PUSHACK nid={int4 notify_packet_id}<br />
<br />
'''Possible Replies:'''<br />
* 701 PUSHACK CONFIRMED<br />
* 702 NO SUCH PACKET PENDING<br />
<br />
'''Info:'''<br />
* See: '''PUSH'''<br />
<br />
== Buddy Commands ==<br />
Group of commands used to administrate your buddylist.<br />
<br />
=== BUDDYADD: Add a user to Buddy List ===<br />
'''Command String:'''<br />
* BUDDYADD uid={int4 buddy uid}<br />
* BUDDYADD uname={int4 buddy name}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 255 BUDDY ADDED<br />
* 355 BUDDY ALREADY ADDED<br />
<br />
----<br />
=== BUDDYDEL: Remove a user from Buddy List ===<br />
'''Command String:'''<br />
* BUDDYDEL uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 256 BUDDY DELETED<br />
<br />
----<br />
=== BUDDYACCEPT: Accept user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYACCEPT uid={int4 user uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 257 BUDDY ACCEPTED<br />
* 357 BUDDY ALREADY ACCEPTED<br />
<br />
----<br />
=== BUDDYDENY: Deny user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYDENY uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 258 BUDDY DENIED<br />
* 358 BUDDY ALREADY DENIED<br />
<br />
----<br />
=== BUDDYLIST: Retrieve Buddy List ===<br />
'''Command String:'''<br />
* BUDDYLIST startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 253 {int2 start} {int2 end} {int2 total} BUDDY LIST<br />
: {int4 uid}|{str username}|{int2 state}<br />
: ...<br />
'''Info:'''<br />
* state is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = this user is in your buddylist<br />
* bit 2 = this user has accepted you<br />
* bit 3 = this user is waiting for your approval<br />
<br />
----<br />
=== BUDDYSTATE: Retrieve Buddy States===<br />
'''Command String:'''<br />
* BUDDYSTATE startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 254 {int2 start} {int2 end} {int2 total} BUDDY STATE<br />
: {int4 uid}|{int2 onlinestate}<br />
: ...<br />
<br />
'''Info:'''<br />
* onlinestate is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = http online (user has issued a HTTP request within the last 10 minutes)<br />
* bit 2 = udp api online (user is currently connected to the udp api server)<br />
* example: 0=offline, 1=http online, 2=udp api online, 3=http&udp api online<br />
<br />
== Data Commands ==<br />
=== ANIME: Retrieve Anime Data ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIME aid={int4 id}[&amask={hexstr}]<br />
by name<br />
* ANIME aname={str anime name}[&amask={hexstr}]<br />
<br />
'''Possible Replies:'''<br />
<br />
If no ''amask'' is provided:<br />
* 230 ANIME<br />
: {int4 aid}|{int4 eps}|{int4 ep count}|{int4 special cnt}|{int4 rating}|{int4 votes}|{int4 tmprating}|{int4 tmpvotes}|{int4 review rating average}|{int4 reviews}|{str year}|{str type}|{str romaji}|{str kanji}|{str english}|{str other}|{str short names}|{str synonyms}|{str category list}<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* Fields are returned in the same order they appear in the ''amask'' field list: byte 1, bit 7 first<br />
* Synonyms and short names are separated with '<br />
* Category fields are separated with ',' and ordered by weight (desc). ''However'', be aware that categories are no longer used nor updated internally, and category responses are only returned to avoid breaking older clients. Use tags as a replacement. <br />
* By name: must be perfect match of romaji/kanji/english/other/synonym/short name.<br />
* 'Producer id list' and 'producer name list' match the data returned by the former producer bits (but using the revised creator ids)<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
* '''Note:''' The character id list is the first data to be truncated if needed. And then: tag list, synonym list, short name list. This applies to the FILE command too.<br />
* Selecting an 'unused' or 'reserved' bit will return an "illegal input" (505) response.<br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="5" align="center"><b>amask</b></td></tr><br />
<tr><br />
<td align="center"><b>Byte 1</b></td><br />
<td align="center"><b>Byte 2</b></td><br />
<td align="center"><b>Byte 3</b></td><br />
<td align="center"><b>Byte 4</b></td><br />
<td align="center"><b>Byte 5</b></td><br />
<td align="center"><b>Byte 6</b></td><br />
<td align="center"><b>Byte 7</b></td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int aid</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int dateflags</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 special ep count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int air date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int end date</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str url</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str picname</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int vote count</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 temp rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int temp vote count</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 average review rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int review count</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str award list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>bool is 18+ restricted</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int ANN id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int allcinema id</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str AnimeNfo id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str tag name list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int tag id list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>int tag weight list</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int date record updated</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int character id list</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int creator id list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int main creator id list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str main creator name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 specials count</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 credits count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 other count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 trailer count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 parody count</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<br />
'''Related aid type (Byte 1, Bit 2):'''<br />
<pre><br />
value meaning<br />
<br />
1 sequel<br />
2 prequel<br />
11 same setting<br />
12 alternative setting<br />
32 alternative version<br />
41 music video<br />
42 character<br />
51 side story<br />
52 parent story<br />
61 summary<br />
62 full story<br />
100 other<br />
</pre><br />
<br />
'''Examples:''' (note that the given amask gives the same result as the default request)<br />
> ANIME aid=1&amask=b2f0e0fc000000&s=xxxxx<br />
< 230 ANIME<br />
1|1999-1999|TV Series|Space,Future,Plot Continuity,SciFi,Space Travel,Shipboard,Other Planet,Novel,Genetic Modification,Action,Romance,Military,Large Breasts,Gunfights,Adventure,Human Enhancement,Nudity|Seikai no Monshou|星界の紋章|Crest of the Stars||13|13|3|853|3225|756|110|875|11<br />
<br />
<br />
----<br />
<br />
=== ANIMEDESC: Retrieve Anime Description ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIMEDESC aid={int4 id}&part={int4 partno}<br />
<br />
'''Possible Replies:'''<br />
* 233 ANIMEDESC<br />
: {int4 current part}|{int4 max parts}|{str description}<br />
* 330 NO SUCH ANIME<br />
* 333 NO SUCH DESCRIPTION<br />
<br />
'''Info:'''<br />
* The maximum length of the anime description is roughly 5000 characters, but the maximum length of a UDP packet is 1400 bytes<br />
* Multiple calls to ANIMEDESC may be necessary to retrieve the complete text, retrieving separate 1400 byte parts with each call<br />
* ''part'' is zero-based<br />
* '''Note:''' No support, at present, for retrieving descriptions by title. ''aid'' only<br />
<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> ANIMEDESC aid=3169&part=0&s=xxxxx<br />
< 233 ANIMEDESC<br />
0|1|As summer break arrives for the students, Jun Sakurada is busily studying on his own in the library, making up for time lost <cut><br />
<br />
----<br />
=== CALENDAR: Get Upcoming Titles ===<br />
Returns the anime ids of the 25 most recently aired / released anime, directly followed by the next 25 anime due to be aired / released, ordered by start date.<br />
<br />
'''Command String:'''<br />
* CALENDAR<br />
<br />
'''Possible Replies:'''<br />
* 297 CALENDAR<br />
{int aid}|{int startdate}|{int dateflags}/n<br />
<br />
..repeated n times<br />
<br />
* 397 CALENDAR EMPTY<br />
<br />
'''Info:'''<br />
* Takes no parameters (other than the session string)<br />
* Titles returned are filtered by the 'show adult' preference of the logged in user. That is, users who have elected to hide adult content will have it hidden here as well.<br />
* Do not depend on the command always returning exactly 50 titles; there may not always be 25 future titles pending, depending on the user's 'adult' preferences, and the date in relation to the relation to the current anime season.<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
<br />
----<br />
=== CHARACTER: Get Character Information ===<br />
Returns character details associated with a given character ID, including associated anime ids, episode ids, and seiyuu.<br />
<br />
'''Command String:'''<br />
* CHARACTER charid={int characterid}<br />
<br />
'''Possible Replies:'''<br />
* 235 CHARACTER<br />
: {int charid}|{str character name kanji}|{str character name transcription}|{str pic}|{anime blocks}|{int episode list}|{int last update date}|{int2 type}|{str gender}<br />
<br />
: An 'anime block' is {int anime id},{int appearance},{int creatorid},{boolean is_main_seiyuu} repeated as many times as necessary, separated by a single quote ( ' ). <br />
<br />
* 335 NO SUCH CHARACTER<br />
<br />
'''Info:'''<br />
* If no seiyuu is associated with the character for a given aid, the 'creatorid' and 'is_main_seiyuu' fields will be empty, but the commas will remain.<br />
* An empty episode list is "undefined": no episode values have been added.<br />
* ''appearance'' values: 0='appears in', 1='cameo appearance in', 2='main character in', 3='secondary cast in'<br />
* ''type'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** 1 => 'Character'<br />
** 2 => 'Mecha'<br />
** 3 => 'Organisation'<br />
** 4 => 'Vessel' <br />
* ''gender'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** "M" => 'Male'<br />
** "F" => 'Female'<br />
** "I" => 'Intersexual'<br />
** "D" => 'Dimorphic'<br />
** "-" => 'none/does not apply'<br />
** "?" => 'unknown'<br />
<br />
'''Example:'''<br />
<br />
CHARACTER charid=488&s=DChan<br />
235 CHARACTER<br />
488|ニコ・ロビン|Nico Robin|14789.jpg|4097,2,1900,1'69,2,1901,0'6199,0,1900,1'5691,0,1900,1'2644,0,,'4851,0,1900,1||1236938094<br />
<br />
=== CREATOR: Get Creator Information ===<br />
<br />
'''Command String:'''<br />
* CREATOR creatorid={int creatorid}<br />
<br />
'''Possible Replies:'''<br />
* 245 CREATOR<br />
: {int creatorid}|{str creator name kanji}|{str creator name transcription}|{int type}|{str pic_name}|{str url_english}|{str url_japanese}|{str wiki_url_english}|{str wiki_url_japanese}|{int last update date}<br />
<br />
* 345 NO SUCH CREATOR<br />
<br />
'''Info:'''<br />
* ANIME AMASK byte6, bit5<br />
* ''type'' values: 1='person', 2='company', 3='collaboration'<br />
<br />
Example:<br />
<br />
245 CREATOR<br />
718|GAINAX|Gainax|2|10092.png||http://www.gainax.co.jp/|Gainax|Gainax|1237048093<br />
<br />
=== EPISODE: Retrieve Episode Data ===<br />
'''Command String:'''<br><br />
by eid<br />
* EPISODE eid={int eid}<br />
by anime and episode number<br />
* EPISODE aname={str anime name}&epno={int4 episode number}<br />
* EPISODE aid={int anime id}&epno={int4 episode number}<br />
<br />
'''Possible Replies:'''<br />
* 240 EPISODE<br />
: {int eid}|{int aid}|{int4 length}|{int4 rating}|{int votes}|{str epno}|{str eng}|{str romaji}|{str kanji}|{int aired}|{int type}<br />
* 340 NO SUCH EPISODE<br />
<br />
'''Info:'''<br />
* length is in minutes<br />
* Returned 'epno' includes special character (only if special) and padding (only if normal).<br />
** Special characters are S(special), C(credits), T(trailer), P(parody), O(other).<br />
* The ''type'' is the raw episode type, used to indicate numerically what the special character will be<br />
** 1: regular episode (no prefix), 2: special ("S"), 3: credit ("C"), 4: trailer ("T"), 5: parody ("P"), 6: other ("O")<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> EPISODE eid=1&s=xxxxx<br />
< 240 EPISODE<br />
1|1|24|400|4|01|Invasion|shinryaku|??<br />
<br />
> EPISODE aname=Seikai no Monshou&epno=2&s=xxxxx<br />
< 240 EPISODE<br />
2|1|24|750|2|02|Kin of the Stars|Hoshi-tachi no Kenzoku|??????|1295059229|1<br />
<br />
----<br />
<br />
=== FILE: Retrieve File Data ===<br />
'''Command String:'''<br><br />
by fid:<br />
* FILE fid={int4 id}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by size+ed2k hash:<br />
* FILE size={int8 size}&ed2k={str ed2khash}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by anime, group and epno<br />
* FILE aname={str anime name}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aname={str anime name}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
<br />
'''Possible Replies:'''<br />
* 220 FILE<br />
: {int4 fid}|{int4 aid}|{int4 eid}|{int4 gid}|{int4 state}|{int8 size}|{str ed2k}|{str anidbfilename}<br />
* 220 FILE<br />
: {int4 fid}|...(data list)<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 0}|{int4 fid 1}|...|{int4 fid n}<br />
* 320 NO SUCH FILE<br />
<br />
'''Info:'''<br />
* fid, aid, eid, gid are the unique ids for the file, anime, ep, group entries at AniDB.<br />
: You can use those to create links to the corresponding pages at AniDB.<br />
* anidbfilename is the AniDB filename for the file.<br />
: However this name does not contain all the extra information of the filenames on AniDB and might be composed slightly different.<br />
* fmask and amask are hexidecimal strings where each bit corresponds to a data field related to the specified file (see below). The data list received is sorted and returned in the same order as the tables: top to bottom, left to right, with fmask preceding amask. There is '''no''' provision to retrieve all fields. Further, requesting a 'unusued' or 'reserved' bit will return an "illegal input" error.<br />
* fid is always returned as the first value, regardless of what masks are provided.<br />
* Only the first matching file is returned when aname, gname and epno is used.<br />
* "audio codec" and "audio bitrate" will return multiple values if there are multiple audio streams present in the file. Values will be separated by a single quote. <br />
* For byte 1, bit 2 (other episodes): episode IDs will be followed by an integer '''percentage''' that indicate the percentage of the related episode this file covers. Typically 100%, there are cases where it will be 50, 30, or other values. This value provides no indication where, within an episode, the file represents. That is, 50% could mean the file covers the first half of the episode, the second half, or some 50% range in between.<br />
'''State:'''<br />
<pre><br />
bit / int value meaning<br />
1 / 1 FILE_CRCOK: file matched official CRC (displayed with green background in AniDB)<br />
2 / 2 FILE_CRCERR: file DID NOT match official CRC (displayed with red background in AniDB)<br />
3 / 4 FILE_ISV2: file is version 2<br />
4 / 8 FILE_ISV3: file is version 3<br />
5 / 16 FILE_ISV4: file is version 4<br />
6 / 32 FILE_ISV5: file is version 5<br />
7 / 64 FILE_UNC: file is uncensored<br />
8 / 128 FILE_CEN: file is censored<br />
<br />
examples:<br />
state ==== 9 ==> FILE_CRCOK+FILE_ISV3 ==> file matched official CRC and is version 3<br />
state ==== 0 ==> - ==> file was not crc checked and is version 1<br />
state ==== 34 ==> FILE_CRCERR+FILE_ISV5 ==> file DID NOT match official CRC and is version 5<br />
state ==== 1 ==> FILE_CRCOK ==> file matched official CRC and is version 1<br />
state ==== 8 ==> FILE_ISV3 ==> file was not CRC checked and is version 3<br />
</pre><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''fmask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
<td align="center">'''Byte 5'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 aid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 eid</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 gid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 mylist id</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>list other episodes</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>int2 IsDeprecated</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int2 state</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int8 size</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ed2k</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str md5</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str sha1</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str crc32</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>video colour depth</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str quality</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str audio codec list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 audio bitrate list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str video codec</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 video bitrate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str video resolution</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str file type (extension)</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str dub language</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str sub language</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 length in seconds</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str description</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 aired date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str anidb file name</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 mylist state</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 mylist filestate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 mylist viewed</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 mylist viewdate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str mylist storage</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str mylist source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str mylist other</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''amask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 anime total episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str category list</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str epno</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ep name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str ep romaji name</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str ep kanji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 episode rating</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 episode vote count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str group name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str group short name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int4 date aid record updated</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
'''Examples:''' (html escaped code intended)<br />
> FILE size=177747474&ed2k=70cd93fd3981cc80a8ea6a646ff805c9&fmask=7FF8FEF8&amask=C000F0C0&s=xxxxx<br />
< 220 FILE<br />
312498|4688|69260|4243|0||0|1|177747474|70cd93fd3981cc80a8ea6a646ff805c9|b2a7c7d591333e20495de3571b235c28|7af9b962c17ff729baeee67533e5219526cd5095|a200fe73|high|DTV|Vorbis (Ogg Vorbis)|104|H264/AVC|800|704x400|japanese|english'english'english|1560||1175472000|26|26|01|The Wings to the Sky|Sora he no Tsubasa|????|#nanoha-DamagedGoodz|Nanoha-DGz<br />
<br />
----<br />
<br />
=== GROUP: Retrieve Group Data ===<br />
'''Command String:'''<br><br />
by gid<br />
* GROUP gid={int gid}<br />
by name/shortname<br />
* GROUP gname={str group name}<br />
<br />
'''Possible Replies:'''<br />
* 250 GROUP<br />
: {int gid}|{int4 rating}|{int votes}|{int4 acount}|{int fcount}|{str name}|{str short}|{str irc channel}|{str irc server}|{str url}|{str picname}|{int4 foundeddate}|{int4 disbandeddate}|{int2 dateflags}|{int4 lastreleasedate}|{int4 lastactivitydate}|{list grouprelations}<br />
* 350 NO SUCH GROUP<br />
<br />
'''Info:'''<br />
* Requires login<br />
* ''gname'' is an exact match of either a group name or short name<br />
* As either name and short names are unique if there is a result from GROUP request by name that will be the only match<br />
* ''dateflags'' values:<br />
** bit0 set == Foundeddate, Unknown Day<br />
** bit1 set == Foundeddate, Unknown Month, Day<br />
** bit2 set == Disbandeddate, Unknown Day<br />
** bit3 set == Disbandeddate, Unknown Month, Day<br />
** bit5 set == Foundeddate, Unknown Year<br />
** bit6 set == Disbandeddate, Unknown Year<br />
* ''releasedate'' and ''activitydate'' are distinct. ''releasedate'' is the date a file was actually released by the group, where ''activitydate'' is the date of a file being added to AniDB. As such, lastrelease may very well be much older than lastactivity.<br />
* ''groupreleations'' is a list of apostrophe-separated pairs, where each pair consists of {int4 othergroupid},{int2 relationtype}<br />
** relationtype:<br />
*** 1 => "Participant in"<br />
*** 2 => "Parent of"<br />
*** 4 => "Merged from"<br />
*** 5 => "Now known as"<br />
*** 6 => "Other"<br />
<br />
'''Example:'''<br />
> GROUP gid=7091&s=bunny<br />
< 250 GROUP<br />
7091|832|1445|43|566|Frostii|Frostii|#frostii|irc.rizon.net|http://frostii.com|15844.jpg|1228089600|0|1|1301875200|1304222640|7255,1'3097,4'748,4'8106,1'8159,2'8402,1'8696,1'9022,1<br />
<br />
----<br />
<br />
=== GROUPSTATUS: Get Completed Episode ===<br />
Returns a list of group names and ranges of episodes released by the group for a given anime.<br />
<br />
'''Command String:'''<br />
* GROUPSTATUS aid={int animeid}[&state={int completion_state}]<br />
<br />
'''Possible Replies:'''<br />
* 225 GROUPSTATUS<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: ... (repeated)<br />
<br />
* 325 NO SUCH GROUPS FOUND<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* The seven fields will be repeated as necessary, one for each group, separated by a new line character<br />
* Groups will be filtered by the languages selected in the user's profile<br />
* If ''state'' is not supplied, groups with a completion state of <i>'ongoing'</i>, <i>'finished'</i>, or <i>'complete'</i> are returned<br />
* Groups are returned in order of descending episode count<br />
* If there are more groups to return than can be stored in a UDP packet, additional groups will be silently discarded<br />
* ''state'' values: <br />
#ongoing<br />
#stalled<br />
#complete<br />
#dropped<br />
#finished<br />
#specials only<br />
<br />
'''Example:'''<br />
> GROUP GROUPSTATUS aid=8692&s=vLl1N<br />
< 225 GROUPSTATUS<br />
7407|Coalgirls|3|25|839|12|1-25<br />
9863|Hadena Subs|3|25|374|1|1-25<br />
11951|ChaosBlades|3|25|0|0|1-25<br />
[truncated]<br />
<br />
=== UPDATED: Get List of Updated Anime IDs ===<br />
Returns a list of AniDB anime ids of anime that have been updated in in a given time frame, ordered by descending age (oldest to newest change).<br />
<br />
'''Command String:'''<br />
* UPDATED entity=1&[age={int4 id}|time={int4 date}]<br />
<br />
'''Possible Replies:'''<br />
* 243 UPDATED<br />
{int entity}|{int total count}|{int last update date}|{list aid}<br />
<br />
* 343 NO UPDATES<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1<br />
* Either ''age'' OR ''time'' can be specified, but not both<br />
* ''age'' is specified in days.<br />
** eg: age=30 requests a list of aid values of anime that have changed in the past 30 days<br />
* ''time'' is specified in unix time.<br />
** eg: time=1264982400 requests a list of aid values of anime that have changed since 2010-02-01<br />
* A maximum of 200 values will be returned<br />
* ''count'' specifies the total number of items found for the given time period. In short, if this value is great than 200, you have not retrieved all applicable ids.<br />
* ''last update date'' will contain the AniDB update time of the ''last'' aid to appear on the list<br />
* A given list value will appear only once. If there have been multiple changes to an entity, its age will reflect the most recent change.<br />
<br />
'''An anime will be considered updated if:'''<br />
* A change is made to the anime record itself<br />
* An ''main'' or ''official'' anime title is added, edited, or deleted (not ''short'' or ''synonym'')<br />
* An episode for the anime is added, or delete (but NOT edited!)<br />
* An episode title is added, edited, or delete<br />
* An anime relation is added, or deleted<br />
<br />
== MyList Commands ==<br />
=== MYLIST: Retrieve MyList Data ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLIST lid={int4 lid}<br />
by fid:<br />
* MYLIST fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLIST size={int4 size}&ed2k={str ed2khash}<br />
by anime + group + epno<br />
* MYLIST aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 221 MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 312 MULTIPLE MYLIST ENTRIES<br />
: {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}<br />
* 321 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* The state field provides information about the location and sharing state of a file in MyList.<br />
* 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).<br />
* eps is a list of episodes, e.g. "1-12,14-16,T1"<br />
<br />
'''States:'''<br />
0 - unknown - state is unknown or the user doesn't want to provide this information<br />
1 - on hdd - the file is stored on hdd (but is not shared)<br />
2 - on cd - the file is stored on cd<br />
3 - deleted - the file has been deleted or is not available for other reasons (i.e. reencoded)<br />
<br />
'''Filestates:''' (for normal files, i.e. not generic)<br />
0 => normal/original<br />
1 => corrupted version/invalid crc<br />
2 => self edited<br />
10 => self ripped<br />
11 => on dvd<br />
12 => on vhs<br />
13 => on tv<br />
14 => in theaters<br />
15 => streamed<br />
100 => other<br />
<br />
'''Example:'''<br />
> MYLIST aname=gits sac&s=xxxxx<br />
< 322 MULTIPLE FILES FOUND<br />
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<br />
<br />
----<br />
=== MYLISTADD: Add file to MyList ===<br />
The command string for MYLISTADD is made of up two blocks: a 'fileinfo' block, which limits the command to a specific file, or an 'animeinfo'/'groupinfo'/'episodeinfo' block, which can be used to specify a range of files, including generics. Additionally, a number of optional parameters can be included with either set.<br />
<br />
'''Adding a single file to the MyList with the 'fileinfo' block'''<br />
<br />
* MYLISTADD fid={int4 fid}<br />
'''or'''<br />
* MYLISTADD size={int4 size}&ed2k={str ed2khash}<br />
'''or'''<br />
* MYLISTADD lid={int4 lid}&edit=1 (valid for edit only)<br />
<br />
'''Adding one or more files to the MyList with the 'animeinfo'/'groupinfo'/'episodeinfo' block'''<br />
<br />
Here, you have a number of options, depending on what data you have available. In brief, 'animeinfo' represents a choice between anime id and anime name. 'groupinfo' represents a choice between group id, group name, and generic=1. 'episodeinfo' represents a range of one or more episodes.<br />
<br />
* MYLISTADD aid={int4 aid}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&generic=1&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&generic=1&epno={int4 episode number}<br />
<br />
Each command listed can have, in addition, a number of optional components to provide further MyList details. Append these as desired.<br />
<br />
* &state={int2 state}<br />
* &viewed={boolean viewed}<br />
* &viewdate={int4 viewdate}<br />
* &source={str source}<br />
* &storage={str storage}<br />
* &other={str other}<br />
<br />
Finally, edit=1 can be included to edit a MyList entry instead of creating a new one. When editing, optional values that are not supplied retain their original value. That is, they are ''not'' replaced with default or empty values. Only values supplied are updated.<br />
<br />
'''Possible Replies:'''<br />
* 320 NO SUCH FILE<br />
* 330 NO SUCH ANIME<br />
* 350 NO SUCH GROUP<br />
when edit=0 and adding by fid, size/ed2k<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 mylist id of new entry}<br />
when edit=0 and adding by aname, aid<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 number of entries added}<br />
* 310 FILE ALREADY IN MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 1}|{int4 fid 2}|...|{int4 fid n}<br />
when edit=1<br />
* 311 MYLIST ENTRY EDITED<br />
* 311 MYLIST ENTRY EDITED<br />
: {int4 number of entries edited}<br />
* 411 NO SUCH MYLIST ENTRY<br />
<br />
'''Info:'''<br />
* All data except lid/fid/size+hash/generic is optional.<br />
* Viewed should be 0 for unwatched files and 1 for watched files.<br />
* If viewdate is not specified, the current time will be used. The field will be disregarded if viewed=0.<br />
* Other is the only field which may contain newlines, but they have to be stored as &lt;br /&gt;<br />
* For state values refer to: '''MYLIST'''<br />
* If you want to change an existing entry and already know its MyList id (lid) please use the lid-version of this command. It put less load on the server.<br />
* epno=0 means all eps (default), negative numbers means upto. (-12 -> upto 12)<br />
* group is optional only when edit=1, meaning you can't add every file for an anime<br />
* If the file already exists (response code 310), the ''current'' record will be returned, in the same format as the MYLIST response.<br />
----<br />
<br />
=== MYLISTDEL: Remove file from MyList ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLISTDEL lid={int4 lid}<br />
by fid:<br />
* MYLISTDEL fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLISTDEL size={int4 size}&ed2k={str ed2k hash}<br />
by anime + group + epno<br />
* MYLISTDEL aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 211 MYLIST ENTRY DELETED<br />
: {int4 number of entries}<br />
* 411 NO SUCH MYLIST ENTRY<br />
'''Info:'''<br />
* group is optional<br />
* command will delete all enties found<br />
<br />
----<br />
=== MYLISTSTATS : Retrieve MyList stats ===<br />
'''Command String:'''<br />
* MYLISTSTATS<br />
'''Possible Replies:'''<br />
* 222 MYLIST STATS<br />
{animes}|{eps}|{files}|{size of files}|{added animes}|{added eps}|{added files}|{added groups}|{leech %}|{glory %}|{viewed % of db}|{mylist % of db}|{viewed % of mylist}|{number of viewed eps}|{votes}|{reviews}|{viewed length in minutes}<br />
<br />
'''Info:'''<br />
* All fields are int<br />
<br />
----<br />
<br />
=== VOTE: Vote for specified anime/episode/group ===<br />
'''Command String:'''<br><br />
by id<br />
* VOTE type={int2 type}&id={int4 id}[&value={int4 vote value}&epno={int4 episode number}]<br />
by name<br />
* VOTE type={int2 type}&name={string name}[&value={int4 vote value}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 260 VOTED<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 261 VOTE FOUND<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 262 VOTE UPDATED<br />
: {str entity name}|{old vote value}|{vote type}|{entity id}<br />
* 263 VOTE REVOKED<br />
: {str entity name}|{revoked vote value}|{vote type}|{entity id}<br />
* 360 NO SUCH VOTE<br />
: {str entity name}|0|{vote type}|{entity id}<br />
* 361 INVALID VOTE TYPE<br />
* 362 INVALID VOTE VALUE<br />
* 363 PERMVOTE NOT ALLOWED<br />
: {str aname}|{vote value}|{type}|{entity id}<br />
* 364 ALREADY PERMVOTED<br />
: {str entity name}|{existing vote value}|{vote type}|{entity id}<br />
<br />
'''Info:'''<br />
* type: 1=anime, 2=anime tmpvote, 3=group<br />
* entity: anime, episode, or group<br />
* for episode voting add epno on type=1<br />
* value: negative number means revoke, 0 means retrieve (default), 100-1000 are valid vote values, rest is illegal<br />
* votes will be updated automatically (no questions asked)<br />
* tmpvoting when there exist a perm vote is not possible<br />
<br />
----<br />
<br />
=== RANDOM: Get a random anime ===<br />
'''Command String:'''<br />
* RANDOMANIME type={int4 type}<br />
<br />
'''Possible Replies:'''<br />
* 230 ANIME ... (see ANIME)<br />
<br />
'''Info:'''<br />
* type: 0=from db, 1=watched, 2=unwatched, 3=all mylist<br />
<br />
== Misc Commands ==<br />
=== MYLISTEXPORT: Schedule a MyList Export ===<br />
Queues a {{AniDBLink|export|MyList Export}} by the AniDB Servers. As with a manual export request, exports are only done during periods when server load is low. As a result, exports may take up to 24 hours. The client submitting the request will receive an AniDB message when the export is ready to be collected.<br />
<br />
Only one export can be in the queue at a time.<br />
<br />
'''Command String:'''<br />
* MYLISTEXPORT [template={str template_name}|cancel=1]<br />
<br />
'''Possible Replies:'''<br />
* 217 EXPORT QUEUED<br />
* 218 EXPORT CANCELLED<br />
* 317 EXPORT NO SUCH TEMPLATE<br />
* 318 EXPORT ALREADY IN QUEUE<br />
* 319 EXPORT NO EXPORT QUEUED OR IS PROCESSING<br />
<br />
'''Info:'''<br />
* ''template_name'' must match an available export template on the {{AniDBLink|export|MyList Export}} page.<br />
* ''cancel'' will cancel any pending export request, queued either through UDP or the web server.<br />
* Clients can subscribe the message notifications if they wish to be notified when an export is complete.<br />
<br />
----<br />
<br />
=== PING: Ping Command ===<br />
'''Command String:'''<br />
* PING [nat=1]<br />
<br />
'''Possible Replies:'''<br />
* 300 PONG<br />
: {int4 port} ''(when nat=1)''<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* May be used by a frontend to determine if the API is still available.<br />
* May be executed even if not yet logged in.<br />
* The option <tt>nat=1</tt> provides an easy way to determine if the router has changed the outgoing port. ({{t|587}})<br />
<br />
----<br />
<br />
=== VERSION: Retrieve Server Version ===<br />
'''Command String:'''<br />
* VERSION<br />
<br />
'''Possible Replies:'''<br />
* 998 VERSION<br />
: {str server version}<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
<br />
----<br />
=== UPTIME: Retrieve Server Uptime ===<br />
'''Command String:'''<br />
* UPTIME<br />
<br />
'''Possible Replies:'''<br />
* 208 UPTIME<br />
: {int4 udpserver uptime in milliseconds}<br />
<br />
'''Info:'''<br />
* This command is the preferred way to check that the session is OK.<br />
<br />
----<br />
=== ENCODING: Change Encoding for Session ===<br />
Sets preferred [[Wikipedia:Character encoding|encoding]] per session. The preferred way to do this is to use the '''enc''' argument for AUTH. This command is mostly for testing.<br />
<br />
'''Command String:'''<br />
* ENCODING name={str encoding name}<br />
<br />
'''Possible Replies:'''<br />
* 219 ENCODING CHANGED<br />
* 519 ENCODING NOT SUPPORTED<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* Supported encodings: http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html<br />
* Default: ASCII.<br />
* Resets to default on logout.<br />
<br />
----<br />
<br />
=== SENDMSG: Send Message ===<br />
'''Command String:'''<br />
* SENDMSG to={str username}&title={str title}&body={str body}<br />
<br />
'''Possible Replies:'''<br />
* 294 SENDMSG SUCCESSFUL<br />
* 394 NO SUCH USER<br />
* 501 LOGIN FIRST<br />
<br />
'''Note:'''<br />
* This command allows you to send an AniDB message.<br />
{{eyecatch|Important|<br />
title must not be longer than 50 chars.<br><br />
body must not be longer than 900 chars.<br />
}}<br />
<br />
----<br />
=== USER: Retrieve User UID ===<br />
'''Command String:'''<br />
* USER [user={str user name}|uid={int user id}]<br />
<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 295 USER<br />
: {int4 uid}|{str username}<br />
<br />
----<br />
<br />
=== STATS [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* STATS<br />
<br />
'''Possible Replies:'''<br />
* 206 STATS<br />
: {int4 animes)|{int4 eps}|{int4 files}|{int4 groups}|{int4 users}|{int8 total file size in bytes}|{int4 open [[creq|creqs]]}<br />
<br />
----<br />
=== TOP [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* TOP<br />
<br />
'''Possible Replies:'''<br />
* 207 TOP<br />
: {str longest mylist}|{int count}<br />
: {str largest mylist}|{int count}<br />
: {str most lame files}|{int count}<br />
: {str most indep. user}|{int count}<br />
: {str biggest leecher}|{int count}<br />
: {str most anime added}|{int count}<br />
: {str most eps added}|{int count}<br />
: {str most files added}|{int count}<br />
: {str most groups added}|{int count}<br />
: {str most votes}|{int count}<br />
: {str most reviews}|{int count}<br />
<br />
'''Info:'''<br />
* All strings are user names.<br />
* 'Hide myself in IRC stats' applies for this too.<br />
<br />
== Fatal Errors ==<br />
At anypoint int the retrieval process you have to expect the following output:<br />
* 6xx INTERNAL SERVER ERROR<br />
: ERROR: {str errormessage}<br />
OR<br />
*6xx INTERNAL SERVER ERROR - {str errormessage}<br />
<br />
Such errors should be reported back to [[User:Ommina|Ommina]].<br />
(xx is a number between 00 and 99)<br />
<br />
If you supply an unknown or unimplemented command you will get an error:<br />
* 598 UNKNOWN COMMAND<br />
<br />
== Return Codes ==<br />
{{eyecatch|Note|While the names below '''are''' the actual code strings returned by the server, clients are nonetheless encouraged to work with the numeric codes instead. }}<br />
<pre><br />
LOGIN_ACCEPTED = 200<br />
LOGIN_ACCEPTED_NEW_VERSION = 201<br />
LOGGED_OUT = 203<br />
RESOURCE = 205<br />
STATS = 206<br />
TOP = 207<br />
UPTIME = 208<br />
ENCRYPTION_ENABLED = 209<br />
MYLIST_ENTRY_ADDED = 210<br />
MYLIST_ENTRY_DELETED = 211<br />
ADDED_FILE = 214<br />
ADDED_STREAM = 215<br />
EXPORT_QUEUED = 217<br />
EXPORT_CANCELLED = 218<br />
ENCODING_CHANGED = 219<br />
FILE = 220<br />
MYLIST = 221<br />
MYLIST_STATS = 222<br />
WISHLIST = 223<br />
NOTIFICATION = 224<br />
GROUP_STATUS = 225<br />
WISHLIST_ENTRY_ADDED = 226<br />
WISHLIST_ENTRY_DELETED = 227<br />
WISHLIST_ENTRY_UPDATED = 228<br />
MULTIPLE_WISHLIST = 229<br />
ANIME = 230<br />
ANIME_BEST_MATCH = 231<br />
RANDOM_ANIME = 232<br />
ANIME_DESCRIPTION = 233<br />
REVIEW = 234<br />
CHARACTER = 235<br />
SONG = 236<br />
ANIMETAG = 237<br />
CHARACTERTAG = 238<br />
EPISODE = 240<br />
UPDATED = 243<br />
TITLE = 244<br />
CREATOR = 245<br />
NOTIFICATION_ENTRY_ADDED = 246<br />
NOTIFICATION_ENTRY_DELETED = 247<br />
NOTIFICATION_ENTRY_UPDATE = 248<br />
MULTIPLE_NOTIFICATION = 249<br />
GROUP = 250<br />
CATEGORY = 251<br />
BUDDY_LIST = 253<br />
BUDDY_STATE = 254<br />
BUDDY_ADDED = 255<br />
BUDDY_DELETED = 256<br />
BUDDY_ACCEPTED = 257<br />
BUDDY_DENIED = 258<br />
VOTED = 260<br />
VOTE_FOUND = 261<br />
VOTE_UPDATED = 262<br />
VOTE_REVOKED = 263<br />
HOT_ANIME = 265<br />
RANDOM_RECOMMENDATION = 266<br />
RANDOM_SIMILAR = 267<br />
NOTIFICATION_ENABLED = 270<br />
NOTIFYACK_SUCCESSFUL_MESSAGE = 281<br />
NOTIFYACK_SUCCESSFUL_NOTIFIATION = 282<br />
NOTIFICATION_STATE = 290<br />
NOTIFYLIST = 291<br />
NOTIFYGET_MESSAGE = 292<br />
NOTIFYGET_NOTIFY = 293<br />
SENDMESSAGE_SUCCESSFUL = 294<br />
USER_ID = 295<br />
CALENDAR = 297<br />
<br />
PONG = 300<br />
AUTHPONG = 301<br />
NO_SUCH_RESOURCE = 305<br />
API_PASSWORD_NOT_DEFINED = 309<br />
FILE_ALREADY_IN_MYLIST = 310<br />
MYLIST_ENTRY_EDITED = 311<br />
MULTIPLE_MYLIST_ENTRIES = 312<br />
WATCHED = 313<br />
SIZE_HASH_EXISTS = 314<br />
INVALID_DATA = 315<br />
STREAMNOID_USED = 316<br />
EXPORT_NO_SUCH_TEMPLATE = 317<br />
EXPORT_ALREADY_IN_QUEUE = 318<br />
EXPORT_NO_EXPORT_QUEUED_OR_IS_PROCESSING = 319<br />
NO_SUCH_FILE = 320<br />
NO_SUCH_ENTRY = 321<br />
MULTIPLE_FILES_FOUND = 322<br />
NO_SUCH_WISHLIST = 323<br />
NO_SUCH_NOTIFICATION = 324<br />
NO_GROUPS_FOUND = 325<br />
NO_SUCH_ANIME = 330<br />
NO_SUCH_DESCRIPTION = 333<br />
NO_SUCH_REVIEW = 334<br />
NO_SUCH_CHARACTER = 335<br />
NO_SUCH_SONG = 336<br />
NO_SUCH_ANIMETAG = 337<br />
NO_SUCH_CHARACTERTAG = 338<br />
NO_SUCH_EPISODE = 340<br />
NO_SUCH_UPDATES = 343<br />
NO_SUCH_TITLES = 344<br />
NO_SUCH_CREATOR = 345<br />
NO_SUCH_GROUP = 350<br />
NO_SUCH_CATEGORY = 351<br />
BUDDY_ALREADY_ADDED = 355<br />
NO_SUCH_BUDDY = 356<br />
BUDDY_ALREADY_ACCEPTED = 357<br />
BUDDY_ALREADY_DENIED = 358<br />
NO_SUCH_VOTE = 360<br />
INVALID_VOTE_TYPE = 361<br />
INVALID_VOTE_VALUE = 362<br />
PERMVOTE_NOT_ALLOWED = 363<br />
ALREADY_PERMVOTED = 364<br />
HOT_ANIME_EMPTY = 365<br />
RANDOM_RECOMMENDATION_EMPTY = 366<br />
RANDOM_SIMILAR_EMPTY = 367<br />
NOTIFICATION_DISABLED = 370<br />
NO_SUCH_ENTRY_MESSAGE = 381<br />
NO_SUCH_ENTRY_NOTIFICATION = 382<br />
NO_SUCH_MESSAGE = 392<br />
NO_SUCH_NOTIFY = 393<br />
NO_SUCH_USER = 394<br />
CALENDAR_EMPTY = 397<br />
NO_CHANGES = 399<br />
<br />
NOT_LOGGED_IN = 403<br />
NO_SUCH_MYLIST_FILE = 410<br />
NO_SUCH_MYLIST_ENTRY = 411<br />
MYLIST_UNAVAILABLE = 412<br />
<br />
LOGIN_FAILED = 500<br />
LOGIN_FIRST = 501<br />
ACCESS_DENIED = 502<br />
CLIENT_VERSION_OUTDATED = 503<br />
CLIENT_BANNED = 504<br />
ILLEGAL_INPUT_OR_ACCESS_DENIED = 505<br />
INVALID_SESSION = 506<br />
NO_SUCH_ENCRYPTION_TYPE = 509<br />
ENCODING_NOT_SUPPORTED = 519<br />
BANNED = 555<br />
UNKNOWN_COMMAND = 598<br />
<br />
INTERNAL_SERVER_ERROR = 600<br />
ANIDB_OUT_OF_SERVICE = 601<br />
SERVER_BUSY = 602<br />
NO_DATA = 603<br />
TIMEOUT - DELAY AND RESUBMIT = 604<br />
API_VIOLATION = 666<br />
<br />
PUSHACK_CONFIRMED = 701<br />
NO_SUCH_PACKET_PENDING = 702<br />
<br />
VERSION = 998</pre><br />
<br />
[[Category:Development]]<br />
[[Category:UDP]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=UDP_API_Definition&diff=22433UDP API Definition2016-01-10T22:51:22Z<p>Ommina: /* UPDATED: Get List of Updated Anime IDs */</p>
<hr />
<div>{{TOCright}}<br />
<br />
== General Information ==<br />
'''Author:''' [[User:Exp|Exp]] & [[User:Epoximator|Epoximator]] & [[User:Ommina|Ommina]]<br><br />
'''Version:''' 0.03.730 (2015-03-25)<br><br />
'''Version number used for protover parameter:''' "3"<br />
<br />
'''IMPORTANT INFORMATION FOR ALL INTERESTED:'''<br />
* If you are mainly interested in notifications and private messaging, check out our [[Jabber]] and [[RSSRDF]] support first.<br />
* The UDP API is not an appropriate choice if you desire to download a local copy of the AniDB database.<br />
* If you want to create a client you have to register it {{AniDBLink|client|here}} and [[UDP Clients|here]].<br />
** Check out the clients that are being developed. There exists usable code in many different languages already.<br />
* If you have suggestions for improvements or new features use the [[UDP API DEV|development]] page.<br />
* Please also take a look at the [[API]] page.<br />
<br />
== Formats used in this Spec ==<br />
* {vartype varname} - Specifies what shall be inserted at this point and its type.<br />
* [...] - Everything between [ and ] is optional.<br />
<br />
=== Used types ===<br />
* ''int2'' - 2 byte Integer (in string representation)<br />
* ''int4'' - 4 byte Integer (in string representation)<br />
* ''boolean'' - true or false - use '1' for ''true'', '0' for ''false''<br />
* ''str'' - String (UDP packet length restricts string size to 1400 bytes)<br />
* ''hexstr'' -- a hex representation of a decimal value, two characters per byte. If multiple bytes are represented, byte one is the first two characters of the string, byte two the next two, and so on.<br />
<br />
=== Content Encoding ===<br />
* Default character encoding: ''ASCII''<br />
* Escape scheme for option values (to server): ''html form encoding'' + ''newline''<br />
** This means you have to encode at least <tt>&</tt> in your option values in html form encoding style (<tt>&amp;amp;</tt>) before sending them to the api server. All other html form encodings are optional.<br />
** All newlines should be replaced by &lt;br /&gt;<br />
* Escape scheme for returned data fields (from server): ', | and newline<br />
** Content newlines are encoded as &lt;br /&gt;, ' is encoded as ` and | is encoded as /.<br />
** Dates are returned in unix time (number of seconds elapsed since January 1, 1970 00:00:00 UTC)<br />
<br />
== Basics ==<br />
=== General ===<br />
The network communication is ''packet'' and ''line'' based. Each AniDB API command is exactly one UDP packet containing one line. Results are sent as one packet but may consist out of multiple lines. A return value always starts with a 3 byte result code followed by a human readable version of the result code. Be aware that important data fields may be returned directly after the return code (see: 200,201,209,271,272,504).<br />
The meaning for all result codes can be found in this document. If there is more than one entry returned, it's one entry per line. Lines are terminated by a <tt>\n</tt> (no dos linefeed <tt>\r</tt>). The elements of a format string are separated by a "|" character.<br />
<br />
<tt>{three digit return code} {str return string}\n</tt><br><br />
<tt>{data field 0}|{data field 1}|...|{data field n}</tt><br />
<br />
'''IMPORTANT:'''<br />
* All commands except PING, ENCRYPT, ENCODING, AUTH and VERSION '''requires''' login, meaning that the ''session tag'' must be set (<tt>s=xxxxx</tt>).<br />
* A client should ignore any additional trailing data fields it doesn't expect. Additional fields are going to be added to the output of some commands from time to time. Those additional fields will simply be appended to the end of the existing output. A client should be written in a way so that it is not affected by such new fields.<br />
* Due to the length constraints of an UDP package (over PPPoE) the replies from the server will never exceed 1400 bytes. String fields will be truncated if necessary to ensure this. No warnings are given when this happens.<br />
* A client should handle all possible return codes for each command.<br />
** Possible return codes for '''all commands''':<br />
*** 505 ILLEGAL INPUT OR ACCESS DENIED<br />
*** 555 BANNED<br />
***: {str reason}<br />
*** 598 UNKNOWN COMMAND<br />
*** 600 INTERNAL SERVER ERROR<br />
*** 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
*** 602 SERVER BUSY - TRY AGAIN LATER<br />
*** 604 TIMEOUT - DELAY AND RESUBMIT<br />
** Additional return codes for all commands that '''require login''':<br />
*** 501 LOGIN FIRST<br />
*** 502 ACCESS DENIED<br />
*** 506 INVALID SESSION<br />
<br />
{{eyecatch|Note|The '555 BANNED' message should not be expected by the client. This message is only enabled temporary to help developers understand what they are doing wrong.}}<br><br />
<br />
{{eyecatch|Note|<br />
While in daily maintenance the AniDB API will reply with<br />
<br />
601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
<br />
to all commands. If a client receives such a return value it should wait at least 30 minutes before trying again.}}<br />
<br />
=== Server / UDP Connection ===<br />
The Client has to send data packets to:<br />
* '''Server:''' api.anidb.net<br />
* '''Port:''' 9000/UDP<br />
The servername and port should not be hardcoded into a frontend but should be read from a configuration file.<br />
<br />
=== Server Errors ===<br />
* At any time the API might return a fatal error of the form:<br />
: <tt>6xx ERROR DESCRIPTION</tt><br />
* Possible codes are 600-699.<br />
* Occurrences of these errors (except 601 and 602) should be reported to [[User:Ommina|Ommina]].<br />
{{eyecatch|Note|6XX messages do not always return the tags given with the command which caused the error!}}<br />
<br />
=== Connection Problems ===<br />
There are many ways for a client to end up banned or the API might currently be handling too many concurrent connections.<br />
If a client does not get any reply to an AUTH command it should start to increase the retry delay exponentially with every failed login attempt. (i.e. try again after 30 seconds if the first login attempt failed, if the second fails too retry after 2 minutes, then 5 minutes, then 10 minutes, then 30 minutes, ... until you reach a retry delay of ~2-4h.)<br />
<br />
=== Local Port ===<br />
A client should select a fixed local port >1024 at install time and reuse it for local UDP Sockets. If the API sees too many different UDP Ports from one IP within ~1 hour it will ban the IP. (So make sure you're reusing your UDP ports also for testing/debugging!)<br />
<br />
The local port may be hardcoded, however, an option to manually specify another port should be offered.<br />
<br />
'''Note when behind a [[Wikipedia:Network address translation|NAT]]/masquerading router:'''<br><br />
A session between the server and a client is identified by the ''IP and port'' used by the client. So when the port (or IP) changes within a session the client has to authenticate again. If a client is behind a NAT router it can’t actually control the local port used for the connection. The router will normally ''translate'' the port to support several computers on a LAN to share the Internet connection. The public port (as determined by the router and seen by the server) which has been assigned to the connection will only be reserved for as long as it is in use. This means that the router will usually ''deallocate the port after a fixed timeout period'' (eg. five, ten or 15 minutes). Once that happens the client will no longer be able to receive UDP messages from the server (the messages will be discarded as undeliverable by the router) and a new port will be selected once the client tries to send a message to the server (which will result in a new connection session - '''Note:''' This could get you banned!, see above). So in order to keep a session over a NAT router alive, the client has to ping the server within the router's deallocation period to prevent a timeout.<br />
<br />
The client can decide whether it is behind a NAT router or not by adding <tt>nat=1</tt> to the AUTH command. This will cause the response to include the IP and port as seen by the server. If the port differs from the port reported by the local socket, the connection subject to NAT and the client should issue PING commands in regular intervals. Please do not send pings more often than is necessary to keep NAT connections alive.<br />
<br />
=== Flood Protection ===<br />
To prevent high server load the UDP API server enforces a strict flood protection policy.<br />
* Short Term:<br />
** A Client MUST NOT send more than 0.5 packets per second (that's one packet every two seconds, not two packets a second!)<br />
** The server will start to enforce the limit after the first 5 packets have been received.<br />
* Long Term:<br />
** A Client MUST NOT send more than one packet every four seconds over an extended amount of time.<br />
** ''An extended amount of time'' is not defined. Use common sense.<br />
<br />
Once a client exceeds a rate limit all further UDP packets from that client will be dropped without feedback until the client's packet rate is back down to acceptable levels.<br />
<br />
{{eyecatch|Note|Dropped packets are still taken into account for the packet rate. Meaning if you continuously send packets your client will be banned forever.}}<br />
<br />
Generally clients should be written in a way to minimize server and network load. You should always keep that in mind.<br />
<br />
Abusive clients may be banned completely.<br />
<br />
{{eyecatch|Note|<br />
If you suddenly stop getting replies from the AniDB API or you normally don't have a notable packetloss and from one point on you suddenly note a high packetloss percentage you have most likely entered a critical flood ratio.<br />
If the AniDB API isn't answering at all it might either be down or you have been banned, this is normally caused by violating the API specs (i.e. too many connections using different ports from one IP, too many auth failures, ...) (usually lasts 30 minutes).<br />
If you're experiencing packet loss you have probably reached the rate limit and the API starts to randomly drop incoming packets from your IP. (can be solved by enforcing a delay between multiple commands when you're sending a batch)}}<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Caching ===<br />
To minimize server and network load a client should use local caching in order to prevent repeated API requests for the same data.<br />
<br />
A client should locally cache FILE/EP/ANIME/GROUP/... info wherever possible for extended amounts of time.<br />
(I.e. if a client is used to scan a local folder with anime files and add them via API to a users MyList then it shall only ask for all files in the first run and cache the info for all files known to AniDB. If run again over the same folder it shall only check those files which were unknown to AniDB at the time of the last check.)<br />
<br />
Later versions of the API might enforce this by banning clients which ask for the same information more than once every week/month.<br />
<br />
=== Tag option ===<br />
The API will add a user defined string at the beginning of each reply line separated with a space, if desired.<br />
* To enable add the <tt>tag={str usertag}</tt> option to a command.<br />
* A tag is only valid for the command it was send with, meaning it is not persistent. If you want to have tags in front of all reply lines you will have to append the tag option to each command you send to the server.<br />
* Tags are meant to enable a client to handle more than one request/reply at a time.<br />
<br />
Usage example:<br />
AUTH user=baka&pass=baka&protover=25&client=someclient&clientver=1&tag=abc123<br />
abc123 200 Jxqxb LOGIN ACCEPTED<br />
or<br />
LOGOUT s=Jxqxb&tag=byebye<br />
byebye 203 LOGGED OUT<br />
<br />
{{eyecatch|Note|The tag option is valid for all api commands and is thus not explicitly listed in the description of each command.}}<br />
<br />
=== Data Indexes (fid,aid,eid,gid,lid) ===<br />
* All indexes start at 1 (not 0).<br />
* It is possible for table entries to have id fields with a value of 0 (i.e. gid). Those are to be interpreted as "NONE" or "NULL".<br />
* An ID is '''never''' reused. That means after an entry is deleted no new entry will ever have that ID again.<br />
* Mylist IDs (lid) are globally unique, not per-user unique.<br />
<br />
== Authing Commands ==<br />
{{eyecatch|Note|'''ANY''' command which requires parameters may return: 505 ILLEGAL INPUT OR ACCESS DENIED}}<br />
<br />
----<br />
=== AUTH: Authing to the AnimeDB ===<br />
'''Command String:'''<br />
* AUTH user={str username}&pass={str password}&protover={int4 apiversion}&client={str clientname}&clientver={int4 clientversion}[&nat=1&comp=1&enc={str encoding}&mtu{int4 mtu value}&imgserver=1]<br />
<br />
'''Possible Replies:'''<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
* 500 LOGIN FAILED<br />
* 503 CLIENT VERSION OUTDATED<br />
* 504 CLIENT BANNED - {str reason}<br />
* 505 ILLEGAL INPUT OR ACCESS DENIED<br />
* 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
when nat=1<br />
* 200 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED<br />
* 201 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
when imgserver=1<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
{str image server name}<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
{str image server name}<br />
<br />
'''Info:'''<br />
{{eyecatch|Note|The password is the normal AniDB website password! The password listed in the profile as API Password in only used for the optional encryption feature.}}<br />
* The ''session_key'' is a String containing only ''a-z,A-Z,0-9'' chars of a length of ''4-8'' characters.<br />
: It has to be stored by the client and needs to be sent as parameter with every command which requires the user to logged in.<br />
* The ''session_key'' String is appended as parameter "s", i.e. "PUSH notify=1&msg=1&s={str session_key}".<br />
* On a '''500 LOGIN FAILED''' message the client should request the user to enter username and password again.<br />
* In case of a '''501 LOGIN FIRST''' message the client should silently resend an auth command and send the failed command again.<br />
* A '''502 ACCESS DENIED''' message should abort the current action on the client side and display a message to the user.<br />
* A '''503 CLIENT VERSION OUTDATED''' message states that the udp server has been updated and does not support your client any longer. (protover is too low). A 201 message refers to a new version of the client software.<br />
* A '''506 INVALID SESSION''' means that either the session key parameter "s" was not provided with a command that requires it or the session key is no longer valid. The client should reissue an AUTH command.<br />
{{eyecatch|Note|A frontend shall expect 501 and 502 messages to be returned on ANY command.}}<br><br />
{{eyecatch|Note|AniDB usernames may only contain characters (a-z,A-Z), numbers (0-9), underscores (_) and hyphens (-).}}<br />
* The client should send the apiversion of the AnimeDB API version it supports as value of the protover parameter.<br />
* The client MAY NOT send anything but the version of the API Specs the author used to write the client! (as it is stated at the top of this file @ "Version number used for protover parameter")<br />
: The API will compare that value to it's own version of the API and if the version of the client is older the API will decide whether the changes were significant enough to deny the old client access to the DB.<br />
* The clientname shall be a lower-case string containing only the chars ''a-z'' of ''4-16 chars'' length which identifies the client. (i.e. mykickassclient)<br />
* The clientversion shall be a number starting with 1, increased on every change in the client.<br />
: clientname and clientversion might be used by the API to distinguish between different clients and client versions if that should ever become necessary.<br />
{{eyecatch|Important|<br />
* DO NOT use the clientname of an existing client. If you modify an existing client's code to meet your own needs, create a new client name for yourself.<br />
* ALWAYS increase the clientversion number if you release a new client version.}}<br />
* A Login and its assigned ''session_key'' is valid until the virtual UDP connection times out or until a LOGOUT command is issued.<br />
* The virtual UDP connection times out if no data was received from the client for '''35 minutes'''.<br />
* A client should issue a UPTIME command once every 30 minutes to keep the connection alive should that be required.<br />
* If the client does not use any of the notification/push features of the API it should NOT keep the connection alive, furthermore it should explicitly terminate the connection by issuing a LOGOUT command once it finished it's work.<br />
* If it is very likely that another command will be issued shortly (within the next 20 minutes) a client SHOULD keep the current connection open, by not sending a LOGOUT command.<br />
{{eyecatch|Important|<br />
* A client should NOT perform a full AUTH / command / LOGOUT cycle for each command it wants to send. Again, if another command is likely within 20 minutes, remain logged in.}}<br />
* The client shall notify the user if it received a 201 message at login.<br />
: This means a new version of the client is available, however the old version is still supported otherwise a client banned message would have been returned.<br />
* The user should get a pop-up message on 503 and 504 messages telling him to update his client software.<br />
: ('''Note:''' 504 means that this version of the client is banned, not the user!)<br />
* The 'nat' option makes the client able to detect whether it is behind a nat router or not. When the client is behind a nat router it should keep the "connection" alive with the PING command.<br />
{{eyecatch|Important|Make sure your client handles ALL possible AUTH return codes before giving out any versions!}}<br />
* When ''enc=x'' is defined the server will change the encoding used to x.<br />
**If the encoding is supported it will change right away (including the response) and be reset on logout/timeout.<br />
**If not supported then the argument will be silently ignored. Use ENCODING to test what works.<br />
**Supported encodings are [http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html these].<br />
* ''comp=1'' means that the client supports compression ([http://java.sun.com/j2se/1.5.0/docs/api/java/util/zip/Deflater.html DEFLATE]).<br />
**The server will compress (instead of truncating) the datagrams when needed if this option is enabled.<br />
**The first two bytes of compressed datagrams will always be set to zero. (So tags should never start with that.)<br />
* Default [[Wikipedia:MTU (networking)|''MTU'']] is 1400. Minimum allowed is 400, maximum 1400, due [[Wikipedia:Point-to-Point Protocol over Ethernet|PPPoE]].<br />
<br />
----<br />
<br />
=== LOGOUT: Logout ===<br />
'''Command String:'''<br />
* LOGOUT<br />
<br />
'''Possible Replies:'''<br />
* 203 LOGGED OUT<br />
* 403 NOT LOGGED IN<br />
<br />
'''Info:'''<br />
* This command only works if you are already logged in.<br />
* A logout should ALWAYS be issued if the client is currently logged in and is either exiting or not expecting to send/receive any AniDB API packets for the next >= 30 minutes.<br />
<br />
----<br />
=== ENCRYPT: Start Encrypted Session ===<br />
Will cause all future messages from the server, except the first (the reply to the ENCRYPT command itself), to be encrypted (128 bit [[Wikipedia:Advanced Encryption Standard|AES]]). The client will also have to encrypt all future requests sent to the server. All non-encrypted messages will be discarded by the server. The encryption key is the [[Wikipedia:MD5|MD5]] hash of a special ''UDP API Key'' (defined in the users profile) concatenated with the salt string as given in the reply to the ENCRYPT message. A normal AUTH message is still necessary to authenticate and should follow the ENCRYPT command once the API has acknowledged the encryption.<br />
<br />
'''Command String:'''<br />
* ENCRYPT user={str name}&type={int2 type}<br />
<br />
'''Possible Replies:'''<br />
* 209 {str salt} ENCRYPTION ENABLED<br />
* 309 API PASSWORD NOT DEFINED<br />
* 509 NO SUCH ENCRYPTION TYPE<br />
* 394 NO SUCH USER<br />
<br />
'''Info:'''<br />
* ''user'' is the user name.<br />
* ''type'' is the type of encryption; 1 => 128 bit AES (only one defined).<br />
* ''API Key'' is the one defined in the {{AniDBLink|profile|profile settings page}}.<br />
* It is not possible to disable the encryption once enabled while staying logged in.<br />
** A logout (the logout message needs to be correctly encrypted) or timeout will disable the encryption.<br />
* In order to minimize server load, encryption should be disabled by default and should have to be enabled manually by the user in the configuration options.<br />
* The encryption key is md5(api_key_of_user+''salt'').<br />
* Padding of the message needs to be done according to the PKCS5Padding scheme.<br />
<br />
== Notify Commands ==<br />
=== Introduction ===<br />
Broadly speaking, notifications provide an indication to the client that some event has occurred within the AniDB database.<br />
<br />
There are three types:<br />
* New file [[Notifications|notification]]. (Only anime type supported.)<br />
* New private message notification.<br />
* New buddy event notification.<br />
<br />
Note that, while a user can subscribe to multiple 'new file' events (see [[Notifications|notifications]]), at present, the UDP API only supports notifications of new files by anime. New files by group, or new files by producer, are NOT presently supported. Just the same, keeping in mind that the API is designed to potentially support such notifications in the future will help in understanding why some of the commands are structured the way they are.<br />
<br />
The word "notification" is also used a bit inconsistently in this document. An AniDB notification is originally a "new file [[Notifications|notification]]". It might be more correct to use the term "event" for the original "happening" and then "notification" as the means to notify the user (client). New-file, new-message, buddy-* and going-down are all events that results in notifications. Only the first two type of events are persistent, though, meaning they exist and remain in the same state until some user action affects them.<br />
<br />
=== Getting Notifications ===<br />
Clients that wish to receive notifications have two routes available to them. They are by no means mutually exclusive and selecting one does not imply a client is unable to use commands from another.<br />
<br />
'''Method One: Polling'''<br />
<br />
With this method, the client contacts the server at some interval (no more than once every 20 minutes) to see if there are new file notifications waiting. If there are, the client can the get further details of the files in question. This is analogous to checking an email server every half hour to see if new email has arrived.<br />
<br />
Its principal advantage is that it is easy to design and code. Blocking sockets are sufficient as the client can expect the reply received to correspond with the command sent.<br />
<br />
The disadvantage of this approach is that it introduces a delay and some uncertainty in receiving notifications. If, for example, the user clears the notification on the website before the client collects it, the client will not learn of the new file. Similarly, if the user does not dismiss notifications via the site, the client will have an increasing amount of stale data to work though. Finally, notifications cleared by the client also clears them from the website, so users will need to be made aware of what is going on.<br />
<br />
A polling HOWTO:<br />
<br />
* Use NOTIFY (no more than once every 20 minutes) to get the number of pending notifications<br />
* IF there are new notifications pending, use NOTIFYLIST to get a list of notification types and associated IDs.<br />
* Use NOTIFYGET to receive a notification, supplying the ID provided by NOTIFYLIST<br />
* Use NOTIFYACK to acknowledge a notification, supplying the ID provided by NOTIFYLIST (if desired)<br />
<br />
{{eyecatch|Note|The ID supplied by NOTIFYLIST will be the ID of the affected notification type. Since, at present, only the anime type is supported, this value is always an aid. In the future, it may represent a group or producer ID. In these cases, the str '''type''' value will indicate what entity the ID represents.}}<br />
<br />
'''Method Two: Server PUSH'''<br />
<br />
With this method, the server takes the active role in advising the client that a new file has arrived. The client must register with the server to receive further advice information, and will be responsible for keeping the login session from timing out, and any NAT router ports open. The UDP packet is sent to the ip and port from which the AUTH command was received.<br />
<br />
This method compensates for the disadvantages of the polling method, but is more difficult to code. Blocking sockets are no longer an option, nor can a client make any assumptions that an incoming packet will necessarily be a reply to the last command sent. The tag option may be helpful here.<br />
<br />
A PUSH HOWTO:<br />
<br />
* PUSH to register your client session.<br />
* Listen for 720-799 NOTIFICATIONs ('''not 290''').<br />
* Use PUSHACK to to acknowledge the notification using the nid supplied with NOTIFICATION<br />
* Use NOTIFYGET to receive a notification, suppling the relid provided by NOTIFICATION (NOT the packet ID)<br />
* Use NOTIFYACK to acknowledge a notification, suppling the relid provided by NOTIFICATION (if desired)<br />
* Use UPTIME (with an interval between 30 and 35 minutes) to keep login session valid<br />
<br />
It is probably a good idea to use tags to separate NOTIFICATIONs from the other communication. NOTIFICATIONs will '''never''' have tags.<br />
<br />
=== PUSH: UDP Notification Registration ===<br />
Register your client as an observer for AniDB notification events for the current user. If you are registered for one or more event types the AniDB server will send an UDP packet (format see below) on each change which affects the current user.<br />
<br />
'''Command String:'''<br />
* PUSH notify={boolean on_new_file}&msg={boolean on_new_private_message}[&buddy={boolean on_buddy_event}]<br />
<br />
'''Possible Replies:'''<br />
* 270 NOTIFICATION ENABLED<br />
OR (if both values are 0)<br />
* 370 NOTIFICATION DISABLED<br />
<br />
'''Info:'''<br />
* A client which has registered to receive UDP notification packets must:<br />
** Issue a PUSHACK command for each notification received with ''notify_packet_id'' provided in the notification packet.<br />
** Use PING to keep the connection alive (< 30 min).<br />
** Use UPTIME to ensure that the session is OK (>= 30 min).<br />
* Every notification generated is resent 3 times unless acknowledged. After that the client is logged out.<br />
<br />
=== NOTIFY: Notifications ===<br />
Get number of pending notifications (and number of online buddies).<br />
<br />
'''Command String:'''<br />
* NOTIFY [buddy=1]<br />
<br />
'''Possible Replies:'''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}<br />
when ''buddy=1''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}|{int4 number_of_online_buddies}<br />
<br />
'''Info:'''<br />
* If the client did send a NOTIFY within the last 35 minutes and it was confirmed by AniDB then receiving a 501 LOGIN FIRST message for the next NOTIFY command shows that AniDB logged the client out because it did not respond to a PUSH Notification packet.<br />
* There is no command to retrieve missed PUSH Notifications.<br />
{{eyecatch|Note|This command MUST NOT be issued more than once every 20 minutes.}}<br />
<br />
----<br />
=== NOTIFYLIST: List Notification/Message IDs ===<br />
List id of all pending (not acknowledged) ''new private message'' and ''new file'' notifications. Buddy events cannot be acknowledged.<br />
<br />
'''Command String:'''<br />
* NOTIFYLIST<br />
<br />
'''Possible Replies:'''<br />
*291 NOTIFYLIST<br />
: {str type}|{int4 id}<br />
: {str type}|{int4 id}<br />
: ...<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as required by NOTIFYGET. For messages it is the actual message id, for notifications it is the id of the related type; anime, group or producer. Since only file notifications related to anime is implemented atm, it is the anime id (aid).<br />
* NOTIFYLIST returns one line per entry, if no entries are available only the first line of the reply is returned.<br />
{{eyecatch|Note|This command MUST NOT be issued regularly but should only be triggered by either a push message received by the client or a reply to a NOTIFY command which tells you that there are messages/notifications waiting.}}<br />
<br />
----<br />
=== NOTIFYGET: Get Notification/Message ===<br />
Receive private message or file notification.<br />
<br />
'''Command String:'''<br />
* NOTIFYGET type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 292 NOTIFYGET<br />
: {int4 id}|{int4 from_user_id}|{str from_user_name}|{int4 date}|{int4 type}|{str title}|{str body}<br />
* 392 NO SUCH ENTRY<br />
when type = N<br />
* 293 NOTIFYGET<br />
: {int4 relid}|{int4 type}|{int2 count}|{int4 date}|{str relidname}|{str fids}<br />
* 393 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as given by NOTIFYLIST (or ''relid'' from 271 NOTIFICATION and mid from 272 NOTIFICATION)<br />
* for message entries (M):<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: type is the type of the message (0=normal msg, 1=annonymous, 2=system msg, 3=mod msg)<br />
* for notification entries (N):<br />
: relid is the id of the related type (anime)<br />
: relname is the name of the related type (anime)<br />
: type is the notification type (0=all, 1=new, 2=group, 3=complete)<br />
: count is the number of events pending for this subscription<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: fids is a comma separated list with the affected file ids<br />
<br />
----<br />
=== NOTIFYACK: Acknowledge Notification/Message ===<br />
This command will mark a message read or clear a ''new file'' notification. Buddy events are not acknowledgeable.<br />
<br />
'''Command String:'''<br />
* NOTIFYACK type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 281 NOTIFYACK SUCCESSFUL<br />
* 381 NO SUCH ENTRY<br />
when type = N<br />
* 282 NOTIFYACK SUCCESSFUL<br />
* 382 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
<br />
====Notification Packet Format====<br />
'''New File Notify:'''<br />
<br />
720 {int4 notify_packet_id} NOTIFICATION - NEW FILE<br />
{int4 fidlist}|{int2 reltype}|{int2 priority}<br />
<br />
* fidlist is a comma separated list of file ids<br />
* reltype is: 1 = anime, 2 = group, 3 = producer<br />
* priority is: 0 = low, 1 = medium, 2 = high<br />
* new file notifications are created as a batch, so it is not unusual to get several new files for a particular anime at once. It is in this case that a comma separated list of fids will be returned<br />
<br />
{{eyecatch|Note|Group (and producer) related file notifications are not implemented yet.}}<br />
<br />
<br />
'''New Private Message Notify:'''<br />
<br />
794 {int4 notify_packet_id} NOTIFICATION - NEW MESSAGE<br />
{int2 type}|{int4 date}|{int4 sent_by_uid}|{str sent_by_name}|{str subject}|{str body}|{int mid}<br />
<br />
* type is the type of the message (0=normal msg, 1=anonymous, 2=system msg, 3=mod msg)<br />
* date is the time the message was sent (in seconds since 1.1.1970)<br />
* sender uid/sender name are the user id and user name of the sender<br />
* subject is the message subject<br />
* body is message body (can be truncated)<br />
* mid is message id and can be used with NOTIFYACK<br />
<br />
'''Buddy Event Notify:'''<br />
753 {int4 notify_packet_id} NOTIFICATION - BUDDY<br />
{int4 buddy uid}|{int2 event type}<br />
* Possible event types:<br />
** 0 => LOGIN<br />
** 1 => LOGOUT<br />
** 2 => ACCEPTED<br />
** 3 => ADDED<br />
<br />
<br />
'''Going Down Event Notify:'''<br />
799 {int4 notify_packet_id} NOTIFICATION - SHUTTING DOWN<br />
{int4 time offline}|{int4 comment}<br />
<br />
* Clients with any notification on will receive the SHUTTING DOWN message before the API goes offline.<br />
* Time offline is the time in minutes the API will be down, 0 if indefinite (client can direct user to the AniDB site for status updates).<br />
* The comment is a short explanation for the downtime.<br />
* Only one datagram will be sent, and the server will not listen for replies.<br />
<br />
<br />
=== PUSHACK: UDP Notification Acknowledge ===<br />
Used to acknowledge notification packets (720-799). A client must be prepared to issue this command before using '''PUSH'''.<br />
<br />
'''Command String:'''<br />
* PUSHACK nid={int4 notify_packet_id}<br />
<br />
'''Possible Replies:'''<br />
* 701 PUSHACK CONFIRMED<br />
* 702 NO SUCH PACKET PENDING<br />
<br />
'''Info:'''<br />
* See: '''PUSH'''<br />
<br />
== Buddy Commands ==<br />
Group of commands used to administrate your buddylist.<br />
<br />
=== BUDDYADD: Add a user to Buddy List ===<br />
'''Command String:'''<br />
* BUDDYADD uid={int4 buddy uid}<br />
* BUDDYADD uname={int4 buddy name}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 255 BUDDY ADDED<br />
* 355 BUDDY ALREADY ADDED<br />
<br />
----<br />
=== BUDDYDEL: Remove a user from Buddy List ===<br />
'''Command String:'''<br />
* BUDDYDEL uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 256 BUDDY DELETED<br />
<br />
----<br />
=== BUDDYACCEPT: Accept user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYACCEPT uid={int4 user uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 257 BUDDY ACCEPTED<br />
* 357 BUDDY ALREADY ACCEPTED<br />
<br />
----<br />
=== BUDDYDENY: Deny user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYDENY uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 258 BUDDY DENIED<br />
* 358 BUDDY ALREADY DENIED<br />
<br />
----<br />
=== BUDDYLIST: Retrieve Buddy List ===<br />
'''Command String:'''<br />
* BUDDYLIST startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 253 {int2 start} {int2 end} {int2 total} BUDDY LIST<br />
: {int4 uid}|{str username}|{int2 state}<br />
: ...<br />
'''Info:'''<br />
* state is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = this user is in your buddylist<br />
* bit 2 = this user has accepted you<br />
* bit 3 = this user is waiting for your approval<br />
<br />
----<br />
=== BUDDYSTATE: Retrieve Buddy States===<br />
'''Command String:'''<br />
* BUDDYSTATE startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 254 {int2 start} {int2 end} {int2 total} BUDDY STATE<br />
: {int4 uid}|{int2 onlinestate}<br />
: ...<br />
<br />
'''Info:'''<br />
* onlinestate is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = http online (user has issued a HTTP request within the last 10 minutes)<br />
* bit 2 = udp api online (user is currently connected to the udp api server)<br />
* example: 0=offline, 1=http online, 2=udp api online, 3=http&udp api online<br />
<br />
== Data Commands ==<br />
=== ANIME: Retrieve Anime Data ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIME aid={int4 id}[&amask={hexstr}]<br />
by name<br />
* ANIME aname={str anime name}[&amask={hexstr}]<br />
<br />
'''Possible Replies:'''<br />
<br />
If no ''amask'' is provided:<br />
* 230 ANIME<br />
: {int4 aid}|{int4 eps}|{int4 ep count}|{int4 special cnt}|{int4 rating}|{int4 votes}|{int4 tmprating}|{int4 tmpvotes}|{int4 review rating average}|{int4 reviews}|{str year}|{str type}|{str romaji}|{str kanji}|{str english}|{str other}|{str short names}|{str synonyms}|{str category list}<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* Fields are returned in the same order they appear in the ''amask'' field list: byte 1, bit 7 first<br />
* Synonyms and short names are separated with '<br />
* Category fields are separated with ',' and ordered by weight (desc).<br />
* By name: must be perfect match of romaji/kanji/english/other/synonym/short name.<br />
* 'Producer id list' and 'producer name list' match the data returned by the former producer bits (but using the revised creator ids)<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
* '''Note:''' The character id list is the first data to be truncated if needed. And then: tag list, synonym list, short name list. This applies to the FILE command too.<br />
* Selecting an 'unused' or 'reserved' bit will return an "illegal input" (505) response.<br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="5" align="center"><b>amask</b></td></tr><br />
<tr><br />
<td align="center"><b>Byte 1</b></td><br />
<td align="center"><b>Byte 2</b></td><br />
<td align="center"><b>Byte 3</b></td><br />
<td align="center"><b>Byte 4</b></td><br />
<td align="center"><b>Byte 5</b></td><br />
<td align="center"><b>Byte 6</b></td><br />
<td align="center"><b>Byte 7</b></td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int aid</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int dateflags</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 special ep count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int air date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int end date</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str url</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str picname</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int vote count</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 temp rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int temp vote count</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 average review rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int review count</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str award list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>bool is 18+ restricted</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int ANN id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int allcinema id</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str AnimeNfo id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td><i>reserved</i></td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td><i>reserved</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>reserved</i></td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int date record updated</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int character id list</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int creator id list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int main creator id list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str main creator name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 specials count</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 credits count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 other count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 trailer count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 parody count</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<br />
'''Related aid type (Byte 1, Bit 2):'''<br />
<pre><br />
value meaning<br />
<br />
1 sequel<br />
2 prequel<br />
11 same setting<br />
12 alternative setting<br />
32 alternative version<br />
41 music video<br />
42 character<br />
51 side story<br />
52 parent story<br />
61 summary<br />
62 full story<br />
100 other<br />
</pre><br />
<br />
'''Examples:''' (note that the given amask gives the same result as the default request)<br />
> ANIME aid=1&amask=b2f0e0fc000000&s=xxxxx<br />
< 230 ANIME<br />
1|1999-1999|TV Series|Space,Future,Plot Continuity,SciFi,Space Travel,Shipboard,Other Planet,Novel,Genetic Modification,Action,Romance,Military,Large Breasts,Gunfights,Adventure,Human Enhancement,Nudity|Seikai no Monshou|星界の紋章|Crest of the Stars||13|13|3|853|3225|756|110|875|11<br />
<br />
<br />
----<br />
<br />
=== ANIMEDESC: Retrieve Anime Description ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIMEDESC aid={int4 id}&part={int4 partno}<br />
<br />
'''Possible Replies:'''<br />
* 233 ANIMEDESC<br />
: {int4 current part}|{int4 max parts}|{str description}<br />
* 330 NO SUCH ANIME<br />
* 333 NO SUCH DESCRIPTION<br />
<br />
'''Info:'''<br />
* The maximum length of the anime description is roughly 5000 characters, but the maximum length of a UDP packet is 1400 bytes<br />
* Multiple calls to ANIMEDESC may be necessary to retrieve the complete text, retrieving separate 1400 byte parts with each call<br />
* ''part'' is zero-based<br />
* '''Note:''' No support, at present, for retrieving descriptions by title. ''aid'' only<br />
<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> ANIMEDESC aid=3169&part=0&s=xxxxx<br />
< 233 ANIMEDESC<br />
0|1|As summer break arrives for the students, Jun Sakurada is busily studying on his own in the library, making up for time lost <cut><br />
<br />
----<br />
=== CALENDAR: Get Upcoming Titles ===<br />
Returns the anime ids of the 25 most recently aired / released anime, directly followed by the next 25 anime due to be aired / released, ordered by start date.<br />
<br />
'''Command String:'''<br />
* CALENDAR<br />
<br />
'''Possible Replies:'''<br />
* 297 CALENDAR<br />
{int aid}|{int startdate}|{int dateflags}/n<br />
<br />
..repeated n times<br />
<br />
* 397 CALENDAR EMPTY<br />
<br />
'''Info:'''<br />
* Takes no parameters (other than the session string)<br />
* Titles returned are filtered by the 'show adult' preference of the logged in user. That is, users who have elected to hide adult content will have it hidden here as well.<br />
* Do not depend on the command always returning exactly 50 titles; there may not always be 25 future titles pending, depending on the user's 'adult' preferences, and the date in relation to the relation to the current anime season.<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
<br />
----<br />
=== CHARACTER: Get Character Information ===<br />
Returns character details associated with a given character ID, including associated anime ids, episode ids, and seiyuu.<br />
<br />
'''Command String:'''<br />
* CHARACTER charid={int characterid}<br />
<br />
'''Possible Replies:'''<br />
* 235 CHARACTER<br />
: {int charid}|{str character name kanji}|{str character name transcription}|{str pic}|{anime blocks}|{int episode list}|{int last update date}|{int2 type}|{str gender}<br />
<br />
: An 'anime block' is {int anime id},{int appearance},{int creatorid},{boolean is_main_seiyuu} repeated as many times as necessary, separated by a single quote ( ' ). <br />
<br />
* 335 NO SUCH CHARACTER<br />
<br />
'''Info:'''<br />
* If no seiyuu is associated with the character for a given aid, the 'creatorid' and 'is_main_seiyuu' fields will be empty, but the commas will remain.<br />
* An empty episode list is "undefined": no episode values have been added.<br />
* ''appearance'' values: 0='appears in', 1='cameo appearance in', 2='main character in', 3='secondary cast in'<br />
* ''type'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** 1 => 'Character'<br />
** 2 => 'Mecha'<br />
** 3 => 'Organisation'<br />
** 4 => 'Vessel' <br />
* ''gender'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** "M" => 'Male'<br />
** "F" => 'Female'<br />
** "I" => 'Intersexual'<br />
** "D" => 'Dimorphic'<br />
** "-" => 'none/does not apply'<br />
** "?" => 'unknown'<br />
<br />
'''Example:'''<br />
<br />
CHARACTER charid=488&s=DChan<br />
235 CHARACTER<br />
488|ニコ・ロビン|Nico Robin|14789.jpg|4097,2,1900,1'69,2,1901,0'6199,0,1900,1'5691,0,1900,1'2644,0,,'4851,0,1900,1||1236938094<br />
<br />
=== CREATOR: Get Creator Information ===<br />
<br />
'''Command String:'''<br />
* CREATOR creatorid={int creatorid}<br />
<br />
'''Possible Replies:'''<br />
* 245 CREATOR<br />
: {int creatorid}|{str creator name kanji}|{str creator name transcription}|{int type}|{str pic_name}|{str url_english}|{str url_japanese}|{str wiki_url_english}|{str wiki_url_japanese}|{int last update date}<br />
<br />
* 345 NO SUCH CREATOR<br />
<br />
'''Info:'''<br />
* ANIME AMASK byte6, bit5<br />
* ''type'' values: 1='person', 2='company', 3='collaboration'<br />
<br />
Example:<br />
<br />
245 CREATOR<br />
718|GAINAX|Gainax|2|10092.png||http://www.gainax.co.jp/|Gainax|Gainax|1237048093<br />
<br />
=== EPISODE: Retrieve Episode Data ===<br />
'''Command String:'''<br><br />
by eid<br />
* EPISODE eid={int eid}<br />
by anime and episode number<br />
* EPISODE aname={str anime name}&epno={int4 episode number}<br />
* EPISODE aid={int anime id}&epno={int4 episode number}<br />
<br />
'''Possible Replies:'''<br />
* 240 EPISODE<br />
: {int eid}|{int aid}|{int4 length}|{int4 rating}|{int votes}|{str epno}|{str eng}|{str romaji}|{str kanji}|{int aired}|{int type}<br />
* 340 NO SUCH EPISODE<br />
<br />
'''Info:'''<br />
* length is in minutes<br />
* Returned 'epno' includes special character (only if special) and padding (only if normal).<br />
** Special characters are S(special), C(credits), T(trailer), P(parody), O(other).<br />
* The ''type'' is the raw episode type, used to indicate numerically what the special character will be<br />
** 1: regular episode (no prefix), 2: special ("S"), 3: credit ("C"), 4: trailer ("T"), 5: parody ("P"), 6: other ("O")<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> EPISODE eid=1&s=xxxxx<br />
< 240 EPISODE<br />
1|1|24|400|4|01|Invasion|shinryaku|??<br />
<br />
> EPISODE aname=Seikai no Monshou&epno=2&s=xxxxx<br />
< 240 EPISODE<br />
2|1|24|750|2|02|Kin of the Stars|Hoshi-tachi no Kenzoku|??????|1295059229|1<br />
<br />
----<br />
<br />
=== FILE: Retrieve File Data ===<br />
'''Command String:'''<br><br />
by fid:<br />
* FILE fid={int4 id}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by size+ed2k hash:<br />
* FILE size={int8 size}&ed2k={str ed2khash}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by anime, group and epno<br />
* FILE aname={str anime name}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aname={str anime name}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
<br />
'''Possible Replies:'''<br />
* 220 FILE<br />
: {int4 fid}|{int4 aid}|{int4 eid}|{int4 gid}|{int4 state}|{int8 size}|{str ed2k}|{str anidbfilename}<br />
* 220 FILE<br />
: {int4 fid}|...(data list)<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 0}|{int4 fid 1}|...|{int4 fid n}<br />
* 320 NO SUCH FILE<br />
<br />
'''Info:'''<br />
* fid, aid, eid, gid are the unique ids for the file, anime, ep, group entries at AniDB.<br />
: You can use those to create links to the corresponding pages at AniDB.<br />
* anidbfilename is the AniDB filename for the file.<br />
: However this name does not contain all the extra information of the filenames on AniDB and might be composed slightly different.<br />
* fmask and amask are hexidecimal strings where each bit corresponds to a data field related to the specified file (see below). The data list received is sorted and returned in the same order as the tables: top to bottom, left to right, with fmask preceding amask. There is '''no''' provision to retrieve all fields. Further, requesting a 'unusued' or 'reserved' bit will return an "illegal input" error.<br />
* fid is always returned as the first value, regardless of what masks are provided.<br />
* Only the first matching file is returned when aname, gname and epno is used.<br />
* "audio codec" and "audio bitrate" will return multiple values if there are multiple audio streams present in the file. Values will be separated by a single quote. <br />
* For byte 1, bit 2 (other episodes): episode IDs will be followed by an integer '''percentage''' that indicate the percentage of the related episode this file covers. Typically 100%, there are cases where it will be 50, 30, or other values. This value provides no indication where, within an episode, the file represents. That is, 50% could mean the file covers the first half of the episode, the second half, or some 50% range in between.<br />
'''State:'''<br />
<pre><br />
bit / int value meaning<br />
1 / 1 FILE_CRCOK: file matched official CRC (displayed with green background in AniDB)<br />
2 / 2 FILE_CRCERR: file DID NOT match official CRC (displayed with red background in AniDB)<br />
3 / 4 FILE_ISV2: file is version 2<br />
4 / 8 FILE_ISV3: file is version 3<br />
5 / 16 FILE_ISV4: file is version 4<br />
6 / 32 FILE_ISV5: file is version 5<br />
7 / 64 FILE_UNC: file is uncensored<br />
8 / 128 FILE_CEN: file is censored<br />
<br />
examples:<br />
state ==== 9 ==> FILE_CRCOK+FILE_ISV3 ==> file matched official CRC and is version 3<br />
state ==== 0 ==> - ==> file was not crc checked and is version 1<br />
state ==== 34 ==> FILE_CRCERR+FILE_ISV5 ==> file DID NOT match official CRC and is version 5<br />
state ==== 1 ==> FILE_CRCOK ==> file matched official CRC and is version 1<br />
state ==== 8 ==> FILE_ISV3 ==> file was not CRC checked and is version 3<br />
</pre><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''fmask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
<td align="center">'''Byte 5'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 aid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 eid</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 gid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 mylist id</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>list other episodes</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>int2 IsDeprecated</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int2 state</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int8 size</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ed2k</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str md5</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str sha1</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str crc32</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>video colour depth</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str quality</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str audio codec list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 audio bitrate list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str video codec</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 video bitrate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str video resolution</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str file type (extension)</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str dub language</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str sub language</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 length in seconds</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str description</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 aired date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str anidb file name</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 mylist state</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 mylist filestate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 mylist viewed</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 mylist viewdate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str mylist storage</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str mylist source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str mylist other</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''amask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 anime total episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str category list</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str epno</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ep name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str ep romaji name</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str ep kanji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 episode rating</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 episode vote count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str group name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str group short name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int4 date aid record updated</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
'''Examples:''' (html escaped code intended)<br />
> FILE size=177747474&ed2k=70cd93fd3981cc80a8ea6a646ff805c9&fmask=7FF8FEF8&amask=C000F0C0&s=xxxxx<br />
< 220 FILE<br />
312498|4688|69260|4243|0||0|1|177747474|70cd93fd3981cc80a8ea6a646ff805c9|b2a7c7d591333e20495de3571b235c28|7af9b962c17ff729baeee67533e5219526cd5095|a200fe73|high|DTV|Vorbis (Ogg Vorbis)|104|H264/AVC|800|704x400|japanese|english'english'english|1560||1175472000|26|26|01|The Wings to the Sky|Sora he no Tsubasa|????|#nanoha-DamagedGoodz|Nanoha-DGz<br />
<br />
----<br />
<br />
=== GROUP: Retrieve Group Data ===<br />
'''Command String:'''<br><br />
by gid<br />
* GROUP gid={int gid}<br />
by name/shortname<br />
* GROUP gname={str group name}<br />
<br />
'''Possible Replies:'''<br />
* 250 GROUP<br />
: {int gid}|{int4 rating}|{int votes}|{int4 acount}|{int fcount}|{str name}|{str short}|{str irc channel}|{str irc server}|{str url}|{str picname}|{int4 foundeddate}|{int4 disbandeddate}|{int2 dateflags}|{int4 lastreleasedate}|{int4 lastactivitydate}|{list grouprelations}<br />
* 350 NO SUCH GROUP<br />
<br />
'''Info:'''<br />
* Requires login<br />
* ''gname'' is an exact match of either a group name or short name<br />
* As either name and short names are unique if there is a result from GROUP request by name that will be the only match<br />
* ''dateflags'' values:<br />
** bit0 set == Foundeddate, Unknown Day<br />
** bit1 set == Foundeddate, Unknown Month, Day<br />
** bit2 set == Disbandeddate, Unknown Day<br />
** bit3 set == Disbandeddate, Unknown Month, Day<br />
** bit5 set == Foundeddate, Unknown Year<br />
** bit6 set == Disbandeddate, Unknown Year<br />
* ''releasedate'' and ''activitydate'' are distinct. ''releasedate'' is the date a file was actually released by the group, where ''activitydate'' is the date of a file being added to AniDB. As such, lastrelease may very well be much older than lastactivity.<br />
* ''groupreleations'' is a list of apostrophe-separated pairs, where each pair consists of {int4 othergroupid},{int2 relationtype}<br />
** relationtype:<br />
*** 1 => "Participant in"<br />
*** 2 => "Parent of"<br />
*** 4 => "Merged from"<br />
*** 5 => "Now known as"<br />
*** 6 => "Other"<br />
<br />
'''Example:'''<br />
> GROUP gid=7091&s=bunny<br />
< 250 GROUP<br />
7091|832|1445|43|566|Frostii|Frostii|#frostii|irc.rizon.net|http://frostii.com|15844.jpg|1228089600|0|1|1301875200|1304222640|7255,1'3097,4'748,4'8106,1'8159,2'8402,1'8696,1'9022,1<br />
<br />
----<br />
<br />
=== GROUPSTATUS: Get Completed Episode ===<br />
Returns a list of group names and ranges of episodes released by the group for a given anime.<br />
<br />
'''Command String:'''<br />
* GROUPSTATUS aid={int animeid}[&state={int completion_state}]<br />
<br />
'''Possible Replies:'''<br />
* 225 GROUPSTATUS<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: ... (repeated)<br />
<br />
* 325 NO SUCH GROUPS FOUND<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* The seven fields will be repeated as necessary, one for each group, separated by a new line character<br />
* Groups will be filtered by the languages selected in the user's profile<br />
* If ''state'' is not supplied, groups with a completion state of <i>'ongoing'</i>, <i>'finished'</i>, or <i>'complete'</i> are returned<br />
* Groups are returned in order of descending episode count<br />
* If there are more groups to return than can be stored in a UDP packet, additional groups will be silently discarded<br />
* ''state'' values: <br />
#ongoing<br />
#stalled<br />
#complete<br />
#dropped<br />
#finished<br />
#specials only<br />
<br />
'''Example:'''<br />
> GROUP GROUPSTATUS aid=8692&s=vLl1N<br />
< 225 GROUPSTATUS<br />
7407|Coalgirls|3|25|839|12|1-25<br />
9863|Hadena Subs|3|25|374|1|1-25<br />
11951|ChaosBlades|3|25|0|0|1-25<br />
[truncated]<br />
<br />
=== UPDATED: Get List of Updated Anime IDs ===<br />
Returns a list of AniDB anime ids of anime that have been updated in in a given time frame, ordered by descending age (oldest to newest change).<br />
<br />
'''Command String:'''<br />
* UPDATED entity=1&[age={int4 id}|time={int4 date}]<br />
<br />
'''Possible Replies:'''<br />
* 243 UPDATED<br />
{int entity}|{int total count}|{int last update date}|{list aid}<br />
<br />
* 343 NO UPDATES<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1<br />
* Either ''age'' OR ''time'' can be specified, but not both<br />
* ''age'' is specified in days.<br />
** eg: age=30 requests a list of aid values of anime that have changed in the past 30 days<br />
* ''time'' is specified in unix time.<br />
** eg: time=1264982400 requests a list of aid values of anime that have changed since 2010-02-01<br />
* A maximum of 200 values will be returned<br />
* ''count'' specifies the total number of items found for the given time period. In short, if this value is great than 200, you have not retrieved all applicable ids.<br />
* ''last update date'' will contain the AniDB update time of the ''last'' aid to appear on the list<br />
* A given list value will appear only once. If there have been multiple changes to an entity, its age will reflect the most recent change.<br />
<br />
'''An anime will be considered updated if:'''<br />
* A change is made to the anime record itself<br />
* An ''main'' or ''official'' anime title is added, edited, or deleted (not ''short'' or ''synonym'')<br />
* An episode for the anime is added, or delete (but NOT edited!)<br />
* An episode title is added, edited, or delete<br />
* An anime relation is added, or deleted<br />
<br />
== MyList Commands ==<br />
=== MYLIST: Retrieve MyList Data ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLIST lid={int4 lid}<br />
by fid:<br />
* MYLIST fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLIST size={int4 size}&ed2k={str ed2khash}<br />
by anime + group + epno<br />
* MYLIST aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 221 MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 312 MULTIPLE MYLIST ENTRIES<br />
: {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}<br />
* 321 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* The state field provides information about the location and sharing state of a file in MyList.<br />
* 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).<br />
* eps is a list of episodes, e.g. "1-12,14-16,T1"<br />
<br />
'''States:'''<br />
0 - unknown - state is unknown or the user doesn't want to provide this information<br />
1 - on hdd - the file is stored on hdd (but is not shared)<br />
2 - on cd - the file is stored on cd<br />
3 - deleted - the file has been deleted or is not available for other reasons (i.e. reencoded)<br />
<br />
'''Filestates:''' (for normal files, i.e. not generic)<br />
0 => normal/original<br />
1 => corrupted version/invalid crc<br />
2 => self edited<br />
10 => self ripped<br />
11 => on dvd<br />
12 => on vhs<br />
13 => on tv<br />
14 => in theaters<br />
15 => streamed<br />
100 => other<br />
<br />
'''Example:'''<br />
> MYLIST aname=gits sac&s=xxxxx<br />
< 322 MULTIPLE FILES FOUND<br />
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<br />
<br />
----<br />
=== MYLISTADD: Add file to MyList ===<br />
The command string for MYLISTADD is made of up two blocks: a 'fileinfo' block, which limits the command to a specific file, or an 'animeinfo'/'groupinfo'/'episodeinfo' block, which can be used to specify a range of files, including generics. Additionally, a number of optional parameters can be included with either set.<br />
<br />
'''Adding a single file to the MyList with the 'fileinfo' block'''<br />
<br />
* MYLISTADD fid={int4 fid}<br />
'''or'''<br />
* MYLISTADD size={int4 size}&ed2k={str ed2khash}<br />
'''or'''<br />
* MYLISTADD lid={int4 lid}&edit=1 (valid for edit only)<br />
<br />
'''Adding one or more files to the MyList with the 'animeinfo'/'groupinfo'/'episodeinfo' block'''<br />
<br />
Here, you have a number of options, depending on what data you have available. In brief, 'animeinfo' represents a choice between anime id and anime name. 'groupinfo' represents a choice between group id, group name, and generic=1. 'episodeinfo' represents a range of one or more episodes.<br />
<br />
* MYLISTADD aid={int4 aid}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&generic=1&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&generic=1&epno={int4 episode number}<br />
<br />
Each command listed can have, in addition, a number of optional components to provide further MyList details. Append these as desired.<br />
<br />
* &state={int2 state}<br />
* &viewed={boolean viewed}<br />
* &viewdate={int4 viewdate}<br />
* &source={str source}<br />
* &storage={str storage}<br />
* &other={str other}<br />
<br />
Finally, edit=1 can be included to edit a MyList entry instead of creating a new one. When editing, optional values that are not supplied retain their original value. That is, they are ''not'' replaced with default or empty values. Only values supplied are updated.<br />
<br />
'''Possible Replies:'''<br />
* 320 NO SUCH FILE<br />
* 330 NO SUCH ANIME<br />
* 350 NO SUCH GROUP<br />
when edit=0 and adding by fid, size/ed2k<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 mylist id of new entry}<br />
when edit=0 and adding by aname, aid<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 number of entries added}<br />
* 310 FILE ALREADY IN MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 1}|{int4 fid 2}|...|{int4 fid n}<br />
when edit=1<br />
* 311 MYLIST ENTRY EDITED<br />
* 311 MYLIST ENTRY EDITED<br />
: {int4 number of entries edited}<br />
* 411 NO SUCH MYLIST ENTRY<br />
<br />
'''Info:'''<br />
* All data except lid/fid/size+hash/generic is optional.<br />
* Viewed should be 0 for unwatched files and 1 for watched files.<br />
* If viewdate is not specified, the current time will be used. The field will be disregarded if viewed=0.<br />
* Other is the only field which may contain newlines, but they have to be stored as &lt;br /&gt;<br />
* For state values refer to: '''MYLIST'''<br />
* If you want to change an existing entry and already know its MyList id (lid) please use the lid-version of this command. It put less load on the server.<br />
* epno=0 means all eps (default), negative numbers means upto. (-12 -> upto 12)<br />
* group is optional only when edit=1, meaning you can't add every file for an anime<br />
* If the file already exists (response code 310), the ''current'' record will be returned, in the same format as the MYLIST response.<br />
----<br />
<br />
=== MYLISTDEL: Remove file from MyList ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLISTDEL lid={int4 lid}<br />
by fid:<br />
* MYLISTDEL fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLISTDEL size={int4 size}&ed2k={str ed2k hash}<br />
by anime + group + epno<br />
* MYLISTDEL aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 211 MYLIST ENTRY DELETED<br />
: {int4 number of entries}<br />
* 411 NO SUCH MYLIST ENTRY<br />
'''Info:'''<br />
* group is optional<br />
* command will delete all enties found<br />
<br />
----<br />
=== MYLISTSTATS : Retrieve MyList stats ===<br />
'''Command String:'''<br />
* MYLISTSTATS<br />
'''Possible Replies:'''<br />
* 222 MYLIST STATS<br />
{animes}|{eps}|{files}|{size of files}|{added animes}|{added eps}|{added files}|{added groups}|{leech %}|{glory %}|{viewed % of db}|{mylist % of db}|{viewed % of mylist}|{number of viewed eps}|{votes}|{reviews}|{viewed length in minutes}<br />
<br />
'''Info:'''<br />
* All fields are int<br />
<br />
----<br />
<br />
=== VOTE: Vote for specified anime/episode/group ===<br />
'''Command String:'''<br><br />
by id<br />
* VOTE type={int2 type}&id={int4 id}[&value={int4 vote value}&epno={int4 episode number}]<br />
by name<br />
* VOTE type={int2 type}&name={string name}[&value={int4 vote value}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 260 VOTED<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 261 VOTE FOUND<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 262 VOTE UPDATED<br />
: {str entity name}|{old vote value}|{vote type}|{entity id}<br />
* 263 VOTE REVOKED<br />
: {str entity name}|{revoked vote value}|{vote type}|{entity id}<br />
* 360 NO SUCH VOTE<br />
: {str entity name}|0|{vote type}|{entity id}<br />
* 361 INVALID VOTE TYPE<br />
* 362 INVALID VOTE VALUE<br />
* 363 PERMVOTE NOT ALLOWED<br />
: {str aname}|{vote value}|{type}|{entity id}<br />
* 364 ALREADY PERMVOTED<br />
: {str entity name}|{existing vote value}|{vote type}|{entity id}<br />
<br />
'''Info:'''<br />
* type: 1=anime, 2=anime tmpvote, 3=group<br />
* entity: anime, episode, or group<br />
* for episode voting add epno on type=1<br />
* value: negative number means revoke, 0 means retrieve (default), 100-1000 are valid vote values, rest is illegal<br />
* votes will be updated automatically (no questions asked)<br />
* tmpvoting when there exist a perm vote is not possible<br />
<br />
----<br />
<br />
=== RANDOM: Get a random anime ===<br />
'''Command String:'''<br />
* RANDOMANIME type={int4 type}<br />
<br />
'''Possible Replies:'''<br />
* 230 ANIME ... (see ANIME)<br />
<br />
'''Info:'''<br />
* type: 0=from db, 1=watched, 2=unwatched, 3=all mylist<br />
<br />
== Misc Commands ==<br />
=== MYLISTEXPORT: Schedule a MyList Export ===<br />
Queues a {{AniDBLink|export|MyList Export}} by the AniDB Servers. As with a manual export request, exports are only done during periods when server load is low. As a result, exports may take up to 24 hours. The client submitting the request will receive an AniDB message when the export is ready to be collected.<br />
<br />
Only one export can be in the queue at a time.<br />
<br />
'''Command String:'''<br />
* MYLISTEXPORT [template={str template_name}|cancel=1]<br />
<br />
'''Possible Replies:'''<br />
* 217 EXPORT QUEUED<br />
* 218 EXPORT CANCELLED<br />
* 317 EXPORT NO SUCH TEMPLATE<br />
* 318 EXPORT ALREADY IN QUEUE<br />
* 319 EXPORT NO EXPORT QUEUED OR IS PROCESSING<br />
<br />
'''Info:'''<br />
* ''template_name'' must match an available export template on the {{AniDBLink|export|MyList Export}} page.<br />
* ''cancel'' will cancel any pending export request, queued either through UDP or the web server.<br />
* Clients can subscribe the message notifications if they wish to be notified when an export is complete.<br />
<br />
----<br />
<br />
=== PING: Ping Command ===<br />
'''Command String:'''<br />
* PING [nat=1]<br />
<br />
'''Possible Replies:'''<br />
* 300 PONG<br />
: {int4 port} ''(when nat=1)''<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* May be used by a frontend to determine if the API is still available.<br />
* May be executed even if not yet logged in.<br />
* The option <tt>nat=1</tt> provides an easy way to determine if the router has changed the outgoing port. ({{t|587}})<br />
<br />
----<br />
<br />
=== VERSION: Retrieve Server Version ===<br />
'''Command String:'''<br />
* VERSION<br />
<br />
'''Possible Replies:'''<br />
* 998 VERSION<br />
: {str server version}<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
<br />
----<br />
=== UPTIME: Retrieve Server Uptime ===<br />
'''Command String:'''<br />
* UPTIME<br />
<br />
'''Possible Replies:'''<br />
* 208 UPTIME<br />
: {int4 udpserver uptime in milliseconds}<br />
<br />
'''Info:'''<br />
* This command is the preferred way to check that the session is OK.<br />
<br />
----<br />
=== ENCODING: Change Encoding for Session ===<br />
Sets preferred [[Wikipedia:Character encoding|encoding]] per session. The preferred way to do this is to use the '''enc''' argument for AUTH. This command is mostly for testing.<br />
<br />
'''Command String:'''<br />
* ENCODING name={str encoding name}<br />
<br />
'''Possible Replies:'''<br />
* 219 ENCODING CHANGED<br />
* 519 ENCODING NOT SUPPORTED<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* Supported encodings: http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html<br />
* Default: ASCII.<br />
* Resets to default on logout.<br />
<br />
----<br />
<br />
=== SENDMSG: Send Message ===<br />
'''Command String:'''<br />
* SENDMSG to={str username}&title={str title}&body={str body}<br />
<br />
'''Possible Replies:'''<br />
* 294 SENDMSG SUCCESSFUL<br />
* 394 NO SUCH USER<br />
* 501 LOGIN FIRST<br />
<br />
'''Note:'''<br />
* This command allows you to send an AniDB message.<br />
{{eyecatch|Important|<br />
title must not be longer than 50 chars.<br><br />
body must not be longer than 900 chars.<br />
}}<br />
<br />
----<br />
=== USER: Retrieve User UID ===<br />
'''Command String:'''<br />
* USER [user={str user name}|uid={int user id}]<br />
<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 295 USER<br />
: {int4 uid}|{str username}<br />
<br />
----<br />
<br />
=== STATS [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* STATS<br />
<br />
'''Possible Replies:'''<br />
* 206 STATS<br />
: {int4 animes)|{int4 eps}|{int4 files}|{int4 groups}|{int4 users}|{int8 total file size in bytes}|{int4 open [[creq|creqs]]}<br />
<br />
----<br />
=== TOP [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* TOP<br />
<br />
'''Possible Replies:'''<br />
* 207 TOP<br />
: {str longest mylist}|{int count}<br />
: {str largest mylist}|{int count}<br />
: {str most lame files}|{int count}<br />
: {str most indep. user}|{int count}<br />
: {str biggest leecher}|{int count}<br />
: {str most anime added}|{int count}<br />
: {str most eps added}|{int count}<br />
: {str most files added}|{int count}<br />
: {str most groups added}|{int count}<br />
: {str most votes}|{int count}<br />
: {str most reviews}|{int count}<br />
<br />
'''Info:'''<br />
* All strings are user names.<br />
* 'Hide myself in IRC stats' applies for this too.<br />
<br />
== Fatal Errors ==<br />
At anypoint int the retrieval process you have to expect the following output:<br />
* 6xx INTERNAL SERVER ERROR<br />
: ERROR: {str errormessage}<br />
OR<br />
*6xx INTERNAL SERVER ERROR - {str errormessage}<br />
<br />
Such errors should be reported back to [[User:Ommina|Ommina]].<br />
(xx is a number between 00 and 99)<br />
<br />
If you supply an unknown or unimplemented command you will get an error:<br />
* 598 UNKNOWN COMMAND<br />
<br />
== Return Codes ==<br />
{{eyecatch|Note|While the names below '''are''' the actual code strings returned by the server, clients are nonetheless encouraged to work with the numeric codes instead. }}<br />
<pre><br />
LOGIN_ACCEPTED = 200<br />
LOGIN_ACCEPTED_NEW_VERSION = 201<br />
LOGGED_OUT = 203<br />
RESOURCE = 205<br />
STATS = 206<br />
TOP = 207<br />
UPTIME = 208<br />
ENCRYPTION_ENABLED = 209<br />
MYLIST_ENTRY_ADDED = 210<br />
MYLIST_ENTRY_DELETED = 211<br />
ADDED_FILE = 214<br />
ADDED_STREAM = 215<br />
EXPORT_QUEUED = 217<br />
EXPORT_CANCELLED = 218<br />
ENCODING_CHANGED = 219<br />
FILE = 220<br />
MYLIST = 221<br />
MYLIST_STATS = 222<br />
WISHLIST = 223<br />
NOTIFICATION = 224<br />
GROUP_STATUS = 225<br />
WISHLIST_ENTRY_ADDED = 226<br />
WISHLIST_ENTRY_DELETED = 227<br />
WISHLIST_ENTRY_UPDATED = 228<br />
MULTIPLE_WISHLIST = 229<br />
ANIME = 230<br />
ANIME_BEST_MATCH = 231<br />
RANDOM_ANIME = 232<br />
ANIME_DESCRIPTION = 233<br />
REVIEW = 234<br />
CHARACTER = 235<br />
SONG = 236<br />
ANIMETAG = 237<br />
CHARACTERTAG = 238<br />
EPISODE = 240<br />
UPDATED = 243<br />
TITLE = 244<br />
CREATOR = 245<br />
NOTIFICATION_ENTRY_ADDED = 246<br />
NOTIFICATION_ENTRY_DELETED = 247<br />
NOTIFICATION_ENTRY_UPDATE = 248<br />
MULTIPLE_NOTIFICATION = 249<br />
GROUP = 250<br />
CATEGORY = 251<br />
BUDDY_LIST = 253<br />
BUDDY_STATE = 254<br />
BUDDY_ADDED = 255<br />
BUDDY_DELETED = 256<br />
BUDDY_ACCEPTED = 257<br />
BUDDY_DENIED = 258<br />
VOTED = 260<br />
VOTE_FOUND = 261<br />
VOTE_UPDATED = 262<br />
VOTE_REVOKED = 263<br />
HOT_ANIME = 265<br />
RANDOM_RECOMMENDATION = 266<br />
RANDOM_SIMILAR = 267<br />
NOTIFICATION_ENABLED = 270<br />
NOTIFYACK_SUCCESSFUL_MESSAGE = 281<br />
NOTIFYACK_SUCCESSFUL_NOTIFIATION = 282<br />
NOTIFICATION_STATE = 290<br />
NOTIFYLIST = 291<br />
NOTIFYGET_MESSAGE = 292<br />
NOTIFYGET_NOTIFY = 293<br />
SENDMESSAGE_SUCCESSFUL = 294<br />
USER_ID = 295<br />
CALENDAR = 297<br />
<br />
PONG = 300<br />
AUTHPONG = 301<br />
NO_SUCH_RESOURCE = 305<br />
API_PASSWORD_NOT_DEFINED = 309<br />
FILE_ALREADY_IN_MYLIST = 310<br />
MYLIST_ENTRY_EDITED = 311<br />
MULTIPLE_MYLIST_ENTRIES = 312<br />
WATCHED = 313<br />
SIZE_HASH_EXISTS = 314<br />
INVALID_DATA = 315<br />
STREAMNOID_USED = 316<br />
EXPORT_NO_SUCH_TEMPLATE = 317<br />
EXPORT_ALREADY_IN_QUEUE = 318<br />
EXPORT_NO_EXPORT_QUEUED_OR_IS_PROCESSING = 319<br />
NO_SUCH_FILE = 320<br />
NO_SUCH_ENTRY = 321<br />
MULTIPLE_FILES_FOUND = 322<br />
NO_SUCH_WISHLIST = 323<br />
NO_SUCH_NOTIFICATION = 324<br />
NO_GROUPS_FOUND = 325<br />
NO_SUCH_ANIME = 330<br />
NO_SUCH_DESCRIPTION = 333<br />
NO_SUCH_REVIEW = 334<br />
NO_SUCH_CHARACTER = 335<br />
NO_SUCH_SONG = 336<br />
NO_SUCH_ANIMETAG = 337<br />
NO_SUCH_CHARACTERTAG = 338<br />
NO_SUCH_EPISODE = 340<br />
NO_SUCH_UPDATES = 343<br />
NO_SUCH_TITLES = 344<br />
NO_SUCH_CREATOR = 345<br />
NO_SUCH_GROUP = 350<br />
NO_SUCH_CATEGORY = 351<br />
BUDDY_ALREADY_ADDED = 355<br />
NO_SUCH_BUDDY = 356<br />
BUDDY_ALREADY_ACCEPTED = 357<br />
BUDDY_ALREADY_DENIED = 358<br />
NO_SUCH_VOTE = 360<br />
INVALID_VOTE_TYPE = 361<br />
INVALID_VOTE_VALUE = 362<br />
PERMVOTE_NOT_ALLOWED = 363<br />
ALREADY_PERMVOTED = 364<br />
HOT_ANIME_EMPTY = 365<br />
RANDOM_RECOMMENDATION_EMPTY = 366<br />
RANDOM_SIMILAR_EMPTY = 367<br />
NOTIFICATION_DISABLED = 370<br />
NO_SUCH_ENTRY_MESSAGE = 381<br />
NO_SUCH_ENTRY_NOTIFICATION = 382<br />
NO_SUCH_MESSAGE = 392<br />
NO_SUCH_NOTIFY = 393<br />
NO_SUCH_USER = 394<br />
CALENDAR_EMPTY = 397<br />
NO_CHANGES = 399<br />
<br />
NOT_LOGGED_IN = 403<br />
NO_SUCH_MYLIST_FILE = 410<br />
NO_SUCH_MYLIST_ENTRY = 411<br />
MYLIST_UNAVAILABLE = 412<br />
<br />
LOGIN_FAILED = 500<br />
LOGIN_FIRST = 501<br />
ACCESS_DENIED = 502<br />
CLIENT_VERSION_OUTDATED = 503<br />
CLIENT_BANNED = 504<br />
ILLEGAL_INPUT_OR_ACCESS_DENIED = 505<br />
INVALID_SESSION = 506<br />
NO_SUCH_ENCRYPTION_TYPE = 509<br />
ENCODING_NOT_SUPPORTED = 519<br />
BANNED = 555<br />
UNKNOWN_COMMAND = 598<br />
<br />
INTERNAL_SERVER_ERROR = 600<br />
ANIDB_OUT_OF_SERVICE = 601<br />
SERVER_BUSY = 602<br />
NO_DATA = 603<br />
TIMEOUT - DELAY AND RESUBMIT = 604<br />
API_VIOLATION = 666<br />
<br />
PUSHACK_CONFIRMED = 701<br />
NO_SUCH_PACKET_PENDING = 702<br />
<br />
VERSION = 998</pre><br />
<br />
[[Category:Development]]<br />
[[Category:UDP]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=UDP_API_Definition&diff=22432UDP API Definition2016-01-10T22:48:30Z<p>Ommina: /* UPDATED: Get List of Updated Anime IDs */</p>
<hr />
<div>{{TOCright}}<br />
<br />
== General Information ==<br />
'''Author:''' [[User:Exp|Exp]] & [[User:Epoximator|Epoximator]] & [[User:Ommina|Ommina]]<br><br />
'''Version:''' 0.03.730 (2015-03-25)<br><br />
'''Version number used for protover parameter:''' "3"<br />
<br />
'''IMPORTANT INFORMATION FOR ALL INTERESTED:'''<br />
* If you are mainly interested in notifications and private messaging, check out our [[Jabber]] and [[RSSRDF]] support first.<br />
* The UDP API is not an appropriate choice if you desire to download a local copy of the AniDB database.<br />
* If you want to create a client you have to register it {{AniDBLink|client|here}} and [[UDP Clients|here]].<br />
** Check out the clients that are being developed. There exists usable code in many different languages already.<br />
* If you have suggestions for improvements or new features use the [[UDP API DEV|development]] page.<br />
* Please also take a look at the [[API]] page.<br />
<br />
== Formats used in this Spec ==<br />
* {vartype varname} - Specifies what shall be inserted at this point and its type.<br />
* [...] - Everything between [ and ] is optional.<br />
<br />
=== Used types ===<br />
* ''int2'' - 2 byte Integer (in string representation)<br />
* ''int4'' - 4 byte Integer (in string representation)<br />
* ''boolean'' - true or false - use '1' for ''true'', '0' for ''false''<br />
* ''str'' - String (UDP packet length restricts string size to 1400 bytes)<br />
* ''hexstr'' -- a hex representation of a decimal value, two characters per byte. If multiple bytes are represented, byte one is the first two characters of the string, byte two the next two, and so on.<br />
<br />
=== Content Encoding ===<br />
* Default character encoding: ''ASCII''<br />
* Escape scheme for option values (to server): ''html form encoding'' + ''newline''<br />
** This means you have to encode at least <tt>&</tt> in your option values in html form encoding style (<tt>&amp;amp;</tt>) before sending them to the api server. All other html form encodings are optional.<br />
** All newlines should be replaced by &lt;br /&gt;<br />
* Escape scheme for returned data fields (from server): ', | and newline<br />
** Content newlines are encoded as &lt;br /&gt;, ' is encoded as ` and | is encoded as /.<br />
** Dates are returned in unix time (number of seconds elapsed since January 1, 1970 00:00:00 UTC)<br />
<br />
== Basics ==<br />
=== General ===<br />
The network communication is ''packet'' and ''line'' based. Each AniDB API command is exactly one UDP packet containing one line. Results are sent as one packet but may consist out of multiple lines. A return value always starts with a 3 byte result code followed by a human readable version of the result code. Be aware that important data fields may be returned directly after the return code (see: 200,201,209,271,272,504).<br />
The meaning for all result codes can be found in this document. If there is more than one entry returned, it's one entry per line. Lines are terminated by a <tt>\n</tt> (no dos linefeed <tt>\r</tt>). The elements of a format string are separated by a "|" character.<br />
<br />
<tt>{three digit return code} {str return string}\n</tt><br><br />
<tt>{data field 0}|{data field 1}|...|{data field n}</tt><br />
<br />
'''IMPORTANT:'''<br />
* All commands except PING, ENCRYPT, ENCODING, AUTH and VERSION '''requires''' login, meaning that the ''session tag'' must be set (<tt>s=xxxxx</tt>).<br />
* A client should ignore any additional trailing data fields it doesn't expect. Additional fields are going to be added to the output of some commands from time to time. Those additional fields will simply be appended to the end of the existing output. A client should be written in a way so that it is not affected by such new fields.<br />
* Due to the length constraints of an UDP package (over PPPoE) the replies from the server will never exceed 1400 bytes. String fields will be truncated if necessary to ensure this. No warnings are given when this happens.<br />
* A client should handle all possible return codes for each command.<br />
** Possible return codes for '''all commands''':<br />
*** 505 ILLEGAL INPUT OR ACCESS DENIED<br />
*** 555 BANNED<br />
***: {str reason}<br />
*** 598 UNKNOWN COMMAND<br />
*** 600 INTERNAL SERVER ERROR<br />
*** 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
*** 602 SERVER BUSY - TRY AGAIN LATER<br />
*** 604 TIMEOUT - DELAY AND RESUBMIT<br />
** Additional return codes for all commands that '''require login''':<br />
*** 501 LOGIN FIRST<br />
*** 502 ACCESS DENIED<br />
*** 506 INVALID SESSION<br />
<br />
{{eyecatch|Note|The '555 BANNED' message should not be expected by the client. This message is only enabled temporary to help developers understand what they are doing wrong.}}<br><br />
<br />
{{eyecatch|Note|<br />
While in daily maintenance the AniDB API will reply with<br />
<br />
601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
<br />
to all commands. If a client receives such a return value it should wait at least 30 minutes before trying again.}}<br />
<br />
=== Server / UDP Connection ===<br />
The Client has to send data packets to:<br />
* '''Server:''' api.anidb.net<br />
* '''Port:''' 9000/UDP<br />
The servername and port should not be hardcoded into a frontend but should be read from a configuration file.<br />
<br />
=== Server Errors ===<br />
* At any time the API might return a fatal error of the form:<br />
: <tt>6xx ERROR DESCRIPTION</tt><br />
* Possible codes are 600-699.<br />
* Occurrences of these errors (except 601 and 602) should be reported to [[User:Ommina|Ommina]].<br />
{{eyecatch|Note|6XX messages do not always return the tags given with the command which caused the error!}}<br />
<br />
=== Connection Problems ===<br />
There are many ways for a client to end up banned or the API might currently be handling too many concurrent connections.<br />
If a client does not get any reply to an AUTH command it should start to increase the retry delay exponentially with every failed login attempt. (i.e. try again after 30 seconds if the first login attempt failed, if the second fails too retry after 2 minutes, then 5 minutes, then 10 minutes, then 30 minutes, ... until you reach a retry delay of ~2-4h.)<br />
<br />
=== Local Port ===<br />
A client should select a fixed local port >1024 at install time and reuse it for local UDP Sockets. If the API sees too many different UDP Ports from one IP within ~1 hour it will ban the IP. (So make sure you're reusing your UDP ports also for testing/debugging!)<br />
<br />
The local port may be hardcoded, however, an option to manually specify another port should be offered.<br />
<br />
'''Note when behind a [[Wikipedia:Network address translation|NAT]]/masquerading router:'''<br><br />
A session between the server and a client is identified by the ''IP and port'' used by the client. So when the port (or IP) changes within a session the client has to authenticate again. If a client is behind a NAT router it can’t actually control the local port used for the connection. The router will normally ''translate'' the port to support several computers on a LAN to share the Internet connection. The public port (as determined by the router and seen by the server) which has been assigned to the connection will only be reserved for as long as it is in use. This means that the router will usually ''deallocate the port after a fixed timeout period'' (eg. five, ten or 15 minutes). Once that happens the client will no longer be able to receive UDP messages from the server (the messages will be discarded as undeliverable by the router) and a new port will be selected once the client tries to send a message to the server (which will result in a new connection session - '''Note:''' This could get you banned!, see above). So in order to keep a session over a NAT router alive, the client has to ping the server within the router's deallocation period to prevent a timeout.<br />
<br />
The client can decide whether it is behind a NAT router or not by adding <tt>nat=1</tt> to the AUTH command. This will cause the response to include the IP and port as seen by the server. If the port differs from the port reported by the local socket, the connection subject to NAT and the client should issue PING commands in regular intervals. Please do not send pings more often than is necessary to keep NAT connections alive.<br />
<br />
=== Flood Protection ===<br />
To prevent high server load the UDP API server enforces a strict flood protection policy.<br />
* Short Term:<br />
** A Client MUST NOT send more than 0.5 packets per second (that's one packet every two seconds, not two packets a second!)<br />
** The server will start to enforce the limit after the first 5 packets have been received.<br />
* Long Term:<br />
** A Client MUST NOT send more than one packet every four seconds over an extended amount of time.<br />
** ''An extended amount of time'' is not defined. Use common sense.<br />
<br />
Once a client exceeds a rate limit all further UDP packets from that client will be dropped without feedback until the client's packet rate is back down to acceptable levels.<br />
<br />
{{eyecatch|Note|Dropped packets are still taken into account for the packet rate. Meaning if you continuously send packets your client will be banned forever.}}<br />
<br />
Generally clients should be written in a way to minimize server and network load. You should always keep that in mind.<br />
<br />
Abusive clients may be banned completely.<br />
<br />
{{eyecatch|Note|<br />
If you suddenly stop getting replies from the AniDB API or you normally don't have a notable packetloss and from one point on you suddenly note a high packetloss percentage you have most likely entered a critical flood ratio.<br />
If the AniDB API isn't answering at all it might either be down or you have been banned, this is normally caused by violating the API specs (i.e. too many connections using different ports from one IP, too many auth failures, ...) (usually lasts 30 minutes).<br />
If you're experiencing packet loss you have probably reached the rate limit and the API starts to randomly drop incoming packets from your IP. (can be solved by enforcing a delay between multiple commands when you're sending a batch)}}<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Caching ===<br />
To minimize server and network load a client should use local caching in order to prevent repeated API requests for the same data.<br />
<br />
A client should locally cache FILE/EP/ANIME/GROUP/... info wherever possible for extended amounts of time.<br />
(I.e. if a client is used to scan a local folder with anime files and add them via API to a users MyList then it shall only ask for all files in the first run and cache the info for all files known to AniDB. If run again over the same folder it shall only check those files which were unknown to AniDB at the time of the last check.)<br />
<br />
Later versions of the API might enforce this by banning clients which ask for the same information more than once every week/month.<br />
<br />
=== Tag option ===<br />
The API will add a user defined string at the beginning of each reply line separated with a space, if desired.<br />
* To enable add the <tt>tag={str usertag}</tt> option to a command.<br />
* A tag is only valid for the command it was send with, meaning it is not persistent. If you want to have tags in front of all reply lines you will have to append the tag option to each command you send to the server.<br />
* Tags are meant to enable a client to handle more than one request/reply at a time.<br />
<br />
Usage example:<br />
AUTH user=baka&pass=baka&protover=25&client=someclient&clientver=1&tag=abc123<br />
abc123 200 Jxqxb LOGIN ACCEPTED<br />
or<br />
LOGOUT s=Jxqxb&tag=byebye<br />
byebye 203 LOGGED OUT<br />
<br />
{{eyecatch|Note|The tag option is valid for all api commands and is thus not explicitly listed in the description of each command.}}<br />
<br />
=== Data Indexes (fid,aid,eid,gid,lid) ===<br />
* All indexes start at 1 (not 0).<br />
* It is possible for table entries to have id fields with a value of 0 (i.e. gid). Those are to be interpreted as "NONE" or "NULL".<br />
* An ID is '''never''' reused. That means after an entry is deleted no new entry will ever have that ID again.<br />
* Mylist IDs (lid) are globally unique, not per-user unique.<br />
<br />
== Authing Commands ==<br />
{{eyecatch|Note|'''ANY''' command which requires parameters may return: 505 ILLEGAL INPUT OR ACCESS DENIED}}<br />
<br />
----<br />
=== AUTH: Authing to the AnimeDB ===<br />
'''Command String:'''<br />
* AUTH user={str username}&pass={str password}&protover={int4 apiversion}&client={str clientname}&clientver={int4 clientversion}[&nat=1&comp=1&enc={str encoding}&mtu{int4 mtu value}&imgserver=1]<br />
<br />
'''Possible Replies:'''<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
* 500 LOGIN FAILED<br />
* 503 CLIENT VERSION OUTDATED<br />
* 504 CLIENT BANNED - {str reason}<br />
* 505 ILLEGAL INPUT OR ACCESS DENIED<br />
* 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
when nat=1<br />
* 200 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED<br />
* 201 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
when imgserver=1<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
{str image server name}<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
{str image server name}<br />
<br />
'''Info:'''<br />
{{eyecatch|Note|The password is the normal AniDB website password! The password listed in the profile as API Password in only used for the optional encryption feature.}}<br />
* The ''session_key'' is a String containing only ''a-z,A-Z,0-9'' chars of a length of ''4-8'' characters.<br />
: It has to be stored by the client and needs to be sent as parameter with every command which requires the user to logged in.<br />
* The ''session_key'' String is appended as parameter "s", i.e. "PUSH notify=1&msg=1&s={str session_key}".<br />
* On a '''500 LOGIN FAILED''' message the client should request the user to enter username and password again.<br />
* In case of a '''501 LOGIN FIRST''' message the client should silently resend an auth command and send the failed command again.<br />
* A '''502 ACCESS DENIED''' message should abort the current action on the client side and display a message to the user.<br />
* A '''503 CLIENT VERSION OUTDATED''' message states that the udp server has been updated and does not support your client any longer. (protover is too low). A 201 message refers to a new version of the client software.<br />
* A '''506 INVALID SESSION''' means that either the session key parameter "s" was not provided with a command that requires it or the session key is no longer valid. The client should reissue an AUTH command.<br />
{{eyecatch|Note|A frontend shall expect 501 and 502 messages to be returned on ANY command.}}<br><br />
{{eyecatch|Note|AniDB usernames may only contain characters (a-z,A-Z), numbers (0-9), underscores (_) and hyphens (-).}}<br />
* The client should send the apiversion of the AnimeDB API version it supports as value of the protover parameter.<br />
* The client MAY NOT send anything but the version of the API Specs the author used to write the client! (as it is stated at the top of this file @ "Version number used for protover parameter")<br />
: The API will compare that value to it's own version of the API and if the version of the client is older the API will decide whether the changes were significant enough to deny the old client access to the DB.<br />
* The clientname shall be a lower-case string containing only the chars ''a-z'' of ''4-16 chars'' length which identifies the client. (i.e. mykickassclient)<br />
* The clientversion shall be a number starting with 1, increased on every change in the client.<br />
: clientname and clientversion might be used by the API to distinguish between different clients and client versions if that should ever become necessary.<br />
{{eyecatch|Important|<br />
* DO NOT use the clientname of an existing client. If you modify an existing client's code to meet your own needs, create a new client name for yourself.<br />
* ALWAYS increase the clientversion number if you release a new client version.}}<br />
* A Login and its assigned ''session_key'' is valid until the virtual UDP connection times out or until a LOGOUT command is issued.<br />
* The virtual UDP connection times out if no data was received from the client for '''35 minutes'''.<br />
* A client should issue a UPTIME command once every 30 minutes to keep the connection alive should that be required.<br />
* If the client does not use any of the notification/push features of the API it should NOT keep the connection alive, furthermore it should explicitly terminate the connection by issuing a LOGOUT command once it finished it's work.<br />
* If it is very likely that another command will be issued shortly (within the next 20 minutes) a client SHOULD keep the current connection open, by not sending a LOGOUT command.<br />
{{eyecatch|Important|<br />
* A client should NOT perform a full AUTH / command / LOGOUT cycle for each command it wants to send. Again, if another command is likely within 20 minutes, remain logged in.}}<br />
* The client shall notify the user if it received a 201 message at login.<br />
: This means a new version of the client is available, however the old version is still supported otherwise a client banned message would have been returned.<br />
* The user should get a pop-up message on 503 and 504 messages telling him to update his client software.<br />
: ('''Note:''' 504 means that this version of the client is banned, not the user!)<br />
* The 'nat' option makes the client able to detect whether it is behind a nat router or not. When the client is behind a nat router it should keep the "connection" alive with the PING command.<br />
{{eyecatch|Important|Make sure your client handles ALL possible AUTH return codes before giving out any versions!}}<br />
* When ''enc=x'' is defined the server will change the encoding used to x.<br />
**If the encoding is supported it will change right away (including the response) and be reset on logout/timeout.<br />
**If not supported then the argument will be silently ignored. Use ENCODING to test what works.<br />
**Supported encodings are [http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html these].<br />
* ''comp=1'' means that the client supports compression ([http://java.sun.com/j2se/1.5.0/docs/api/java/util/zip/Deflater.html DEFLATE]).<br />
**The server will compress (instead of truncating) the datagrams when needed if this option is enabled.<br />
**The first two bytes of compressed datagrams will always be set to zero. (So tags should never start with that.)<br />
* Default [[Wikipedia:MTU (networking)|''MTU'']] is 1400. Minimum allowed is 400, maximum 1400, due [[Wikipedia:Point-to-Point Protocol over Ethernet|PPPoE]].<br />
<br />
----<br />
<br />
=== LOGOUT: Logout ===<br />
'''Command String:'''<br />
* LOGOUT<br />
<br />
'''Possible Replies:'''<br />
* 203 LOGGED OUT<br />
* 403 NOT LOGGED IN<br />
<br />
'''Info:'''<br />
* This command only works if you are already logged in.<br />
* A logout should ALWAYS be issued if the client is currently logged in and is either exiting or not expecting to send/receive any AniDB API packets for the next >= 30 minutes.<br />
<br />
----<br />
=== ENCRYPT: Start Encrypted Session ===<br />
Will cause all future messages from the server, except the first (the reply to the ENCRYPT command itself), to be encrypted (128 bit [[Wikipedia:Advanced Encryption Standard|AES]]). The client will also have to encrypt all future requests sent to the server. All non-encrypted messages will be discarded by the server. The encryption key is the [[Wikipedia:MD5|MD5]] hash of a special ''UDP API Key'' (defined in the users profile) concatenated with the salt string as given in the reply to the ENCRYPT message. A normal AUTH message is still necessary to authenticate and should follow the ENCRYPT command once the API has acknowledged the encryption.<br />
<br />
'''Command String:'''<br />
* ENCRYPT user={str name}&type={int2 type}<br />
<br />
'''Possible Replies:'''<br />
* 209 {str salt} ENCRYPTION ENABLED<br />
* 309 API PASSWORD NOT DEFINED<br />
* 509 NO SUCH ENCRYPTION TYPE<br />
* 394 NO SUCH USER<br />
<br />
'''Info:'''<br />
* ''user'' is the user name.<br />
* ''type'' is the type of encryption; 1 => 128 bit AES (only one defined).<br />
* ''API Key'' is the one defined in the {{AniDBLink|profile|profile settings page}}.<br />
* It is not possible to disable the encryption once enabled while staying logged in.<br />
** A logout (the logout message needs to be correctly encrypted) or timeout will disable the encryption.<br />
* In order to minimize server load, encryption should be disabled by default and should have to be enabled manually by the user in the configuration options.<br />
* The encryption key is md5(api_key_of_user+''salt'').<br />
* Padding of the message needs to be done according to the PKCS5Padding scheme.<br />
<br />
== Notify Commands ==<br />
=== Introduction ===<br />
Broadly speaking, notifications provide an indication to the client that some event has occurred within the AniDB database.<br />
<br />
There are three types:<br />
* New file [[Notifications|notification]]. (Only anime type supported.)<br />
* New private message notification.<br />
* New buddy event notification.<br />
<br />
Note that, while a user can subscribe to multiple 'new file' events (see [[Notifications|notifications]]), at present, the UDP API only supports notifications of new files by anime. New files by group, or new files by producer, are NOT presently supported. Just the same, keeping in mind that the API is designed to potentially support such notifications in the future will help in understanding why some of the commands are structured the way they are.<br />
<br />
The word "notification" is also used a bit inconsistently in this document. An AniDB notification is originally a "new file [[Notifications|notification]]". It might be more correct to use the term "event" for the original "happening" and then "notification" as the means to notify the user (client). New-file, new-message, buddy-* and going-down are all events that results in notifications. Only the first two type of events are persistent, though, meaning they exist and remain in the same state until some user action affects them.<br />
<br />
=== Getting Notifications ===<br />
Clients that wish to receive notifications have two routes available to them. They are by no means mutually exclusive and selecting one does not imply a client is unable to use commands from another.<br />
<br />
'''Method One: Polling'''<br />
<br />
With this method, the client contacts the server at some interval (no more than once every 20 minutes) to see if there are new file notifications waiting. If there are, the client can the get further details of the files in question. This is analogous to checking an email server every half hour to see if new email has arrived.<br />
<br />
Its principal advantage is that it is easy to design and code. Blocking sockets are sufficient as the client can expect the reply received to correspond with the command sent.<br />
<br />
The disadvantage of this approach is that it introduces a delay and some uncertainty in receiving notifications. If, for example, the user clears the notification on the website before the client collects it, the client will not learn of the new file. Similarly, if the user does not dismiss notifications via the site, the client will have an increasing amount of stale data to work though. Finally, notifications cleared by the client also clears them from the website, so users will need to be made aware of what is going on.<br />
<br />
A polling HOWTO:<br />
<br />
* Use NOTIFY (no more than once every 20 minutes) to get the number of pending notifications<br />
* IF there are new notifications pending, use NOTIFYLIST to get a list of notification types and associated IDs.<br />
* Use NOTIFYGET to receive a notification, supplying the ID provided by NOTIFYLIST<br />
* Use NOTIFYACK to acknowledge a notification, supplying the ID provided by NOTIFYLIST (if desired)<br />
<br />
{{eyecatch|Note|The ID supplied by NOTIFYLIST will be the ID of the affected notification type. Since, at present, only the anime type is supported, this value is always an aid. In the future, it may represent a group or producer ID. In these cases, the str '''type''' value will indicate what entity the ID represents.}}<br />
<br />
'''Method Two: Server PUSH'''<br />
<br />
With this method, the server takes the active role in advising the client that a new file has arrived. The client must register with the server to receive further advice information, and will be responsible for keeping the login session from timing out, and any NAT router ports open. The UDP packet is sent to the ip and port from which the AUTH command was received.<br />
<br />
This method compensates for the disadvantages of the polling method, but is more difficult to code. Blocking sockets are no longer an option, nor can a client make any assumptions that an incoming packet will necessarily be a reply to the last command sent. The tag option may be helpful here.<br />
<br />
A PUSH HOWTO:<br />
<br />
* PUSH to register your client session.<br />
* Listen for 720-799 NOTIFICATIONs ('''not 290''').<br />
* Use PUSHACK to to acknowledge the notification using the nid supplied with NOTIFICATION<br />
* Use NOTIFYGET to receive a notification, suppling the relid provided by NOTIFICATION (NOT the packet ID)<br />
* Use NOTIFYACK to acknowledge a notification, suppling the relid provided by NOTIFICATION (if desired)<br />
* Use UPTIME (with an interval between 30 and 35 minutes) to keep login session valid<br />
<br />
It is probably a good idea to use tags to separate NOTIFICATIONs from the other communication. NOTIFICATIONs will '''never''' have tags.<br />
<br />
=== PUSH: UDP Notification Registration ===<br />
Register your client as an observer for AniDB notification events for the current user. If you are registered for one or more event types the AniDB server will send an UDP packet (format see below) on each change which affects the current user.<br />
<br />
'''Command String:'''<br />
* PUSH notify={boolean on_new_file}&msg={boolean on_new_private_message}[&buddy={boolean on_buddy_event}]<br />
<br />
'''Possible Replies:'''<br />
* 270 NOTIFICATION ENABLED<br />
OR (if both values are 0)<br />
* 370 NOTIFICATION DISABLED<br />
<br />
'''Info:'''<br />
* A client which has registered to receive UDP notification packets must:<br />
** Issue a PUSHACK command for each notification received with ''notify_packet_id'' provided in the notification packet.<br />
** Use PING to keep the connection alive (< 30 min).<br />
** Use UPTIME to ensure that the session is OK (>= 30 min).<br />
* Every notification generated is resent 3 times unless acknowledged. After that the client is logged out.<br />
<br />
=== NOTIFY: Notifications ===<br />
Get number of pending notifications (and number of online buddies).<br />
<br />
'''Command String:'''<br />
* NOTIFY [buddy=1]<br />
<br />
'''Possible Replies:'''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}<br />
when ''buddy=1''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}|{int4 number_of_online_buddies}<br />
<br />
'''Info:'''<br />
* If the client did send a NOTIFY within the last 35 minutes and it was confirmed by AniDB then receiving a 501 LOGIN FIRST message for the next NOTIFY command shows that AniDB logged the client out because it did not respond to a PUSH Notification packet.<br />
* There is no command to retrieve missed PUSH Notifications.<br />
{{eyecatch|Note|This command MUST NOT be issued more than once every 20 minutes.}}<br />
<br />
----<br />
=== NOTIFYLIST: List Notification/Message IDs ===<br />
List id of all pending (not acknowledged) ''new private message'' and ''new file'' notifications. Buddy events cannot be acknowledged.<br />
<br />
'''Command String:'''<br />
* NOTIFYLIST<br />
<br />
'''Possible Replies:'''<br />
*291 NOTIFYLIST<br />
: {str type}|{int4 id}<br />
: {str type}|{int4 id}<br />
: ...<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as required by NOTIFYGET. For messages it is the actual message id, for notifications it is the id of the related type; anime, group or producer. Since only file notifications related to anime is implemented atm, it is the anime id (aid).<br />
* NOTIFYLIST returns one line per entry, if no entries are available only the first line of the reply is returned.<br />
{{eyecatch|Note|This command MUST NOT be issued regularly but should only be triggered by either a push message received by the client or a reply to a NOTIFY command which tells you that there are messages/notifications waiting.}}<br />
<br />
----<br />
=== NOTIFYGET: Get Notification/Message ===<br />
Receive private message or file notification.<br />
<br />
'''Command String:'''<br />
* NOTIFYGET type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 292 NOTIFYGET<br />
: {int4 id}|{int4 from_user_id}|{str from_user_name}|{int4 date}|{int4 type}|{str title}|{str body}<br />
* 392 NO SUCH ENTRY<br />
when type = N<br />
* 293 NOTIFYGET<br />
: {int4 relid}|{int4 type}|{int2 count}|{int4 date}|{str relidname}|{str fids}<br />
* 393 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as given by NOTIFYLIST (or ''relid'' from 271 NOTIFICATION and mid from 272 NOTIFICATION)<br />
* for message entries (M):<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: type is the type of the message (0=normal msg, 1=annonymous, 2=system msg, 3=mod msg)<br />
* for notification entries (N):<br />
: relid is the id of the related type (anime)<br />
: relname is the name of the related type (anime)<br />
: type is the notification type (0=all, 1=new, 2=group, 3=complete)<br />
: count is the number of events pending for this subscription<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: fids is a comma separated list with the affected file ids<br />
<br />
----<br />
=== NOTIFYACK: Acknowledge Notification/Message ===<br />
This command will mark a message read or clear a ''new file'' notification. Buddy events are not acknowledgeable.<br />
<br />
'''Command String:'''<br />
* NOTIFYACK type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 281 NOTIFYACK SUCCESSFUL<br />
* 381 NO SUCH ENTRY<br />
when type = N<br />
* 282 NOTIFYACK SUCCESSFUL<br />
* 382 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
<br />
====Notification Packet Format====<br />
'''New File Notify:'''<br />
<br />
720 {int4 notify_packet_id} NOTIFICATION - NEW FILE<br />
{int4 fidlist}|{int2 reltype}|{int2 priority}<br />
<br />
* fidlist is a comma separated list of file ids<br />
* reltype is: 1 = anime, 2 = group, 3 = producer<br />
* priority is: 0 = low, 1 = medium, 2 = high<br />
* new file notifications are created as a batch, so it is not unusual to get several new files for a particular anime at once. It is in this case that a comma separated list of fids will be returned<br />
<br />
{{eyecatch|Note|Group (and producer) related file notifications are not implemented yet.}}<br />
<br />
<br />
'''New Private Message Notify:'''<br />
<br />
794 {int4 notify_packet_id} NOTIFICATION - NEW MESSAGE<br />
{int2 type}|{int4 date}|{int4 sent_by_uid}|{str sent_by_name}|{str subject}|{str body}|{int mid}<br />
<br />
* type is the type of the message (0=normal msg, 1=anonymous, 2=system msg, 3=mod msg)<br />
* date is the time the message was sent (in seconds since 1.1.1970)<br />
* sender uid/sender name are the user id and user name of the sender<br />
* subject is the message subject<br />
* body is message body (can be truncated)<br />
* mid is message id and can be used with NOTIFYACK<br />
<br />
'''Buddy Event Notify:'''<br />
753 {int4 notify_packet_id} NOTIFICATION - BUDDY<br />
{int4 buddy uid}|{int2 event type}<br />
* Possible event types:<br />
** 0 => LOGIN<br />
** 1 => LOGOUT<br />
** 2 => ACCEPTED<br />
** 3 => ADDED<br />
<br />
<br />
'''Going Down Event Notify:'''<br />
799 {int4 notify_packet_id} NOTIFICATION - SHUTTING DOWN<br />
{int4 time offline}|{int4 comment}<br />
<br />
* Clients with any notification on will receive the SHUTTING DOWN message before the API goes offline.<br />
* Time offline is the time in minutes the API will be down, 0 if indefinite (client can direct user to the AniDB site for status updates).<br />
* The comment is a short explanation for the downtime.<br />
* Only one datagram will be sent, and the server will not listen for replies.<br />
<br />
<br />
=== PUSHACK: UDP Notification Acknowledge ===<br />
Used to acknowledge notification packets (720-799). A client must be prepared to issue this command before using '''PUSH'''.<br />
<br />
'''Command String:'''<br />
* PUSHACK nid={int4 notify_packet_id}<br />
<br />
'''Possible Replies:'''<br />
* 701 PUSHACK CONFIRMED<br />
* 702 NO SUCH PACKET PENDING<br />
<br />
'''Info:'''<br />
* See: '''PUSH'''<br />
<br />
== Buddy Commands ==<br />
Group of commands used to administrate your buddylist.<br />
<br />
=== BUDDYADD: Add a user to Buddy List ===<br />
'''Command String:'''<br />
* BUDDYADD uid={int4 buddy uid}<br />
* BUDDYADD uname={int4 buddy name}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 255 BUDDY ADDED<br />
* 355 BUDDY ALREADY ADDED<br />
<br />
----<br />
=== BUDDYDEL: Remove a user from Buddy List ===<br />
'''Command String:'''<br />
* BUDDYDEL uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 256 BUDDY DELETED<br />
<br />
----<br />
=== BUDDYACCEPT: Accept user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYACCEPT uid={int4 user uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 257 BUDDY ACCEPTED<br />
* 357 BUDDY ALREADY ACCEPTED<br />
<br />
----<br />
=== BUDDYDENY: Deny user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYDENY uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 258 BUDDY DENIED<br />
* 358 BUDDY ALREADY DENIED<br />
<br />
----<br />
=== BUDDYLIST: Retrieve Buddy List ===<br />
'''Command String:'''<br />
* BUDDYLIST startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 253 {int2 start} {int2 end} {int2 total} BUDDY LIST<br />
: {int4 uid}|{str username}|{int2 state}<br />
: ...<br />
'''Info:'''<br />
* state is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = this user is in your buddylist<br />
* bit 2 = this user has accepted you<br />
* bit 3 = this user is waiting for your approval<br />
<br />
----<br />
=== BUDDYSTATE: Retrieve Buddy States===<br />
'''Command String:'''<br />
* BUDDYSTATE startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 254 {int2 start} {int2 end} {int2 total} BUDDY STATE<br />
: {int4 uid}|{int2 onlinestate}<br />
: ...<br />
<br />
'''Info:'''<br />
* onlinestate is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = http online (user has issued a HTTP request within the last 10 minutes)<br />
* bit 2 = udp api online (user is currently connected to the udp api server)<br />
* example: 0=offline, 1=http online, 2=udp api online, 3=http&udp api online<br />
<br />
== Data Commands ==<br />
=== ANIME: Retrieve Anime Data ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIME aid={int4 id}[&amask={hexstr}]<br />
by name<br />
* ANIME aname={str anime name}[&amask={hexstr}]<br />
<br />
'''Possible Replies:'''<br />
<br />
If no ''amask'' is provided:<br />
* 230 ANIME<br />
: {int4 aid}|{int4 eps}|{int4 ep count}|{int4 special cnt}|{int4 rating}|{int4 votes}|{int4 tmprating}|{int4 tmpvotes}|{int4 review rating average}|{int4 reviews}|{str year}|{str type}|{str romaji}|{str kanji}|{str english}|{str other}|{str short names}|{str synonyms}|{str category list}<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* Fields are returned in the same order they appear in the ''amask'' field list: byte 1, bit 7 first<br />
* Synonyms and short names are separated with '<br />
* Category fields are separated with ',' and ordered by weight (desc).<br />
* By name: must be perfect match of romaji/kanji/english/other/synonym/short name.<br />
* 'Producer id list' and 'producer name list' match the data returned by the former producer bits (but using the revised creator ids)<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
* '''Note:''' The character id list is the first data to be truncated if needed. And then: tag list, synonym list, short name list. This applies to the FILE command too.<br />
* Selecting an 'unused' or 'reserved' bit will return an "illegal input" (505) response.<br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="5" align="center"><b>amask</b></td></tr><br />
<tr><br />
<td align="center"><b>Byte 1</b></td><br />
<td align="center"><b>Byte 2</b></td><br />
<td align="center"><b>Byte 3</b></td><br />
<td align="center"><b>Byte 4</b></td><br />
<td align="center"><b>Byte 5</b></td><br />
<td align="center"><b>Byte 6</b></td><br />
<td align="center"><b>Byte 7</b></td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int aid</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int dateflags</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 special ep count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int air date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int end date</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str url</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str picname</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int vote count</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 temp rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int temp vote count</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 average review rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int review count</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str award list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>bool is 18+ restricted</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int ANN id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int allcinema id</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str AnimeNfo id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td><i>reserved</i></td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td><i>reserved</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>reserved</i></td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int date record updated</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int character id list</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int creator id list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int main creator id list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str main creator name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 specials count</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 credits count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 other count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 trailer count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 parody count</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<br />
'''Related aid type (Byte 1, Bit 2):'''<br />
<pre><br />
value meaning<br />
<br />
1 sequel<br />
2 prequel<br />
11 same setting<br />
12 alternative setting<br />
32 alternative version<br />
41 music video<br />
42 character<br />
51 side story<br />
52 parent story<br />
61 summary<br />
62 full story<br />
100 other<br />
</pre><br />
<br />
'''Examples:''' (note that the given amask gives the same result as the default request)<br />
> ANIME aid=1&amask=b2f0e0fc000000&s=xxxxx<br />
< 230 ANIME<br />
1|1999-1999|TV Series|Space,Future,Plot Continuity,SciFi,Space Travel,Shipboard,Other Planet,Novel,Genetic Modification,Action,Romance,Military,Large Breasts,Gunfights,Adventure,Human Enhancement,Nudity|Seikai no Monshou|星界の紋章|Crest of the Stars||13|13|3|853|3225|756|110|875|11<br />
<br />
<br />
----<br />
<br />
=== ANIMEDESC: Retrieve Anime Description ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIMEDESC aid={int4 id}&part={int4 partno}<br />
<br />
'''Possible Replies:'''<br />
* 233 ANIMEDESC<br />
: {int4 current part}|{int4 max parts}|{str description}<br />
* 330 NO SUCH ANIME<br />
* 333 NO SUCH DESCRIPTION<br />
<br />
'''Info:'''<br />
* The maximum length of the anime description is roughly 5000 characters, but the maximum length of a UDP packet is 1400 bytes<br />
* Multiple calls to ANIMEDESC may be necessary to retrieve the complete text, retrieving separate 1400 byte parts with each call<br />
* ''part'' is zero-based<br />
* '''Note:''' No support, at present, for retrieving descriptions by title. ''aid'' only<br />
<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> ANIMEDESC aid=3169&part=0&s=xxxxx<br />
< 233 ANIMEDESC<br />
0|1|As summer break arrives for the students, Jun Sakurada is busily studying on his own in the library, making up for time lost <cut><br />
<br />
----<br />
=== CALENDAR: Get Upcoming Titles ===<br />
Returns the anime ids of the 25 most recently aired / released anime, directly followed by the next 25 anime due to be aired / released, ordered by start date.<br />
<br />
'''Command String:'''<br />
* CALENDAR<br />
<br />
'''Possible Replies:'''<br />
* 297 CALENDAR<br />
{int aid}|{int startdate}|{int dateflags}/n<br />
<br />
..repeated n times<br />
<br />
* 397 CALENDAR EMPTY<br />
<br />
'''Info:'''<br />
* Takes no parameters (other than the session string)<br />
* Titles returned are filtered by the 'show adult' preference of the logged in user. That is, users who have elected to hide adult content will have it hidden here as well.<br />
* Do not depend on the command always returning exactly 50 titles; there may not always be 25 future titles pending, depending on the user's 'adult' preferences, and the date in relation to the relation to the current anime season.<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
<br />
----<br />
=== CHARACTER: Get Character Information ===<br />
Returns character details associated with a given character ID, including associated anime ids, episode ids, and seiyuu.<br />
<br />
'''Command String:'''<br />
* CHARACTER charid={int characterid}<br />
<br />
'''Possible Replies:'''<br />
* 235 CHARACTER<br />
: {int charid}|{str character name kanji}|{str character name transcription}|{str pic}|{anime blocks}|{int episode list}|{int last update date}|{int2 type}|{str gender}<br />
<br />
: An 'anime block' is {int anime id},{int appearance},{int creatorid},{boolean is_main_seiyuu} repeated as many times as necessary, separated by a single quote ( ' ). <br />
<br />
* 335 NO SUCH CHARACTER<br />
<br />
'''Info:'''<br />
* If no seiyuu is associated with the character for a given aid, the 'creatorid' and 'is_main_seiyuu' fields will be empty, but the commas will remain.<br />
* An empty episode list is "undefined": no episode values have been added.<br />
* ''appearance'' values: 0='appears in', 1='cameo appearance in', 2='main character in', 3='secondary cast in'<br />
* ''type'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** 1 => 'Character'<br />
** 2 => 'Mecha'<br />
** 3 => 'Organisation'<br />
** 4 => 'Vessel' <br />
* ''gender'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** "M" => 'Male'<br />
** "F" => 'Female'<br />
** "I" => 'Intersexual'<br />
** "D" => 'Dimorphic'<br />
** "-" => 'none/does not apply'<br />
** "?" => 'unknown'<br />
<br />
'''Example:'''<br />
<br />
CHARACTER charid=488&s=DChan<br />
235 CHARACTER<br />
488|ニコ・ロビン|Nico Robin|14789.jpg|4097,2,1900,1'69,2,1901,0'6199,0,1900,1'5691,0,1900,1'2644,0,,'4851,0,1900,1||1236938094<br />
<br />
=== CREATOR: Get Creator Information ===<br />
<br />
'''Command String:'''<br />
* CREATOR creatorid={int creatorid}<br />
<br />
'''Possible Replies:'''<br />
* 245 CREATOR<br />
: {int creatorid}|{str creator name kanji}|{str creator name transcription}|{int type}|{str pic_name}|{str url_english}|{str url_japanese}|{str wiki_url_english}|{str wiki_url_japanese}|{int last update date}<br />
<br />
* 345 NO SUCH CREATOR<br />
<br />
'''Info:'''<br />
* ANIME AMASK byte6, bit5<br />
* ''type'' values: 1='person', 2='company', 3='collaboration'<br />
<br />
Example:<br />
<br />
245 CREATOR<br />
718|GAINAX|Gainax|2|10092.png||http://www.gainax.co.jp/|Gainax|Gainax|1237048093<br />
<br />
=== EPISODE: Retrieve Episode Data ===<br />
'''Command String:'''<br><br />
by eid<br />
* EPISODE eid={int eid}<br />
by anime and episode number<br />
* EPISODE aname={str anime name}&epno={int4 episode number}<br />
* EPISODE aid={int anime id}&epno={int4 episode number}<br />
<br />
'''Possible Replies:'''<br />
* 240 EPISODE<br />
: {int eid}|{int aid}|{int4 length}|{int4 rating}|{int votes}|{str epno}|{str eng}|{str romaji}|{str kanji}|{int aired}|{int type}<br />
* 340 NO SUCH EPISODE<br />
<br />
'''Info:'''<br />
* length is in minutes<br />
* Returned 'epno' includes special character (only if special) and padding (only if normal).<br />
** Special characters are S(special), C(credits), T(trailer), P(parody), O(other).<br />
* The ''type'' is the raw episode type, used to indicate numerically what the special character will be<br />
** 1: regular episode (no prefix), 2: special ("S"), 3: credit ("C"), 4: trailer ("T"), 5: parody ("P"), 6: other ("O")<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> EPISODE eid=1&s=xxxxx<br />
< 240 EPISODE<br />
1|1|24|400|4|01|Invasion|shinryaku|??<br />
<br />
> EPISODE aname=Seikai no Monshou&epno=2&s=xxxxx<br />
< 240 EPISODE<br />
2|1|24|750|2|02|Kin of the Stars|Hoshi-tachi no Kenzoku|??????|1295059229|1<br />
<br />
----<br />
<br />
=== FILE: Retrieve File Data ===<br />
'''Command String:'''<br><br />
by fid:<br />
* FILE fid={int4 id}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by size+ed2k hash:<br />
* FILE size={int8 size}&ed2k={str ed2khash}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by anime, group and epno<br />
* FILE aname={str anime name}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aname={str anime name}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
<br />
'''Possible Replies:'''<br />
* 220 FILE<br />
: {int4 fid}|{int4 aid}|{int4 eid}|{int4 gid}|{int4 state}|{int8 size}|{str ed2k}|{str anidbfilename}<br />
* 220 FILE<br />
: {int4 fid}|...(data list)<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 0}|{int4 fid 1}|...|{int4 fid n}<br />
* 320 NO SUCH FILE<br />
<br />
'''Info:'''<br />
* fid, aid, eid, gid are the unique ids for the file, anime, ep, group entries at AniDB.<br />
: You can use those to create links to the corresponding pages at AniDB.<br />
* anidbfilename is the AniDB filename for the file.<br />
: However this name does not contain all the extra information of the filenames on AniDB and might be composed slightly different.<br />
* fmask and amask are hexidecimal strings where each bit corresponds to a data field related to the specified file (see below). The data list received is sorted and returned in the same order as the tables: top to bottom, left to right, with fmask preceding amask. There is '''no''' provision to retrieve all fields. Further, requesting a 'unusued' or 'reserved' bit will return an "illegal input" error.<br />
* fid is always returned as the first value, regardless of what masks are provided.<br />
* Only the first matching file is returned when aname, gname and epno is used.<br />
* "audio codec" and "audio bitrate" will return multiple values if there are multiple audio streams present in the file. Values will be separated by a single quote. <br />
* For byte 1, bit 2 (other episodes): episode IDs will be followed by an integer '''percentage''' that indicate the percentage of the related episode this file covers. Typically 100%, there are cases where it will be 50, 30, or other values. This value provides no indication where, within an episode, the file represents. That is, 50% could mean the file covers the first half of the episode, the second half, or some 50% range in between.<br />
'''State:'''<br />
<pre><br />
bit / int value meaning<br />
1 / 1 FILE_CRCOK: file matched official CRC (displayed with green background in AniDB)<br />
2 / 2 FILE_CRCERR: file DID NOT match official CRC (displayed with red background in AniDB)<br />
3 / 4 FILE_ISV2: file is version 2<br />
4 / 8 FILE_ISV3: file is version 3<br />
5 / 16 FILE_ISV4: file is version 4<br />
6 / 32 FILE_ISV5: file is version 5<br />
7 / 64 FILE_UNC: file is uncensored<br />
8 / 128 FILE_CEN: file is censored<br />
<br />
examples:<br />
state ==== 9 ==> FILE_CRCOK+FILE_ISV3 ==> file matched official CRC and is version 3<br />
state ==== 0 ==> - ==> file was not crc checked and is version 1<br />
state ==== 34 ==> FILE_CRCERR+FILE_ISV5 ==> file DID NOT match official CRC and is version 5<br />
state ==== 1 ==> FILE_CRCOK ==> file matched official CRC and is version 1<br />
state ==== 8 ==> FILE_ISV3 ==> file was not CRC checked and is version 3<br />
</pre><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''fmask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
<td align="center">'''Byte 5'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 aid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 eid</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 gid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 mylist id</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>list other episodes</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>int2 IsDeprecated</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int2 state</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int8 size</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ed2k</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str md5</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str sha1</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str crc32</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>video colour depth</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str quality</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str audio codec list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 audio bitrate list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str video codec</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 video bitrate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str video resolution</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str file type (extension)</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str dub language</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str sub language</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 length in seconds</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str description</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 aired date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str anidb file name</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 mylist state</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 mylist filestate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 mylist viewed</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 mylist viewdate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str mylist storage</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str mylist source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str mylist other</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''amask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 anime total episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str category list</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str epno</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ep name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str ep romaji name</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str ep kanji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 episode rating</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 episode vote count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str group name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str group short name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int4 date aid record updated</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
'''Examples:''' (html escaped code intended)<br />
> FILE size=177747474&ed2k=70cd93fd3981cc80a8ea6a646ff805c9&fmask=7FF8FEF8&amask=C000F0C0&s=xxxxx<br />
< 220 FILE<br />
312498|4688|69260|4243|0||0|1|177747474|70cd93fd3981cc80a8ea6a646ff805c9|b2a7c7d591333e20495de3571b235c28|7af9b962c17ff729baeee67533e5219526cd5095|a200fe73|high|DTV|Vorbis (Ogg Vorbis)|104|H264/AVC|800|704x400|japanese|english'english'english|1560||1175472000|26|26|01|The Wings to the Sky|Sora he no Tsubasa|????|#nanoha-DamagedGoodz|Nanoha-DGz<br />
<br />
----<br />
<br />
=== GROUP: Retrieve Group Data ===<br />
'''Command String:'''<br><br />
by gid<br />
* GROUP gid={int gid}<br />
by name/shortname<br />
* GROUP gname={str group name}<br />
<br />
'''Possible Replies:'''<br />
* 250 GROUP<br />
: {int gid}|{int4 rating}|{int votes}|{int4 acount}|{int fcount}|{str name}|{str short}|{str irc channel}|{str irc server}|{str url}|{str picname}|{int4 foundeddate}|{int4 disbandeddate}|{int2 dateflags}|{int4 lastreleasedate}|{int4 lastactivitydate}|{list grouprelations}<br />
* 350 NO SUCH GROUP<br />
<br />
'''Info:'''<br />
* Requires login<br />
* ''gname'' is an exact match of either a group name or short name<br />
* As either name and short names are unique if there is a result from GROUP request by name that will be the only match<br />
* ''dateflags'' values:<br />
** bit0 set == Foundeddate, Unknown Day<br />
** bit1 set == Foundeddate, Unknown Month, Day<br />
** bit2 set == Disbandeddate, Unknown Day<br />
** bit3 set == Disbandeddate, Unknown Month, Day<br />
** bit5 set == Foundeddate, Unknown Year<br />
** bit6 set == Disbandeddate, Unknown Year<br />
* ''releasedate'' and ''activitydate'' are distinct. ''releasedate'' is the date a file was actually released by the group, where ''activitydate'' is the date of a file being added to AniDB. As such, lastrelease may very well be much older than lastactivity.<br />
* ''groupreleations'' is a list of apostrophe-separated pairs, where each pair consists of {int4 othergroupid},{int2 relationtype}<br />
** relationtype:<br />
*** 1 => "Participant in"<br />
*** 2 => "Parent of"<br />
*** 4 => "Merged from"<br />
*** 5 => "Now known as"<br />
*** 6 => "Other"<br />
<br />
'''Example:'''<br />
> GROUP gid=7091&s=bunny<br />
< 250 GROUP<br />
7091|832|1445|43|566|Frostii|Frostii|#frostii|irc.rizon.net|http://frostii.com|15844.jpg|1228089600|0|1|1301875200|1304222640|7255,1'3097,4'748,4'8106,1'8159,2'8402,1'8696,1'9022,1<br />
<br />
----<br />
<br />
=== GROUPSTATUS: Get Completed Episode ===<br />
Returns a list of group names and ranges of episodes released by the group for a given anime.<br />
<br />
'''Command String:'''<br />
* GROUPSTATUS aid={int animeid}[&state={int completion_state}]<br />
<br />
'''Possible Replies:'''<br />
* 225 GROUPSTATUS<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: ... (repeated)<br />
<br />
* 325 NO SUCH GROUPS FOUND<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* The seven fields will be repeated as necessary, one for each group, separated by a new line character<br />
* Groups will be filtered by the languages selected in the user's profile<br />
* If ''state'' is not supplied, groups with a completion state of <i>'ongoing'</i>, <i>'finished'</i>, or <i>'complete'</i> are returned<br />
* Groups are returned in order of descending episode count<br />
* If there are more groups to return than can be stored in a UDP packet, additional groups will be silently discarded<br />
* ''state'' values: <br />
#ongoing<br />
#stalled<br />
#complete<br />
#dropped<br />
#finished<br />
#specials only<br />
<br />
'''Example:'''<br />
> GROUP GROUPSTATUS aid=8692&s=vLl1N<br />
< 225 GROUPSTATUS<br />
7407|Coalgirls|3|25|839|12|1-25<br />
9863|Hadena Subs|3|25|374|1|1-25<br />
11951|ChaosBlades|3|25|0|0|1-25<br />
[truncated]<br />
<br />
=== UPDATED: Get List of Updated Anime IDs ===<br />
Returns a list of AniDB anime ids of anime that have been updated in in a given time frame, ordered by descending age (oldest to newest change).<br />
<br />
'''Command String:'''<br />
* UPDATED entity=1&[age={int4 id}|time={int4 date}]<br />
<br />
'''Possible Replies:'''<br />
* 243 UPDATED<br />
{int entity}|{int total count}|{int last update date}|{list aid}<br />
<br />
* 343 NO UPDATES<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1<br />
* Either ''age'' OR ''time'' can be specified, but not both<br />
* ''age'' is specified in days.<br />
** eg: age=30 requests a list of aid values of anime that have changed in the past 30 days<br />
* ''time'' is specified in unix time.<br />
** eg: time=1264982400 requests a list of aid values of anime that have changed since 2010-02-01<br />
* A maximum of 200 values will be returned<br />
* ''count'' specifies the total number of items found for the given time period. In short, if this value is great than 200, you have not retrieved all applicable ids.<br />
* ''last update date'' will contain the AniDB update time of the ''last'' aid to appear on the list<br />
<br />
'''An anime will be considered updated if:'''<br />
* A change is made to the anime record itself<br />
* An ''main'' or ''official'' anime title is added, edited, or deleted (not ''short'' or ''synonym'')<br />
* An episode for the anime is added, or delete (but NOT edited!)<br />
* An episode title is added, edited, or delete<br />
* An anime relation is added, or deleted<br />
<br />
== MyList Commands ==<br />
=== MYLIST: Retrieve MyList Data ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLIST lid={int4 lid}<br />
by fid:<br />
* MYLIST fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLIST size={int4 size}&ed2k={str ed2khash}<br />
by anime + group + epno<br />
* MYLIST aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 221 MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 312 MULTIPLE MYLIST ENTRIES<br />
: {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}<br />
* 321 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* The state field provides information about the location and sharing state of a file in MyList.<br />
* 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).<br />
* eps is a list of episodes, e.g. "1-12,14-16,T1"<br />
<br />
'''States:'''<br />
0 - unknown - state is unknown or the user doesn't want to provide this information<br />
1 - on hdd - the file is stored on hdd (but is not shared)<br />
2 - on cd - the file is stored on cd<br />
3 - deleted - the file has been deleted or is not available for other reasons (i.e. reencoded)<br />
<br />
'''Filestates:''' (for normal files, i.e. not generic)<br />
0 => normal/original<br />
1 => corrupted version/invalid crc<br />
2 => self edited<br />
10 => self ripped<br />
11 => on dvd<br />
12 => on vhs<br />
13 => on tv<br />
14 => in theaters<br />
15 => streamed<br />
100 => other<br />
<br />
'''Example:'''<br />
> MYLIST aname=gits sac&s=xxxxx<br />
< 322 MULTIPLE FILES FOUND<br />
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<br />
<br />
----<br />
=== MYLISTADD: Add file to MyList ===<br />
The command string for MYLISTADD is made of up two blocks: a 'fileinfo' block, which limits the command to a specific file, or an 'animeinfo'/'groupinfo'/'episodeinfo' block, which can be used to specify a range of files, including generics. Additionally, a number of optional parameters can be included with either set.<br />
<br />
'''Adding a single file to the MyList with the 'fileinfo' block'''<br />
<br />
* MYLISTADD fid={int4 fid}<br />
'''or'''<br />
* MYLISTADD size={int4 size}&ed2k={str ed2khash}<br />
'''or'''<br />
* MYLISTADD lid={int4 lid}&edit=1 (valid for edit only)<br />
<br />
'''Adding one or more files to the MyList with the 'animeinfo'/'groupinfo'/'episodeinfo' block'''<br />
<br />
Here, you have a number of options, depending on what data you have available. In brief, 'animeinfo' represents a choice between anime id and anime name. 'groupinfo' represents a choice between group id, group name, and generic=1. 'episodeinfo' represents a range of one or more episodes.<br />
<br />
* MYLISTADD aid={int4 aid}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&generic=1&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&generic=1&epno={int4 episode number}<br />
<br />
Each command listed can have, in addition, a number of optional components to provide further MyList details. Append these as desired.<br />
<br />
* &state={int2 state}<br />
* &viewed={boolean viewed}<br />
* &viewdate={int4 viewdate}<br />
* &source={str source}<br />
* &storage={str storage}<br />
* &other={str other}<br />
<br />
Finally, edit=1 can be included to edit a MyList entry instead of creating a new one. When editing, optional values that are not supplied retain their original value. That is, they are ''not'' replaced with default or empty values. Only values supplied are updated.<br />
<br />
'''Possible Replies:'''<br />
* 320 NO SUCH FILE<br />
* 330 NO SUCH ANIME<br />
* 350 NO SUCH GROUP<br />
when edit=0 and adding by fid, size/ed2k<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 mylist id of new entry}<br />
when edit=0 and adding by aname, aid<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 number of entries added}<br />
* 310 FILE ALREADY IN MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 1}|{int4 fid 2}|...|{int4 fid n}<br />
when edit=1<br />
* 311 MYLIST ENTRY EDITED<br />
* 311 MYLIST ENTRY EDITED<br />
: {int4 number of entries edited}<br />
* 411 NO SUCH MYLIST ENTRY<br />
<br />
'''Info:'''<br />
* All data except lid/fid/size+hash/generic is optional.<br />
* Viewed should be 0 for unwatched files and 1 for watched files.<br />
* If viewdate is not specified, the current time will be used. The field will be disregarded if viewed=0.<br />
* Other is the only field which may contain newlines, but they have to be stored as &lt;br /&gt;<br />
* For state values refer to: '''MYLIST'''<br />
* If you want to change an existing entry and already know its MyList id (lid) please use the lid-version of this command. It put less load on the server.<br />
* epno=0 means all eps (default), negative numbers means upto. (-12 -> upto 12)<br />
* group is optional only when edit=1, meaning you can't add every file for an anime<br />
* If the file already exists (response code 310), the ''current'' record will be returned, in the same format as the MYLIST response.<br />
----<br />
<br />
=== MYLISTDEL: Remove file from MyList ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLISTDEL lid={int4 lid}<br />
by fid:<br />
* MYLISTDEL fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLISTDEL size={int4 size}&ed2k={str ed2k hash}<br />
by anime + group + epno<br />
* MYLISTDEL aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 211 MYLIST ENTRY DELETED<br />
: {int4 number of entries}<br />
* 411 NO SUCH MYLIST ENTRY<br />
'''Info:'''<br />
* group is optional<br />
* command will delete all enties found<br />
<br />
----<br />
=== MYLISTSTATS : Retrieve MyList stats ===<br />
'''Command String:'''<br />
* MYLISTSTATS<br />
'''Possible Replies:'''<br />
* 222 MYLIST STATS<br />
{animes}|{eps}|{files}|{size of files}|{added animes}|{added eps}|{added files}|{added groups}|{leech %}|{glory %}|{viewed % of db}|{mylist % of db}|{viewed % of mylist}|{number of viewed eps}|{votes}|{reviews}|{viewed length in minutes}<br />
<br />
'''Info:'''<br />
* All fields are int<br />
<br />
----<br />
<br />
=== VOTE: Vote for specified anime/episode/group ===<br />
'''Command String:'''<br><br />
by id<br />
* VOTE type={int2 type}&id={int4 id}[&value={int4 vote value}&epno={int4 episode number}]<br />
by name<br />
* VOTE type={int2 type}&name={string name}[&value={int4 vote value}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 260 VOTED<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 261 VOTE FOUND<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 262 VOTE UPDATED<br />
: {str entity name}|{old vote value}|{vote type}|{entity id}<br />
* 263 VOTE REVOKED<br />
: {str entity name}|{revoked vote value}|{vote type}|{entity id}<br />
* 360 NO SUCH VOTE<br />
: {str entity name}|0|{vote type}|{entity id}<br />
* 361 INVALID VOTE TYPE<br />
* 362 INVALID VOTE VALUE<br />
* 363 PERMVOTE NOT ALLOWED<br />
: {str aname}|{vote value}|{type}|{entity id}<br />
* 364 ALREADY PERMVOTED<br />
: {str entity name}|{existing vote value}|{vote type}|{entity id}<br />
<br />
'''Info:'''<br />
* type: 1=anime, 2=anime tmpvote, 3=group<br />
* entity: anime, episode, or group<br />
* for episode voting add epno on type=1<br />
* value: negative number means revoke, 0 means retrieve (default), 100-1000 are valid vote values, rest is illegal<br />
* votes will be updated automatically (no questions asked)<br />
* tmpvoting when there exist a perm vote is not possible<br />
<br />
----<br />
<br />
=== RANDOM: Get a random anime ===<br />
'''Command String:'''<br />
* RANDOMANIME type={int4 type}<br />
<br />
'''Possible Replies:'''<br />
* 230 ANIME ... (see ANIME)<br />
<br />
'''Info:'''<br />
* type: 0=from db, 1=watched, 2=unwatched, 3=all mylist<br />
<br />
== Misc Commands ==<br />
=== MYLISTEXPORT: Schedule a MyList Export ===<br />
Queues a {{AniDBLink|export|MyList Export}} by the AniDB Servers. As with a manual export request, exports are only done during periods when server load is low. As a result, exports may take up to 24 hours. The client submitting the request will receive an AniDB message when the export is ready to be collected.<br />
<br />
Only one export can be in the queue at a time.<br />
<br />
'''Command String:'''<br />
* MYLISTEXPORT [template={str template_name}|cancel=1]<br />
<br />
'''Possible Replies:'''<br />
* 217 EXPORT QUEUED<br />
* 218 EXPORT CANCELLED<br />
* 317 EXPORT NO SUCH TEMPLATE<br />
* 318 EXPORT ALREADY IN QUEUE<br />
* 319 EXPORT NO EXPORT QUEUED OR IS PROCESSING<br />
<br />
'''Info:'''<br />
* ''template_name'' must match an available export template on the {{AniDBLink|export|MyList Export}} page.<br />
* ''cancel'' will cancel any pending export request, queued either through UDP or the web server.<br />
* Clients can subscribe the message notifications if they wish to be notified when an export is complete.<br />
<br />
----<br />
<br />
=== PING: Ping Command ===<br />
'''Command String:'''<br />
* PING [nat=1]<br />
<br />
'''Possible Replies:'''<br />
* 300 PONG<br />
: {int4 port} ''(when nat=1)''<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* May be used by a frontend to determine if the API is still available.<br />
* May be executed even if not yet logged in.<br />
* The option <tt>nat=1</tt> provides an easy way to determine if the router has changed the outgoing port. ({{t|587}})<br />
<br />
----<br />
<br />
=== VERSION: Retrieve Server Version ===<br />
'''Command String:'''<br />
* VERSION<br />
<br />
'''Possible Replies:'''<br />
* 998 VERSION<br />
: {str server version}<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
<br />
----<br />
=== UPTIME: Retrieve Server Uptime ===<br />
'''Command String:'''<br />
* UPTIME<br />
<br />
'''Possible Replies:'''<br />
* 208 UPTIME<br />
: {int4 udpserver uptime in milliseconds}<br />
<br />
'''Info:'''<br />
* This command is the preferred way to check that the session is OK.<br />
<br />
----<br />
=== ENCODING: Change Encoding for Session ===<br />
Sets preferred [[Wikipedia:Character encoding|encoding]] per session. The preferred way to do this is to use the '''enc''' argument for AUTH. This command is mostly for testing.<br />
<br />
'''Command String:'''<br />
* ENCODING name={str encoding name}<br />
<br />
'''Possible Replies:'''<br />
* 219 ENCODING CHANGED<br />
* 519 ENCODING NOT SUPPORTED<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* Supported encodings: http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html<br />
* Default: ASCII.<br />
* Resets to default on logout.<br />
<br />
----<br />
<br />
=== SENDMSG: Send Message ===<br />
'''Command String:'''<br />
* SENDMSG to={str username}&title={str title}&body={str body}<br />
<br />
'''Possible Replies:'''<br />
* 294 SENDMSG SUCCESSFUL<br />
* 394 NO SUCH USER<br />
* 501 LOGIN FIRST<br />
<br />
'''Note:'''<br />
* This command allows you to send an AniDB message.<br />
{{eyecatch|Important|<br />
title must not be longer than 50 chars.<br><br />
body must not be longer than 900 chars.<br />
}}<br />
<br />
----<br />
=== USER: Retrieve User UID ===<br />
'''Command String:'''<br />
* USER [user={str user name}|uid={int user id}]<br />
<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 295 USER<br />
: {int4 uid}|{str username}<br />
<br />
----<br />
<br />
=== STATS [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* STATS<br />
<br />
'''Possible Replies:'''<br />
* 206 STATS<br />
: {int4 animes)|{int4 eps}|{int4 files}|{int4 groups}|{int4 users}|{int8 total file size in bytes}|{int4 open [[creq|creqs]]}<br />
<br />
----<br />
=== TOP [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* TOP<br />
<br />
'''Possible Replies:'''<br />
* 207 TOP<br />
: {str longest mylist}|{int count}<br />
: {str largest mylist}|{int count}<br />
: {str most lame files}|{int count}<br />
: {str most indep. user}|{int count}<br />
: {str biggest leecher}|{int count}<br />
: {str most anime added}|{int count}<br />
: {str most eps added}|{int count}<br />
: {str most files added}|{int count}<br />
: {str most groups added}|{int count}<br />
: {str most votes}|{int count}<br />
: {str most reviews}|{int count}<br />
<br />
'''Info:'''<br />
* All strings are user names.<br />
* 'Hide myself in IRC stats' applies for this too.<br />
<br />
== Fatal Errors ==<br />
At anypoint int the retrieval process you have to expect the following output:<br />
* 6xx INTERNAL SERVER ERROR<br />
: ERROR: {str errormessage}<br />
OR<br />
*6xx INTERNAL SERVER ERROR - {str errormessage}<br />
<br />
Such errors should be reported back to [[User:Ommina|Ommina]].<br />
(xx is a number between 00 and 99)<br />
<br />
If you supply an unknown or unimplemented command you will get an error:<br />
* 598 UNKNOWN COMMAND<br />
<br />
== Return Codes ==<br />
{{eyecatch|Note|While the names below '''are''' the actual code strings returned by the server, clients are nonetheless encouraged to work with the numeric codes instead. }}<br />
<pre><br />
LOGIN_ACCEPTED = 200<br />
LOGIN_ACCEPTED_NEW_VERSION = 201<br />
LOGGED_OUT = 203<br />
RESOURCE = 205<br />
STATS = 206<br />
TOP = 207<br />
UPTIME = 208<br />
ENCRYPTION_ENABLED = 209<br />
MYLIST_ENTRY_ADDED = 210<br />
MYLIST_ENTRY_DELETED = 211<br />
ADDED_FILE = 214<br />
ADDED_STREAM = 215<br />
EXPORT_QUEUED = 217<br />
EXPORT_CANCELLED = 218<br />
ENCODING_CHANGED = 219<br />
FILE = 220<br />
MYLIST = 221<br />
MYLIST_STATS = 222<br />
WISHLIST = 223<br />
NOTIFICATION = 224<br />
GROUP_STATUS = 225<br />
WISHLIST_ENTRY_ADDED = 226<br />
WISHLIST_ENTRY_DELETED = 227<br />
WISHLIST_ENTRY_UPDATED = 228<br />
MULTIPLE_WISHLIST = 229<br />
ANIME = 230<br />
ANIME_BEST_MATCH = 231<br />
RANDOM_ANIME = 232<br />
ANIME_DESCRIPTION = 233<br />
REVIEW = 234<br />
CHARACTER = 235<br />
SONG = 236<br />
ANIMETAG = 237<br />
CHARACTERTAG = 238<br />
EPISODE = 240<br />
UPDATED = 243<br />
TITLE = 244<br />
CREATOR = 245<br />
NOTIFICATION_ENTRY_ADDED = 246<br />
NOTIFICATION_ENTRY_DELETED = 247<br />
NOTIFICATION_ENTRY_UPDATE = 248<br />
MULTIPLE_NOTIFICATION = 249<br />
GROUP = 250<br />
CATEGORY = 251<br />
BUDDY_LIST = 253<br />
BUDDY_STATE = 254<br />
BUDDY_ADDED = 255<br />
BUDDY_DELETED = 256<br />
BUDDY_ACCEPTED = 257<br />
BUDDY_DENIED = 258<br />
VOTED = 260<br />
VOTE_FOUND = 261<br />
VOTE_UPDATED = 262<br />
VOTE_REVOKED = 263<br />
HOT_ANIME = 265<br />
RANDOM_RECOMMENDATION = 266<br />
RANDOM_SIMILAR = 267<br />
NOTIFICATION_ENABLED = 270<br />
NOTIFYACK_SUCCESSFUL_MESSAGE = 281<br />
NOTIFYACK_SUCCESSFUL_NOTIFIATION = 282<br />
NOTIFICATION_STATE = 290<br />
NOTIFYLIST = 291<br />
NOTIFYGET_MESSAGE = 292<br />
NOTIFYGET_NOTIFY = 293<br />
SENDMESSAGE_SUCCESSFUL = 294<br />
USER_ID = 295<br />
CALENDAR = 297<br />
<br />
PONG = 300<br />
AUTHPONG = 301<br />
NO_SUCH_RESOURCE = 305<br />
API_PASSWORD_NOT_DEFINED = 309<br />
FILE_ALREADY_IN_MYLIST = 310<br />
MYLIST_ENTRY_EDITED = 311<br />
MULTIPLE_MYLIST_ENTRIES = 312<br />
WATCHED = 313<br />
SIZE_HASH_EXISTS = 314<br />
INVALID_DATA = 315<br />
STREAMNOID_USED = 316<br />
EXPORT_NO_SUCH_TEMPLATE = 317<br />
EXPORT_ALREADY_IN_QUEUE = 318<br />
EXPORT_NO_EXPORT_QUEUED_OR_IS_PROCESSING = 319<br />
NO_SUCH_FILE = 320<br />
NO_SUCH_ENTRY = 321<br />
MULTIPLE_FILES_FOUND = 322<br />
NO_SUCH_WISHLIST = 323<br />
NO_SUCH_NOTIFICATION = 324<br />
NO_GROUPS_FOUND = 325<br />
NO_SUCH_ANIME = 330<br />
NO_SUCH_DESCRIPTION = 333<br />
NO_SUCH_REVIEW = 334<br />
NO_SUCH_CHARACTER = 335<br />
NO_SUCH_SONG = 336<br />
NO_SUCH_ANIMETAG = 337<br />
NO_SUCH_CHARACTERTAG = 338<br />
NO_SUCH_EPISODE = 340<br />
NO_SUCH_UPDATES = 343<br />
NO_SUCH_TITLES = 344<br />
NO_SUCH_CREATOR = 345<br />
NO_SUCH_GROUP = 350<br />
NO_SUCH_CATEGORY = 351<br />
BUDDY_ALREADY_ADDED = 355<br />
NO_SUCH_BUDDY = 356<br />
BUDDY_ALREADY_ACCEPTED = 357<br />
BUDDY_ALREADY_DENIED = 358<br />
NO_SUCH_VOTE = 360<br />
INVALID_VOTE_TYPE = 361<br />
INVALID_VOTE_VALUE = 362<br />
PERMVOTE_NOT_ALLOWED = 363<br />
ALREADY_PERMVOTED = 364<br />
HOT_ANIME_EMPTY = 365<br />
RANDOM_RECOMMENDATION_EMPTY = 366<br />
RANDOM_SIMILAR_EMPTY = 367<br />
NOTIFICATION_DISABLED = 370<br />
NO_SUCH_ENTRY_MESSAGE = 381<br />
NO_SUCH_ENTRY_NOTIFICATION = 382<br />
NO_SUCH_MESSAGE = 392<br />
NO_SUCH_NOTIFY = 393<br />
NO_SUCH_USER = 394<br />
CALENDAR_EMPTY = 397<br />
NO_CHANGES = 399<br />
<br />
NOT_LOGGED_IN = 403<br />
NO_SUCH_MYLIST_FILE = 410<br />
NO_SUCH_MYLIST_ENTRY = 411<br />
MYLIST_UNAVAILABLE = 412<br />
<br />
LOGIN_FAILED = 500<br />
LOGIN_FIRST = 501<br />
ACCESS_DENIED = 502<br />
CLIENT_VERSION_OUTDATED = 503<br />
CLIENT_BANNED = 504<br />
ILLEGAL_INPUT_OR_ACCESS_DENIED = 505<br />
INVALID_SESSION = 506<br />
NO_SUCH_ENCRYPTION_TYPE = 509<br />
ENCODING_NOT_SUPPORTED = 519<br />
BANNED = 555<br />
UNKNOWN_COMMAND = 598<br />
<br />
INTERNAL_SERVER_ERROR = 600<br />
ANIDB_OUT_OF_SERVICE = 601<br />
SERVER_BUSY = 602<br />
NO_DATA = 603<br />
TIMEOUT - DELAY AND RESUBMIT = 604<br />
API_VIOLATION = 666<br />
<br />
PUSHACK_CONFIRMED = 701<br />
NO_SUCH_PACKET_PENDING = 702<br />
<br />
VERSION = 998</pre><br />
<br />
[[Category:Development]]<br />
[[Category:UDP]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=UDP_API_Definition&diff=22431UDP API Definition2016-01-10T22:46:45Z<p>Ommina: /* UPDATED: Get List of Updated Anime IDs */</p>
<hr />
<div>{{TOCright}}<br />
<br />
== General Information ==<br />
'''Author:''' [[User:Exp|Exp]] & [[User:Epoximator|Epoximator]] & [[User:Ommina|Ommina]]<br><br />
'''Version:''' 0.03.730 (2015-03-25)<br><br />
'''Version number used for protover parameter:''' "3"<br />
<br />
'''IMPORTANT INFORMATION FOR ALL INTERESTED:'''<br />
* If you are mainly interested in notifications and private messaging, check out our [[Jabber]] and [[RSSRDF]] support first.<br />
* The UDP API is not an appropriate choice if you desire to download a local copy of the AniDB database.<br />
* If you want to create a client you have to register it {{AniDBLink|client|here}} and [[UDP Clients|here]].<br />
** Check out the clients that are being developed. There exists usable code in many different languages already.<br />
* If you have suggestions for improvements or new features use the [[UDP API DEV|development]] page.<br />
* Please also take a look at the [[API]] page.<br />
<br />
== Formats used in this Spec ==<br />
* {vartype varname} - Specifies what shall be inserted at this point and its type.<br />
* [...] - Everything between [ and ] is optional.<br />
<br />
=== Used types ===<br />
* ''int2'' - 2 byte Integer (in string representation)<br />
* ''int4'' - 4 byte Integer (in string representation)<br />
* ''boolean'' - true or false - use '1' for ''true'', '0' for ''false''<br />
* ''str'' - String (UDP packet length restricts string size to 1400 bytes)<br />
* ''hexstr'' -- a hex representation of a decimal value, two characters per byte. If multiple bytes are represented, byte one is the first two characters of the string, byte two the next two, and so on.<br />
<br />
=== Content Encoding ===<br />
* Default character encoding: ''ASCII''<br />
* Escape scheme for option values (to server): ''html form encoding'' + ''newline''<br />
** This means you have to encode at least <tt>&</tt> in your option values in html form encoding style (<tt>&amp;amp;</tt>) before sending them to the api server. All other html form encodings are optional.<br />
** All newlines should be replaced by &lt;br /&gt;<br />
* Escape scheme for returned data fields (from server): ', | and newline<br />
** Content newlines are encoded as &lt;br /&gt;, ' is encoded as ` and | is encoded as /.<br />
** Dates are returned in unix time (number of seconds elapsed since January 1, 1970 00:00:00 UTC)<br />
<br />
== Basics ==<br />
=== General ===<br />
The network communication is ''packet'' and ''line'' based. Each AniDB API command is exactly one UDP packet containing one line. Results are sent as one packet but may consist out of multiple lines. A return value always starts with a 3 byte result code followed by a human readable version of the result code. Be aware that important data fields may be returned directly after the return code (see: 200,201,209,271,272,504).<br />
The meaning for all result codes can be found in this document. If there is more than one entry returned, it's one entry per line. Lines are terminated by a <tt>\n</tt> (no dos linefeed <tt>\r</tt>). The elements of a format string are separated by a "|" character.<br />
<br />
<tt>{three digit return code} {str return string}\n</tt><br><br />
<tt>{data field 0}|{data field 1}|...|{data field n}</tt><br />
<br />
'''IMPORTANT:'''<br />
* All commands except PING, ENCRYPT, ENCODING, AUTH and VERSION '''requires''' login, meaning that the ''session tag'' must be set (<tt>s=xxxxx</tt>).<br />
* A client should ignore any additional trailing data fields it doesn't expect. Additional fields are going to be added to the output of some commands from time to time. Those additional fields will simply be appended to the end of the existing output. A client should be written in a way so that it is not affected by such new fields.<br />
* Due to the length constraints of an UDP package (over PPPoE) the replies from the server will never exceed 1400 bytes. String fields will be truncated if necessary to ensure this. No warnings are given when this happens.<br />
* A client should handle all possible return codes for each command.<br />
** Possible return codes for '''all commands''':<br />
*** 505 ILLEGAL INPUT OR ACCESS DENIED<br />
*** 555 BANNED<br />
***: {str reason}<br />
*** 598 UNKNOWN COMMAND<br />
*** 600 INTERNAL SERVER ERROR<br />
*** 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
*** 602 SERVER BUSY - TRY AGAIN LATER<br />
*** 604 TIMEOUT - DELAY AND RESUBMIT<br />
** Additional return codes for all commands that '''require login''':<br />
*** 501 LOGIN FIRST<br />
*** 502 ACCESS DENIED<br />
*** 506 INVALID SESSION<br />
<br />
{{eyecatch|Note|The '555 BANNED' message should not be expected by the client. This message is only enabled temporary to help developers understand what they are doing wrong.}}<br><br />
<br />
{{eyecatch|Note|<br />
While in daily maintenance the AniDB API will reply with<br />
<br />
601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
<br />
to all commands. If a client receives such a return value it should wait at least 30 minutes before trying again.}}<br />
<br />
=== Server / UDP Connection ===<br />
The Client has to send data packets to:<br />
* '''Server:''' api.anidb.net<br />
* '''Port:''' 9000/UDP<br />
The servername and port should not be hardcoded into a frontend but should be read from a configuration file.<br />
<br />
=== Server Errors ===<br />
* At any time the API might return a fatal error of the form:<br />
: <tt>6xx ERROR DESCRIPTION</tt><br />
* Possible codes are 600-699.<br />
* Occurrences of these errors (except 601 and 602) should be reported to [[User:Ommina|Ommina]].<br />
{{eyecatch|Note|6XX messages do not always return the tags given with the command which caused the error!}}<br />
<br />
=== Connection Problems ===<br />
There are many ways for a client to end up banned or the API might currently be handling too many concurrent connections.<br />
If a client does not get any reply to an AUTH command it should start to increase the retry delay exponentially with every failed login attempt. (i.e. try again after 30 seconds if the first login attempt failed, if the second fails too retry after 2 minutes, then 5 minutes, then 10 minutes, then 30 minutes, ... until you reach a retry delay of ~2-4h.)<br />
<br />
=== Local Port ===<br />
A client should select a fixed local port >1024 at install time and reuse it for local UDP Sockets. If the API sees too many different UDP Ports from one IP within ~1 hour it will ban the IP. (So make sure you're reusing your UDP ports also for testing/debugging!)<br />
<br />
The local port may be hardcoded, however, an option to manually specify another port should be offered.<br />
<br />
'''Note when behind a [[Wikipedia:Network address translation|NAT]]/masquerading router:'''<br><br />
A session between the server and a client is identified by the ''IP and port'' used by the client. So when the port (or IP) changes within a session the client has to authenticate again. If a client is behind a NAT router it can’t actually control the local port used for the connection. The router will normally ''translate'' the port to support several computers on a LAN to share the Internet connection. The public port (as determined by the router and seen by the server) which has been assigned to the connection will only be reserved for as long as it is in use. This means that the router will usually ''deallocate the port after a fixed timeout period'' (eg. five, ten or 15 minutes). Once that happens the client will no longer be able to receive UDP messages from the server (the messages will be discarded as undeliverable by the router) and a new port will be selected once the client tries to send a message to the server (which will result in a new connection session - '''Note:''' This could get you banned!, see above). So in order to keep a session over a NAT router alive, the client has to ping the server within the router's deallocation period to prevent a timeout.<br />
<br />
The client can decide whether it is behind a NAT router or not by adding <tt>nat=1</tt> to the AUTH command. This will cause the response to include the IP and port as seen by the server. If the port differs from the port reported by the local socket, the connection subject to NAT and the client should issue PING commands in regular intervals. Please do not send pings more often than is necessary to keep NAT connections alive.<br />
<br />
=== Flood Protection ===<br />
To prevent high server load the UDP API server enforces a strict flood protection policy.<br />
* Short Term:<br />
** A Client MUST NOT send more than 0.5 packets per second (that's one packet every two seconds, not two packets a second!)<br />
** The server will start to enforce the limit after the first 5 packets have been received.<br />
* Long Term:<br />
** A Client MUST NOT send more than one packet every four seconds over an extended amount of time.<br />
** ''An extended amount of time'' is not defined. Use common sense.<br />
<br />
Once a client exceeds a rate limit all further UDP packets from that client will be dropped without feedback until the client's packet rate is back down to acceptable levels.<br />
<br />
{{eyecatch|Note|Dropped packets are still taken into account for the packet rate. Meaning if you continuously send packets your client will be banned forever.}}<br />
<br />
Generally clients should be written in a way to minimize server and network load. You should always keep that in mind.<br />
<br />
Abusive clients may be banned completely.<br />
<br />
{{eyecatch|Note|<br />
If you suddenly stop getting replies from the AniDB API or you normally don't have a notable packetloss and from one point on you suddenly note a high packetloss percentage you have most likely entered a critical flood ratio.<br />
If the AniDB API isn't answering at all it might either be down or you have been banned, this is normally caused by violating the API specs (i.e. too many connections using different ports from one IP, too many auth failures, ...) (usually lasts 30 minutes).<br />
If you're experiencing packet loss you have probably reached the rate limit and the API starts to randomly drop incoming packets from your IP. (can be solved by enforcing a delay between multiple commands when you're sending a batch)}}<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Caching ===<br />
To minimize server and network load a client should use local caching in order to prevent repeated API requests for the same data.<br />
<br />
A client should locally cache FILE/EP/ANIME/GROUP/... info wherever possible for extended amounts of time.<br />
(I.e. if a client is used to scan a local folder with anime files and add them via API to a users MyList then it shall only ask for all files in the first run and cache the info for all files known to AniDB. If run again over the same folder it shall only check those files which were unknown to AniDB at the time of the last check.)<br />
<br />
Later versions of the API might enforce this by banning clients which ask for the same information more than once every week/month.<br />
<br />
=== Tag option ===<br />
The API will add a user defined string at the beginning of each reply line separated with a space, if desired.<br />
* To enable add the <tt>tag={str usertag}</tt> option to a command.<br />
* A tag is only valid for the command it was send with, meaning it is not persistent. If you want to have tags in front of all reply lines you will have to append the tag option to each command you send to the server.<br />
* Tags are meant to enable a client to handle more than one request/reply at a time.<br />
<br />
Usage example:<br />
AUTH user=baka&pass=baka&protover=25&client=someclient&clientver=1&tag=abc123<br />
abc123 200 Jxqxb LOGIN ACCEPTED<br />
or<br />
LOGOUT s=Jxqxb&tag=byebye<br />
byebye 203 LOGGED OUT<br />
<br />
{{eyecatch|Note|The tag option is valid for all api commands and is thus not explicitly listed in the description of each command.}}<br />
<br />
=== Data Indexes (fid,aid,eid,gid,lid) ===<br />
* All indexes start at 1 (not 0).<br />
* It is possible for table entries to have id fields with a value of 0 (i.e. gid). Those are to be interpreted as "NONE" or "NULL".<br />
* An ID is '''never''' reused. That means after an entry is deleted no new entry will ever have that ID again.<br />
* Mylist IDs (lid) are globally unique, not per-user unique.<br />
<br />
== Authing Commands ==<br />
{{eyecatch|Note|'''ANY''' command which requires parameters may return: 505 ILLEGAL INPUT OR ACCESS DENIED}}<br />
<br />
----<br />
=== AUTH: Authing to the AnimeDB ===<br />
'''Command String:'''<br />
* AUTH user={str username}&pass={str password}&protover={int4 apiversion}&client={str clientname}&clientver={int4 clientversion}[&nat=1&comp=1&enc={str encoding}&mtu{int4 mtu value}&imgserver=1]<br />
<br />
'''Possible Replies:'''<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
* 500 LOGIN FAILED<br />
* 503 CLIENT VERSION OUTDATED<br />
* 504 CLIENT BANNED - {str reason}<br />
* 505 ILLEGAL INPUT OR ACCESS DENIED<br />
* 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
when nat=1<br />
* 200 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED<br />
* 201 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
when imgserver=1<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
{str image server name}<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
{str image server name}<br />
<br />
'''Info:'''<br />
{{eyecatch|Note|The password is the normal AniDB website password! The password listed in the profile as API Password in only used for the optional encryption feature.}}<br />
* The ''session_key'' is a String containing only ''a-z,A-Z,0-9'' chars of a length of ''4-8'' characters.<br />
: It has to be stored by the client and needs to be sent as parameter with every command which requires the user to logged in.<br />
* The ''session_key'' String is appended as parameter "s", i.e. "PUSH notify=1&msg=1&s={str session_key}".<br />
* On a '''500 LOGIN FAILED''' message the client should request the user to enter username and password again.<br />
* In case of a '''501 LOGIN FIRST''' message the client should silently resend an auth command and send the failed command again.<br />
* A '''502 ACCESS DENIED''' message should abort the current action on the client side and display a message to the user.<br />
* A '''503 CLIENT VERSION OUTDATED''' message states that the udp server has been updated and does not support your client any longer. (protover is too low). A 201 message refers to a new version of the client software.<br />
* A '''506 INVALID SESSION''' means that either the session key parameter "s" was not provided with a command that requires it or the session key is no longer valid. The client should reissue an AUTH command.<br />
{{eyecatch|Note|A frontend shall expect 501 and 502 messages to be returned on ANY command.}}<br><br />
{{eyecatch|Note|AniDB usernames may only contain characters (a-z,A-Z), numbers (0-9), underscores (_) and hyphens (-).}}<br />
* The client should send the apiversion of the AnimeDB API version it supports as value of the protover parameter.<br />
* The client MAY NOT send anything but the version of the API Specs the author used to write the client! (as it is stated at the top of this file @ "Version number used for protover parameter")<br />
: The API will compare that value to it's own version of the API and if the version of the client is older the API will decide whether the changes were significant enough to deny the old client access to the DB.<br />
* The clientname shall be a lower-case string containing only the chars ''a-z'' of ''4-16 chars'' length which identifies the client. (i.e. mykickassclient)<br />
* The clientversion shall be a number starting with 1, increased on every change in the client.<br />
: clientname and clientversion might be used by the API to distinguish between different clients and client versions if that should ever become necessary.<br />
{{eyecatch|Important|<br />
* DO NOT use the clientname of an existing client. If you modify an existing client's code to meet your own needs, create a new client name for yourself.<br />
* ALWAYS increase the clientversion number if you release a new client version.}}<br />
* A Login and its assigned ''session_key'' is valid until the virtual UDP connection times out or until a LOGOUT command is issued.<br />
* The virtual UDP connection times out if no data was received from the client for '''35 minutes'''.<br />
* A client should issue a UPTIME command once every 30 minutes to keep the connection alive should that be required.<br />
* If the client does not use any of the notification/push features of the API it should NOT keep the connection alive, furthermore it should explicitly terminate the connection by issuing a LOGOUT command once it finished it's work.<br />
* If it is very likely that another command will be issued shortly (within the next 20 minutes) a client SHOULD keep the current connection open, by not sending a LOGOUT command.<br />
{{eyecatch|Important|<br />
* A client should NOT perform a full AUTH / command / LOGOUT cycle for each command it wants to send. Again, if another command is likely within 20 minutes, remain logged in.}}<br />
* The client shall notify the user if it received a 201 message at login.<br />
: This means a new version of the client is available, however the old version is still supported otherwise a client banned message would have been returned.<br />
* The user should get a pop-up message on 503 and 504 messages telling him to update his client software.<br />
: ('''Note:''' 504 means that this version of the client is banned, not the user!)<br />
* The 'nat' option makes the client able to detect whether it is behind a nat router or not. When the client is behind a nat router it should keep the "connection" alive with the PING command.<br />
{{eyecatch|Important|Make sure your client handles ALL possible AUTH return codes before giving out any versions!}}<br />
* When ''enc=x'' is defined the server will change the encoding used to x.<br />
**If the encoding is supported it will change right away (including the response) and be reset on logout/timeout.<br />
**If not supported then the argument will be silently ignored. Use ENCODING to test what works.<br />
**Supported encodings are [http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html these].<br />
* ''comp=1'' means that the client supports compression ([http://java.sun.com/j2se/1.5.0/docs/api/java/util/zip/Deflater.html DEFLATE]).<br />
**The server will compress (instead of truncating) the datagrams when needed if this option is enabled.<br />
**The first two bytes of compressed datagrams will always be set to zero. (So tags should never start with that.)<br />
* Default [[Wikipedia:MTU (networking)|''MTU'']] is 1400. Minimum allowed is 400, maximum 1400, due [[Wikipedia:Point-to-Point Protocol over Ethernet|PPPoE]].<br />
<br />
----<br />
<br />
=== LOGOUT: Logout ===<br />
'''Command String:'''<br />
* LOGOUT<br />
<br />
'''Possible Replies:'''<br />
* 203 LOGGED OUT<br />
* 403 NOT LOGGED IN<br />
<br />
'''Info:'''<br />
* This command only works if you are already logged in.<br />
* A logout should ALWAYS be issued if the client is currently logged in and is either exiting or not expecting to send/receive any AniDB API packets for the next >= 30 minutes.<br />
<br />
----<br />
=== ENCRYPT: Start Encrypted Session ===<br />
Will cause all future messages from the server, except the first (the reply to the ENCRYPT command itself), to be encrypted (128 bit [[Wikipedia:Advanced Encryption Standard|AES]]). The client will also have to encrypt all future requests sent to the server. All non-encrypted messages will be discarded by the server. The encryption key is the [[Wikipedia:MD5|MD5]] hash of a special ''UDP API Key'' (defined in the users profile) concatenated with the salt string as given in the reply to the ENCRYPT message. A normal AUTH message is still necessary to authenticate and should follow the ENCRYPT command once the API has acknowledged the encryption.<br />
<br />
'''Command String:'''<br />
* ENCRYPT user={str name}&type={int2 type}<br />
<br />
'''Possible Replies:'''<br />
* 209 {str salt} ENCRYPTION ENABLED<br />
* 309 API PASSWORD NOT DEFINED<br />
* 509 NO SUCH ENCRYPTION TYPE<br />
* 394 NO SUCH USER<br />
<br />
'''Info:'''<br />
* ''user'' is the user name.<br />
* ''type'' is the type of encryption; 1 => 128 bit AES (only one defined).<br />
* ''API Key'' is the one defined in the {{AniDBLink|profile|profile settings page}}.<br />
* It is not possible to disable the encryption once enabled while staying logged in.<br />
** A logout (the logout message needs to be correctly encrypted) or timeout will disable the encryption.<br />
* In order to minimize server load, encryption should be disabled by default and should have to be enabled manually by the user in the configuration options.<br />
* The encryption key is md5(api_key_of_user+''salt'').<br />
* Padding of the message needs to be done according to the PKCS5Padding scheme.<br />
<br />
== Notify Commands ==<br />
=== Introduction ===<br />
Broadly speaking, notifications provide an indication to the client that some event has occurred within the AniDB database.<br />
<br />
There are three types:<br />
* New file [[Notifications|notification]]. (Only anime type supported.)<br />
* New private message notification.<br />
* New buddy event notification.<br />
<br />
Note that, while a user can subscribe to multiple 'new file' events (see [[Notifications|notifications]]), at present, the UDP API only supports notifications of new files by anime. New files by group, or new files by producer, are NOT presently supported. Just the same, keeping in mind that the API is designed to potentially support such notifications in the future will help in understanding why some of the commands are structured the way they are.<br />
<br />
The word "notification" is also used a bit inconsistently in this document. An AniDB notification is originally a "new file [[Notifications|notification]]". It might be more correct to use the term "event" for the original "happening" and then "notification" as the means to notify the user (client). New-file, new-message, buddy-* and going-down are all events that results in notifications. Only the first two type of events are persistent, though, meaning they exist and remain in the same state until some user action affects them.<br />
<br />
=== Getting Notifications ===<br />
Clients that wish to receive notifications have two routes available to them. They are by no means mutually exclusive and selecting one does not imply a client is unable to use commands from another.<br />
<br />
'''Method One: Polling'''<br />
<br />
With this method, the client contacts the server at some interval (no more than once every 20 minutes) to see if there are new file notifications waiting. If there are, the client can the get further details of the files in question. This is analogous to checking an email server every half hour to see if new email has arrived.<br />
<br />
Its principal advantage is that it is easy to design and code. Blocking sockets are sufficient as the client can expect the reply received to correspond with the command sent.<br />
<br />
The disadvantage of this approach is that it introduces a delay and some uncertainty in receiving notifications. If, for example, the user clears the notification on the website before the client collects it, the client will not learn of the new file. Similarly, if the user does not dismiss notifications via the site, the client will have an increasing amount of stale data to work though. Finally, notifications cleared by the client also clears them from the website, so users will need to be made aware of what is going on.<br />
<br />
A polling HOWTO:<br />
<br />
* Use NOTIFY (no more than once every 20 minutes) to get the number of pending notifications<br />
* IF there are new notifications pending, use NOTIFYLIST to get a list of notification types and associated IDs.<br />
* Use NOTIFYGET to receive a notification, supplying the ID provided by NOTIFYLIST<br />
* Use NOTIFYACK to acknowledge a notification, supplying the ID provided by NOTIFYLIST (if desired)<br />
<br />
{{eyecatch|Note|The ID supplied by NOTIFYLIST will be the ID of the affected notification type. Since, at present, only the anime type is supported, this value is always an aid. In the future, it may represent a group or producer ID. In these cases, the str '''type''' value will indicate what entity the ID represents.}}<br />
<br />
'''Method Two: Server PUSH'''<br />
<br />
With this method, the server takes the active role in advising the client that a new file has arrived. The client must register with the server to receive further advice information, and will be responsible for keeping the login session from timing out, and any NAT router ports open. The UDP packet is sent to the ip and port from which the AUTH command was received.<br />
<br />
This method compensates for the disadvantages of the polling method, but is more difficult to code. Blocking sockets are no longer an option, nor can a client make any assumptions that an incoming packet will necessarily be a reply to the last command sent. The tag option may be helpful here.<br />
<br />
A PUSH HOWTO:<br />
<br />
* PUSH to register your client session.<br />
* Listen for 720-799 NOTIFICATIONs ('''not 290''').<br />
* Use PUSHACK to to acknowledge the notification using the nid supplied with NOTIFICATION<br />
* Use NOTIFYGET to receive a notification, suppling the relid provided by NOTIFICATION (NOT the packet ID)<br />
* Use NOTIFYACK to acknowledge a notification, suppling the relid provided by NOTIFICATION (if desired)<br />
* Use UPTIME (with an interval between 30 and 35 minutes) to keep login session valid<br />
<br />
It is probably a good idea to use tags to separate NOTIFICATIONs from the other communication. NOTIFICATIONs will '''never''' have tags.<br />
<br />
=== PUSH: UDP Notification Registration ===<br />
Register your client as an observer for AniDB notification events for the current user. If you are registered for one or more event types the AniDB server will send an UDP packet (format see below) on each change which affects the current user.<br />
<br />
'''Command String:'''<br />
* PUSH notify={boolean on_new_file}&msg={boolean on_new_private_message}[&buddy={boolean on_buddy_event}]<br />
<br />
'''Possible Replies:'''<br />
* 270 NOTIFICATION ENABLED<br />
OR (if both values are 0)<br />
* 370 NOTIFICATION DISABLED<br />
<br />
'''Info:'''<br />
* A client which has registered to receive UDP notification packets must:<br />
** Issue a PUSHACK command for each notification received with ''notify_packet_id'' provided in the notification packet.<br />
** Use PING to keep the connection alive (< 30 min).<br />
** Use UPTIME to ensure that the session is OK (>= 30 min).<br />
* Every notification generated is resent 3 times unless acknowledged. After that the client is logged out.<br />
<br />
=== NOTIFY: Notifications ===<br />
Get number of pending notifications (and number of online buddies).<br />
<br />
'''Command String:'''<br />
* NOTIFY [buddy=1]<br />
<br />
'''Possible Replies:'''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}<br />
when ''buddy=1''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}|{int4 number_of_online_buddies}<br />
<br />
'''Info:'''<br />
* If the client did send a NOTIFY within the last 35 minutes and it was confirmed by AniDB then receiving a 501 LOGIN FIRST message for the next NOTIFY command shows that AniDB logged the client out because it did not respond to a PUSH Notification packet.<br />
* There is no command to retrieve missed PUSH Notifications.<br />
{{eyecatch|Note|This command MUST NOT be issued more than once every 20 minutes.}}<br />
<br />
----<br />
=== NOTIFYLIST: List Notification/Message IDs ===<br />
List id of all pending (not acknowledged) ''new private message'' and ''new file'' notifications. Buddy events cannot be acknowledged.<br />
<br />
'''Command String:'''<br />
* NOTIFYLIST<br />
<br />
'''Possible Replies:'''<br />
*291 NOTIFYLIST<br />
: {str type}|{int4 id}<br />
: {str type}|{int4 id}<br />
: ...<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as required by NOTIFYGET. For messages it is the actual message id, for notifications it is the id of the related type; anime, group or producer. Since only file notifications related to anime is implemented atm, it is the anime id (aid).<br />
* NOTIFYLIST returns one line per entry, if no entries are available only the first line of the reply is returned.<br />
{{eyecatch|Note|This command MUST NOT be issued regularly but should only be triggered by either a push message received by the client or a reply to a NOTIFY command which tells you that there are messages/notifications waiting.}}<br />
<br />
----<br />
=== NOTIFYGET: Get Notification/Message ===<br />
Receive private message or file notification.<br />
<br />
'''Command String:'''<br />
* NOTIFYGET type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 292 NOTIFYGET<br />
: {int4 id}|{int4 from_user_id}|{str from_user_name}|{int4 date}|{int4 type}|{str title}|{str body}<br />
* 392 NO SUCH ENTRY<br />
when type = N<br />
* 293 NOTIFYGET<br />
: {int4 relid}|{int4 type}|{int2 count}|{int4 date}|{str relidname}|{str fids}<br />
* 393 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as given by NOTIFYLIST (or ''relid'' from 271 NOTIFICATION and mid from 272 NOTIFICATION)<br />
* for message entries (M):<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: type is the type of the message (0=normal msg, 1=annonymous, 2=system msg, 3=mod msg)<br />
* for notification entries (N):<br />
: relid is the id of the related type (anime)<br />
: relname is the name of the related type (anime)<br />
: type is the notification type (0=all, 1=new, 2=group, 3=complete)<br />
: count is the number of events pending for this subscription<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: fids is a comma separated list with the affected file ids<br />
<br />
----<br />
=== NOTIFYACK: Acknowledge Notification/Message ===<br />
This command will mark a message read or clear a ''new file'' notification. Buddy events are not acknowledgeable.<br />
<br />
'''Command String:'''<br />
* NOTIFYACK type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 281 NOTIFYACK SUCCESSFUL<br />
* 381 NO SUCH ENTRY<br />
when type = N<br />
* 282 NOTIFYACK SUCCESSFUL<br />
* 382 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
<br />
====Notification Packet Format====<br />
'''New File Notify:'''<br />
<br />
720 {int4 notify_packet_id} NOTIFICATION - NEW FILE<br />
{int4 fidlist}|{int2 reltype}|{int2 priority}<br />
<br />
* fidlist is a comma separated list of file ids<br />
* reltype is: 1 = anime, 2 = group, 3 = producer<br />
* priority is: 0 = low, 1 = medium, 2 = high<br />
* new file notifications are created as a batch, so it is not unusual to get several new files for a particular anime at once. It is in this case that a comma separated list of fids will be returned<br />
<br />
{{eyecatch|Note|Group (and producer) related file notifications are not implemented yet.}}<br />
<br />
<br />
'''New Private Message Notify:'''<br />
<br />
794 {int4 notify_packet_id} NOTIFICATION - NEW MESSAGE<br />
{int2 type}|{int4 date}|{int4 sent_by_uid}|{str sent_by_name}|{str subject}|{str body}|{int mid}<br />
<br />
* type is the type of the message (0=normal msg, 1=anonymous, 2=system msg, 3=mod msg)<br />
* date is the time the message was sent (in seconds since 1.1.1970)<br />
* sender uid/sender name are the user id and user name of the sender<br />
* subject is the message subject<br />
* body is message body (can be truncated)<br />
* mid is message id and can be used with NOTIFYACK<br />
<br />
'''Buddy Event Notify:'''<br />
753 {int4 notify_packet_id} NOTIFICATION - BUDDY<br />
{int4 buddy uid}|{int2 event type}<br />
* Possible event types:<br />
** 0 => LOGIN<br />
** 1 => LOGOUT<br />
** 2 => ACCEPTED<br />
** 3 => ADDED<br />
<br />
<br />
'''Going Down Event Notify:'''<br />
799 {int4 notify_packet_id} NOTIFICATION - SHUTTING DOWN<br />
{int4 time offline}|{int4 comment}<br />
<br />
* Clients with any notification on will receive the SHUTTING DOWN message before the API goes offline.<br />
* Time offline is the time in minutes the API will be down, 0 if indefinite (client can direct user to the AniDB site for status updates).<br />
* The comment is a short explanation for the downtime.<br />
* Only one datagram will be sent, and the server will not listen for replies.<br />
<br />
<br />
=== PUSHACK: UDP Notification Acknowledge ===<br />
Used to acknowledge notification packets (720-799). A client must be prepared to issue this command before using '''PUSH'''.<br />
<br />
'''Command String:'''<br />
* PUSHACK nid={int4 notify_packet_id}<br />
<br />
'''Possible Replies:'''<br />
* 701 PUSHACK CONFIRMED<br />
* 702 NO SUCH PACKET PENDING<br />
<br />
'''Info:'''<br />
* See: '''PUSH'''<br />
<br />
== Buddy Commands ==<br />
Group of commands used to administrate your buddylist.<br />
<br />
=== BUDDYADD: Add a user to Buddy List ===<br />
'''Command String:'''<br />
* BUDDYADD uid={int4 buddy uid}<br />
* BUDDYADD uname={int4 buddy name}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 255 BUDDY ADDED<br />
* 355 BUDDY ALREADY ADDED<br />
<br />
----<br />
=== BUDDYDEL: Remove a user from Buddy List ===<br />
'''Command String:'''<br />
* BUDDYDEL uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 256 BUDDY DELETED<br />
<br />
----<br />
=== BUDDYACCEPT: Accept user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYACCEPT uid={int4 user uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 257 BUDDY ACCEPTED<br />
* 357 BUDDY ALREADY ACCEPTED<br />
<br />
----<br />
=== BUDDYDENY: Deny user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYDENY uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 258 BUDDY DENIED<br />
* 358 BUDDY ALREADY DENIED<br />
<br />
----<br />
=== BUDDYLIST: Retrieve Buddy List ===<br />
'''Command String:'''<br />
* BUDDYLIST startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 253 {int2 start} {int2 end} {int2 total} BUDDY LIST<br />
: {int4 uid}|{str username}|{int2 state}<br />
: ...<br />
'''Info:'''<br />
* state is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = this user is in your buddylist<br />
* bit 2 = this user has accepted you<br />
* bit 3 = this user is waiting for your approval<br />
<br />
----<br />
=== BUDDYSTATE: Retrieve Buddy States===<br />
'''Command String:'''<br />
* BUDDYSTATE startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 254 {int2 start} {int2 end} {int2 total} BUDDY STATE<br />
: {int4 uid}|{int2 onlinestate}<br />
: ...<br />
<br />
'''Info:'''<br />
* onlinestate is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = http online (user has issued a HTTP request within the last 10 minutes)<br />
* bit 2 = udp api online (user is currently connected to the udp api server)<br />
* example: 0=offline, 1=http online, 2=udp api online, 3=http&udp api online<br />
<br />
== Data Commands ==<br />
=== ANIME: Retrieve Anime Data ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIME aid={int4 id}[&amask={hexstr}]<br />
by name<br />
* ANIME aname={str anime name}[&amask={hexstr}]<br />
<br />
'''Possible Replies:'''<br />
<br />
If no ''amask'' is provided:<br />
* 230 ANIME<br />
: {int4 aid}|{int4 eps}|{int4 ep count}|{int4 special cnt}|{int4 rating}|{int4 votes}|{int4 tmprating}|{int4 tmpvotes}|{int4 review rating average}|{int4 reviews}|{str year}|{str type}|{str romaji}|{str kanji}|{str english}|{str other}|{str short names}|{str synonyms}|{str category list}<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* Fields are returned in the same order they appear in the ''amask'' field list: byte 1, bit 7 first<br />
* Synonyms and short names are separated with '<br />
* Category fields are separated with ',' and ordered by weight (desc).<br />
* By name: must be perfect match of romaji/kanji/english/other/synonym/short name.<br />
* 'Producer id list' and 'producer name list' match the data returned by the former producer bits (but using the revised creator ids)<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
* '''Note:''' The character id list is the first data to be truncated if needed. And then: tag list, synonym list, short name list. This applies to the FILE command too.<br />
* Selecting an 'unused' or 'reserved' bit will return an "illegal input" (505) response.<br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="5" align="center"><b>amask</b></td></tr><br />
<tr><br />
<td align="center"><b>Byte 1</b></td><br />
<td align="center"><b>Byte 2</b></td><br />
<td align="center"><b>Byte 3</b></td><br />
<td align="center"><b>Byte 4</b></td><br />
<td align="center"><b>Byte 5</b></td><br />
<td align="center"><b>Byte 6</b></td><br />
<td align="center"><b>Byte 7</b></td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int aid</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int dateflags</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 special ep count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int air date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int end date</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str url</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str picname</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int vote count</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 temp rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int temp vote count</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 average review rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int review count</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str award list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>bool is 18+ restricted</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int ANN id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int allcinema id</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str AnimeNfo id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td><i>reserved</i></td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td><i>reserved</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>reserved</i></td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int date record updated</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int character id list</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int creator id list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int main creator id list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str main creator name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 specials count</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 credits count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 other count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 trailer count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 parody count</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<br />
'''Related aid type (Byte 1, Bit 2):'''<br />
<pre><br />
value meaning<br />
<br />
1 sequel<br />
2 prequel<br />
11 same setting<br />
12 alternative setting<br />
32 alternative version<br />
41 music video<br />
42 character<br />
51 side story<br />
52 parent story<br />
61 summary<br />
62 full story<br />
100 other<br />
</pre><br />
<br />
'''Examples:''' (note that the given amask gives the same result as the default request)<br />
> ANIME aid=1&amask=b2f0e0fc000000&s=xxxxx<br />
< 230 ANIME<br />
1|1999-1999|TV Series|Space,Future,Plot Continuity,SciFi,Space Travel,Shipboard,Other Planet,Novel,Genetic Modification,Action,Romance,Military,Large Breasts,Gunfights,Adventure,Human Enhancement,Nudity|Seikai no Monshou|星界の紋章|Crest of the Stars||13|13|3|853|3225|756|110|875|11<br />
<br />
<br />
----<br />
<br />
=== ANIMEDESC: Retrieve Anime Description ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIMEDESC aid={int4 id}&part={int4 partno}<br />
<br />
'''Possible Replies:'''<br />
* 233 ANIMEDESC<br />
: {int4 current part}|{int4 max parts}|{str description}<br />
* 330 NO SUCH ANIME<br />
* 333 NO SUCH DESCRIPTION<br />
<br />
'''Info:'''<br />
* The maximum length of the anime description is roughly 5000 characters, but the maximum length of a UDP packet is 1400 bytes<br />
* Multiple calls to ANIMEDESC may be necessary to retrieve the complete text, retrieving separate 1400 byte parts with each call<br />
* ''part'' is zero-based<br />
* '''Note:''' No support, at present, for retrieving descriptions by title. ''aid'' only<br />
<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> ANIMEDESC aid=3169&part=0&s=xxxxx<br />
< 233 ANIMEDESC<br />
0|1|As summer break arrives for the students, Jun Sakurada is busily studying on his own in the library, making up for time lost <cut><br />
<br />
----<br />
=== CALENDAR: Get Upcoming Titles ===<br />
Returns the anime ids of the 25 most recently aired / released anime, directly followed by the next 25 anime due to be aired / released, ordered by start date.<br />
<br />
'''Command String:'''<br />
* CALENDAR<br />
<br />
'''Possible Replies:'''<br />
* 297 CALENDAR<br />
{int aid}|{int startdate}|{int dateflags}/n<br />
<br />
..repeated n times<br />
<br />
* 397 CALENDAR EMPTY<br />
<br />
'''Info:'''<br />
* Takes no parameters (other than the session string)<br />
* Titles returned are filtered by the 'show adult' preference of the logged in user. That is, users who have elected to hide adult content will have it hidden here as well.<br />
* Do not depend on the command always returning exactly 50 titles; there may not always be 25 future titles pending, depending on the user's 'adult' preferences, and the date in relation to the relation to the current anime season.<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
<br />
----<br />
=== CHARACTER: Get Character Information ===<br />
Returns character details associated with a given character ID, including associated anime ids, episode ids, and seiyuu.<br />
<br />
'''Command String:'''<br />
* CHARACTER charid={int characterid}<br />
<br />
'''Possible Replies:'''<br />
* 235 CHARACTER<br />
: {int charid}|{str character name kanji}|{str character name transcription}|{str pic}|{anime blocks}|{int episode list}|{int last update date}|{int2 type}|{str gender}<br />
<br />
: An 'anime block' is {int anime id},{int appearance},{int creatorid},{boolean is_main_seiyuu} repeated as many times as necessary, separated by a single quote ( ' ). <br />
<br />
* 335 NO SUCH CHARACTER<br />
<br />
'''Info:'''<br />
* If no seiyuu is associated with the character for a given aid, the 'creatorid' and 'is_main_seiyuu' fields will be empty, but the commas will remain.<br />
* An empty episode list is "undefined": no episode values have been added.<br />
* ''appearance'' values: 0='appears in', 1='cameo appearance in', 2='main character in', 3='secondary cast in'<br />
* ''type'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** 1 => 'Character'<br />
** 2 => 'Mecha'<br />
** 3 => 'Organisation'<br />
** 4 => 'Vessel' <br />
* ''gender'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** "M" => 'Male'<br />
** "F" => 'Female'<br />
** "I" => 'Intersexual'<br />
** "D" => 'Dimorphic'<br />
** "-" => 'none/does not apply'<br />
** "?" => 'unknown'<br />
<br />
'''Example:'''<br />
<br />
CHARACTER charid=488&s=DChan<br />
235 CHARACTER<br />
488|ニコ・ロビン|Nico Robin|14789.jpg|4097,2,1900,1'69,2,1901,0'6199,0,1900,1'5691,0,1900,1'2644,0,,'4851,0,1900,1||1236938094<br />
<br />
=== CREATOR: Get Creator Information ===<br />
<br />
'''Command String:'''<br />
* CREATOR creatorid={int creatorid}<br />
<br />
'''Possible Replies:'''<br />
* 245 CREATOR<br />
: {int creatorid}|{str creator name kanji}|{str creator name transcription}|{int type}|{str pic_name}|{str url_english}|{str url_japanese}|{str wiki_url_english}|{str wiki_url_japanese}|{int last update date}<br />
<br />
* 345 NO SUCH CREATOR<br />
<br />
'''Info:'''<br />
* ANIME AMASK byte6, bit5<br />
* ''type'' values: 1='person', 2='company', 3='collaboration'<br />
<br />
Example:<br />
<br />
245 CREATOR<br />
718|GAINAX|Gainax|2|10092.png||http://www.gainax.co.jp/|Gainax|Gainax|1237048093<br />
<br />
=== EPISODE: Retrieve Episode Data ===<br />
'''Command String:'''<br><br />
by eid<br />
* EPISODE eid={int eid}<br />
by anime and episode number<br />
* EPISODE aname={str anime name}&epno={int4 episode number}<br />
* EPISODE aid={int anime id}&epno={int4 episode number}<br />
<br />
'''Possible Replies:'''<br />
* 240 EPISODE<br />
: {int eid}|{int aid}|{int4 length}|{int4 rating}|{int votes}|{str epno}|{str eng}|{str romaji}|{str kanji}|{int aired}|{int type}<br />
* 340 NO SUCH EPISODE<br />
<br />
'''Info:'''<br />
* length is in minutes<br />
* Returned 'epno' includes special character (only if special) and padding (only if normal).<br />
** Special characters are S(special), C(credits), T(trailer), P(parody), O(other).<br />
* The ''type'' is the raw episode type, used to indicate numerically what the special character will be<br />
** 1: regular episode (no prefix), 2: special ("S"), 3: credit ("C"), 4: trailer ("T"), 5: parody ("P"), 6: other ("O")<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> EPISODE eid=1&s=xxxxx<br />
< 240 EPISODE<br />
1|1|24|400|4|01|Invasion|shinryaku|??<br />
<br />
> EPISODE aname=Seikai no Monshou&epno=2&s=xxxxx<br />
< 240 EPISODE<br />
2|1|24|750|2|02|Kin of the Stars|Hoshi-tachi no Kenzoku|??????|1295059229|1<br />
<br />
----<br />
<br />
=== FILE: Retrieve File Data ===<br />
'''Command String:'''<br><br />
by fid:<br />
* FILE fid={int4 id}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by size+ed2k hash:<br />
* FILE size={int8 size}&ed2k={str ed2khash}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by anime, group and epno<br />
* FILE aname={str anime name}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aname={str anime name}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
<br />
'''Possible Replies:'''<br />
* 220 FILE<br />
: {int4 fid}|{int4 aid}|{int4 eid}|{int4 gid}|{int4 state}|{int8 size}|{str ed2k}|{str anidbfilename}<br />
* 220 FILE<br />
: {int4 fid}|...(data list)<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 0}|{int4 fid 1}|...|{int4 fid n}<br />
* 320 NO SUCH FILE<br />
<br />
'''Info:'''<br />
* fid, aid, eid, gid are the unique ids for the file, anime, ep, group entries at AniDB.<br />
: You can use those to create links to the corresponding pages at AniDB.<br />
* anidbfilename is the AniDB filename for the file.<br />
: However this name does not contain all the extra information of the filenames on AniDB and might be composed slightly different.<br />
* fmask and amask are hexidecimal strings where each bit corresponds to a data field related to the specified file (see below). The data list received is sorted and returned in the same order as the tables: top to bottom, left to right, with fmask preceding amask. There is '''no''' provision to retrieve all fields. Further, requesting a 'unusued' or 'reserved' bit will return an "illegal input" error.<br />
* fid is always returned as the first value, regardless of what masks are provided.<br />
* Only the first matching file is returned when aname, gname and epno is used.<br />
* "audio codec" and "audio bitrate" will return multiple values if there are multiple audio streams present in the file. Values will be separated by a single quote. <br />
* For byte 1, bit 2 (other episodes): episode IDs will be followed by an integer '''percentage''' that indicate the percentage of the related episode this file covers. Typically 100%, there are cases where it will be 50, 30, or other values. This value provides no indication where, within an episode, the file represents. That is, 50% could mean the file covers the first half of the episode, the second half, or some 50% range in between.<br />
'''State:'''<br />
<pre><br />
bit / int value meaning<br />
1 / 1 FILE_CRCOK: file matched official CRC (displayed with green background in AniDB)<br />
2 / 2 FILE_CRCERR: file DID NOT match official CRC (displayed with red background in AniDB)<br />
3 / 4 FILE_ISV2: file is version 2<br />
4 / 8 FILE_ISV3: file is version 3<br />
5 / 16 FILE_ISV4: file is version 4<br />
6 / 32 FILE_ISV5: file is version 5<br />
7 / 64 FILE_UNC: file is uncensored<br />
8 / 128 FILE_CEN: file is censored<br />
<br />
examples:<br />
state ==== 9 ==> FILE_CRCOK+FILE_ISV3 ==> file matched official CRC and is version 3<br />
state ==== 0 ==> - ==> file was not crc checked and is version 1<br />
state ==== 34 ==> FILE_CRCERR+FILE_ISV5 ==> file DID NOT match official CRC and is version 5<br />
state ==== 1 ==> FILE_CRCOK ==> file matched official CRC and is version 1<br />
state ==== 8 ==> FILE_ISV3 ==> file was not CRC checked and is version 3<br />
</pre><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''fmask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
<td align="center">'''Byte 5'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 aid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 eid</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 gid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 mylist id</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>list other episodes</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>int2 IsDeprecated</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int2 state</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int8 size</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ed2k</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str md5</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str sha1</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str crc32</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>video colour depth</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str quality</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str audio codec list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 audio bitrate list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str video codec</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 video bitrate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str video resolution</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str file type (extension)</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str dub language</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str sub language</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 length in seconds</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str description</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 aired date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str anidb file name</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 mylist state</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 mylist filestate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 mylist viewed</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 mylist viewdate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str mylist storage</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str mylist source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str mylist other</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''amask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 anime total episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str category list</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str epno</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ep name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str ep romaji name</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str ep kanji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 episode rating</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 episode vote count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str group name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str group short name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int4 date aid record updated</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
'''Examples:''' (html escaped code intended)<br />
> FILE size=177747474&ed2k=70cd93fd3981cc80a8ea6a646ff805c9&fmask=7FF8FEF8&amask=C000F0C0&s=xxxxx<br />
< 220 FILE<br />
312498|4688|69260|4243|0||0|1|177747474|70cd93fd3981cc80a8ea6a646ff805c9|b2a7c7d591333e20495de3571b235c28|7af9b962c17ff729baeee67533e5219526cd5095|a200fe73|high|DTV|Vorbis (Ogg Vorbis)|104|H264/AVC|800|704x400|japanese|english'english'english|1560||1175472000|26|26|01|The Wings to the Sky|Sora he no Tsubasa|????|#nanoha-DamagedGoodz|Nanoha-DGz<br />
<br />
----<br />
<br />
=== GROUP: Retrieve Group Data ===<br />
'''Command String:'''<br><br />
by gid<br />
* GROUP gid={int gid}<br />
by name/shortname<br />
* GROUP gname={str group name}<br />
<br />
'''Possible Replies:'''<br />
* 250 GROUP<br />
: {int gid}|{int4 rating}|{int votes}|{int4 acount}|{int fcount}|{str name}|{str short}|{str irc channel}|{str irc server}|{str url}|{str picname}|{int4 foundeddate}|{int4 disbandeddate}|{int2 dateflags}|{int4 lastreleasedate}|{int4 lastactivitydate}|{list grouprelations}<br />
* 350 NO SUCH GROUP<br />
<br />
'''Info:'''<br />
* Requires login<br />
* ''gname'' is an exact match of either a group name or short name<br />
* As either name and short names are unique if there is a result from GROUP request by name that will be the only match<br />
* ''dateflags'' values:<br />
** bit0 set == Foundeddate, Unknown Day<br />
** bit1 set == Foundeddate, Unknown Month, Day<br />
** bit2 set == Disbandeddate, Unknown Day<br />
** bit3 set == Disbandeddate, Unknown Month, Day<br />
** bit5 set == Foundeddate, Unknown Year<br />
** bit6 set == Disbandeddate, Unknown Year<br />
* ''releasedate'' and ''activitydate'' are distinct. ''releasedate'' is the date a file was actually released by the group, where ''activitydate'' is the date of a file being added to AniDB. As such, lastrelease may very well be much older than lastactivity.<br />
* ''groupreleations'' is a list of apostrophe-separated pairs, where each pair consists of {int4 othergroupid},{int2 relationtype}<br />
** relationtype:<br />
*** 1 => "Participant in"<br />
*** 2 => "Parent of"<br />
*** 4 => "Merged from"<br />
*** 5 => "Now known as"<br />
*** 6 => "Other"<br />
<br />
'''Example:'''<br />
> GROUP gid=7091&s=bunny<br />
< 250 GROUP<br />
7091|832|1445|43|566|Frostii|Frostii|#frostii|irc.rizon.net|http://frostii.com|15844.jpg|1228089600|0|1|1301875200|1304222640|7255,1'3097,4'748,4'8106,1'8159,2'8402,1'8696,1'9022,1<br />
<br />
----<br />
<br />
=== GROUPSTATUS: Get Completed Episode ===<br />
Returns a list of group names and ranges of episodes released by the group for a given anime.<br />
<br />
'''Command String:'''<br />
* GROUPSTATUS aid={int animeid}[&state={int completion_state}]<br />
<br />
'''Possible Replies:'''<br />
* 225 GROUPSTATUS<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: ... (repeated)<br />
<br />
* 325 NO SUCH GROUPS FOUND<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* The seven fields will be repeated as necessary, one for each group, separated by a new line character<br />
* Groups will be filtered by the languages selected in the user's profile<br />
* If ''state'' is not supplied, groups with a completion state of <i>'ongoing'</i>, <i>'finished'</i>, or <i>'complete'</i> are returned<br />
* Groups are returned in order of descending episode count<br />
* If there are more groups to return than can be stored in a UDP packet, additional groups will be silently discarded<br />
* ''state'' values: <br />
#ongoing<br />
#stalled<br />
#complete<br />
#dropped<br />
#finished<br />
#specials only<br />
<br />
'''Example:'''<br />
> GROUP GROUPSTATUS aid=8692&s=vLl1N<br />
< 225 GROUPSTATUS<br />
7407|Coalgirls|3|25|839|12|1-25<br />
9863|Hadena Subs|3|25|374|1|1-25<br />
11951|ChaosBlades|3|25|0|0|1-25<br />
[truncated]<br />
<br />
=== UPDATED: Get List of Updated Anime IDs ===<br />
Returns a list of AniDB anime ids of anime that have been updated in in a given time frame, ordered by descending age.<br />
<br />
'''Command String:'''<br />
* UPDATED entity=1&[age={int4 id}|time={int4 date}]<br />
<br />
'''Possible Replies:'''<br />
* 243 UPDATED<br />
{int entity}|{int total count}|{int last update date}|{list aid}<br />
<br />
* 343 NO UPDATES<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1<br />
* Either ''age'' OR ''time'' can be specified, but not both<br />
* ''age'' is specified in days.<br />
** eg: age=30 requests a list of aid values of anime that have changed in the past 30 days<br />
* ''time'' is specified in unix time.<br />
** eg: time=1264982400 requests a list of aid values of anime that have changed since 2010-02-01<br />
* A maximum of 200 values will be returned<br />
* ''count'' specifies the total number of items found for the given time period. In short, if this value is great than 200, you have not retrieved all applicable ids.<br />
* ''last update date'' will contain the AniDB update time of the ''last'' aid to appear on the list<br />
<br />
'''An anime will be considered updated if:'''<br />
* A change is made to the anime record itself<br />
* An ''main'' or ''official'' anime title is added, edited, or deleted (not ''short'' or ''synonym'')<br />
* An episode for the anime is added, or delete (but NOT edited!)<br />
* An episode title is added, edited, or delete<br />
* An anime relation is added, or deleted<br />
<br />
== MyList Commands ==<br />
=== MYLIST: Retrieve MyList Data ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLIST lid={int4 lid}<br />
by fid:<br />
* MYLIST fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLIST size={int4 size}&ed2k={str ed2khash}<br />
by anime + group + epno<br />
* MYLIST aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 221 MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 312 MULTIPLE MYLIST ENTRIES<br />
: {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}<br />
* 321 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* The state field provides information about the location and sharing state of a file in MyList.<br />
* 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).<br />
* eps is a list of episodes, e.g. "1-12,14-16,T1"<br />
<br />
'''States:'''<br />
0 - unknown - state is unknown or the user doesn't want to provide this information<br />
1 - on hdd - the file is stored on hdd (but is not shared)<br />
2 - on cd - the file is stored on cd<br />
3 - deleted - the file has been deleted or is not available for other reasons (i.e. reencoded)<br />
<br />
'''Filestates:''' (for normal files, i.e. not generic)<br />
0 => normal/original<br />
1 => corrupted version/invalid crc<br />
2 => self edited<br />
10 => self ripped<br />
11 => on dvd<br />
12 => on vhs<br />
13 => on tv<br />
14 => in theaters<br />
15 => streamed<br />
100 => other<br />
<br />
'''Example:'''<br />
> MYLIST aname=gits sac&s=xxxxx<br />
< 322 MULTIPLE FILES FOUND<br />
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<br />
<br />
----<br />
=== MYLISTADD: Add file to MyList ===<br />
The command string for MYLISTADD is made of up two blocks: a 'fileinfo' block, which limits the command to a specific file, or an 'animeinfo'/'groupinfo'/'episodeinfo' block, which can be used to specify a range of files, including generics. Additionally, a number of optional parameters can be included with either set.<br />
<br />
'''Adding a single file to the MyList with the 'fileinfo' block'''<br />
<br />
* MYLISTADD fid={int4 fid}<br />
'''or'''<br />
* MYLISTADD size={int4 size}&ed2k={str ed2khash}<br />
'''or'''<br />
* MYLISTADD lid={int4 lid}&edit=1 (valid for edit only)<br />
<br />
'''Adding one or more files to the MyList with the 'animeinfo'/'groupinfo'/'episodeinfo' block'''<br />
<br />
Here, you have a number of options, depending on what data you have available. In brief, 'animeinfo' represents a choice between anime id and anime name. 'groupinfo' represents a choice between group id, group name, and generic=1. 'episodeinfo' represents a range of one or more episodes.<br />
<br />
* MYLISTADD aid={int4 aid}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&generic=1&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&generic=1&epno={int4 episode number}<br />
<br />
Each command listed can have, in addition, a number of optional components to provide further MyList details. Append these as desired.<br />
<br />
* &state={int2 state}<br />
* &viewed={boolean viewed}<br />
* &viewdate={int4 viewdate}<br />
* &source={str source}<br />
* &storage={str storage}<br />
* &other={str other}<br />
<br />
Finally, edit=1 can be included to edit a MyList entry instead of creating a new one. When editing, optional values that are not supplied retain their original value. That is, they are ''not'' replaced with default or empty values. Only values supplied are updated.<br />
<br />
'''Possible Replies:'''<br />
* 320 NO SUCH FILE<br />
* 330 NO SUCH ANIME<br />
* 350 NO SUCH GROUP<br />
when edit=0 and adding by fid, size/ed2k<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 mylist id of new entry}<br />
when edit=0 and adding by aname, aid<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 number of entries added}<br />
* 310 FILE ALREADY IN MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 1}|{int4 fid 2}|...|{int4 fid n}<br />
when edit=1<br />
* 311 MYLIST ENTRY EDITED<br />
* 311 MYLIST ENTRY EDITED<br />
: {int4 number of entries edited}<br />
* 411 NO SUCH MYLIST ENTRY<br />
<br />
'''Info:'''<br />
* All data except lid/fid/size+hash/generic is optional.<br />
* Viewed should be 0 for unwatched files and 1 for watched files.<br />
* If viewdate is not specified, the current time will be used. The field will be disregarded if viewed=0.<br />
* Other is the only field which may contain newlines, but they have to be stored as &lt;br /&gt;<br />
* For state values refer to: '''MYLIST'''<br />
* If you want to change an existing entry and already know its MyList id (lid) please use the lid-version of this command. It put less load on the server.<br />
* epno=0 means all eps (default), negative numbers means upto. (-12 -> upto 12)<br />
* group is optional only when edit=1, meaning you can't add every file for an anime<br />
* If the file already exists (response code 310), the ''current'' record will be returned, in the same format as the MYLIST response.<br />
----<br />
<br />
=== MYLISTDEL: Remove file from MyList ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLISTDEL lid={int4 lid}<br />
by fid:<br />
* MYLISTDEL fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLISTDEL size={int4 size}&ed2k={str ed2k hash}<br />
by anime + group + epno<br />
* MYLISTDEL aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 211 MYLIST ENTRY DELETED<br />
: {int4 number of entries}<br />
* 411 NO SUCH MYLIST ENTRY<br />
'''Info:'''<br />
* group is optional<br />
* command will delete all enties found<br />
<br />
----<br />
=== MYLISTSTATS : Retrieve MyList stats ===<br />
'''Command String:'''<br />
* MYLISTSTATS<br />
'''Possible Replies:'''<br />
* 222 MYLIST STATS<br />
{animes}|{eps}|{files}|{size of files}|{added animes}|{added eps}|{added files}|{added groups}|{leech %}|{glory %}|{viewed % of db}|{mylist % of db}|{viewed % of mylist}|{number of viewed eps}|{votes}|{reviews}|{viewed length in minutes}<br />
<br />
'''Info:'''<br />
* All fields are int<br />
<br />
----<br />
<br />
=== VOTE: Vote for specified anime/episode/group ===<br />
'''Command String:'''<br><br />
by id<br />
* VOTE type={int2 type}&id={int4 id}[&value={int4 vote value}&epno={int4 episode number}]<br />
by name<br />
* VOTE type={int2 type}&name={string name}[&value={int4 vote value}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 260 VOTED<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 261 VOTE FOUND<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 262 VOTE UPDATED<br />
: {str entity name}|{old vote value}|{vote type}|{entity id}<br />
* 263 VOTE REVOKED<br />
: {str entity name}|{revoked vote value}|{vote type}|{entity id}<br />
* 360 NO SUCH VOTE<br />
: {str entity name}|0|{vote type}|{entity id}<br />
* 361 INVALID VOTE TYPE<br />
* 362 INVALID VOTE VALUE<br />
* 363 PERMVOTE NOT ALLOWED<br />
: {str aname}|{vote value}|{type}|{entity id}<br />
* 364 ALREADY PERMVOTED<br />
: {str entity name}|{existing vote value}|{vote type}|{entity id}<br />
<br />
'''Info:'''<br />
* type: 1=anime, 2=anime tmpvote, 3=group<br />
* entity: anime, episode, or group<br />
* for episode voting add epno on type=1<br />
* value: negative number means revoke, 0 means retrieve (default), 100-1000 are valid vote values, rest is illegal<br />
* votes will be updated automatically (no questions asked)<br />
* tmpvoting when there exist a perm vote is not possible<br />
<br />
----<br />
<br />
=== RANDOM: Get a random anime ===<br />
'''Command String:'''<br />
* RANDOMANIME type={int4 type}<br />
<br />
'''Possible Replies:'''<br />
* 230 ANIME ... (see ANIME)<br />
<br />
'''Info:'''<br />
* type: 0=from db, 1=watched, 2=unwatched, 3=all mylist<br />
<br />
== Misc Commands ==<br />
=== MYLISTEXPORT: Schedule a MyList Export ===<br />
Queues a {{AniDBLink|export|MyList Export}} by the AniDB Servers. As with a manual export request, exports are only done during periods when server load is low. As a result, exports may take up to 24 hours. The client submitting the request will receive an AniDB message when the export is ready to be collected.<br />
<br />
Only one export can be in the queue at a time.<br />
<br />
'''Command String:'''<br />
* MYLISTEXPORT [template={str template_name}|cancel=1]<br />
<br />
'''Possible Replies:'''<br />
* 217 EXPORT QUEUED<br />
* 218 EXPORT CANCELLED<br />
* 317 EXPORT NO SUCH TEMPLATE<br />
* 318 EXPORT ALREADY IN QUEUE<br />
* 319 EXPORT NO EXPORT QUEUED OR IS PROCESSING<br />
<br />
'''Info:'''<br />
* ''template_name'' must match an available export template on the {{AniDBLink|export|MyList Export}} page.<br />
* ''cancel'' will cancel any pending export request, queued either through UDP or the web server.<br />
* Clients can subscribe the message notifications if they wish to be notified when an export is complete.<br />
<br />
----<br />
<br />
=== PING: Ping Command ===<br />
'''Command String:'''<br />
* PING [nat=1]<br />
<br />
'''Possible Replies:'''<br />
* 300 PONG<br />
: {int4 port} ''(when nat=1)''<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* May be used by a frontend to determine if the API is still available.<br />
* May be executed even if not yet logged in.<br />
* The option <tt>nat=1</tt> provides an easy way to determine if the router has changed the outgoing port. ({{t|587}})<br />
<br />
----<br />
<br />
=== VERSION: Retrieve Server Version ===<br />
'''Command String:'''<br />
* VERSION<br />
<br />
'''Possible Replies:'''<br />
* 998 VERSION<br />
: {str server version}<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
<br />
----<br />
=== UPTIME: Retrieve Server Uptime ===<br />
'''Command String:'''<br />
* UPTIME<br />
<br />
'''Possible Replies:'''<br />
* 208 UPTIME<br />
: {int4 udpserver uptime in milliseconds}<br />
<br />
'''Info:'''<br />
* This command is the preferred way to check that the session is OK.<br />
<br />
----<br />
=== ENCODING: Change Encoding for Session ===<br />
Sets preferred [[Wikipedia:Character encoding|encoding]] per session. The preferred way to do this is to use the '''enc''' argument for AUTH. This command is mostly for testing.<br />
<br />
'''Command String:'''<br />
* ENCODING name={str encoding name}<br />
<br />
'''Possible Replies:'''<br />
* 219 ENCODING CHANGED<br />
* 519 ENCODING NOT SUPPORTED<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* Supported encodings: http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html<br />
* Default: ASCII.<br />
* Resets to default on logout.<br />
<br />
----<br />
<br />
=== SENDMSG: Send Message ===<br />
'''Command String:'''<br />
* SENDMSG to={str username}&title={str title}&body={str body}<br />
<br />
'''Possible Replies:'''<br />
* 294 SENDMSG SUCCESSFUL<br />
* 394 NO SUCH USER<br />
* 501 LOGIN FIRST<br />
<br />
'''Note:'''<br />
* This command allows you to send an AniDB message.<br />
{{eyecatch|Important|<br />
title must not be longer than 50 chars.<br><br />
body must not be longer than 900 chars.<br />
}}<br />
<br />
----<br />
=== USER: Retrieve User UID ===<br />
'''Command String:'''<br />
* USER [user={str user name}|uid={int user id}]<br />
<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 295 USER<br />
: {int4 uid}|{str username}<br />
<br />
----<br />
<br />
=== STATS [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* STATS<br />
<br />
'''Possible Replies:'''<br />
* 206 STATS<br />
: {int4 animes)|{int4 eps}|{int4 files}|{int4 groups}|{int4 users}|{int8 total file size in bytes}|{int4 open [[creq|creqs]]}<br />
<br />
----<br />
=== TOP [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* TOP<br />
<br />
'''Possible Replies:'''<br />
* 207 TOP<br />
: {str longest mylist}|{int count}<br />
: {str largest mylist}|{int count}<br />
: {str most lame files}|{int count}<br />
: {str most indep. user}|{int count}<br />
: {str biggest leecher}|{int count}<br />
: {str most anime added}|{int count}<br />
: {str most eps added}|{int count}<br />
: {str most files added}|{int count}<br />
: {str most groups added}|{int count}<br />
: {str most votes}|{int count}<br />
: {str most reviews}|{int count}<br />
<br />
'''Info:'''<br />
* All strings are user names.<br />
* 'Hide myself in IRC stats' applies for this too.<br />
<br />
== Fatal Errors ==<br />
At anypoint int the retrieval process you have to expect the following output:<br />
* 6xx INTERNAL SERVER ERROR<br />
: ERROR: {str errormessage}<br />
OR<br />
*6xx INTERNAL SERVER ERROR - {str errormessage}<br />
<br />
Such errors should be reported back to [[User:Ommina|Ommina]].<br />
(xx is a number between 00 and 99)<br />
<br />
If you supply an unknown or unimplemented command you will get an error:<br />
* 598 UNKNOWN COMMAND<br />
<br />
== Return Codes ==<br />
{{eyecatch|Note|While the names below '''are''' the actual code strings returned by the server, clients are nonetheless encouraged to work with the numeric codes instead. }}<br />
<pre><br />
LOGIN_ACCEPTED = 200<br />
LOGIN_ACCEPTED_NEW_VERSION = 201<br />
LOGGED_OUT = 203<br />
RESOURCE = 205<br />
STATS = 206<br />
TOP = 207<br />
UPTIME = 208<br />
ENCRYPTION_ENABLED = 209<br />
MYLIST_ENTRY_ADDED = 210<br />
MYLIST_ENTRY_DELETED = 211<br />
ADDED_FILE = 214<br />
ADDED_STREAM = 215<br />
EXPORT_QUEUED = 217<br />
EXPORT_CANCELLED = 218<br />
ENCODING_CHANGED = 219<br />
FILE = 220<br />
MYLIST = 221<br />
MYLIST_STATS = 222<br />
WISHLIST = 223<br />
NOTIFICATION = 224<br />
GROUP_STATUS = 225<br />
WISHLIST_ENTRY_ADDED = 226<br />
WISHLIST_ENTRY_DELETED = 227<br />
WISHLIST_ENTRY_UPDATED = 228<br />
MULTIPLE_WISHLIST = 229<br />
ANIME = 230<br />
ANIME_BEST_MATCH = 231<br />
RANDOM_ANIME = 232<br />
ANIME_DESCRIPTION = 233<br />
REVIEW = 234<br />
CHARACTER = 235<br />
SONG = 236<br />
ANIMETAG = 237<br />
CHARACTERTAG = 238<br />
EPISODE = 240<br />
UPDATED = 243<br />
TITLE = 244<br />
CREATOR = 245<br />
NOTIFICATION_ENTRY_ADDED = 246<br />
NOTIFICATION_ENTRY_DELETED = 247<br />
NOTIFICATION_ENTRY_UPDATE = 248<br />
MULTIPLE_NOTIFICATION = 249<br />
GROUP = 250<br />
CATEGORY = 251<br />
BUDDY_LIST = 253<br />
BUDDY_STATE = 254<br />
BUDDY_ADDED = 255<br />
BUDDY_DELETED = 256<br />
BUDDY_ACCEPTED = 257<br />
BUDDY_DENIED = 258<br />
VOTED = 260<br />
VOTE_FOUND = 261<br />
VOTE_UPDATED = 262<br />
VOTE_REVOKED = 263<br />
HOT_ANIME = 265<br />
RANDOM_RECOMMENDATION = 266<br />
RANDOM_SIMILAR = 267<br />
NOTIFICATION_ENABLED = 270<br />
NOTIFYACK_SUCCESSFUL_MESSAGE = 281<br />
NOTIFYACK_SUCCESSFUL_NOTIFIATION = 282<br />
NOTIFICATION_STATE = 290<br />
NOTIFYLIST = 291<br />
NOTIFYGET_MESSAGE = 292<br />
NOTIFYGET_NOTIFY = 293<br />
SENDMESSAGE_SUCCESSFUL = 294<br />
USER_ID = 295<br />
CALENDAR = 297<br />
<br />
PONG = 300<br />
AUTHPONG = 301<br />
NO_SUCH_RESOURCE = 305<br />
API_PASSWORD_NOT_DEFINED = 309<br />
FILE_ALREADY_IN_MYLIST = 310<br />
MYLIST_ENTRY_EDITED = 311<br />
MULTIPLE_MYLIST_ENTRIES = 312<br />
WATCHED = 313<br />
SIZE_HASH_EXISTS = 314<br />
INVALID_DATA = 315<br />
STREAMNOID_USED = 316<br />
EXPORT_NO_SUCH_TEMPLATE = 317<br />
EXPORT_ALREADY_IN_QUEUE = 318<br />
EXPORT_NO_EXPORT_QUEUED_OR_IS_PROCESSING = 319<br />
NO_SUCH_FILE = 320<br />
NO_SUCH_ENTRY = 321<br />
MULTIPLE_FILES_FOUND = 322<br />
NO_SUCH_WISHLIST = 323<br />
NO_SUCH_NOTIFICATION = 324<br />
NO_GROUPS_FOUND = 325<br />
NO_SUCH_ANIME = 330<br />
NO_SUCH_DESCRIPTION = 333<br />
NO_SUCH_REVIEW = 334<br />
NO_SUCH_CHARACTER = 335<br />
NO_SUCH_SONG = 336<br />
NO_SUCH_ANIMETAG = 337<br />
NO_SUCH_CHARACTERTAG = 338<br />
NO_SUCH_EPISODE = 340<br />
NO_SUCH_UPDATES = 343<br />
NO_SUCH_TITLES = 344<br />
NO_SUCH_CREATOR = 345<br />
NO_SUCH_GROUP = 350<br />
NO_SUCH_CATEGORY = 351<br />
BUDDY_ALREADY_ADDED = 355<br />
NO_SUCH_BUDDY = 356<br />
BUDDY_ALREADY_ACCEPTED = 357<br />
BUDDY_ALREADY_DENIED = 358<br />
NO_SUCH_VOTE = 360<br />
INVALID_VOTE_TYPE = 361<br />
INVALID_VOTE_VALUE = 362<br />
PERMVOTE_NOT_ALLOWED = 363<br />
ALREADY_PERMVOTED = 364<br />
HOT_ANIME_EMPTY = 365<br />
RANDOM_RECOMMENDATION_EMPTY = 366<br />
RANDOM_SIMILAR_EMPTY = 367<br />
NOTIFICATION_DISABLED = 370<br />
NO_SUCH_ENTRY_MESSAGE = 381<br />
NO_SUCH_ENTRY_NOTIFICATION = 382<br />
NO_SUCH_MESSAGE = 392<br />
NO_SUCH_NOTIFY = 393<br />
NO_SUCH_USER = 394<br />
CALENDAR_EMPTY = 397<br />
NO_CHANGES = 399<br />
<br />
NOT_LOGGED_IN = 403<br />
NO_SUCH_MYLIST_FILE = 410<br />
NO_SUCH_MYLIST_ENTRY = 411<br />
MYLIST_UNAVAILABLE = 412<br />
<br />
LOGIN_FAILED = 500<br />
LOGIN_FIRST = 501<br />
ACCESS_DENIED = 502<br />
CLIENT_VERSION_OUTDATED = 503<br />
CLIENT_BANNED = 504<br />
ILLEGAL_INPUT_OR_ACCESS_DENIED = 505<br />
INVALID_SESSION = 506<br />
NO_SUCH_ENCRYPTION_TYPE = 509<br />
ENCODING_NOT_SUPPORTED = 519<br />
BANNED = 555<br />
UNKNOWN_COMMAND = 598<br />
<br />
INTERNAL_SERVER_ERROR = 600<br />
ANIDB_OUT_OF_SERVICE = 601<br />
SERVER_BUSY = 602<br />
NO_DATA = 603<br />
TIMEOUT - DELAY AND RESUBMIT = 604<br />
API_VIOLATION = 666<br />
<br />
PUSHACK_CONFIRMED = 701<br />
NO_SUCH_PACKET_PENDING = 702<br />
<br />
VERSION = 998</pre><br />
<br />
[[Category:Development]]<br />
[[Category:UDP]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=HTTP_API_Definition&diff=22422HTTP API Definition2015-12-26T05:57:22Z<p>Ommina: </p>
<hr />
<div>{{TOCright}}<br />
<br />
== General ==<br />
The HTTP XML API is only a small part of the AniDB API framework, please refer to [[API]] for an overview.<br />
<br />
=== Clients ===<br />
<br />
If you want to create a client you have to register it {{AniDBLink|client|here}} and [[HTTP / UDP Clients|here]].<br />
<br />
=== Encoding ===<br />
All content is UTF8 encoded and gzip compressed (you may have to handle the decompressing yourself, if your HTTP library doesn't support compression of HTTP data). Transfer is in chunks, which are part of HTTP 1.1. This is the case even when your client requested uncompressed HTTP 1.0.<br />
<br />
=== Flooding and Caching ===<br />
All users of this API should employ heavy local caching. Requesting the same dataset multiple times on a single day can get you banned. The same goes for request flooding. You should not request more than one page every two seconds.<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Parameters ===<br />
These parameters apply to all HTTP XML API pages and should always be added to the request URLs.<br />
<br />
All users of the HTTP XML API need to be registered and have to provide their registered client identifier and version number on each request.<br />
<br />
Parameters:<br />
* <tt>client={string}</tt> [required]<br />
** client identification string, needs to be a registered client identifier, see: <br />
<br />
* <tt>clientver={integer}</tt> [required]<br />
** client version number, needs to be valid client version number for the given client identification string.<br />
<br />
* <tt>protover={integer}</tt> [required]<br />
** protocol version in use. Possible values: 1<br />
<br />
* <tt>request={string}</tt> [required]<br />
** HTTP XML datapage requested. See following sections.<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1</nowiki></u><br />
<br />
== Data Commands ==<br />
<br />
=== Anime ===<br />
Allows retrieval of non-file or episode related information for a specific anime by AID (AniDB anime id).<br />
<br />
==== Search ====<br />
* [[API#Anime_Titles|Look here]]<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=anime</tt><br />
* <tt>aid={integer}</tt> [required]<br />
** AniDB anime id of the anime you want to retrieve data for.<br />
<br />
<br />
{{eyecatch|Note|The tags node presently contains both 'spoiler' and 'localspoiler' attributes. Both represent the same value. Clients should use 'localspoiler'; in time, 'spoiler' will be removed.}}<br />
<br />
<br />
{{eyecatch|Important!|The meaning of the <temporary> vote node has changed since the HTTP API was put in place. To help keep clients compatible, the node will not be removed short term, but client consumers should be aware that this value now represents the mean of all votes (both permanent and temporary).}}<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime&client={str}&clientver={int}&protover=1&aid={int}</nowiki></u><br />
<br />
===== Data =====<br />
<code><pre><br />
<?xml version="1.0" encoding="UTF-8"?><br />
<anime id="1" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>1999-01-04</startdate><br />
<enddate>1999-03-29</enddate><br />
<titles><br />
<title xml:lang="x-jat" type="main">Seikai no Monshou</title><br />
<title xml:lang="zh-Hans" type="syn">星界之纹章</title><br />
<title xml:lang="en" type="short">CotS</title><br />
<title xml:lang="x-jat" type="short">SnM</title><br />
<title xml:lang="ja" type="official">星界の紋章</title><br />
<title xml:lang="en" type="official">Crest of the Stars</title><br />
<title xml:lang="fr" type="official">Crest of the Stars</title><br />
<title xml:lang="pl" type="official">Crest of the Stars</title><br />
</titles><br />
<relatedanime><br />
<anime id="4" type="Sequel">Seikai no Senki</anime><br />
<anime id="6" type="Prequel">Seikai no Danshou</anime><br />
<anime id="1623" type="Summary">Seikai no Monshou Tokubetsuhen</anime><br />
</relatedanime><br />
<url>http://www.sunrise-inc.co.jp/seikai/</url><br />
<creators><br />
<name id="4495" type="Original Work">Morioka Hiroyuki</name><br />
</creators><br />
<description>Jinto Lin`s life changes forever when the Humankind Empire Abh takes over his home planet of Martine without firing a single shot. He is soon sent off to study the Abh language and culture and to prepare himself for his future as a nobleman — a future he never dreamed of. Or wanted.Now, Jinto is entering the next phase of his training, and he is about to meet his first Abh, the lovely Lafiel. But Jinto is about to learn that she is more than she appears to be. And together they will have to fight for their very lives.</description><br />
<ratings><br />
<permanent count="2953">8.53</permanent><br />
<temporary count="96">7.58</temporary><br />
<review count="11">8.75</review><br />
</ratings><br />
<picture>440.jpg</picture><br />
<categories><br />
<category id="174" parentid="8" hentai="false" weight="500"><br />
<name>Space Travel</name><br />
<description>Space Travel usually refers going to space or travelling there with or without a spacecraft. There are different forms of space travel like Interplanetary travel, Interstellar travel or Intergalactic travel. Since it isn`t possible to travel faster than light, most anime series involve some sort "sub-space travel mechanism" as a way to travel faster than light.</description><br />
</category><br />
<category id="274" parentid="268" hentai="false" weight="400"><br />
<name>Novel</name><br />
<description>Note that novel means book with words in paper, so no comics and no "visual novels", which should go under manga and dating-sim - visual Novel/erotic game respectively.&#13;<br />
&#13;<br />
Note that it can be applied to novels as we know them but also the typical light novels for teens and young adults, which are common in Japan and aside from being short include a number of illustrations. </description><br />
</category><br />
</categories><br />
<tags><br />
<tag id="136" approval="20" spoiler="false" update="2009-05-23"><br />
<name>space opera</name><br />
<count>71</count><br />
</tag><br />
<tag id="175" approval="17" spoiler="false" update="2008-03-13"><br />
<name>space elves</name><br />
<count>12</count><br />
</tag><br />
<tag id="389" approval="15" spoiler="false" update="2008-06-03"><br />
<name>war setting</name><br />
<count>64</count><br />
</tag><br />
<tag id="393" approval="18" spoiler="false" update="2008-06-03"><br />
<name>space battles</name><br />
<count>43</count><br />
<description>There are space battles in this anime. Usually between Earth forces and some alien invader, but ship to ship skirmishes in deep space are just as common.</description><br />
</tag><br />
</tags><br />
<characters><br />
<character id="7493" type="appears in" update="2009-05-28"><br />
<name>Gosroth</name><br />
<description>The Resii Gothroth.The first Abh ship lost in the war.</description><br />
<episodes>1,1012</episodes><br />
<picture>26147.jpg</picture><br />
</character><br />
<character id="7501" type="appears in" update="2009-05-28"><br />
<name>Planet Martine</name><br />
<description>The homeworld of Jinto</description><br />
<episodes>1</episodes><br />
</character><br />
<character id="7503" type="appears in" update="2009-05-28"><br />
<name>Rock Lynn</name><br />
<description>The former president of Martine, later made count of the Hyde system, after striking a deal with the Abh (in episode 1)</description><br />
<episodes>1</episodes><br />
<picture>26165.jpg</picture><br />
</character><br />
</characters><br />
<episodes><br />
<episode id="1" update="2005-03-10"><br />
<epno>1</epno><br />
<length>24</length><br />
<airdate>1999-01-03</airdate><br />
<rating votes="17">5.66</rating><br />
<title xml:lang="ja">侵略</title><br />
<title xml:lang="en">Invasion</title><br />
<title xml:lang="fr">Invasion</title><br />
<title xml:lang="x-jat">shinryaku</title><br />
</episode><br />
<episode id="2" update="2005-03-11"><br />
<epno>2</epno><br />
<length>24</length><br />
<airdate>1999-01-10</airdate><br />
<rating votes="12">6.66</rating><br />
<title xml:lang="ja">星たちの眷族</title><br />
<title xml:lang="en">Kin of the Stars</title><br />
<title xml:lang="fr">Les parents des Étoiles</title><br />
<title xml:lang="x-jat">Hoshi-tachi no Kenzoku</title><br />
</episode><br />
</episodes><br />
</anime><br />
</pre></code><br />
<br />
==== Errors ====<br />
[http://anidb.net/perl-bin/animedb.pl?show=cmt&post=159118 According to ommina] the API does not use HTTP return code. Instead you will get XML consisting of one tag with a textual description.<br />
<code><pre><br />
<error>Banned</error><br />
</pre></code><br />
<br />
=== Random Recommendation ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random recommendations' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomrecommendation</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomrecommendation</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomrecommendation</nowiki></u><br />
<br />
<code><pre><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="7899" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>2010-10-04</startdate><br />
<enddate>2010-12-27</enddate><br />
<title xml:lang="x-jat" type="main">Arakawa Under the Bridge 2</title><br />
<picture>54734.jpg</picture><br />
<ratings><br />
<permanent count="781">623</permanent><br />
<recommendations>8</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
...<br />
<br />
<randomrecommendation><br />
</pre></code><br />
<br />
=== Random Similar ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random similar' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomsimilar</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomsimilar</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomsimilar</nowiki></u><br />
<br />
<code><pre><br />
<randomsimilar><br />
<similar><br />
<source aid="7056" restricted="false"><br />
<title xml:lang="x-jat" type="main">Aoi Bungaku Series</title><br />
<picture>37124.jpg</picture><br />
</source><br />
<target aid="3654" restricted="false"><br />
<title xml:lang="x-jat" type="main">Ayakashi: Japanese Classic Horror</title><br />
<picture>44085.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
</randomsimilar><br />
</pre></code><br />
<br />
=== Hot Anime ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Unlike the two random result commands, the results here will match the results as supplied by the main web page (with some possible variance of a few hours, depending on cache life.)<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=hotanime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=hotanime</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=hotanime</nowiki></u><br />
<br />
<code><pre><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
</pre></code><br />
<br />
=== Main ===<br />
<br />
A one-stop command returning the combined results of random recommendation, random similar, and hot anime. Use this command instead of scraping the HTML, and if you need more than one of the individual replies.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=main</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=main</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=main</nowiki></u><br />
<br />
<code><pre><br />
<main><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
<randomsimilar><br />
<similar><br />
<source aid="8107" restricted="false"><br />
<title xml:lang="x-jat" type="main">A Channel: The Animation</title><br />
<picture>59870.jpg</picture><br />
</source><br />
<target aid="4777" restricted="false"><br />
<title xml:lang="x-jat" type="main">Lucky Star</title><br />
<picture>65555.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
<randomsimilar><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="44" restricted="false"><br />
<type>OVA</type><br />
<episodecount>1</episodecount><br />
<startdate>2000-05-24</startdate><br />
<enddate>2000-05-24</enddate><br />
<title xml:lang="x-jat" type="main">Amon Devilman Mokushiroku</title><br />
<picture>14016.jpg</picture><br />
<ratings><br />
<permanent count="317">387</permanent><br />
<recommendations>1</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
....<br />
<br />
</randomrecommendation><br />
</main><br />
</pre></code><br />
<br />
== User Data Commands ==<br />
<br />
=== User Mylist Summary ===<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=mylistsummary&user={str anidb username}&pass={str anidb password}</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=mylistsummary</tt><br />
** Returns a list of the user's anime list in summary form, roughly matching the data in the "my list" page of the web interface.<br />
* <tt>user={str username}&pass={str password}</tt><br />
** The user name and password of the desired user. This is their main password, not the API password specified in the profile.<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=mylistsummary&user={str}&pass={str}</nowiki></u><br />
<br />
<code><pre><br />
<mylistsummary uid="40237"><br />
<mylistitem aid="5841" state="2"><br />
<episodecount>22</episodecount><br />
<seencount>22</seencount><br />
<specialcount>9</specialcount><br />
<seenspecialcount>4</seenspecialcount><br />
</mylistitem><br />
<mylistsummary><br />
</pre></code><br />
<br />
=== User Hints ===<br />
<br />
Returns a list of unwatched titles and a calculated rating, based upon existing votes. The list may be empty if the requested user is very new, has not voted for enough titles, or has very stale (a number of months old) data.<br />
<br />
Hints are calculated once a day.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=hints&user={str anidb username}&pass={str anidb password}&type=1</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=hints</tt><br />
* <tt>user={str username}&pass={str password}</tt><br />
** The user name and password of the desired user. This is their main password, not the API password specified in the profile.<br />
* <tt>type=1</tt><br />
** always 1, but must be included.<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=hints&user={str}&pass={str}&type=1</nowiki></u><br />
<br />
<code><pre><br />
<hints uid="40237" type="1"><br />
<hint adddate="2015-03-23"><br />
<relid>5</relid><br />
<calculated>8.09</calculated><br />
</hint><br />
</hints><br />
</pre></code><br />
<br />
[[Category:Development]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=HTTP_API_Definition&diff=18528HTTP API Definition2015-06-04T05:16:19Z<p>Ommina: /* User Mylist Summary */</p>
<hr />
<div>{{TOCright}}<br />
<br />
{{eyecatch|Important!|2015-02-23<br />
<br />
Portions of the HTTP API have changed! A new version of the HTTP API will be deployed. The primary change are the transition to the new tag design, rolled out late last year.<br />
<br />
A fair bit has changed. While some concessions have been made to avoid breaking existing clients, such concessions will only last a number of weeks, not forever. Outdated nodes and attributes are scheduled to be removed on or very near 2015-06-01 (roughly two weeks from now.)<br />
<br />
So far:<br />
<br />
*<categories> will continue to be returned ''as is''. Later, will be removed entirely.<br />
*<tags> attribute 'spoiler' will be fixed to '''false'''. Later, will be removed entirely.<br />
*<tags> attribute 'approval' will be fixed to '''100'''. Later, will be removed entirely.<br />
*<tags> node 'count' will have a fixed content of '''1'''. Later, will be removed entirely.<br />
*The command 'categorylist' will continue to work ''as is''. Later, will be removed entirely.<br />
<br />
The 'id', 'localspoiler', 'globalspoiler' and 'updated' attributes, 'name' and 'description' nodes will remain.<br />
<br />
If your client is going to blow up with the removal of the above values, please considering taking this opportunity to make it less blowupy. }}<br />
<br />
== General ==<br />
The HTTP XML API is only a small part of the AniDB API framework, please refer to [[API]] for an overview.<br />
<br />
=== Clients ===<br />
<br />
If you want to create a client you have to register it {{AniDBLink|client|here}} and [[HTTP / UDP Clients|here]].<br />
<br />
=== Encoding ===<br />
All content is UTF8 encoded and gzip compressed (you may have to handle the decompressing yourself, if your HTTP library doesn't support compression of HTTP data). Transfer is in chunks, which are part of HTTP 1.1. This is the case even when your client requested uncompressed HTTP 1.0.<br />
<br />
=== Flooding and Caching ===<br />
All users of this API should employ heavy local caching. Requesting the same dataset multiple times on a single day can get you banned. The same goes for request flooding. You should not request more than one page every two seconds.<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Parameters ===<br />
These parameters apply to all HTTP XML API pages and should always be added to the request URLs.<br />
<br />
All users of the HTTP XML API need to be registered and have to provide their registered client identifier and version number on each request.<br />
<br />
Parameters:<br />
* <tt>client={string}</tt> [required]<br />
** client identification string, needs to be a registered client identifier, see: <br />
<br />
* <tt>clientver={integer}</tt> [required]<br />
** client version number, needs to be valid client version number for the given client identification string.<br />
<br />
* <tt>protover={integer}</tt> [required]<br />
** protocol version in use. Possible values: 1<br />
<br />
* <tt>request={string}</tt> [required]<br />
** HTTP XML datapage requested. See following sections.<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1</nowiki></u><br />
<br />
== Data Commands ==<br />
<br />
=== Anime ===<br />
Allows retrieval of non-file or episode related information for a specific anime by AID (AniDB anime id).<br />
<br />
==== Search ====<br />
* [[API#Anime_Titles|Look here]]<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=anime</tt><br />
* <tt>aid={integer}</tt> [required]<br />
** AniDB anime id of the anime you want to retrieve data for.<br />
<br />
<br />
{{eyecatch|Note|The tags node presently contains both 'spoiler' and 'localspoiler' attributes. Both represent the same value. Clients should use 'localspoiler'; in time, 'spoiler' will be removed.}}<br />
<br />
<br />
{{eyecatch|Important!|The meaning of the <temporary> vote node has changed since the HTTP API was put in place. To help keep clients compatible, the node will not be removed short term, but client consumers should be aware that this value now represents the mean of all votes (both permanent and temporary).}}<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime&client={str}&clientver={int}&protover=1&aid={int}</nowiki></u><br />
<br />
===== Data =====<br />
<code><pre><br />
<?xml version="1.0" encoding="UTF-8"?><br />
<anime id="1" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>1999-01-04</startdate><br />
<enddate>1999-03-29</enddate><br />
<titles><br />
<title xml:lang="x-jat" type="main">Seikai no Monshou</title><br />
<title xml:lang="zh-Hans" type="syn">星界之纹章</title><br />
<title xml:lang="en" type="short">CotS</title><br />
<title xml:lang="x-jat" type="short">SnM</title><br />
<title xml:lang="ja" type="official">星界の紋章</title><br />
<title xml:lang="en" type="official">Crest of the Stars</title><br />
<title xml:lang="fr" type="official">Crest of the Stars</title><br />
<title xml:lang="pl" type="official">Crest of the Stars</title><br />
</titles><br />
<relatedanime><br />
<anime id="4" type="Sequel">Seikai no Senki</anime><br />
<anime id="6" type="Prequel">Seikai no Danshou</anime><br />
<anime id="1623" type="Summary">Seikai no Monshou Tokubetsuhen</anime><br />
</relatedanime><br />
<url>http://www.sunrise-inc.co.jp/seikai/</url><br />
<creators><br />
<name id="4495" type="Original Work">Morioka Hiroyuki</name><br />
</creators><br />
<description>Jinto Lin`s life changes forever when the Humankind Empire Abh takes over his home planet of Martine without firing a single shot. He is soon sent off to study the Abh language and culture and to prepare himself for his future as a nobleman — a future he never dreamed of. Or wanted.Now, Jinto is entering the next phase of his training, and he is about to meet his first Abh, the lovely Lafiel. But Jinto is about to learn that she is more than she appears to be. And together they will have to fight for their very lives.</description><br />
<ratings><br />
<permanent count="2953">8.53</permanent><br />
<temporary count="96">7.58</temporary><br />
<review count="11">8.75</review><br />
</ratings><br />
<picture>440.jpg</picture><br />
<categories><br />
<category id="174" parentid="8" hentai="false" weight="500"><br />
<name>Space Travel</name><br />
<description>Space Travel usually refers going to space or travelling there with or without a spacecraft. There are different forms of space travel like Interplanetary travel, Interstellar travel or Intergalactic travel. Since it isn`t possible to travel faster than light, most anime series involve some sort "sub-space travel mechanism" as a way to travel faster than light.</description><br />
</category><br />
<category id="274" parentid="268" hentai="false" weight="400"><br />
<name>Novel</name><br />
<description>Note that novel means book with words in paper, so no comics and no "visual novels", which should go under manga and dating-sim - visual Novel/erotic game respectively.&#13;<br />
&#13;<br />
Note that it can be applied to novels as we know them but also the typical light novels for teens and young adults, which are common in Japan and aside from being short include a number of illustrations. </description><br />
</category><br />
</categories><br />
<tags><br />
<tag id="136" approval="20" spoiler="false" update="2009-05-23"><br />
<name>space opera</name><br />
<count>71</count><br />
</tag><br />
<tag id="175" approval="17" spoiler="false" update="2008-03-13"><br />
<name>space elves</name><br />
<count>12</count><br />
</tag><br />
<tag id="389" approval="15" spoiler="false" update="2008-06-03"><br />
<name>war setting</name><br />
<count>64</count><br />
</tag><br />
<tag id="393" approval="18" spoiler="false" update="2008-06-03"><br />
<name>space battles</name><br />
<count>43</count><br />
<description>There are space battles in this anime. Usually between Earth forces and some alien invader, but ship to ship skirmishes in deep space are just as common.</description><br />
</tag><br />
</tags><br />
<characters><br />
<character id="7493" type="appears in" update="2009-05-28"><br />
<name>Gosroth</name><br />
<description>The Resii Gothroth.The first Abh ship lost in the war.</description><br />
<episodes>1,1012</episodes><br />
<picture>26147.jpg</picture><br />
</character><br />
<character id="7501" type="appears in" update="2009-05-28"><br />
<name>Planet Martine</name><br />
<description>The homeworld of Jinto</description><br />
<episodes>1</episodes><br />
</character><br />
<character id="7503" type="appears in" update="2009-05-28"><br />
<name>Rock Lynn</name><br />
<description>The former president of Martine, later made count of the Hyde system, after striking a deal with the Abh (in episode 1)</description><br />
<episodes>1</episodes><br />
<picture>26165.jpg</picture><br />
</character><br />
</characters><br />
<episodes><br />
<episode id="1" update="2005-03-10"><br />
<epno>1</epno><br />
<length>24</length><br />
<airdate>1999-01-03</airdate><br />
<rating votes="17">5.66</rating><br />
<title xml:lang="ja">侵略</title><br />
<title xml:lang="en">Invasion</title><br />
<title xml:lang="fr">Invasion</title><br />
<title xml:lang="x-jat">shinryaku</title><br />
</episode><br />
<episode id="2" update="2005-03-11"><br />
<epno>2</epno><br />
<length>24</length><br />
<airdate>1999-01-10</airdate><br />
<rating votes="12">6.66</rating><br />
<title xml:lang="ja">星たちの眷族</title><br />
<title xml:lang="en">Kin of the Stars</title><br />
<title xml:lang="fr">Les parents des Étoiles</title><br />
<title xml:lang="x-jat">Hoshi-tachi no Kenzoku</title><br />
</episode><br />
</episodes><br />
</anime><br />
</pre></code><br />
<br />
==== Errors ====<br />
[http://anidb.net/perl-bin/animedb.pl?show=cmt&post=159118 According to ommina] the API does not use HTTP return code. Instead you will get XML consisting of one tag with a textual description.<br />
<code><pre><br />
<error>Banned</error><br />
</pre></code><br />
<br />
=== Random Recommendation ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random recommendations' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomrecommendation</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomrecommendation</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomrecommendation</nowiki></u><br />
<br />
<code><pre><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="7899" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>2010-10-04</startdate><br />
<enddate>2010-12-27</enddate><br />
<title xml:lang="x-jat" type="main">Arakawa Under the Bridge 2</title><br />
<picture>54734.jpg</picture><br />
<ratings><br />
<permanent count="781">623</permanent><br />
<recommendations>8</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
...<br />
<br />
<randomrecommendation><br />
</pre></code><br />
<br />
=== Random Similar ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random similar' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomsimilar</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomsimilar</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomsimilar</nowiki></u><br />
<br />
<code><pre><br />
<randomsimilar><br />
<similar><br />
<source aid="7056" restricted="false"><br />
<title xml:lang="x-jat" type="main">Aoi Bungaku Series</title><br />
<picture>37124.jpg</picture><br />
</source><br />
<target aid="3654" restricted="false"><br />
<title xml:lang="x-jat" type="main">Ayakashi: Japanese Classic Horror</title><br />
<picture>44085.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
</randomsimilar><br />
</pre></code><br />
<br />
=== Hot Anime ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Unlike the two random result commands, the results here will match the results as supplied by the main web page (with some possible variance of a few hours, depending on cache life.)<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=hotanime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=hotanime</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=hotanime</nowiki></u><br />
<br />
<code><pre><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
</pre></code><br />
<br />
=== Main ===<br />
<br />
A one-stop command returning the combined results of random recommendation, random similar, and hot anime. Use this command instead of scraping the HTML, and if you need more than one of the individual replies.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=main</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=main</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=main</nowiki></u><br />
<br />
<code><pre><br />
<main><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
<randomsimilar><br />
<similar><br />
<source aid="8107" restricted="false"><br />
<title xml:lang="x-jat" type="main">A Channel: The Animation</title><br />
<picture>59870.jpg</picture><br />
</source><br />
<target aid="4777" restricted="false"><br />
<title xml:lang="x-jat" type="main">Lucky Star</title><br />
<picture>65555.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
<randomsimilar><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="44" restricted="false"><br />
<type>OVA</type><br />
<episodecount>1</episodecount><br />
<startdate>2000-05-24</startdate><br />
<enddate>2000-05-24</enddate><br />
<title xml:lang="x-jat" type="main">Amon Devilman Mokushiroku</title><br />
<picture>14016.jpg</picture><br />
<ratings><br />
<permanent count="317">387</permanent><br />
<recommendations>1</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
....<br />
<br />
</randomrecommendation><br />
</main><br />
</pre></code><br />
<br />
== User Data Commands ==<br />
<br />
=== User Mylist Summary ===<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=mylistsummary&user={str anidb username}&pass={str anidb password}</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=mylistsummary</tt><br />
** Returns a list of the user's anime list in summary form, roughly matching the data in the "my list" page of the web interface.<br />
* <tt>user={str username}&pass={str password}</tt><br />
** The user name and password of the desired user. This is their main password, not the API password specified in the profile.<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=mylistsummary&user={str}&pass={str}</nowiki></u><br />
<br />
<code><pre><br />
<mylistsummary uid="40237"><br />
<mylistitem aid="5841" state="2"><br />
<episodecount>22</episodecount><br />
<seencount>22</seencount><br />
<specialcount>9</specialcount><br />
<seenspecialcount>4</seenspecialcount><br />
</mylistitem><br />
<mylistsummary><br />
</pre></code><br />
<br />
=== User Hints ===<br />
<br />
Returns a list of unwatched titles and a calculated rating, based upon existing votes. The list may be empty if the requested user is very new, has not voted for enough titles, or has very stale (a number of months old) data.<br />
<br />
Hints are calculated once a day.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=hints&user={str anidb username}&pass={str anidb password}&type=1</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=hints</tt><br />
* <tt>user={str username}&pass={str password}</tt><br />
** The user name and password of the desired user. This is their main password, not the API password specified in the profile.<br />
* <tt>type=1</tt><br />
** always 1, but must be included.<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=hints&user={str}&pass={str}&type=1</nowiki></u><br />
<br />
<code><pre><br />
<hints uid="40237" type="1"><br />
<hint adddate="2015-03-23"><br />
<relid>5</relid><br />
<calculated>8.09</calculated><br />
</hint><br />
</hints><br />
</pre></code><br />
<br />
[[Category:Development]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=HTTP_API_Definition&diff=18523HTTP API Definition2015-05-12T01:11:23Z<p>Ommina: /* Flooding and Caching */</p>
<hr />
<div>{{TOCright}}<br />
<br />
{{eyecatch|Important!|2015-02-23<br />
<br />
Portions of the HTTP API have changed! A new version of the HTTP API will be deployed. The primary change are the transition to the new tag design, rolled out late last year.<br />
<br />
A fair bit has changed. While some concessions have been made to avoid breaking existing clients, such concessions will only last a number of weeks, not forever. Outdated nodes and attributes are scheduled to be removed on or very near 2015-06-01 (roughly two weeks from now.)<br />
<br />
So far:<br />
<br />
*<categories> will continue to be returned ''as is''. Later, will be removed entirely.<br />
*<tags> attribute 'spoiler' will be fixed to '''false'''. Later, will be removed entirely.<br />
*<tags> attribute 'approval' will be fixed to '''100'''. Later, will be removed entirely.<br />
*<tags> node 'count' will have a fixed content of '''1'''. Later, will be removed entirely.<br />
*The command 'categorylist' will continue to work ''as is''. Later, will be removed entirely.<br />
<br />
The 'id', 'localspoiler', 'globalspoiler' and 'updated' attributes, 'name' and 'description' nodes will remain.<br />
<br />
If your client is going to blow up with the removal of the above values, please considering taking this opportunity to make it less blowupy. }}<br />
<br />
== General ==<br />
The HTTP XML API is only a small part of the AniDB API framework, please refer to [[API]] for an overview.<br />
<br />
=== Clients ===<br />
<br />
If you want to create a client you have to register it {{AniDBLink|client|here}} and [[HTTP / UDP Clients|here]].<br />
<br />
=== Encoding ===<br />
All content is UTF8 encoded and gzip compressed (you may have to handle the decompressing yourself, if your HTTP library doesn't support compression of HTTP data). Transfer is in chunks, which are part of HTTP 1.1. This is the case even when your client requested uncompressed HTTP 1.0.<br />
<br />
=== Flooding and Caching ===<br />
All users of this API should employ heavy local caching. Requesting the same dataset multiple times on a single day can get you banned. The same goes for request flooding. You should not request more than one page every two seconds.<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Parameters ===<br />
These parameters apply to all HTTP XML API pages and should always be added to the request URLs.<br />
<br />
All users of the HTTP XML API need to be registered and have to provide their registered client identifier and version number on each request.<br />
<br />
Parameters:<br />
* <tt>client={string}</tt> [required]<br />
** client identification string, needs to be a registered client identifier, see: <br />
<br />
* <tt>clientver={integer}</tt> [required]<br />
** client version number, needs to be valid client version number for the given client identification string.<br />
<br />
* <tt>protover={integer}</tt> [required]<br />
** protocol version in use. Possible values: 1<br />
<br />
* <tt>request={string}</tt> [required]<br />
** HTTP XML datapage requested. See following sections.<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1</nowiki></u><br />
<br />
== Data Commands ==<br />
<br />
=== Anime ===<br />
Allows retrieval of non-file or episode related information for a specific anime by AID (AniDB anime id).<br />
<br />
==== Search ====<br />
* [[API#Anime_Titles|Look here]]<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=anime</tt><br />
* <tt>aid={integer}</tt> [required]<br />
** AniDB anime id of the anime you want to retrieve data for.<br />
<br />
<br />
{{eyecatch|Note|The tags node presently contains both 'spoiler' and 'localspoiler' attributes. Both represent the same value. Clients should use 'localspoiler'; in time, 'spoiler' will be removed.}}<br />
<br />
<br />
{{eyecatch|Important!|The meaning of the <temporary> vote node has changed since the HTTP API was put in place. To help keep clients compatible, the node will not be removed short term, but client consumers should be aware that this value now represents the mean of all votes (both permanent and temporary).}}<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime&client={str}&clientver={int}&protover=1&aid={int}</nowiki></u><br />
<br />
===== Data =====<br />
<code><pre><br />
<?xml version="1.0" encoding="UTF-8"?><br />
<anime id="1" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>1999-01-04</startdate><br />
<enddate>1999-03-29</enddate><br />
<titles><br />
<title xml:lang="x-jat" type="main">Seikai no Monshou</title><br />
<title xml:lang="zh-Hans" type="syn">星界之纹章</title><br />
<title xml:lang="en" type="short">CotS</title><br />
<title xml:lang="x-jat" type="short">SnM</title><br />
<title xml:lang="ja" type="official">星界の紋章</title><br />
<title xml:lang="en" type="official">Crest of the Stars</title><br />
<title xml:lang="fr" type="official">Crest of the Stars</title><br />
<title xml:lang="pl" type="official">Crest of the Stars</title><br />
</titles><br />
<relatedanime><br />
<anime id="4" type="Sequel">Seikai no Senki</anime><br />
<anime id="6" type="Prequel">Seikai no Danshou</anime><br />
<anime id="1623" type="Summary">Seikai no Monshou Tokubetsuhen</anime><br />
</relatedanime><br />
<url>http://www.sunrise-inc.co.jp/seikai/</url><br />
<creators><br />
<name id="4495" type="Original Work">Morioka Hiroyuki</name><br />
</creators><br />
<description>Jinto Lin`s life changes forever when the Humankind Empire Abh takes over his home planet of Martine without firing a single shot. He is soon sent off to study the Abh language and culture and to prepare himself for his future as a nobleman — a future he never dreamed of. Or wanted.Now, Jinto is entering the next phase of his training, and he is about to meet his first Abh, the lovely Lafiel. But Jinto is about to learn that she is more than she appears to be. And together they will have to fight for their very lives.</description><br />
<ratings><br />
<permanent count="2953">8.53</permanent><br />
<temporary count="96">7.58</temporary><br />
<review count="11">8.75</review><br />
</ratings><br />
<picture>440.jpg</picture><br />
<categories><br />
<category id="174" parentid="8" hentai="false" weight="500"><br />
<name>Space Travel</name><br />
<description>Space Travel usually refers going to space or travelling there with or without a spacecraft. There are different forms of space travel like Interplanetary travel, Interstellar travel or Intergalactic travel. Since it isn`t possible to travel faster than light, most anime series involve some sort "sub-space travel mechanism" as a way to travel faster than light.</description><br />
</category><br />
<category id="274" parentid="268" hentai="false" weight="400"><br />
<name>Novel</name><br />
<description>Note that novel means book with words in paper, so no comics and no "visual novels", which should go under manga and dating-sim - visual Novel/erotic game respectively.&#13;<br />
&#13;<br />
Note that it can be applied to novels as we know them but also the typical light novels for teens and young adults, which are common in Japan and aside from being short include a number of illustrations. </description><br />
</category><br />
</categories><br />
<tags><br />
<tag id="136" approval="20" spoiler="false" update="2009-05-23"><br />
<name>space opera</name><br />
<count>71</count><br />
</tag><br />
<tag id="175" approval="17" spoiler="false" update="2008-03-13"><br />
<name>space elves</name><br />
<count>12</count><br />
</tag><br />
<tag id="389" approval="15" spoiler="false" update="2008-06-03"><br />
<name>war setting</name><br />
<count>64</count><br />
</tag><br />
<tag id="393" approval="18" spoiler="false" update="2008-06-03"><br />
<name>space battles</name><br />
<count>43</count><br />
<description>There are space battles in this anime. Usually between Earth forces and some alien invader, but ship to ship skirmishes in deep space are just as common.</description><br />
</tag><br />
</tags><br />
<characters><br />
<character id="7493" type="appears in" update="2009-05-28"><br />
<name>Gosroth</name><br />
<description>The Resii Gothroth.The first Abh ship lost in the war.</description><br />
<episodes>1,1012</episodes><br />
<picture>26147.jpg</picture><br />
</character><br />
<character id="7501" type="appears in" update="2009-05-28"><br />
<name>Planet Martine</name><br />
<description>The homeworld of Jinto</description><br />
<episodes>1</episodes><br />
</character><br />
<character id="7503" type="appears in" update="2009-05-28"><br />
<name>Rock Lynn</name><br />
<description>The former president of Martine, later made count of the Hyde system, after striking a deal with the Abh (in episode 1)</description><br />
<episodes>1</episodes><br />
<picture>26165.jpg</picture><br />
</character><br />
</characters><br />
<episodes><br />
<episode id="1" update="2005-03-10"><br />
<epno>1</epno><br />
<length>24</length><br />
<airdate>1999-01-03</airdate><br />
<rating votes="17">5.66</rating><br />
<title xml:lang="ja">侵略</title><br />
<title xml:lang="en">Invasion</title><br />
<title xml:lang="fr">Invasion</title><br />
<title xml:lang="x-jat">shinryaku</title><br />
</episode><br />
<episode id="2" update="2005-03-11"><br />
<epno>2</epno><br />
<length>24</length><br />
<airdate>1999-01-10</airdate><br />
<rating votes="12">6.66</rating><br />
<title xml:lang="ja">星たちの眷族</title><br />
<title xml:lang="en">Kin of the Stars</title><br />
<title xml:lang="fr">Les parents des Étoiles</title><br />
<title xml:lang="x-jat">Hoshi-tachi no Kenzoku</title><br />
</episode><br />
</episodes><br />
</anime><br />
</pre></code><br />
<br />
==== Errors ====<br />
[http://anidb.net/perl-bin/animedb.pl?show=cmt&post=159118 According to ommina] the API does not use HTTP return code. Instead you will get XML consisting of one tag with a textual description.<br />
<code><pre><br />
<error>Banned</error><br />
</pre></code><br />
<br />
=== Random Recommendation ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random recommendations' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomrecommendation</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomrecommendation</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomrecommendation</nowiki></u><br />
<br />
<code><pre><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="7899" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>2010-10-04</startdate><br />
<enddate>2010-12-27</enddate><br />
<title xml:lang="x-jat" type="main">Arakawa Under the Bridge 2</title><br />
<picture>54734.jpg</picture><br />
<ratings><br />
<permanent count="781">623</permanent><br />
<recommendations>8</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
...<br />
<br />
<randomrecommendation><br />
</pre></code><br />
<br />
=== Random Similar ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random similar' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomsimilar</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomsimilar</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomsimilar</nowiki></u><br />
<br />
<code><pre><br />
<randomsimilar><br />
<similar><br />
<source aid="7056" restricted="false"><br />
<title xml:lang="x-jat" type="main">Aoi Bungaku Series</title><br />
<picture>37124.jpg</picture><br />
</source><br />
<target aid="3654" restricted="false"><br />
<title xml:lang="x-jat" type="main">Ayakashi: Japanese Classic Horror</title><br />
<picture>44085.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
</randomsimilar><br />
</pre></code><br />
<br />
=== Hot Anime ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Unlike the two random result commands, the results here will match the results as supplied by the main web page (with some possible variance of a few hours, depending on cache life.)<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=hotanime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=hotanime</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=hotanime</nowiki></u><br />
<br />
<code><pre><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
</pre></code><br />
<br />
=== Main ===<br />
<br />
A one-stop command returning the combined results of random recommendation, random similar, and hot anime. Use this command instead of scraping the HTML, and if you need more than one of the individual replies.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=main</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=main</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=main</nowiki></u><br />
<br />
<code><pre><br />
<main><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
<randomsimilar><br />
<similar><br />
<source aid="8107" restricted="false"><br />
<title xml:lang="x-jat" type="main">A Channel: The Animation</title><br />
<picture>59870.jpg</picture><br />
</source><br />
<target aid="4777" restricted="false"><br />
<title xml:lang="x-jat" type="main">Lucky Star</title><br />
<picture>65555.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
<randomsimilar><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="44" restricted="false"><br />
<type>OVA</type><br />
<episodecount>1</episodecount><br />
<startdate>2000-05-24</startdate><br />
<enddate>2000-05-24</enddate><br />
<title xml:lang="x-jat" type="main">Amon Devilman Mokushiroku</title><br />
<picture>14016.jpg</picture><br />
<ratings><br />
<permanent count="317">387</permanent><br />
<recommendations>1</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
....<br />
<br />
</randomrecommendation><br />
</main><br />
</pre></code><br />
<br />
== User Data Commands ==<br />
<br />
=== User Mylist Summary ===<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=mylistsummary&user={str anidb username}&pass={str anidb password}</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=mylistsummary</tt><br />
** Returns a list of the user's anime list in summary form, roughly matching the data in the "my list" page of the web interface.<br />
* <tt>user={str username}&pass={str password}</tt><br />
** The user name and password of the desired user. This is their main password, not the API password specified in the profile.<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=mylistsummary&user={str}&pass={str}</nowiki></u><br />
<br />
<code><pre><br />
<mylistsummary uid="40237"><br />
<mylistitem aid="5841" state="2"><br />
<episodecount>22</episodecount><br />
<seencount>22</seencount><br />
<specialcount>9</specialcount><br />
<seenspecialcount>4</seenspecialcount><br />
</mylistitem><br />
<mylistsummary><br />
</pre></code><br />
<br />
[[Category:Development]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=HTTP_API_Definition&diff=18522HTTP API Definition2015-05-12T01:10:48Z<p>Ommina: </p>
<hr />
<div>{{TOCright}}<br />
<br />
{{eyecatch|Important!|2015-02-23<br />
<br />
Portions of the HTTP API have changed! A new version of the HTTP API will be deployed. The primary change are the transition to the new tag design, rolled out late last year.<br />
<br />
A fair bit has changed. While some concessions have been made to avoid breaking existing clients, such concessions will only last a number of weeks, not forever. Outdated nodes and attributes are scheduled to be removed on or very near 2015-06-01 (roughly two weeks from now.)<br />
<br />
So far:<br />
<br />
*<categories> will continue to be returned ''as is''. Later, will be removed entirely.<br />
*<tags> attribute 'spoiler' will be fixed to '''false'''. Later, will be removed entirely.<br />
*<tags> attribute 'approval' will be fixed to '''100'''. Later, will be removed entirely.<br />
*<tags> node 'count' will have a fixed content of '''1'''. Later, will be removed entirely.<br />
*The command 'categorylist' will continue to work ''as is''. Later, will be removed entirely.<br />
<br />
The 'id', 'localspoiler', 'globalspoiler' and 'updated' attributes, 'name' and 'description' nodes will remain.<br />
<br />
If your client is going to blow up with the removal of the above values, please considering taking this opportunity to make it less blowupy. }}<br />
<br />
== General ==<br />
The HTTP XML API is only a small part of the AniDB API framework, please refer to [[API]] for an overview.<br />
<br />
=== Clients ===<br />
<br />
If you want to create a client you have to register it {{AniDBLink|client|here}} and [[HTTP / UDP Clients|here]].<br />
<br />
=== Encoding ===<br />
All content is UTF8 encoded and gzip compressed (you may have to handle the decompressing yourself, if your HTTP library doesn't support compression of HTTP data). Transfer is in chunks, which are part of HTTP 1.1. This is the case even when your client requested uncompressed HTTP 1.0.<br />
<br />
=== Flooding and Caching ===<br />
All users of this API should employ heavy local caching. Requesting the same dataset multiple times on a single day can get you banned. The same goes for request flooding. You should not request more than one page every two seconds on average.<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Parameters ===<br />
These parameters apply to all HTTP XML API pages and should always be added to the request URLs.<br />
<br />
All users of the HTTP XML API need to be registered and have to provide their registered client identifier and version number on each request.<br />
<br />
Parameters:<br />
* <tt>client={string}</tt> [required]<br />
** client identification string, needs to be a registered client identifier, see: <br />
<br />
* <tt>clientver={integer}</tt> [required]<br />
** client version number, needs to be valid client version number for the given client identification string.<br />
<br />
* <tt>protover={integer}</tt> [required]<br />
** protocol version in use. Possible values: 1<br />
<br />
* <tt>request={string}</tt> [required]<br />
** HTTP XML datapage requested. See following sections.<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1</nowiki></u><br />
<br />
== Data Commands ==<br />
<br />
=== Anime ===<br />
Allows retrieval of non-file or episode related information for a specific anime by AID (AniDB anime id).<br />
<br />
==== Search ====<br />
* [[API#Anime_Titles|Look here]]<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=anime</tt><br />
* <tt>aid={integer}</tt> [required]<br />
** AniDB anime id of the anime you want to retrieve data for.<br />
<br />
<br />
{{eyecatch|Note|The tags node presently contains both 'spoiler' and 'localspoiler' attributes. Both represent the same value. Clients should use 'localspoiler'; in time, 'spoiler' will be removed.}}<br />
<br />
<br />
{{eyecatch|Important!|The meaning of the <temporary> vote node has changed since the HTTP API was put in place. To help keep clients compatible, the node will not be removed short term, but client consumers should be aware that this value now represents the mean of all votes (both permanent and temporary).}}<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime&client={str}&clientver={int}&protover=1&aid={int}</nowiki></u><br />
<br />
===== Data =====<br />
<code><pre><br />
<?xml version="1.0" encoding="UTF-8"?><br />
<anime id="1" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>1999-01-04</startdate><br />
<enddate>1999-03-29</enddate><br />
<titles><br />
<title xml:lang="x-jat" type="main">Seikai no Monshou</title><br />
<title xml:lang="zh-Hans" type="syn">星界之纹章</title><br />
<title xml:lang="en" type="short">CotS</title><br />
<title xml:lang="x-jat" type="short">SnM</title><br />
<title xml:lang="ja" type="official">星界の紋章</title><br />
<title xml:lang="en" type="official">Crest of the Stars</title><br />
<title xml:lang="fr" type="official">Crest of the Stars</title><br />
<title xml:lang="pl" type="official">Crest of the Stars</title><br />
</titles><br />
<relatedanime><br />
<anime id="4" type="Sequel">Seikai no Senki</anime><br />
<anime id="6" type="Prequel">Seikai no Danshou</anime><br />
<anime id="1623" type="Summary">Seikai no Monshou Tokubetsuhen</anime><br />
</relatedanime><br />
<url>http://www.sunrise-inc.co.jp/seikai/</url><br />
<creators><br />
<name id="4495" type="Original Work">Morioka Hiroyuki</name><br />
</creators><br />
<description>Jinto Lin`s life changes forever when the Humankind Empire Abh takes over his home planet of Martine without firing a single shot. He is soon sent off to study the Abh language and culture and to prepare himself for his future as a nobleman — a future he never dreamed of. Or wanted.Now, Jinto is entering the next phase of his training, and he is about to meet his first Abh, the lovely Lafiel. But Jinto is about to learn that she is more than she appears to be. And together they will have to fight for their very lives.</description><br />
<ratings><br />
<permanent count="2953">8.53</permanent><br />
<temporary count="96">7.58</temporary><br />
<review count="11">8.75</review><br />
</ratings><br />
<picture>440.jpg</picture><br />
<categories><br />
<category id="174" parentid="8" hentai="false" weight="500"><br />
<name>Space Travel</name><br />
<description>Space Travel usually refers going to space or travelling there with or without a spacecraft. There are different forms of space travel like Interplanetary travel, Interstellar travel or Intergalactic travel. Since it isn`t possible to travel faster than light, most anime series involve some sort "sub-space travel mechanism" as a way to travel faster than light.</description><br />
</category><br />
<category id="274" parentid="268" hentai="false" weight="400"><br />
<name>Novel</name><br />
<description>Note that novel means book with words in paper, so no comics and no "visual novels", which should go under manga and dating-sim - visual Novel/erotic game respectively.&#13;<br />
&#13;<br />
Note that it can be applied to novels as we know them but also the typical light novels for teens and young adults, which are common in Japan and aside from being short include a number of illustrations. </description><br />
</category><br />
</categories><br />
<tags><br />
<tag id="136" approval="20" spoiler="false" update="2009-05-23"><br />
<name>space opera</name><br />
<count>71</count><br />
</tag><br />
<tag id="175" approval="17" spoiler="false" update="2008-03-13"><br />
<name>space elves</name><br />
<count>12</count><br />
</tag><br />
<tag id="389" approval="15" spoiler="false" update="2008-06-03"><br />
<name>war setting</name><br />
<count>64</count><br />
</tag><br />
<tag id="393" approval="18" spoiler="false" update="2008-06-03"><br />
<name>space battles</name><br />
<count>43</count><br />
<description>There are space battles in this anime. Usually between Earth forces and some alien invader, but ship to ship skirmishes in deep space are just as common.</description><br />
</tag><br />
</tags><br />
<characters><br />
<character id="7493" type="appears in" update="2009-05-28"><br />
<name>Gosroth</name><br />
<description>The Resii Gothroth.The first Abh ship lost in the war.</description><br />
<episodes>1,1012</episodes><br />
<picture>26147.jpg</picture><br />
</character><br />
<character id="7501" type="appears in" update="2009-05-28"><br />
<name>Planet Martine</name><br />
<description>The homeworld of Jinto</description><br />
<episodes>1</episodes><br />
</character><br />
<character id="7503" type="appears in" update="2009-05-28"><br />
<name>Rock Lynn</name><br />
<description>The former president of Martine, later made count of the Hyde system, after striking a deal with the Abh (in episode 1)</description><br />
<episodes>1</episodes><br />
<picture>26165.jpg</picture><br />
</character><br />
</characters><br />
<episodes><br />
<episode id="1" update="2005-03-10"><br />
<epno>1</epno><br />
<length>24</length><br />
<airdate>1999-01-03</airdate><br />
<rating votes="17">5.66</rating><br />
<title xml:lang="ja">侵略</title><br />
<title xml:lang="en">Invasion</title><br />
<title xml:lang="fr">Invasion</title><br />
<title xml:lang="x-jat">shinryaku</title><br />
</episode><br />
<episode id="2" update="2005-03-11"><br />
<epno>2</epno><br />
<length>24</length><br />
<airdate>1999-01-10</airdate><br />
<rating votes="12">6.66</rating><br />
<title xml:lang="ja">星たちの眷族</title><br />
<title xml:lang="en">Kin of the Stars</title><br />
<title xml:lang="fr">Les parents des Étoiles</title><br />
<title xml:lang="x-jat">Hoshi-tachi no Kenzoku</title><br />
</episode><br />
</episodes><br />
</anime><br />
</pre></code><br />
<br />
==== Errors ====<br />
[http://anidb.net/perl-bin/animedb.pl?show=cmt&post=159118 According to ommina] the API does not use HTTP return code. Instead you will get XML consisting of one tag with a textual description.<br />
<code><pre><br />
<error>Banned</error><br />
</pre></code><br />
<br />
=== Random Recommendation ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random recommendations' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomrecommendation</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomrecommendation</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomrecommendation</nowiki></u><br />
<br />
<code><pre><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="7899" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>2010-10-04</startdate><br />
<enddate>2010-12-27</enddate><br />
<title xml:lang="x-jat" type="main">Arakawa Under the Bridge 2</title><br />
<picture>54734.jpg</picture><br />
<ratings><br />
<permanent count="781">623</permanent><br />
<recommendations>8</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
...<br />
<br />
<randomrecommendation><br />
</pre></code><br />
<br />
=== Random Similar ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random similar' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomsimilar</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomsimilar</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomsimilar</nowiki></u><br />
<br />
<code><pre><br />
<randomsimilar><br />
<similar><br />
<source aid="7056" restricted="false"><br />
<title xml:lang="x-jat" type="main">Aoi Bungaku Series</title><br />
<picture>37124.jpg</picture><br />
</source><br />
<target aid="3654" restricted="false"><br />
<title xml:lang="x-jat" type="main">Ayakashi: Japanese Classic Horror</title><br />
<picture>44085.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
</randomsimilar><br />
</pre></code><br />
<br />
=== Hot Anime ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Unlike the two random result commands, the results here will match the results as supplied by the main web page (with some possible variance of a few hours, depending on cache life.)<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=hotanime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=hotanime</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=hotanime</nowiki></u><br />
<br />
<code><pre><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
</pre></code><br />
<br />
=== Main ===<br />
<br />
A one-stop command returning the combined results of random recommendation, random similar, and hot anime. Use this command instead of scraping the HTML, and if you need more than one of the individual replies.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=main</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=main</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=main</nowiki></u><br />
<br />
<code><pre><br />
<main><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
<randomsimilar><br />
<similar><br />
<source aid="8107" restricted="false"><br />
<title xml:lang="x-jat" type="main">A Channel: The Animation</title><br />
<picture>59870.jpg</picture><br />
</source><br />
<target aid="4777" restricted="false"><br />
<title xml:lang="x-jat" type="main">Lucky Star</title><br />
<picture>65555.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
<randomsimilar><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="44" restricted="false"><br />
<type>OVA</type><br />
<episodecount>1</episodecount><br />
<startdate>2000-05-24</startdate><br />
<enddate>2000-05-24</enddate><br />
<title xml:lang="x-jat" type="main">Amon Devilman Mokushiroku</title><br />
<picture>14016.jpg</picture><br />
<ratings><br />
<permanent count="317">387</permanent><br />
<recommendations>1</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
....<br />
<br />
</randomrecommendation><br />
</main><br />
</pre></code><br />
<br />
== User Data Commands ==<br />
<br />
=== User Mylist Summary ===<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=mylistsummary&user={str anidb username}&pass={str anidb password}</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=mylistsummary</tt><br />
** Returns a list of the user's anime list in summary form, roughly matching the data in the "my list" page of the web interface.<br />
* <tt>user={str username}&pass={str password}</tt><br />
** The user name and password of the desired user. This is their main password, not the API password specified in the profile.<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=mylistsummary&user={str}&pass={str}</nowiki></u><br />
<br />
<code><pre><br />
<mylistsummary uid="40237"><br />
<mylistitem aid="5841" state="2"><br />
<episodecount>22</episodecount><br />
<seencount>22</seencount><br />
<specialcount>9</specialcount><br />
<seenspecialcount>4</seenspecialcount><br />
</mylistitem><br />
<mylistsummary><br />
</pre></code><br />
<br />
[[Category:Development]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=UDP_API_Definition&diff=18477UDP API Definition2015-04-03T04:02:50Z<p>Ommina: /* GROUPSTATUS: Get Completed Episode */</p>
<hr />
<div>{{TOCright}}<br />
<br />
== General Information ==<br />
'''Author:''' [[User:Exp|Exp]] & [[User:Epoximator|Epoximator]] & [[User:Ommina|Ommina]]<br><br />
'''Version:''' 0.03.730 (2015-03-25)<br><br />
'''Version number used for protover parameter:''' "3"<br />
<br />
'''IMPORTANT INFORMATION FOR ALL INTERESTED:'''<br />
* If you are mainly interested in notifications and private messaging, check out our [[Jabber]] and [[RSSRDF]] support first.<br />
* The UDP API is not an appropriate choice if you desire to download a local copy of the AniDB database.<br />
* If you want to create a client you have to register it {{AniDBLink|client|here}} and [[UDP Clients|here]].<br />
** Check out the clients that are being developed. There exists usable code in many different languages already.<br />
* If you have suggestions for improvements or new features use the [[UDP API DEV|development]] page.<br />
* Please also take a look at the [[API]] page.<br />
<br />
== Formats used in this Spec ==<br />
* {vartype varname} - Specifies what shall be inserted at this point and its type.<br />
* [...] - Everything between [ and ] is optional.<br />
<br />
=== Used types ===<br />
* ''int2'' - 2 byte Integer (in string representation)<br />
* ''int4'' - 4 byte Integer (in string representation)<br />
* ''boolean'' - true or false - use '1' for ''true'', '0' for ''false''<br />
* ''str'' - String (UDP packet length restricts string size to 1400 bytes)<br />
* ''hexstr'' -- a hex representation of a decimal value, two characters per byte. If multiple bytes are represented, byte one is the first two characters of the string, byte two the next two, and so on.<br />
<br />
=== Content Encoding ===<br />
* Default character encoding: ''ASCII''<br />
* Escape scheme for option values (to server): ''html form encoding'' + ''newline''<br />
** This means you have to encode at least <tt>&</tt> in your option values in html form encoding style (<tt>&amp;amp;</tt>) before sending them to the api server. All other html form encodings are optional.<br />
** All newlines should be replaced by &lt;br /&gt;<br />
* Escape scheme for returned data fields (from server): ', | and newline<br />
** Content newlines are encoded as &lt;br /&gt;, ' is encoded as ` and | is not allowed in data fields.<br />
** Dates are returned in unix time (number of seconds elapsed since January 1, 1970 00:00:00 UTC)<br />
<br />
== Basics ==<br />
=== General ===<br />
The network communication is ''packet'' and ''line'' based. Each AniDB API command is exactly one UDP packet containing one line. Results are sent as one packet but may consist out of multiple lines. A return value always starts with a 3 byte result code followed by a human readable version of the result code. Be aware that important data fields may be returned directly after the return code (see: 200,201,271,272,504).<br />
The meaning for all result codes can be found in this document. If there is more than one entry returned, it's one entry per line. Lines are terminated by a <tt>\n</tt> (no dos linefeed <tt>\r</tt>). The elements of a format string are separated by a "|" character.<br />
<br />
<tt>{three digit return code} {str return string}\n</tt><br><br />
<tt>{data field 0}|{data field 1}|...|{data field n}</tt><br />
<br />
'''IMPORTANT:'''<br />
* All commands except PING, ENCRYPT, ENCODING, AUTH and VERSION '''requires''' login, meaning that the ''session tag'' must be set (<tt>s=xxxxx</tt>).<br />
* A client should ignore any additional trailing data fields it doesn't expect. Additional fields are going to be added to the output of some commands from time to time. Those additional fields will simply be appended to the end of the existing output. A client should be written in a way so that it is not affected by such new fields.<br />
* Due to the length constraints of an UDP package (over PPPoE) the replies from the server will never exceed 1400 bytes. String fields will be truncated if necessary to ensure this. No warnings are given when this happens.<br />
* A client should handle all possible return codes for each command.<br />
** Possible return codes for '''all commands''':<br />
*** 505 ILLEGAL INPUT OR ACCESS DENIED<br />
*** 555 BANNED<br />
***: {str reason}<br />
*** 598 UNKNOWN COMMAND<br />
*** 600 INTERNAL SERVER ERROR<br />
*** 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
*** 602 SERVER BUSY - TRY AGAIN LATER<br />
*** 604 TIMEOUT - DELAY AND RESUBMIT<br />
** Additional return codes for all commands that '''require login''':<br />
*** 501 LOGIN FIRST<br />
*** 502 ACCESS DENIED<br />
*** 506 INVALID SESSION<br />
<br />
{{eyecatch|Note|The '555 BANNED' message should not be expected by the client. This message is only enabled temporary to help developers understand what they are doing wrong.}}<br><br />
<br />
{{eyecatch|Note|<br />
While in daily maintenance the AniDB API will reply with<br />
<br />
601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
<br />
to all commands. If a client receives such a return value it should wait at least 30 minutes before trying again.}}<br />
<br />
=== Server / UDP Connection ===<br />
The Client has to send data packets to:<br />
* '''Server:''' api.anidb.net<br />
* '''Port:''' 9000/UDP<br />
The servername and port should not be hardcoded into a frontend but should be read from a configuration file.<br />
<br />
=== Server Errors ===<br />
* At any time the API might return a fatal error of the form:<br />
: <tt>6xx ERROR DESCRIPTION</tt><br />
* Possible codes are 600-699.<br />
* Occurrences of these errors (except 601 and 602) should be reported to [[User:Ommina|Ommina]].<br />
{{eyecatch|Note|6XX messages do not always return the tags given with the command which caused the error!}}<br />
<br />
=== Connection Problems ===<br />
There are many ways for a client to end up banned or the API might currently be handling too many concurrent connections.<br />
If a client does not get any reply to an AUTH command it should start to increase the retry delay exponentially with every failed login attempt. (i.e. try again after 30 seconds if the first login attempt failed, if the second fails too retry after 2 minutes, then 5 minutes, then 10 minutes, then 30 minutes, ... until you reach a retry delay of ~2-4h.)<br />
<br />
=== Local Port ===<br />
A client should select a fixed local port >1024 at install time and reuse it for local UDP Sockets. If the API sees too many different UDP Ports from one IP within ~1 hour it will ban the IP. (So make sure you're reusing your UDP ports also for testing/debugging!)<br />
<br />
The local port may be hardcoded, however, an option to manually specify another port should be offered.<br />
<br />
'''Note when behind a [[Wikipedia:Network address translation|NAT]]/masquerading router:'''<br><br />
A session between the server and a client is identified by the ''IP and port'' used by the client. So when the port (or IP) changes within a session the client has to authenticate again. If a client is behind a NAT router it can’t actually control the local port used for the connection. The router will normally ''translate'' the port to support several computers on a LAN to share the Internet connection. The public port (as determined by the router and seen by the server) which has been assigned to the connection will only be reserved for as long as it is in use. This means that the router will usually ''deallocate the port after a fixed timeout period'' (eg. five, ten or 15 minutes). Once that happens the client will no longer be able to receive UDP messages from the server (the messages will be discarded as undeliverable by the router) and a new port will be selected once the client tries to send a message to the server (which will result in a new connection session - '''Note:''' This could get you banned!, see above). So in order to keep a session over a NAT router alive, the client has to ping the server within the router's deallocation period to prevent a timeout.<br />
<br />
The client can decide whether it is behind a NAT router or not by adding <tt>nat=1</tt> to the AUTH command. This will cause the response to include the IP and port as seen by the server. If the port differs from the port reported by the local socket, the connection subject to NAT and the client should issue PING commands in regular intervals. Please do not send pings more often than is necessary to keep NAT connections alive.<br />
<br />
=== Flood Protection ===<br />
To prevent high server load the UDP API server enforces a strict flood protection policy.<br />
* Short Term:<br />
** A Client MUST NOT send more than 0.5 packets per second (that's one packet every two seconds, not two packets a second!)<br />
** The server will start to enforce the limit after the first 5 packets have been received.<br />
* Long Term:<br />
** A Client MUST NOT send more than one packet every four seconds over an extended amount of time.<br />
** ''An extended amount of time'' is not defined. Use common sense.<br />
<br />
Once a client exceeds a rate limit all further UDP packets from that client will be dropped without feedback until the client's packet rate is back down to acceptable levels.<br />
<br />
{{eyecatch|Note|Dropped packets are still taken into account for the packet rate. Meaning if you continuously send packets your client will be banned forever.}}<br />
<br />
Generally clients should be written in a way to minimize server and network load. You should always keep that in mind.<br />
<br />
Abusive clients may be banned completely.<br />
<br />
{{eyecatch|Note|<br />
If you suddenly stop getting replies from the AniDB API or you normally don't have a notable packetloss and from one point on you suddenly note a high packetloss percentage you have most likely entered a critical flood ratio.<br />
If the AniDB API isn't answering at all it might either be down or you have been banned, this is normally caused by violating the API specs (i.e. too many connections using different ports from one IP, too many auth failures, ...) (usually lasts 30 minutes).<br />
If you're experiencing packet loss you have probably reached the rate limit and the API starts to randomly drop incoming packets from your IP. (can be solved by enforcing a delay between multiple commands when you're sending a batch)}}<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Caching ===<br />
To minimize server and network load a client should use local caching in order to prevent repeated API requests for the same data.<br />
<br />
A client should locally cache FILE/EP/ANIME/GROUP/... info wherever possible for extended amounts of time.<br />
(I.e. if a client is used to scan a local folder with anime files and add them via API to a users MyList then it shall only ask for all files in the first run and cache the info for all files known to AniDB. If run again over the same folder it shall only check those files which were unknown to AniDB at the time of the last check.)<br />
<br />
Later versions of the API might enforce this by banning clients which ask for the same information more than once every week/month.<br />
<br />
=== Tag option ===<br />
The API will add a user defined string at the beginning of each reply line separated with a space, if desired.<br />
* To enable add the <tt>tag={str usertag}</tt> option to a command.<br />
* A tag is only valid for the command it was send with, meaning it is not persistent. If you want to have tags in front of all reply lines you will have to append the tag option to each command you send to the server.<br />
* Tags are meant to enable a client to handle more than one request/reply at a time.<br />
<br />
Usage example:<br />
AUTH user=baka&pass=baka&protover=25&client=someclient&clientver=1&tag=abc123<br />
abc123 200 Jxqxb LOGIN ACCEPTED<br />
or<br />
LOGOUT s=Jxqxb&tag=byebye<br />
byebye 203 LOGGED OUT<br />
<br />
{{eyecatch|Note|The tag option is valid for all api commands and is thus not explicitly listed in the description of each command.}}<br />
<br />
=== Data Indexes (fid,aid,eid,gid,lid) ===<br />
* All indexes start at 1 (not 0).<br />
* It is possible for table entries to have id fields with a value of 0 (i.e. gid). Those are to be interpreted as "NONE" or "NULL".<br />
* An ID is '''never''' reused. That means after an entry is deleted no new entry will ever have that ID again.<br />
* Mylist IDs (lid) are globally unique, not per-user unique.<br />
<br />
== Authing Commands ==<br />
{{eyecatch|Note|'''ANY''' command which requires parameters may return: 505 ILLEGAL INPUT OR ACCESS DENIED}}<br />
<br />
----<br />
=== AUTH: Authing to the AnimeDB ===<br />
'''Command String:'''<br />
* AUTH user={str username}&pass={str password}&protover={int4 apiversion}&client={str clientname}&clientver={int4 clientversion}[&nat=1&comp=1&enc={str encoding}&mtu{int4 mtu value}&imgserver=1]<br />
<br />
'''Possible Replies:'''<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
* 500 LOGIN FAILED<br />
* 503 CLIENT VERSION OUTDATED<br />
* 504 CLIENT BANNED - {str reason}<br />
* 505 ILLEGAL INPUT OR ACCESS DENIED<br />
* 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
when nat=1<br />
* 200 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED<br />
* 201 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
when imgserver=1<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
{str image server name}<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
{str image server name}<br />
<br />
'''Info:'''<br />
{{eyecatch|Note|The password is the normal AniDB website password! The password listed in the profile as API Password in only used for the optional encryption feature.}}<br />
* The ''session_key'' is a String containing only ''a-z,A-Z,0-9'' chars of a length of ''4-8'' characters.<br />
: It has to be stored by the client and needs to be sent as parameter with every command which requires the user to logged in.<br />
* The ''session_key'' String is appended as parameter "s", i.e. "PUSH notify=1&msg=1&s={str session_key}".<br />
* On a '''500 LOGIN FAILED''' message the client should request the user to enter username and password again.<br />
* In case of a '''501 LOGIN FIRST''' message the client should silently resend an auth command and send the failed command again.<br />
* A '''502 ACCESS DENIED''' message should abort the current action on the client side and display a message to the user.<br />
* A '''503 CLIENT VERSION OUTDATED''' message states that the udp server has been updated and does not support your client any longer. (protover is too low). A 201 message refers to a new version of the client software.<br />
* A '''506 INVALID SESSION''' means that either the session key parameter "s" was not provided with a command that requires it or the session key is no longer valid. The client should reissue an AUTH command.<br />
{{eyecatch|Note|A frontend shall expect 501 and 502 messages to be returned on ANY command.}}<br><br />
{{eyecatch|Note|AniDB usernames may only contain characters (a-z,A-Z), numbers (0-9), underscores (_) and hyphens (-).}}<br />
* The client should send the apiversion of the AnimeDB API version it supports as value of the protover parameter.<br />
* The client MAY NOT send anything but the version of the API Specs the author used to write the client! (as it is stated at the top of this file @ "Version number used for protover parameter")<br />
: The API will compare that value to it's own version of the API and if the version of the client is older the API will decide whether the changes were significant enough to deny the old client access to the DB.<br />
* The clientname shall be a lower-case string containing only the chars ''a-z'' of ''4-16 chars'' length which identifies the client. (i.e. mykickassclient)<br />
* The clientversion shall be a number starting with 1, increased on every change in the client.<br />
: clientname and clientversion might be used by the API to distinguish between different clients and client versions if that should ever become necessary.<br />
{{eyecatch|Important|<br />
* DO NOT use the clientname of an existing client. If you modify an existing client's code to meet your own needs, create a new client name for yourself.<br />
* ALWAYS increase the clientversion number if you release a new client version.}}<br />
* A Login and its assigned ''session_key'' is valid until the virtual UDP connection times out or until a LOGOUT command is issued.<br />
* The virtual UDP connection times out if no data was received from the client for '''35 minutes'''.<br />
* A client should issue a UPTIME command once every 30 minutes to keep the connection alive should that be required.<br />
* If the client does not use any of the notification/push features of the API it should NOT keep the connection alive, furthermore it should explicitly terminate the connection by issuing a LOGOUT command once it finished it's work.<br />
* If it is very likely that another command will be issued shortly (within the next 20 minutes) a client SHOULD keep the current connection open, by not sending a LOGOUT command.<br />
{{eyecatch|Important|<br />
* A client should NOT perform a full AUTH / command / LOGOUT cycle for each command it wants to send. Again, if another command is likely within 20 minutes, remain logged in.}}<br />
* The client shall notify the user if it received a 201 message at login.<br />
: This means a new version of the client is available, however the old version is still supported otherwise a client banned message would have been returned.<br />
* The user should get a pop-up message on 503 and 504 messages telling him to update his client software.<br />
: ('''Note:''' 504 means that this version of the client is banned, not the user!)<br />
* The 'nat' option makes the client able to detect whether it is behind a nat router or not. When the client is behind a nat router it should keep the "connection" alive with the PING command.<br />
{{eyecatch|Important|Make sure your client handles ALL possible AUTH return codes before giving out any versions!}}<br />
* When ''enc=x'' is defined the server will change the encoding used to x.<br />
**If the encoding is supported it will change right away (including the response) and be reset on logout/timeout.<br />
**If not supported then the argument will be silently ignored. Use ENCODING to test what works.<br />
**Supported encodings are [http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html these].<br />
* ''comp=1'' means that the client supports compression ([http://java.sun.com/j2se/1.5.0/docs/api/java/util/zip/Deflater.html DEFLATE]).<br />
**The server will compress (instead of truncating) the datagrams when needed if this option is enabled.<br />
**The first two bytes of compressed datagrams will always be set to zero. (So tags should never start with that.)<br />
* Default [[Wikipedia:MTU (networking)|''MTU'']] is 1400. Minimum allowed is 400, maximum 1400, due [[Wikipedia:Point-to-Point Protocol over Ethernet|PPPoE]].<br />
<br />
----<br />
<br />
=== LOGOUT: Logout ===<br />
'''Command String:'''<br />
* LOGOUT<br />
<br />
'''Possible Replies:'''<br />
* 203 LOGGED OUT<br />
* 403 NOT LOGGED IN<br />
<br />
'''Info:'''<br />
* This command only works if you are already logged in.<br />
* A logout should ALWAYS be issued if the client is currently logged in and is either exiting or not expecting to send/receive any AniDB API packets for the next >= 30 minutes.<br />
<br />
----<br />
=== ENCRYPT: Start Encrypted Session ===<br />
Will cause all future messages from the server, except the first (the reply to the ENCRYPT command itself), to be encrypted (128 bit [[Wikipedia:Advanced Encryption Standard|AES]]). The client will also have to encrypt all future requests sent to the server. All non-encrypted messages will be discarded by the server. The encryption key is the [[Wikipedia:MD5|MD5]] hash of a special ''UDP API Key'' (defined in the users profile) concatenated with the salt string as given in the reply to the ENCRYPT message. A normal AUTH message is still necessary to authenticate and should follow the ENCRYPT command once the API has acknowledged the encryption.<br />
<br />
'''Command String:'''<br />
* ENCRYPT user={str name}&type={int2 type}<br />
<br />
'''Possible Replies:'''<br />
* 209 {str salt} ENCRYPTION ENABLED<br />
* 309 API PASSWORD NOT DEFINED<br />
* 509 NO SUCH ENCRYPTION TYPE<br />
* 394 NO SUCH USER<br />
<br />
'''Info:'''<br />
* ''user'' is the user name.<br />
* ''type'' is the type of encryption; 1 => 128 bit AES (only one defined).<br />
* ''API Key'' is the one defined in the {{AniDBLink|profile|profile settings page}}.<br />
* It is not possible to disable the encryption once enabled while staying logged in.<br />
** A logout (the logout message needs to be correctly encrypted) or timeout will disable the encryption.<br />
* In order to minimize server load, encryption should be disabled by default and should have to be enabled manually by the user in the configuration options.<br />
* The encryption key is md5(api_key_of_user+''salt'').<br />
* Padding of the message needs to be done according to the PKCS5Padding scheme.<br />
<br />
== Notify Commands ==<br />
=== Introduction ===<br />
Broadly speaking, notifications provide an indication to the client that some event has occurred within the AniDB database.<br />
<br />
There are three types:<br />
* New file [[Notifications|notification]]. (Only anime type supported.)<br />
* New private message notification.<br />
* New buddy event notification.<br />
<br />
Note that, while a user can subscribe to multiple 'new file' events (see [[Notifications|notifications]]), at present, the UDP API only supports notifications of new files by anime. New files by group, or new files by producer, are NOT presently supported. Just the same, keeping in mind that the API is designed to potentially support such notifications in the future will help in understanding why some of the commands are structured the way they are.<br />
<br />
The word "notification" is also used a bit inconsistently in this document. An AniDB notification is originally a "new file [[Notifications|notification]]". It might be more correct to use the term "event" for the original "happening" and then "notification" as the means to notify the user (client). New-file, new-message, buddy-* and going-down are all events that results in notifications. Only the first two type of events are persistent, though, meaning they exist and remain in the same state until some user action affects them.<br />
<br />
=== Getting Notifications ===<br />
Clients that wish to receive notifications have two routes available to them. They are by no means mutually exclusive and selecting one does not imply a client is unable to use commands from another.<br />
<br />
'''Method One: Polling'''<br />
<br />
With this method, the client contacts the server at some interval (no more than once every 20 minutes) to see if there are new file notifications waiting. If there are, the client can the get further details of the files in question. This is analogous to checking an email server every half hour to see if new email has arrived.<br />
<br />
Its principal advantage is that it is easy to design and code. Blocking sockets are sufficient as the client can expect the reply received to correspond with the command sent.<br />
<br />
The disadvantage of this approach is that it introduces a delay and some uncertainty in receiving notifications. If, for example, the user clears the notification on the website before the client collects it, the client will not learn of the new file. Similarly, if the user does not dismiss notifications via the site, the client will have an increasing amount of stale data to work though. Finally, notifications cleared by the client also clears them from the website, so users will need to be made aware of what is going on.<br />
<br />
A polling HOWTO:<br />
<br />
* Use NOTIFY (no more than once every 20 minutes) to get the number of pending notifications<br />
* IF there are new notifications pending, use NOTIFYLIST to get a list of notification types and associated IDs.<br />
* Use NOTIFYGET to receive a notification, supplying the ID provided by NOTIFYLIST<br />
* Use NOTIFYACK to acknowledge a notification, supplying the ID provided by NOTIFYLIST (if desired)<br />
<br />
{{eyecatch|Note|The ID supplied by NOTIFYLIST will be the ID of the affected notification type. Since, at present, only the anime type is supported, this value is always an aid. In the future, it may represent a group or producer ID. In these cases, the str '''type''' value will indicate what entity the ID represents.}}<br />
<br />
'''Method Two: Server PUSH'''<br />
<br />
With this method, the server takes the active role in advising the client that a new file has arrived. The client must register with the server to receive further advice information, and will be responsible for keeping the login session from timing out, and any NAT router ports open. The UDP packet is sent to the ip and port from which the AUTH command was received.<br />
<br />
This method compensates for the disadvantages of the polling method, but is more difficult to code. Blocking sockets are no longer an option, nor can a client make any assumptions that an incoming packet will necessarily be a reply to the last command sent. The tag option may be helpful here.<br />
<br />
A PUSH HOWTO:<br />
<br />
* PUSH to register your client session.<br />
* Listen for 720-799 NOTIFICATIONs ('''not 290''').<br />
* Use PUSHACK to to acknowledge the notification using the nid supplied with NOTIFICATION<br />
* Use NOTIFYGET to receive a notification, suppling the relid provided by NOTIFICATION (NOT the packet ID)<br />
* Use NOTIFYACK to acknowledge a notification, suppling the relid provided by NOTIFICATION (if desired)<br />
* Use UPTIME (with an interval between 30 and 35 minutes) to keep login session valid<br />
<br />
It is probably a good idea to use tags to separate NOTIFICATIONs from the other communication. NOTIFICATIONs will '''never''' have tags.<br />
<br />
=== PUSH: UDP Notification Registration ===<br />
Register your client as an observer for AniDB notification events for the current user. If you are registered for one or more event types the AniDB server will send an UDP packet (format see below) on each change which affects the current user.<br />
<br />
'''Command String:'''<br />
* PUSH notify={boolean on_new_file}&msg={boolean on_new_private_message}[&buddy={boolean on_buddy_event}]<br />
<br />
'''Possible Replies:'''<br />
* 270 NOTIFICATION ENABLED<br />
OR (if both values are 0)<br />
* 370 NOTIFICATION DISABLED<br />
<br />
'''Info:'''<br />
* A client which has registered to receive UDP notification packets must:<br />
** Issue a PUSHACK command for each notification received with ''notify_packet_id'' provided in the notification packet.<br />
** Use PING to keep the connection alive (< 30 min).<br />
** Use UPTIME to ensure that the session is OK (>= 30 min).<br />
* Every notification generated is resent 3 times unless acknowledged. After that the client is logged out.<br />
<br />
=== NOTIFY: Notifications ===<br />
Get number of pending notifications (and number of online buddies).<br />
<br />
'''Command String:'''<br />
* NOTIFY [buddy=1]<br />
<br />
'''Possible Replies:'''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}<br />
when ''buddy=1''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}|{int4 number_of_online_buddies}<br />
<br />
'''Info:'''<br />
* If the client did send a NOTIFY within the last 35 minutes and it was confirmed by AniDB then receiving a 501 LOGIN FIRST message for the next NOTIFY command shows that AniDB logged the client out because it did not respond to a PUSH Notification packet.<br />
* There is no command to retrieve missed PUSH Notifications.<br />
{{eyecatch|Note|This command MUST NOT be issued more than once every 20 minutes.}}<br />
<br />
----<br />
=== NOTIFYLIST: List Notification/Message IDs ===<br />
List id of all pending (not acknowledged) ''new private message'' and ''new file'' notifications. Buddy events cannot be acknowledged.<br />
<br />
'''Command String:'''<br />
* NOTIFYLIST<br />
<br />
'''Possible Replies:'''<br />
*291 NOTIFYLIST<br />
: {str type}|{int4 id}<br />
: {str type}|{int4 id}<br />
: ...<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as required by NOTIFYGET. For messages it is the actual message id, for notifications it is the id of the related type; anime, group or producer. Since only file notifications related to anime is implemented atm, it is the anime id (aid).<br />
* NOTIFYLIST returns one line per entry, if no entries are available only the first line of the reply is returned.<br />
{{eyecatch|Note|This command MUST NOT be issued regularly but should only be triggered by either a push message received by the client or a reply to a NOTIFY command which tells you that there are messages/notifications waiting.}}<br />
<br />
----<br />
=== NOTIFYGET: Get Notification/Message ===<br />
Receive private message or file notification.<br />
<br />
'''Command String:'''<br />
* NOTIFYGET type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 292 NOTIFYGET<br />
: {int4 id}|{int4 from_user_id}|{str from_user_name}|{int4 date}|{int4 type}|{str title}|{str body}<br />
* 392 NO SUCH ENTRY<br />
when type = N<br />
* 293 NOTIFYGET<br />
: {int4 relid}|{int4 type}|{int2 count}|{int4 date}|{str relidname}|{str fids}<br />
* 393 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as given by NOTIFYLIST (or ''relid'' from 271 NOTIFICATION and mid from 272 NOTIFICATION)<br />
* for message entries (M):<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: type is the type of the message (0=normal msg, 1=annonymous, 2=system msg, 3=mod msg)<br />
* for notification entries (N):<br />
: relid is the id of the related type (anime)<br />
: relname is the name of the related type (anime)<br />
: type is the notification type (0=all, 1=new, 2=group, 3=complete)<br />
: count is the number of events pending for this subscription<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: fids is a comma separated list with the affected file ids<br />
<br />
----<br />
=== NOTIFYACK: Acknowledge Notification/Message ===<br />
This command will mark a message read or clear a ''new file'' notification. Buddy events are not acknowledgeable.<br />
<br />
'''Command String:'''<br />
* NOTIFYACK type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 281 NOTIFYACK SUCCESSFUL<br />
* 381 NO SUCH ENTRY<br />
when type = N<br />
* 282 NOTIFYACK SUCCESSFUL<br />
* 382 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
<br />
====Notification Packet Format====<br />
'''New File Notify:'''<br />
<br />
720 {int4 notify_packet_id} NOTIFICATION - NEW FILE<br />
{int4 fidlist}|{int2 reltype}|{int2 priority}<br />
<br />
* fidlist is a comma separated list of file ids<br />
* reltype is: 1 = anime, 2 = group, 3 = producer<br />
* priority is: 0 = low, 1 = medium, 2 = high<br />
* new file notifications are created as a batch, so it is not unusual to get several new files for a particular anime at once. It is in this case that a comma separated list of fids will be returned<br />
<br />
{{eyecatch|Note|Group (and producer) related file notifications are not implemented yet.}}<br />
<br />
<br />
'''New Private Message Notify:'''<br />
<br />
794 {int4 notify_packet_id} NOTIFICATION - NEW MESSAGE<br />
{int2 type}|{int4 date}|{int4 sent_by_uid}|{str sent_by_name}|{str subject}|{str body}|{int mid}<br />
<br />
* type is the type of the message (0=normal msg, 1=anonymous, 2=system msg, 3=mod msg)<br />
* date is the time the message was sent (in seconds since 1.1.1970)<br />
* sender uid/sender name are the user id and user name of the sender<br />
* subject is the message subject<br />
* body is message body (can be truncated)<br />
* mid is message id and can be used with NOTIFYACK<br />
<br />
'''Buddy Event Notify:'''<br />
753 {int4 notify_packet_id} NOTIFICATION - BUDDY<br />
{int4 buddy uid}|{int2 event type}<br />
* Possible event types:<br />
** 0 => LOGIN<br />
** 1 => LOGOUT<br />
** 2 => ACCEPTED<br />
** 3 => ADDED<br />
<br />
<br />
'''Going Down Event Notify:'''<br />
799 {int4 notify_packet_id} NOTIFICATION - SHUTTING DOWN<br />
{int4 time offline}|{int4 comment}<br />
<br />
* Clients with any notification on will receive the SHUTTING DOWN message before the API goes offline.<br />
* Time offline is the time in minutes the API will be down, 0 if indefinite (client can direct user to the AniDB site for status updates).<br />
* The comment is a short explanation for the downtime.<br />
* Only one datagram will be sent, and the server will not listen for replies.<br />
<br />
<br />
=== PUSHACK: UDP Notification Acknowledge ===<br />
Used to acknowledge notification packets (720-799). A client must be prepared to issue this command before using '''PUSH'''.<br />
<br />
'''Command String:'''<br />
* PUSHACK nid={int4 notify_packet_id}<br />
<br />
'''Possible Replies:'''<br />
* 701 PUSHACK CONFIRMED<br />
* 702 NO SUCH PACKET PENDING<br />
<br />
'''Info:'''<br />
* See: '''PUSH'''<br />
<br />
== Buddy Commands ==<br />
Group of commands used to administrate your buddylist.<br />
<br />
=== BUDDYADD: Add a user to Buddy List ===<br />
'''Command String:'''<br />
* BUDDYADD uid={int4 buddy uid}<br />
* BUDDYADD uname={int4 buddy name}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 255 BUDDY ADDED<br />
* 355 BUDDY ALREADY ADDED<br />
<br />
----<br />
=== BUDDYDEL: Remove a user from Buddy List ===<br />
'''Command String:'''<br />
* BUDDYDEL uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 256 BUDDY DELETED<br />
<br />
----<br />
=== BUDDYACCEPT: Accept user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYACCEPT uid={int4 user uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 257 BUDDY ACCEPTED<br />
* 357 BUDDY ALREADY ACCEPTED<br />
<br />
----<br />
=== BUDDYDENY: Deny user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYDENY uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 258 BUDDY DENIED<br />
* 358 BUDDY ALREADY DENIED<br />
<br />
----<br />
=== BUDDYLIST: Retrieve Buddy List ===<br />
'''Command String:'''<br />
* BUDDYLIST startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 253 {int2 start} {int2 end} {int2 total} BUDDY LIST<br />
: {int4 uid}|{str username}|{int2 state}<br />
: ...<br />
'''Info:'''<br />
* state is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = this user is in your buddylist<br />
* bit 2 = this user has accepted you<br />
* bit 3 = this user is waiting for your approval<br />
<br />
----<br />
=== BUDDYSTATE: Retrieve Buddy States===<br />
'''Command String:'''<br />
* BUDDYSTATE startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 254 {int2 start} {int2 end} {int2 total} BUDDY STATE<br />
: {int4 uid}|{int2 onlinestate}<br />
: ...<br />
<br />
'''Info:'''<br />
* onlinestate is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = http online (user has issued a HTTP request within the last 10 minutes)<br />
* bit 2 = udp api online (user is currently connected to the udp api server)<br />
* example: 0=offline, 1=http online, 2=udp api online, 3=http&udp api online<br />
<br />
== Data Commands ==<br />
=== ANIME: Retrieve Anime Data ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIME aid={int4 id}[&amask={hexstr}]<br />
by name<br />
* ANIME aname={str anime name}[&amask={hexstr}]<br />
<br />
'''Possible Replies:'''<br />
<br />
If no ''amask'' is provided:<br />
* 230 ANIME<br />
: {int4 aid}|{int4 eps}|{int4 ep count}|{int4 special cnt}|{int4 rating}|{int4 votes}|{int4 tmprating}|{int4 tmpvotes}|{int4 review rating average}|{int4 reviews}|{str year}|{str type}|{str romaji}|{str kanji}|{str english}|{str other}|{str short names}|{str synonyms}|{str category list}<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* Fields are returned in the same order they appear in the ''amask'' field list: byte 1, bit 7 first<br />
* Synonyms and short names are separated with '<br />
* Category fields are separated with ',' and ordered by weight (desc).<br />
* By name: must be perfect match of romaji/kanji/english/other/synonym/short name.<br />
* 'Producer id list' and 'producer name list' match the data returned by the former producer bits (but using the revised creator ids)<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
* '''Note:''' The character id list is the first data to be truncated if needed. And then: tag list, synonym list, short name list. This applies to the FILE command too.<br />
* Selecting an 'unused' or 'reserved' bit will return an "illegal input" (505) response.<br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="5" align="center"><b>amask</b></td></tr><br />
<tr><br />
<td align="center"><b>Byte 1</b></td><br />
<td align="center"><b>Byte 2</b></td><br />
<td align="center"><b>Byte 3</b></td><br />
<td align="center"><b>Byte 4</b></td><br />
<td align="center"><b>Byte 5</b></td><br />
<td align="center"><b>Byte 6</b></td><br />
<td align="center"><b>Byte 7</b></td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int aid</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int dateflags</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 special ep count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int air date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int end date</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str url</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str picname</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int vote count</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 temp rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int temp vote count</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 average review rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int review count</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str award list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>bool is 18+ restricted</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int ANN id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int allcinema id</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str AnimeNfo id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td><i>reserved</i></td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td><i>reserved</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>reserved</i></td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int date record updated</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int character id list</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int creator id list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int main creator id list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str main creator name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 specials count</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 credits count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 other count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 trailer count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 parody count</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<br />
'''Related aid type (Byte 1, Bit 2):'''<br />
<pre><br />
value meaning<br />
<br />
1 sequel<br />
2 prequel<br />
11 same setting<br />
12 alternative setting<br />
32 alternative version<br />
41 music video<br />
42 character<br />
51 side story<br />
52 parent story<br />
61 summary<br />
62 full story<br />
100 other<br />
</pre><br />
<br />
'''Examples:''' (note that the given amask gives the same result as the default request)<br />
> ANIME aid=1&amask=b2f0e0fc000000&s=xxxxx<br />
< 230 ANIME<br />
1|1999-1999|TV Series|Space,Future,Plot Continuity,SciFi,Space Travel,Shipboard,Other Planet,Novel,Genetic Modification,Action,Romance,Military,Large Breasts,Gunfights,Adventure,Human Enhancement,Nudity|Seikai no Monshou|星界の紋章|Crest of the Stars||13|13|3|853|3225|756|110|875|11<br />
<br />
<br />
----<br />
<br />
=== ANIMEDESC: Retrieve Anime Description ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIMEDESC aid={int4 id}&part={int4 partno}<br />
<br />
'''Possible Replies:'''<br />
* 233 ANIMEDESC<br />
: {int4 current part}|{int4 max parts}|{str description}<br />
* 330 NO SUCH ANIME<br />
* 333 NO SUCH DESCRIPTION<br />
<br />
'''Info:'''<br />
* The maximum length of the anime description is roughly 5000 characters, but the maximum length of a UDP packet is 1400 bytes<br />
* Multiple calls to ANIMEDESC may be necessary to retrieve the complete text, retrieving separate 1400 byte parts with each call<br />
* ''part'' is zero-based<br />
* '''Note:''' No support, at present, for retrieving descriptions by title. ''aid'' only<br />
<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> ANIMEDESC aid=3169&part=0&s=xxxxx<br />
< 233 ANIMEDESC<br />
0|1|As summer break arrives for the students, Jun Sakurada is busily studying on his own in the library, making up for time lost <cut><br />
<br />
----<br />
=== CALENDAR: Get Upcoming Titles ===<br />
Returns the anime ids of the 25 most recently aired / released anime, directly followed by the next 25 anime due to be aired / released, ordered by start date.<br />
<br />
'''Command String:'''<br />
* CALENDAR<br />
<br />
'''Possible Replies:'''<br />
* 297 CALENDAR<br />
{int aid}|{int startdate}|{int dateflags}/n<br />
<br />
..repeated n times<br />
<br />
* 397 CALENDAR EMPTY<br />
<br />
'''Info:'''<br />
* Takes no parameters (other than the session string)<br />
* Titles returned are filtered by the 'show adult' preference of the logged in user. That is, users who have elected to hide adult content will have it hidden here as well.<br />
* Do not depend on the command always returning exactly 50 titles; there may not always be 25 future titles pending, depending on the user's 'adult' preferences, and the date in relation to the relation to the current anime season.<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
<br />
----<br />
=== CHARACTER: Get Character Information ===<br />
Returns character details associated with a given character ID, including associated anime ids, episode ids, and seiyuu.<br />
<br />
'''Command String:'''<br />
* CHARACTER charid={int characterid}<br />
<br />
'''Possible Replies:'''<br />
* 235 CHARACTER<br />
: {int charid}|{str character name kanji}|{str character name transcription}|{str pic}|{anime blocks}|{int episode list}|{int last update date}|{int2 type}|{str gender}<br />
<br />
: An 'anime block' is {int anime id},{int appearance},{int creatorid},{boolean is_main_seiyuu} repeated as many times as necessary, separated by a single quote ( ' ). <br />
<br />
* 335 NO SUCH CHARACTER<br />
<br />
'''Info:'''<br />
* If no seiyuu is associated with the character for a given aid, the 'creatorid' and 'is_main_seiyuu' fields will be empty, but the commas will remain.<br />
* An empty episode list is "undefined": no episode values have been added.<br />
* ''appearance'' values: 0='appears in', 1='cameo appearance in', 2='main character in', 3='secondary cast in'<br />
* ''type'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** 1 => 'Character'<br />
** 2 => 'Mecha'<br />
** 3 => 'Organisation'<br />
** 4 => 'Vessel' <br />
* ''gender'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** "M" => 'Male'<br />
** "F" => 'Female'<br />
** "I" => 'Intersexual'<br />
** "D" => 'Dimorphic'<br />
** "-" => 'none/does not apply'<br />
** "?" => 'unknown'<br />
<br />
'''Example:'''<br />
<br />
CHARACTER charid=488&s=DChan<br />
235 CHARACTER<br />
488|ニコ・ロビン|Nico Robin|14789.jpg|4097,2,1900,1'69,2,1901,0'6199,0,1900,1'5691,0,1900,1'2644,0,,'4851,0,1900,1||1236938094<br />
<br />
=== CREATOR: Get Creator Information ===<br />
<br />
'''Command String:'''<br />
* CREATOR creatorid={int creatorid}<br />
<br />
'''Possible Replies:'''<br />
* 245 CREATOR<br />
: {int creatorid}|{str creator name kanji}|{str creator name transcription}|{int type}|{str pic_name}|{str url_english}|{str url_japanese}|{str wiki_url_english}|{str wiki_url_japanese}|{int last update date}<br />
<br />
* 345 NO SUCH CREATOR<br />
<br />
'''Info:'''<br />
* ANIME AMASK byte6, bit5<br />
* ''type'' values: 1='person', 2='company', 3='collaboration'<br />
<br />
Example:<br />
<br />
245 CREATOR<br />
718|GAINAX|Gainax|2|10092.png||http://www.gainax.co.jp/|Gainax|Gainax|1237048093<br />
<br />
=== EPISODE: Retrieve Episode Data ===<br />
'''Command String:'''<br><br />
by eid<br />
* EPISODE eid={int eid}<br />
by anime and episode number<br />
* EPISODE aname={str anime name}&epno={int4 episode number}<br />
* EPISODE aid={int anime id}&epno={int4 episode number}<br />
<br />
'''Possible Replies:'''<br />
* 240 EPISODE<br />
: {int eid}|{int aid}|{int4 length}|{int4 rating}|{int votes}|{str epno}|{str eng}|{str romaji}|{str kanji}|{int aired}|{int type}<br />
* 340 NO SUCH EPISODE<br />
<br />
'''Info:'''<br />
* length is in minutes<br />
* Returned 'epno' includes special character (only if special) and padding (only if normal).<br />
** Special characters are S(special), C(credits), T(trailer), P(parody), O(other).<br />
* The ''type'' is the raw episode type, used to indicate numerically what the special character will be<br />
** 1: regular episode (no prefix), 2: special ("S"), 3: credit ("C"), 4: trailer ("T"), 5: parody ("P"), 6: other ("O")<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> EPISODE eid=1&s=xxxxx<br />
< 240 EPISODE<br />
1|1|24|400|4|01|Invasion|shinryaku|??<br />
<br />
> EPISODE aname=Seikai no Monshou&epno=2&s=xxxxx<br />
< 240 EPISODE<br />
2|1|24|750|2|02|Kin of the Stars|Hoshi-tachi no Kenzoku|??????|1295059229|1<br />
<br />
----<br />
<br />
=== FILE: Retrieve File Data ===<br />
'''Command String:'''<br><br />
by fid:<br />
* FILE fid={int4 id}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by size+ed2k hash:<br />
* FILE size={int8 size}&ed2k={str ed2khash}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by anime, group and epno<br />
* FILE aname={str anime name}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aname={str anime name}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
<br />
'''Possible Replies:'''<br />
* 220 FILE<br />
: {int4 fid}|{int4 aid}|{int4 eid}|{int4 gid}|{int4 state}|{int8 size}|{str ed2k}|{str anidbfilename}<br />
* 220 FILE<br />
: {int4 fid}|...(data list)<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 0}|{int4 fid 1}|...|{int4 fid n}<br />
* 320 NO SUCH FILE<br />
<br />
'''Info:'''<br />
* fid, aid, eid, gid are the unique ids for the file, anime, ep, group entries at AniDB.<br />
: You can use those to create links to the corresponding pages at AniDB.<br />
* anidbfilename is the AniDB filename for the file.<br />
: However this name does not contain all the extra information of the filenames on AniDB and might be composed slightly different.<br />
* fmask and amask are hexidecimal strings where each bit corresponds to a data field related to the specified file (see below). The data list received is sorted and returned in the same order as the tables: top to bottom, left to right, with fmask preceding amask. There is '''no''' provision to retrieve all fields. Further, requesting a 'unusued' or 'reserved' bit will return an "illegal input" error.<br />
* fid is always returned as the first value, regardless of what masks are provided.<br />
* Only the first matching file is returned when aname, gname and epno is used.<br />
* "audio codec" and "audio bitrate" will return multiple values if there are multiple audio streams present in the file. Values will be separated by a single quote. <br />
* For byte 1, bit 2 (other episodes): episode IDs will be followed by an integer '''percentage''' that indicate the percentage of the related episode this file covers. Typically 100%, there are cases where it will be 50, 30, or other values. This value provides no indication where, within an episode, the file represents. That is, 50% could mean the file covers the first half of the episode, the second half, or some 50% range in between.<br />
'''State:'''<br />
<pre><br />
bit / int value meaning<br />
1 / 1 FILE_CRCOK: file matched official CRC (displayed with green background in AniDB)<br />
2 / 2 FILE_CRCERR: file DID NOT match official CRC (displayed with red background in AniDB)<br />
3 / 4 FILE_ISV2: file is version 2<br />
4 / 8 FILE_ISV3: file is version 3<br />
5 / 16 FILE_ISV4: file is version 4<br />
6 / 32 FILE_ISV5: file is version 5<br />
7 / 64 FILE_UNC: file is uncensored<br />
8 / 128 FILE_CEN: file is censored<br />
<br />
examples:<br />
state ==== 9 ==> FILE_CRCOK+FILE_ISV3 ==> file matched official CRC and is version 3<br />
state ==== 0 ==> - ==> file was not crc checked and is version 1<br />
state ==== 34 ==> FILE_CRCERR+FILE_ISV5 ==> file DID NOT match official CRC and is version 5<br />
state ==== 1 ==> FILE_CRCOK ==> file matched official CRC and is version 1<br />
state ==== 8 ==> FILE_ISV3 ==> file was not CRC checked and is version 3<br />
</pre><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''fmask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
<td align="center">'''Byte 5'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 aid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 eid</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 gid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 mylist id</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>list other episodes</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>int2 IsDeprecated</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int2 state</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int8 size</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ed2k</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str md5</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str sha1</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str crc32</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>video colour depth</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str quality</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str audio codec list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 audio bitrate list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str video codec</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 video bitrate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str video resolution</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str file type (extension)</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str dub language</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str sub language</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 length in seconds</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str description</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 aired date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str anidb file name</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 mylist state</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 mylist filestate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 mylist viewed</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 mylist viewdate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str mylist storage</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str mylist source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str mylist other</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''amask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 anime total episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str category list</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str epno</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ep name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str ep romaji name</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str ep kanji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 episode rating</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 episode vote count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str group name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str group short name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int4 date aid record updated</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
'''Examples:''' (html escaped code intended)<br />
> FILE size=177747474&ed2k=70cd93fd3981cc80a8ea6a646ff805c9&fmask=7FF8FEF8&amask=C000F0C0&s=xxxxx<br />
< 220 FILE<br />
312498|4688|69260|4243|0||0|1|177747474|70cd93fd3981cc80a8ea6a646ff805c9|b2a7c7d591333e20495de3571b235c28|7af9b962c17ff729baeee67533e5219526cd5095|a200fe73|high|DTV|Vorbis (Ogg Vorbis)|104|H264/AVC|800|704x400|japanese|english'english'english|1560||1175472000|26|26|01|The Wings to the Sky|Sora he no Tsubasa|????|#nanoha-DamagedGoodz|Nanoha-DGz<br />
<br />
----<br />
<br />
=== GROUP: Retrieve Group Data ===<br />
'''Command String:'''<br><br />
by gid<br />
* GROUP gid={int gid}<br />
by name/shortname<br />
* GROUP gname={str group name}<br />
<br />
'''Possible Replies:'''<br />
* 250 GROUP<br />
: {int gid}|{int4 rating}|{int votes}|{int4 acount}|{int fcount}|{str name}|{str short}|{str irc channel}|{str irc server}|{str url}|{str picname}|{int4 foundeddate}|{int4 disbandeddate}|{int2 dateflags}|{int4 lastreleasedate}|{int4 lastactivitydate}|{list grouprelations}<br />
* 350 NO SUCH GROUP<br />
<br />
'''Info:'''<br />
* Requires login<br />
* ''gname'' is an exact match of either a group name or short name<br />
* As either name and short names are unique if there is a result from GROUP request by name that will be the only match<br />
* ''dateflags'' values:<br />
** bit0 set == Foundeddate, Unknown Day<br />
** bit1 set == Foundeddate, Unknown Month, Day<br />
** bit2 set == Disbandeddate, Unknown Day<br />
** bit3 set == Disbandeddate, Unknown Month, Day<br />
** bit5 set == Foundeddate, Unknown Year<br />
** bit6 set == Disbandeddate, Unknown Year<br />
* ''releasedate'' and ''activitydate'' are distinct. ''releasedate'' is the date a file was actually released by the group, where ''activitydate'' is the date of a file being added to AniDB. As such, lastrelease may very well be much older than lastactivity.<br />
* ''groupreleations'' is a list of apostrophe-separated pairs, where each pair consists of {int4 othergroupid},{int2 relationtype}<br />
** relationtype:<br />
*** 1 => "Participant in"<br />
*** 2 => "Parent of"<br />
*** 4 => "Merged from"<br />
*** 5 => "Now known as"<br />
*** 6 => "Other"<br />
<br />
'''Example:'''<br />
> GROUP gid=7091&s=bunny<br />
< 250 GROUP<br />
7091|832|1445|43|566|Frostii|Frostii|#frostii|irc.rizon.net|http://frostii.com|15844.jpg|1228089600|0|1|1301875200|1304222640|7255,1'3097,4'748,4'8106,1'8159,2'8402,1'8696,1'9022,1<br />
<br />
----<br />
<br />
=== GROUPSTATUS: Get Completed Episode ===<br />
Returns a list of group names and ranges of episodes released by the group for a given anime.<br />
<br />
'''Command String:'''<br />
* GROUPSTATUS aid={int animeid}[&state={int completion_state}]<br />
<br />
'''Possible Replies:'''<br />
* 225 GROUPSTATUS<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: ... (repeated)<br />
<br />
* 325 NO SUCH GROUPS FOUND<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* The seven fields will be repeated as necessary, one for each group, separated by a new line character<br />
* Groups will be filtered by the languages selected in the user's profile<br />
* If ''state'' is not supplied, groups with a completion state of <i>'ongoing'</i>, <i>'finished'</i>, or <i>'complete'</i> are returned<br />
* Groups are returned in order of descending episode count<br />
* If there are more groups to return than can be stored in a UDP packet, additional groups will be silently discarded<br />
* ''state'' values: <br />
#ongoing<br />
#stalled<br />
#complete<br />
#dropped<br />
#finished<br />
#specials only<br />
<br />
'''Example:'''<br />
> GROUP GROUPSTATUS aid=8692&s=vLl1N<br />
< 225 GROUPSTATUS<br />
7407|Coalgirls|3|25|839|12|1-25<br />
9863|Hadena Subs|3|25|374|1|1-25<br />
11951|ChaosBlades|3|25|0|0|1-25<br />
[truncated]<br />
<br />
=== UPDATED: Get List of Updated Anime IDs ===<br />
Returns a list of AniDB anime ids of anime that have been updated in in a given time frame, ordered by descending date.<br />
<br />
'''Command String:'''<br />
* UPDATED entity=1&[age={int4 id}|time={int4 date}]<br />
<br />
'''Possible Replies:'''<br />
* 243 UPDATED<br />
{int entity}|{int total count}|{int last update date}|{list aid}<br />
<br />
* 343 NO UPDATES<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1<br />
* Either ''age'' OR ''time'' can be specified, but not both<br />
* ''age'' is specified in days.<br />
** eg: age=30 requests a list of aid values of anime that have changed in the past 30 days<br />
* ''time'' is specified in unix time.<br />
** eg: time=1264982400 requests a list of aid values of anime that have changed since 2010-02-01<br />
* A maximum of 200 values will be returned<br />
* ''count'' specifies the total number of items found for the given time period. In short, if this value is great than 200, you have not retrieved all applicable ids.<br />
* ''last update date'' will contain the AniDB update time of the ''last'' aid to appear on the list<br />
<br />
'''An anime will be considered updated if:'''<br />
* A change is made to the anime record itself<br />
* An ''main'' or ''official'' anime title is added, edited, or deleted (not ''short'' or ''synonym'')<br />
* An episode for the anime is added, or delete (but NOT edited!)<br />
* An episode title is added, edited, or delete<br />
* An anime relation is added, or deleted<br />
<br />
== MyList Commands ==<br />
=== MYLIST: Retrieve MyList Data ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLIST lid={int4 lid}<br />
by fid:<br />
* MYLIST fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLIST size={int4 size}&ed2k={str ed2khash}<br />
by anime + group + epno<br />
* MYLIST aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 221 MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 312 MULTIPLE MYLIST ENTRIES<br />
: {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}<br />
* 321 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* The state field provides information about the location and sharing state of a file in MyList.<br />
* 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).<br />
* eps is a list of episodes, e.g. "1-12,14-16,T1"<br />
<br />
'''States:'''<br />
0 - unknown - state is unknown or the user doesn't want to provide this information<br />
1 - on hdd - the file is stored on hdd (but is not shared)<br />
2 - on cd - the file is stored on cd<br />
3 - deleted - the file has been deleted or is not available for other reasons (i.e. reencoded)<br />
<br />
'''Filestates:''' (for normal files, i.e. not generic)<br />
0 => normal/original<br />
1 => corrupted version/invalid crc<br />
2 => self edited<br />
10 => self ripped<br />
11 => on dvd<br />
12 => on vhs<br />
13 => on tv<br />
14 => in theaters<br />
15 => streamed<br />
100 => other<br />
<br />
'''Example:'''<br />
> MYLIST aname=gits sac&s=xxxxx<br />
< 322 MULTIPLE FILES FOUND<br />
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<br />
<br />
----<br />
=== MYLISTADD: Add file to MyList ===<br />
The command string for MYLISTADD is made of up two blocks: a 'fileinfo' block, which limits the command to a specific file, or an 'animeinfo'/'groupinfo'/'episodeinfo' block, which can be used to specify a range of files, including generics. Additionally, a number of optional parameters can be included with either set.<br />
<br />
'''Adding a single file to the MyList with the 'fileinfo' block'''<br />
<br />
* MYLISTADD fid={int4 fid}<br />
'''or'''<br />
* MYLISTADD size={int4 size}&ed2k={str ed2khash}<br />
'''or'''<br />
* MYLISTADD lid={int4 lid}&edit=1 (valid for edit only)<br />
<br />
'''Adding one or more files to the MyList with the 'animeinfo'/'groupinfo'/'episodeinfo' block'''<br />
<br />
Here, you have a number of options, depending on what data you have available. In brief, 'animeinfo' represents a choice between anime id and anime name. 'groupinfo' represents a choice between group id, group name, and generic=1. 'episodeinfo' represents a range of one or more episodes.<br />
<br />
* MYLISTADD aid={int4 aid}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&generic=1&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&generic=1&epno={int4 episode number}<br />
<br />
Each command listed can have, in addition, a number of optional components to provide further MyList details. Append these as desired.<br />
<br />
* &state={int2 state}<br />
* &viewed={boolean viewed}<br />
* &viewdate={int4 viewdate}<br />
* &source={str source}<br />
* &storage={str storage}<br />
* &other={str other}<br />
<br />
Finally, edit=1 can be included to edit a MyList entry instead of creating a new one. When editing, optional values that are not supplied retain their original value. That is, they are ''not'' replaced with default or empty values. Only values supplied are updated.<br />
<br />
'''Possible Replies:'''<br />
* 320 NO SUCH FILE<br />
* 330 NO SUCH ANIME<br />
* 350 NO SUCH GROUP<br />
when edit=0 and adding by fid, size/ed2k<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 mylist id of new entry}<br />
when edit=0 and adding by aname, aid<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 number of entries added}<br />
* 310 FILE ALREADY IN MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 1}|{int4 fid 2}|...|{int4 fid n}<br />
when edit=1<br />
* 311 MYLIST ENTRY EDITED<br />
* 311 MYLIST ENTRY EDITED<br />
: {int4 number of entries edited}<br />
* 411 NO SUCH MYLIST ENTRY<br />
<br />
'''Info:'''<br />
* All data except lid/fid/size+hash/generic is optional.<br />
* Viewed should be 0 for unwatched files and 1 for watched files.<br />
* If viewdate is not specified, the current time will be used. The field will be disregarded if viewed=0.<br />
* Other is the only field which may contain newlines, but they have to be stored as &lt;br /&gt;<br />
* For state values refer to: '''MYLIST'''<br />
* If you want to change an existing entry and already know its MyList id (lid) please use the lid-version of this command. It put less load on the server.<br />
* epno=0 means all eps (default), negative numbers means upto. (-12 -> upto 12)<br />
* group is optional only when edit=1, meaning you can't add every file for an anime<br />
* If the file already exists (response code 310), the ''current'' record will be returned, in the same format as the MYLIST response.<br />
----<br />
<br />
=== MYLISTDEL: Remove file from MyList ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLISTDEL lid={int4 lid}<br />
by fid:<br />
* MYLISTDEL fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLISTDEL size={int4 size}&ed2k={str ed2k hash}<br />
by anime + group + epno<br />
* MYLISTDEL aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 211 MYLIST ENTRY DELETED<br />
: {int4 number of entries}<br />
* 411 NO SUCH MYLIST ENTRY<br />
'''Info:'''<br />
* group is optional<br />
* command will delete all enties found<br />
<br />
----<br />
=== MYLISTSTATS : Retrieve MyList stats ===<br />
'''Command String:'''<br />
* MYLISTSTATS<br />
'''Possible Replies:'''<br />
* 222 MYLIST STATS<br />
{animes}|{eps}|{files}|{size of files}|{added animes}|{added eps}|{added files}|{added groups}|{leech %}|{glory %}|{viewed % of db}|{mylist % of db}|{viewed % of mylist}|{number of viewed eps}|{votes}|{reviews}|{viewed length in minutes}<br />
<br />
'''Info:'''<br />
* All fields are int<br />
<br />
----<br />
<br />
=== VOTE: Vote for specified anime/episode/group ===<br />
'''Command String:'''<br><br />
by id<br />
* VOTE type={int2 type}&id={int4 id}[&value={int4 vote value}&epno={int4 episode number}]<br />
by name<br />
* VOTE type={int2 type}&name={string name}[&value={int4 vote value}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 260 VOTED<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 261 VOTE FOUND<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 262 VOTE UPDATED<br />
: {str entity name}|{old vote value}|{vote type}|{entity id}<br />
* 263 VOTE REVOKED<br />
: {str entity name}|{revoked vote value}|{vote type}|{entity id}<br />
* 360 NO SUCH VOTE<br />
: {str entity name}|0|{vote type}|{entity id}<br />
* 361 INVALID VOTE TYPE<br />
* 362 INVALID VOTE VALUE<br />
* 363 PERMVOTE NOT ALLOWED<br />
: {str aname}|{vote value}|{type}|{entity id}<br />
* 364 ALREADY PERMVOTED<br />
: {str entity name}|{existing vote value}|{vote type}|{entity id}<br />
<br />
'''Info:'''<br />
* type: 1=anime, 2=anime tmpvote, 3=group<br />
* entity: anime, episode, or group<br />
* for episode voting add epno on type=1<br />
* value: negative number means revoke, 0 means retrieve (default), 100-1000 are valid vote values, rest is illegal<br />
* votes will be updated automatically (no questions asked)<br />
* tmpvoting when there exist a perm vote is not possible<br />
<br />
----<br />
<br />
=== RANDOM: Get a random anime ===<br />
'''Command String:'''<br />
* RANDOMANIME type={int4 type}<br />
<br />
'''Possible Replies:'''<br />
* 230 ANIME ... (see ANIME)<br />
<br />
'''Info:'''<br />
* type: 0=from db, 1=watched, 2=unwatched, 3=all mylist<br />
<br />
== Misc Commands ==<br />
=== MYLISTEXPORT: Schedule a MyList Export ===<br />
Queues a {{AniDBLink|export|MyList Export}} by the AniDB Servers. As with a manual export request, exports are only done during periods when server load is low. As a result, exports may take up to 24 hours. The client submitting the request will receive an AniDB message when the export is ready to be collected.<br />
<br />
Only one export can be in the queue at a time.<br />
<br />
'''Command String:'''<br />
* MYLISTEXPORT [template={str template_name}|cancel=1]<br />
<br />
'''Possible Replies:'''<br />
* 217 EXPORT QUEUED<br />
* 218 EXPORT CANCELLED<br />
* 317 EXPORT NO SUCH TEMPLATE<br />
* 318 EXPORT ALREADY IN QUEUE<br />
* 319 EXPORT NO EXPORT QUEUED OR IS PROCESSING<br />
<br />
'''Info:'''<br />
* ''template_name'' must match an available export template on the {{AniDBLink|export|MyList Export}} page.<br />
* ''cancel'' will cancel any pending export request, queued either through UDP or the web server.<br />
* Clients can subscribe the message notifications if they wish to be notified when an export is complete.<br />
<br />
----<br />
<br />
=== PING: Ping Command ===<br />
'''Command String:'''<br />
* PING [nat=1]<br />
<br />
'''Possible Replies:'''<br />
* 300 PONG<br />
: {int4 port} ''(when nat=1)''<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* May be used by a frontend to determine if the API is still available.<br />
* May be executed even if not yet logged in.<br />
* The option <tt>nat=1</tt> provides an easy way to determine if the router has changed the outgoing port. ({{t|587}})<br />
<br />
----<br />
<br />
=== VERSION: Retrieve Server Version ===<br />
'''Command String:'''<br />
* VERSION<br />
<br />
'''Possible Replies:'''<br />
* 998 VERSION<br />
: {str server version}<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
<br />
----<br />
=== UPTIME: Retrieve Server Uptime ===<br />
'''Command String:'''<br />
* UPTIME<br />
<br />
'''Possible Replies:'''<br />
* 208 UPTIME<br />
: {int4 udpserver uptime in milliseconds}<br />
<br />
'''Info:'''<br />
* This command is the preferred way to check that the session is OK.<br />
<br />
----<br />
=== ENCODING: Change Encoding for Session ===<br />
Sets preferred [[Wikipedia:Character encoding|encoding]] per session. The preferred way to do this is to use the '''enc''' argument for AUTH. This command is mostly for testing.<br />
<br />
'''Command String:'''<br />
* ENCODING name={str encoding name}<br />
<br />
'''Possible Replies:'''<br />
* 219 ENCODING CHANGED<br />
* 519 ENCODING NOT SUPPORTED<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* Supported encodings: http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html<br />
* Default: ASCII.<br />
* Resets to default on logout.<br />
<br />
----<br />
<br />
=== SENDMSG: Send Message ===<br />
'''Command String:'''<br />
* SENDMSG to={str username}&title={str title}&body={str body}<br />
<br />
'''Possible Replies:'''<br />
* 294 SENDMSG SUCCESSFUL<br />
* 394 NO SUCH USER<br />
* 501 LOGIN FIRST<br />
<br />
'''Note:'''<br />
* This command allows you to send an AniDB message.<br />
{{eyecatch|Important|<br />
title must not be longer than 50 chars.<br><br />
body must not be longer than 900 chars.<br />
}}<br />
<br />
----<br />
=== USER: Retrieve User UID ===<br />
'''Command String:'''<br />
* USER [user={str user name}|uid={int user id}]<br />
<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 295 USER<br />
: {int4 uid}|{str username}<br />
<br />
----<br />
<br />
=== STATS [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* STATS<br />
<br />
'''Possible Replies:'''<br />
* 206 STATS<br />
: {int4 animes)|{int4 eps}|{int4 files}|{int4 groups}|{int4 users}|{int8 total file size in bytes}|{int4 open [[creq|creqs]]}<br />
<br />
----<br />
=== TOP [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* TOP<br />
<br />
'''Possible Replies:'''<br />
* 207 TOP<br />
: {str longest mylist}|{int count}<br />
: {str largest mylist}|{int count}<br />
: {str most lame files}|{int count}<br />
: {str most indep. user}|{int count}<br />
: {str biggest leecher}|{int count}<br />
: {str most anime added}|{int count}<br />
: {str most eps added}|{int count}<br />
: {str most files added}|{int count}<br />
: {str most groups added}|{int count}<br />
: {str most votes}|{int count}<br />
: {str most reviews}|{int count}<br />
<br />
'''Info:'''<br />
* All strings are user names.<br />
* 'Hide myself in IRC stats' applies for this too.<br />
<br />
== Fatal Errors ==<br />
At anypoint int the retrieval process you have to expect the following output:<br />
* 6xx INTERNAL SERVER ERROR<br />
: ERROR: {str errormessage}<br />
OR<br />
*6xx INTERNAL SERVER ERROR - {str errormessage}<br />
<br />
Such errors should be reported back to [[User:Ommina|Ommina]].<br />
(xx is a number between 00 and 99)<br />
<br />
If you supply an unknown or unimplemented command you will get an error:<br />
* 598 UNKNOWN COMMAND<br />
<br />
== Return Codes ==<br />
{{eyecatch|Note|While the names below '''are''' the actual code strings returned by the server, clients are nonetheless encouraged to work with the numeric codes instead. }}<br />
<pre><br />
LOGIN_ACCEPTED = 200<br />
LOGIN_ACCEPTED_NEW_VERSION = 201<br />
LOGGED_OUT = 203<br />
RESOURCE = 205<br />
STATS = 206<br />
TOP = 207<br />
UPTIME = 208<br />
ENCRYPTION_ENABLED = 209<br />
MYLIST_ENTRY_ADDED = 210<br />
MYLIST_ENTRY_DELETED = 211<br />
ADDED_FILE = 214<br />
ADDED_STREAM = 215<br />
EXPORT_QUEUED = 217<br />
EXPORT_CANCELLED = 218<br />
ENCODING_CHANGED = 219<br />
FILE = 220<br />
MYLIST = 221<br />
MYLIST_STATS = 222<br />
WISHLIST = 223<br />
NOTIFICATION = 224<br />
GROUP_STATUS = 225<br />
WISHLIST_ENTRY_ADDED = 226<br />
WISHLIST_ENTRY_DELETED = 227<br />
WISHLIST_ENTRY_UPDATED = 228<br />
MULTIPLE_WISHLIST = 229<br />
ANIME = 230<br />
ANIME_BEST_MATCH = 231<br />
RANDOM_ANIME = 232<br />
ANIME_DESCRIPTION = 233<br />
REVIEW = 234<br />
CHARACTER = 235<br />
SONG = 236<br />
ANIMETAG = 237<br />
CHARACTERTAG = 238<br />
EPISODE = 240<br />
UPDATED = 243<br />
TITLE = 244<br />
CREATOR = 245<br />
NOTIFICATION_ENTRY_ADDED = 246<br />
NOTIFICATION_ENTRY_DELETED = 247<br />
NOTIFICATION_ENTRY_UPDATE = 248<br />
MULTIPLE_NOTIFICATION = 249<br />
GROUP = 250<br />
CATEGORY = 251<br />
BUDDY_LIST = 253<br />
BUDDY_STATE = 254<br />
BUDDY_ADDED = 255<br />
BUDDY_DELETED = 256<br />
BUDDY_ACCEPTED = 257<br />
BUDDY_DENIED = 258<br />
VOTED = 260<br />
VOTE_FOUND = 261<br />
VOTE_UPDATED = 262<br />
VOTE_REVOKED = 263<br />
HOT_ANIME = 265<br />
RANDOM_RECOMMENDATION = 266<br />
RANDOM_SIMILAR = 267<br />
NOTIFICATION_ENABLED = 270<br />
NOTIFYACK_SUCCESSFUL_MESSAGE = 281<br />
NOTIFYACK_SUCCESSFUL_NOTIFIATION = 282<br />
NOTIFICATION_STATE = 290<br />
NOTIFYLIST = 291<br />
NOTIFYGET_MESSAGE = 292<br />
NOTIFYGET_NOTIFY = 293<br />
SENDMESSAGE_SUCCESSFUL = 294<br />
USER_ID = 295<br />
CALENDAR = 297<br />
<br />
PONG = 300<br />
AUTHPONG = 301<br />
NO_SUCH_RESOURCE = 305<br />
API_PASSWORD_NOT_DEFINED = 309<br />
FILE_ALREADY_IN_MYLIST = 310<br />
MYLIST_ENTRY_EDITED = 311<br />
MULTIPLE_MYLIST_ENTRIES = 312<br />
WATCHED = 313<br />
SIZE_HASH_EXISTS = 314<br />
INVALID_DATA = 315<br />
STREAMNOID_USED = 316<br />
EXPORT_NO_SUCH_TEMPLATE = 317<br />
EXPORT_ALREADY_IN_QUEUE = 318<br />
EXPORT_NO_EXPORT_QUEUED_OR_IS_PROCESSING = 319<br />
NO_SUCH_FILE = 320<br />
NO_SUCH_ENTRY = 321<br />
MULTIPLE_FILES_FOUND = 322<br />
NO_SUCH_WISHLIST = 323<br />
NO_SUCH_NOTIFICATION = 324<br />
NO_GROUPS_FOUND = 325<br />
NO_SUCH_ANIME = 330<br />
NO_SUCH_DESCRIPTION = 333<br />
NO_SUCH_REVIEW = 334<br />
NO_SUCH_CHARACTER = 335<br />
NO_SUCH_SONG = 336<br />
NO_SUCH_ANIMETAG = 337<br />
NO_SUCH_CHARACTERTAG = 338<br />
NO_SUCH_EPISODE = 340<br />
NO_SUCH_UPDATES = 343<br />
NO_SUCH_TITLES = 344<br />
NO_SUCH_CREATOR = 345<br />
NO_SUCH_GROUP = 350<br />
NO_SUCH_CATEGORY = 351<br />
BUDDY_ALREADY_ADDED = 355<br />
NO_SUCH_BUDDY = 356<br />
BUDDY_ALREADY_ACCEPTED = 357<br />
BUDDY_ALREADY_DENIED = 358<br />
NO_SUCH_VOTE = 360<br />
INVALID_VOTE_TYPE = 361<br />
INVALID_VOTE_VALUE = 362<br />
PERMVOTE_NOT_ALLOWED = 363<br />
ALREADY_PERMVOTED = 364<br />
HOT_ANIME_EMPTY = 365<br />
RANDOM_RECOMMENDATION_EMPTY = 366<br />
RANDOM_SIMILAR_EMPTY = 367<br />
NOTIFICATION_DISABLED = 370<br />
NO_SUCH_ENTRY_MESSAGE = 381<br />
NO_SUCH_ENTRY_NOTIFICATION = 382<br />
NO_SUCH_MESSAGE = 392<br />
NO_SUCH_NOTIFY = 393<br />
NO_SUCH_USER = 394<br />
CALENDAR_EMPTY = 397<br />
NO_CHANGES = 399<br />
<br />
NOT_LOGGED_IN = 403<br />
NO_SUCH_MYLIST_FILE = 410<br />
NO_SUCH_MYLIST_ENTRY = 411<br />
MYLIST_UNAVAILABLE = 412<br />
<br />
LOGIN_FAILED = 500<br />
LOGIN_FIRST = 501<br />
ACCESS_DENIED = 502<br />
CLIENT_VERSION_OUTDATED = 503<br />
CLIENT_BANNED = 504<br />
ILLEGAL_INPUT_OR_ACCESS_DENIED = 505<br />
INVALID_SESSION = 506<br />
NO_SUCH_ENCRYPTION_TYPE = 509<br />
ENCODING_NOT_SUPPORTED = 519<br />
BANNED = 555<br />
UNKNOWN_COMMAND = 598<br />
<br />
INTERNAL_SERVER_ERROR = 600<br />
ANIDB_OUT_OF_SERVICE = 601<br />
SERVER_BUSY = 602<br />
NO_DATA = 603<br />
TIMEOUT - DELAY AND RESUBMIT = 604<br />
API_VIOLATION = 666<br />
<br />
PUSHACK_CONFIRMED = 701<br />
NO_SUCH_PACKET_PENDING = 702<br />
<br />
VERSION = 998</pre><br />
<br />
[[Category:Development]]<br />
[[Category:UDP]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=UDP_API_Definition&diff=18463UDP API Definition2015-03-31T09:20:05Z<p>Ommina: /* ANIME: Retrieve Anime Data */</p>
<hr />
<div>{{TOCright}}<br />
<br />
== General Information ==<br />
'''Author:''' [[User:Exp|Exp]] & [[User:Epoximator|Epoximator]] & [[User:Ommina|Ommina]]<br><br />
'''Version:''' 0.03.730 (2015-03-25)<br><br />
'''Version number used for protover parameter:''' "3"<br />
<br />
'''IMPORTANT INFORMATION FOR ALL INTERESTED:'''<br />
* If you are mainly interested in notifications and private messaging, check out our [[Jabber]] and [[RSSRDF]] support first.<br />
* The UDP API is not an appropriate choice if you desire to download a local copy of the AniDB database.<br />
* If you want to create a client you have to register it {{AniDBLink|client|here}} and [[UDP Clients|here]].<br />
** Check out the clients that are being developed. There exists usable code in many different languages already.<br />
* If you have suggestions for improvements or new features use the [[UDP API DEV|development]] page.<br />
* Please also take a look at the [[API]] page.<br />
<br />
== Formats used in this Spec ==<br />
* {vartype varname} - Specifies what shall be inserted at this point and its type.<br />
* [...] - Everything between [ and ] is optional.<br />
<br />
=== Used types ===<br />
* ''int2'' - 2 byte Integer (in string representation)<br />
* ''int4'' - 4 byte Integer (in string representation)<br />
* ''boolean'' - true or false - use '1' for ''true'', '0' for ''false''<br />
* ''str'' - String (UDP packet length restricts string size to 1400 bytes)<br />
* ''hexstr'' -- a hex representation of a decimal value, two characters per byte. If multiple bytes are represented, byte one is the first two characters of the string, byte two the next two, and so on.<br />
<br />
=== Content Encoding ===<br />
* Default character encoding: ''ASCII''<br />
* Escape scheme for option values (to server): ''html form encoding'' + ''newline''<br />
** This means you have to encode at least <tt>&</tt> in your option values in html form encoding style (<tt>&amp;amp;</tt>) before sending them to the api server. All other html form encodings are optional.<br />
** All newlines should be replaced by &lt;br /&gt;<br />
* Escape scheme for returned data fields (from server): ', | and newline<br />
** Content newlines are encoded as &lt;br /&gt;, ' is encoded as ` and | is not allowed in data fields.<br />
** Dates are returned in unix time (number of seconds elapsed since January 1, 1970 00:00:00 UTC)<br />
<br />
== Basics ==<br />
=== General ===<br />
The network communication is ''packet'' and ''line'' based. Each AniDB API command is exactly one UDP packet containing one line. Results are sent as one packet but may consist out of multiple lines. A return value always starts with a 3 byte result code followed by a human readable version of the result code. Be aware that important data fields may be returned directly after the return code (see: 200,201,271,272,504).<br />
The meaning for all result codes can be found in this document. If there is more than one entry returned, it's one entry per line. Lines are terminated by a <tt>\n</tt> (no dos linefeed <tt>\r</tt>). The elements of a format string are separated by a "|" character.<br />
<br />
<tt>{three digit return code} {str return string}\n</tt><br><br />
<tt>{data field 0}|{data field 1}|...|{data field n}</tt><br />
<br />
'''IMPORTANT:'''<br />
* All commands except PING, ENCRYPT, ENCODING, AUTH and VERSION '''requires''' login, meaning that the ''session tag'' must be set (<tt>s=xxxxx</tt>).<br />
* A client should ignore any additional trailing data fields it doesn't expect. Additional fields are going to be added to the output of some commands from time to time. Those additional fields will simply be appended to the end of the existing output. A client should be written in a way so that it is not affected by such new fields.<br />
* Due to the length constraints of an UDP package (over PPPoE) the replies from the server will never exceed 1400 bytes. String fields will be truncated if necessary to ensure this. No warnings are given when this happens.<br />
* A client should handle all possible return codes for each command.<br />
** Possible return codes for '''all commands''':<br />
*** 505 ILLEGAL INPUT OR ACCESS DENIED<br />
*** 555 BANNED<br />
***: {str reason}<br />
*** 598 UNKNOWN COMMAND<br />
*** 600 INTERNAL SERVER ERROR<br />
*** 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
*** 602 SERVER BUSY - TRY AGAIN LATER<br />
*** 604 TIMEOUT - DELAY AND RESUBMIT<br />
** Additional return codes for all commands that '''require login''':<br />
*** 501 LOGIN FIRST<br />
*** 502 ACCESS DENIED<br />
*** 506 INVALID SESSION<br />
<br />
{{eyecatch|Note|The '555 BANNED' message should not be expected by the client. This message is only enabled temporary to help developers understand what they are doing wrong.}}<br><br />
<br />
{{eyecatch|Note|<br />
While in daily maintenance the AniDB API will reply with<br />
<br />
601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
<br />
to all commands. If a client receives such a return value it should wait at least 30 minutes before trying again.}}<br />
<br />
=== Server / UDP Connection ===<br />
The Client has to send data packets to:<br />
* '''Server:''' api.anidb.net<br />
* '''Port:''' 9000/UDP<br />
The servername and port should not be hardcoded into a frontend but should be read from a configuration file.<br />
<br />
=== Server Errors ===<br />
* At any time the API might return a fatal error of the form:<br />
: <tt>6xx ERROR DESCRIPTION</tt><br />
* Possible codes are 600-699.<br />
* Occurrences of these errors (except 601 and 602) should be reported to [[User:Ommina|Ommina]].<br />
{{eyecatch|Note|6XX messages do not always return the tags given with the command which caused the error!}}<br />
<br />
=== Connection Problems ===<br />
There are many ways for a client to end up banned or the API might currently be handling too many concurrent connections.<br />
If a client does not get any reply to an AUTH command it should start to increase the retry delay exponentially with every failed login attempt. (i.e. try again after 30 seconds if the first login attempt failed, if the second fails too retry after 2 minutes, then 5 minutes, then 10 minutes, then 30 minutes, ... until you reach a retry delay of ~2-4h.)<br />
<br />
=== Local Port ===<br />
A client should select a fixed local port >1024 at install time and reuse it for local UDP Sockets. If the API sees too many different UDP Ports from one IP within ~1 hour it will ban the IP. (So make sure you're reusing your UDP ports also for testing/debugging!)<br />
<br />
The local port may be hardcoded, however, an option to manually specify another port should be offered.<br />
<br />
'''Note when behind a [[Wikipedia:Network address translation|NAT]]/masquerading router:'''<br><br />
A session between the server and a client is identified by the ''IP and port'' used by the client. So when the port (or IP) changes within a session the client has to authenticate again. If a client is behind a NAT router it can’t actually control the local port used for the connection. The router will normally ''translate'' the port to support several computers on a LAN to share the Internet connection. The public port (as determined by the router and seen by the server) which has been assigned to the connection will only be reserved for as long as it is in use. This means that the router will usually ''deallocate the port after a fixed timeout period'' (eg. five, ten or 15 minutes). Once that happens the client will no longer be able to receive UDP messages from the server (the messages will be discarded as undeliverable by the router) and a new port will be selected once the client tries to send a message to the server (which will result in a new connection session - '''Note:''' This could get you banned!, see above). So in order to keep a session over a NAT router alive, the client has to ping the server within the router's deallocation period to prevent a timeout.<br />
<br />
The client can decide whether it is behind a NAT router or not by adding <tt>nat=1</tt> to the AUTH command. This will cause the response to include the IP and port as seen by the server. If the port differs from the port reported by the local socket, the connection subject to NAT and the client should issue PING commands in regular intervals. Please do not send pings more often than is necessary to keep NAT connections alive.<br />
<br />
=== Flood Protection ===<br />
To prevent high server load the UDP API server enforces a strict flood protection policy.<br />
* Short Term:<br />
** A Client MUST NOT send more than 0.5 packets per second (that's one packet every two seconds, not two packets a second!)<br />
** The server will start to enforce the limit after the first 5 packets have been received.<br />
* Long Term:<br />
** A Client MUST NOT send more than one packet every four seconds over an extended amount of time.<br />
** ''An extended amount of time'' is not defined. Use common sense.<br />
<br />
Once a client exceeds a rate limit all further UDP packets from that client will be dropped without feedback until the client's packet rate is back down to acceptable levels.<br />
<br />
{{eyecatch|Note|Dropped packets are still taken into account for the packet rate. Meaning if you continuously send packets your client will be banned forever.}}<br />
<br />
Generally clients should be written in a way to minimize server and network load. You should always keep that in mind.<br />
<br />
Abusive clients may be banned completely.<br />
<br />
{{eyecatch|Note|<br />
If you suddenly stop getting replies from the AniDB API or you normally don't have a notable packetloss and from one point on you suddenly note a high packetloss percentage you have most likely entered a critical flood ratio.<br />
If the AniDB API isn't answering at all it might either be down or you have been banned, this is normally caused by violating the API specs (i.e. too many connections using different ports from one IP, too many auth failures, ...) (usually lasts 30 minutes).<br />
If you're experiencing packet loss you have probably reached the rate limit and the API starts to randomly drop incoming packets from your IP. (can be solved by enforcing a delay between multiple commands when you're sending a batch)}}<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Caching ===<br />
To minimize server and network load a client should use local caching in order to prevent repeated API requests for the same data.<br />
<br />
A client should locally cache FILE/EP/ANIME/GROUP/... info wherever possible for extended amounts of time.<br />
(I.e. if a client is used to scan a local folder with anime files and add them via API to a users MyList then it shall only ask for all files in the first run and cache the info for all files known to AniDB. If run again over the same folder it shall only check those files which were unknown to AniDB at the time of the last check.)<br />
<br />
Later versions of the API might enforce this by banning clients which ask for the same information more than once every week/month.<br />
<br />
=== Tag option ===<br />
The API will add a user defined string at the beginning of each reply line separated with a space, if desired.<br />
* To enable add the <tt>tag={str usertag}</tt> option to a command.<br />
* A tag is only valid for the command it was send with, meaning it is not persistent. If you want to have tags in front of all reply lines you will have to append the tag option to each command you send to the server.<br />
* Tags are meant to enable a client to handle more than one request/reply at a time.<br />
<br />
Usage example:<br />
AUTH user=baka&pass=baka&protover=25&client=someclient&clientver=1&tag=abc123<br />
abc123 200 Jxqxb LOGIN ACCEPTED<br />
or<br />
LOGOUT s=Jxqxb&tag=byebye<br />
byebye 203 LOGGED OUT<br />
<br />
{{eyecatch|Note|The tag option is valid for all api commands and is thus not explicitly listed in the description of each command.}}<br />
<br />
=== Data Indexes (fid,aid,eid,gid,lid) ===<br />
* All indexes start at 1 (not 0).<br />
* It is possible for table entries to have id fields with a value of 0 (i.e. gid). Those are to be interpreted as "NONE" or "NULL".<br />
* An ID is '''never''' reused. That means after an entry is deleted no new entry will ever have that ID again.<br />
* Mylist IDs (lid) are globally unique, not per-user unique.<br />
<br />
== Authing Commands ==<br />
{{eyecatch|Note|'''ANY''' command which requires parameters may return: 505 ILLEGAL INPUT OR ACCESS DENIED}}<br />
<br />
----<br />
=== AUTH: Authing to the AnimeDB ===<br />
'''Command String:'''<br />
* AUTH user={str username}&pass={str password}&protover={int4 apiversion}&client={str clientname}&clientver={int4 clientversion}[&nat=1&comp=1&enc={str encoding}&mtu{int4 mtu value}&imgserver=1]<br />
<br />
'''Possible Replies:'''<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
* 500 LOGIN FAILED<br />
* 503 CLIENT VERSION OUTDATED<br />
* 504 CLIENT BANNED - {str reason}<br />
* 505 ILLEGAL INPUT OR ACCESS DENIED<br />
* 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
when nat=1<br />
* 200 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED<br />
* 201 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
when imgserver=1<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
{str image server name}<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
{str image server name}<br />
<br />
'''Info:'''<br />
{{eyecatch|Note|The password is the normal AniDB website password! The password listed in the profile as API Password in only used for the optional encryption feature.}}<br />
* The ''session_key'' is a String containing only ''a-z,A-Z,0-9'' chars of a length of ''4-8'' characters.<br />
: It has to be stored by the client and needs to be sent as parameter with every command which requires the user to logged in.<br />
* The ''session_key'' String is appended as parameter "s", i.e. "PUSH notify=1&msg=1&s={str session_key}".<br />
* On a '''500 LOGIN FAILED''' message the client should request the user to enter username and password again.<br />
* In case of a '''501 LOGIN FIRST''' message the client should silently resend an auth command and send the failed command again.<br />
* A '''502 ACCESS DENIED''' message should abort the current action on the client side and display a message to the user.<br />
* A '''503 CLIENT VERSION OUTDATED''' message states that the udp server has been updated and does not support your client any longer. (protover is too low). A 201 message refers to a new version of the client software.<br />
* A '''506 INVALID SESSION''' means that either the session key parameter "s" was not provided with a command that requires it or the session key is no longer valid. The client should reissue an AUTH command.<br />
{{eyecatch|Note|A frontend shall expect 501 and 502 messages to be returned on ANY command.}}<br><br />
{{eyecatch|Note|AniDB usernames may only contain characters (a-z,A-Z), numbers (0-9), underscores (_) and hyphens (-).}}<br />
* The client should send the apiversion of the AnimeDB API version it supports as value of the protover parameter.<br />
* The client MAY NOT send anything but the version of the API Specs the author used to write the client! (as it is stated at the top of this file @ "Version number used for protover parameter")<br />
: The API will compare that value to it's own version of the API and if the version of the client is older the API will decide whether the changes were significant enough to deny the old client access to the DB.<br />
* The clientname shall be a lower-case string containing only the chars ''a-z'' of ''4-16 chars'' length which identifies the client. (i.e. mykickassclient)<br />
* The clientversion shall be a number starting with 1, increased on every change in the client.<br />
: clientname and clientversion might be used by the API to distinguish between different clients and client versions if that should ever become necessary.<br />
{{eyecatch|Important|<br />
* DO NOT use the clientname of an existing client. If you modify an existing client's code to meet your own needs, create a new client name for yourself.<br />
* ALWAYS increase the clientversion number if you release a new client version.}}<br />
* A Login and its assigned ''session_key'' is valid until the virtual UDP connection times out or until a LOGOUT command is issued.<br />
* The virtual UDP connection times out if no data was received from the client for '''35 minutes'''.<br />
* A client should issue a UPTIME command once every 30 minutes to keep the connection alive should that be required.<br />
* If the client does not use any of the notification/push features of the API it should NOT keep the connection alive, furthermore it should explicitly terminate the connection by issuing a LOGOUT command once it finished it's work.<br />
* If it is very likely that another command will be issued shortly (within the next 20 minutes) a client SHOULD keep the current connection open, by not sending a LOGOUT command.<br />
{{eyecatch|Important|<br />
* A client should NOT perform a full AUTH / command / LOGOUT cycle for each command it wants to send. Again, if another command is likely within 20 minutes, remain logged in.}}<br />
* The client shall notify the user if it received a 201 message at login.<br />
: This means a new version of the client is available, however the old version is still supported otherwise a client banned message would have been returned.<br />
* The user should get a pop-up message on 503 and 504 messages telling him to update his client software.<br />
: ('''Note:''' 504 means that this version of the client is banned, not the user!)<br />
* The 'nat' option makes the client able to detect whether it is behind a nat router or not. When the client is behind a nat router it should keep the "connection" alive with the PING command.<br />
{{eyecatch|Important|Make sure your client handles ALL possible AUTH return codes before giving out any versions!}}<br />
* When ''enc=x'' is defined the server will change the encoding used to x.<br />
**If the encoding is supported it will change right away (including the response) and be reset on logout/timeout.<br />
**If not supported then the argument will be silently ignored. Use ENCODING to test what works.<br />
**Supported encodings are [http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html these].<br />
* ''comp=1'' means that the client supports compression ([http://java.sun.com/j2se/1.5.0/docs/api/java/util/zip/Deflater.html DEFLATE]).<br />
**The server will compress (instead of truncating) the datagrams when needed if this option is enabled.<br />
**The first two bytes of compressed datagrams will always be set to zero. (So tags should never start with that.)<br />
* Default [[Wikipedia:MTU (networking)|''MTU'']] is 1400. Minimum allowed is 400, maximum 1400, due [[Wikipedia:Point-to-Point Protocol over Ethernet|PPPoE]].<br />
<br />
----<br />
<br />
=== LOGOUT: Logout ===<br />
'''Command String:'''<br />
* LOGOUT<br />
<br />
'''Possible Replies:'''<br />
* 203 LOGGED OUT<br />
* 403 NOT LOGGED IN<br />
<br />
'''Info:'''<br />
* This command only works if you are already logged in.<br />
* A logout should ALWAYS be issued if the client is currently logged in and is either exiting or not expecting to send/receive any AniDB API packets for the next >= 30 minutes.<br />
<br />
----<br />
=== ENCRYPT: Start Encrypted Session ===<br />
Will cause all future messages from the server, except the first (the reply to the ENCRYPT command itself), to be encrypted (128 bit [[Wikipedia:Advanced Encryption Standard|AES]]). The client will also have to encrypt all future requests sent to the server. All non-encrypted messages will be discarded by the server. The encryption key is the [[Wikipedia:MD5|MD5]] hash of a special ''UDP API Key'' (defined in the users profile) concatenated with the salt string as given in the reply to the ENCRYPT message. A normal AUTH message is still necessary to authenticate and should follow the ENCRYPT command once the API has acknowledged the encryption.<br />
<br />
'''Command String:'''<br />
* ENCRYPT user={str name}&type={int2 type}<br />
<br />
'''Possible Replies:'''<br />
* 209 {str salt} ENCRYPTION ENABLED<br />
* 309 API PASSWORD NOT DEFINED<br />
* 509 NO SUCH ENCRYPTION TYPE<br />
* 394 NO SUCH USER<br />
<br />
'''Info:'''<br />
* ''user'' is the user name.<br />
* ''type'' is the type of encryption; 1 => 128 bit AES (only one defined).<br />
* ''API Key'' is the one defined in the {{AniDBLink|profile|profile settings page}}.<br />
* It is not possible to disable the encryption once enabled while staying logged in.<br />
** A logout (the logout message needs to be correctly encrypted) or timeout will disable the encryption.<br />
* In order to minimize server load, encryption should be disabled by default and should have to be enabled manually by the user in the configuration options.<br />
* The encryption key is md5(api_key_of_user+''salt'').<br />
* Padding of the message needs to be done according to the PKCS5Padding scheme.<br />
<br />
== Notify Commands ==<br />
=== Introduction ===<br />
Broadly speaking, notifications provide an indication to the client that some event has occurred within the AniDB database.<br />
<br />
There are three types:<br />
* New file [[Notifications|notification]]. (Only anime type supported.)<br />
* New private message notification.<br />
* New buddy event notification.<br />
<br />
Note that, while a user can subscribe to multiple 'new file' events (see [[Notifications|notifications]]), at present, the UDP API only supports notifications of new files by anime. New files by group, or new files by producer, are NOT presently supported. Just the same, keeping in mind that the API is designed to potentially support such notifications in the future will help in understanding why some of the commands are structured the way they are.<br />
<br />
The word "notification" is also used a bit inconsistently in this document. An AniDB notification is originally a "new file [[Notifications|notification]]". It might be more correct to use the term "event" for the original "happening" and then "notification" as the means to notify the user (client). New-file, new-message, buddy-* and going-down are all events that results in notifications. Only the first two type of events are persistent, though, meaning they exist and remain in the same state until some user action affects them.<br />
<br />
=== Getting Notifications ===<br />
Clients that wish to receive notifications have two routes available to them. They are by no means mutually exclusive and selecting one does not imply a client is unable to use commands from another.<br />
<br />
'''Method One: Polling'''<br />
<br />
With this method, the client contacts the server at some interval (no more than once every 20 minutes) to see if there are new file notifications waiting. If there are, the client can the get further details of the files in question. This is analogous to checking an email server every half hour to see if new email has arrived.<br />
<br />
Its principal advantage is that it is easy to design and code. Blocking sockets are sufficient as the client can expect the reply received to correspond with the command sent.<br />
<br />
The disadvantage of this approach is that it introduces a delay and some uncertainty in receiving notifications. If, for example, the user clears the notification on the website before the client collects it, the client will not learn of the new file. Similarly, if the user does not dismiss notifications via the site, the client will have an increasing amount of stale data to work though. Finally, notifications cleared by the client also clears them from the website, so users will need to be made aware of what is going on.<br />
<br />
A polling HOWTO:<br />
<br />
* Use NOTIFY (no more than once every 20 minutes) to get the number of pending notifications<br />
* IF there are new notifications pending, use NOTIFYLIST to get a list of notification types and associated IDs.<br />
* Use NOTIFYGET to receive a notification, supplying the ID provided by NOTIFYLIST<br />
* Use NOTIFYACK to acknowledge a notification, supplying the ID provided by NOTIFYLIST (if desired)<br />
<br />
{{eyecatch|Note|The ID supplied by NOTIFYLIST will be the ID of the affected notification type. Since, at present, only the anime type is supported, this value is always an aid. In the future, it may represent a group or producer ID. In these cases, the str '''type''' value will indicate what entity the ID represents.}}<br />
<br />
'''Method Two: Server PUSH'''<br />
<br />
With this method, the server takes the active role in advising the client that a new file has arrived. The client must register with the server to receive further advice information, and will be responsible for keeping the login session from timing out, and any NAT router ports open. The UDP packet is sent to the ip and port from which the AUTH command was received.<br />
<br />
This method compensates for the disadvantages of the polling method, but is more difficult to code. Blocking sockets are no longer an option, nor can a client make any assumptions that an incoming packet will necessarily be a reply to the last command sent. The tag option may be helpful here.<br />
<br />
A PUSH HOWTO:<br />
<br />
* PUSH to register your client session.<br />
* Listen for 720-799 NOTIFICATIONs ('''not 290''').<br />
* Use PUSHACK to to acknowledge the notification using the nid supplied with NOTIFICATION<br />
* Use NOTIFYGET to receive a notification, suppling the relid provided by NOTIFICATION (NOT the packet ID)<br />
* Use NOTIFYACK to acknowledge a notification, suppling the relid provided by NOTIFICATION (if desired)<br />
* Use UPTIME (with an interval between 30 and 35 minutes) to keep login session valid<br />
<br />
It is probably a good idea to use tags to separate NOTIFICATIONs from the other communication. NOTIFICATIONs will '''never''' have tags.<br />
<br />
=== PUSH: UDP Notification Registration ===<br />
Register your client as an observer for AniDB notification events for the current user. If you are registered for one or more event types the AniDB server will send an UDP packet (format see below) on each change which affects the current user.<br />
<br />
'''Command String:'''<br />
* PUSH notify={boolean on_new_file}&msg={boolean on_new_private_message}[&buddy={boolean on_buddy_event}]<br />
<br />
'''Possible Replies:'''<br />
* 270 NOTIFICATION ENABLED<br />
OR (if both values are 0)<br />
* 370 NOTIFICATION DISABLED<br />
<br />
'''Info:'''<br />
* A client which has registered to receive UDP notification packets must:<br />
** Issue a PUSHACK command for each notification received with ''notify_packet_id'' provided in the notification packet.<br />
** Use PING to keep the connection alive (< 30 min).<br />
** Use UPTIME to ensure that the session is OK (>= 30 min).<br />
* Every notification generated is resent 3 times unless acknowledged. After that the client is logged out.<br />
<br />
=== NOTIFY: Notifications ===<br />
Get number of pending notifications (and number of online buddies).<br />
<br />
'''Command String:'''<br />
* NOTIFY [buddy=1]<br />
<br />
'''Possible Replies:'''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}<br />
when ''buddy=1''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}|{int4 number_of_online_buddies}<br />
<br />
'''Info:'''<br />
* If the client did send a NOTIFY within the last 35 minutes and it was confirmed by AniDB then receiving a 501 LOGIN FIRST message for the next NOTIFY command shows that AniDB logged the client out because it did not respond to a PUSH Notification packet.<br />
* There is no command to retrieve missed PUSH Notifications.<br />
{{eyecatch|Note|This command MUST NOT be issued more than once every 20 minutes.}}<br />
<br />
----<br />
=== NOTIFYLIST: List Notification/Message IDs ===<br />
List id of all pending (not acknowledged) ''new private message'' and ''new file'' notifications. Buddy events cannot be acknowledged.<br />
<br />
'''Command String:'''<br />
* NOTIFYLIST<br />
<br />
'''Possible Replies:'''<br />
*291 NOTIFYLIST<br />
: {str type}|{int4 id}<br />
: {str type}|{int4 id}<br />
: ...<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as required by NOTIFYGET. For messages it is the actual message id, for notifications it is the id of the related type; anime, group or producer. Since only file notifications related to anime is implemented atm, it is the anime id (aid).<br />
* NOTIFYLIST returns one line per entry, if no entries are available only the first line of the reply is returned.<br />
{{eyecatch|Note|This command MUST NOT be issued regularly but should only be triggered by either a push message received by the client or a reply to a NOTIFY command which tells you that there are messages/notifications waiting.}}<br />
<br />
----<br />
=== NOTIFYGET: Get Notification/Message ===<br />
Receive private message or file notification.<br />
<br />
'''Command String:'''<br />
* NOTIFYGET type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 292 NOTIFYGET<br />
: {int4 id}|{int4 from_user_id}|{str from_user_name}|{int4 date}|{int4 type}|{str title}|{str body}<br />
* 392 NO SUCH ENTRY<br />
when type = N<br />
* 293 NOTIFYGET<br />
: {int4 relid}|{int4 type}|{int2 count}|{int4 date}|{str relidname}|{str fids}<br />
* 393 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as given by NOTIFYLIST (or ''relid'' from 271 NOTIFICATION and mid from 272 NOTIFICATION)<br />
* for message entries (M):<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: type is the type of the message (0=normal msg, 1=annonymous, 2=system msg, 3=mod msg)<br />
* for notification entries (N):<br />
: relid is the id of the related type (anime)<br />
: relname is the name of the related type (anime)<br />
: type is the notification type (0=all, 1=new, 2=group, 3=complete)<br />
: count is the number of events pending for this subscription<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: fids is a comma separated list with the affected file ids<br />
<br />
----<br />
=== NOTIFYACK: Acknowledge Notification/Message ===<br />
This command will mark a message read or clear a ''new file'' notification. Buddy events are not acknowledgeable.<br />
<br />
'''Command String:'''<br />
* NOTIFYACK type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 281 NOTIFYACK SUCCESSFUL<br />
* 381 NO SUCH ENTRY<br />
when type = N<br />
* 282 NOTIFYACK SUCCESSFUL<br />
* 382 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
<br />
====Notification Packet Format====<br />
'''New File Notify:'''<br />
<br />
720 {int4 notify_packet_id} NOTIFICATION - NEW FILE<br />
{int4 fidlist}|{int2 reltype}|{int2 priority}<br />
<br />
* fidlist is a comma separated list of file ids<br />
* reltype is: 1 = anime, 2 = group, 3 = producer<br />
* priority is: 0 = low, 1 = medium, 2 = high<br />
* new file notifications are created as a batch, so it is not unusual to get several new files for a particular anime at once. It is in this case that a comma separated list of fids will be returned<br />
<br />
{{eyecatch|Note|Group (and producer) related file notifications are not implemented yet.}}<br />
<br />
<br />
'''New Private Message Notify:'''<br />
<br />
794 {int4 notify_packet_id} NOTIFICATION - NEW MESSAGE<br />
{int2 type}|{int4 date}|{int4 sent_by_uid}|{str sent_by_name}|{str subject}|{str body}|{int mid}<br />
<br />
* type is the type of the message (0=normal msg, 1=anonymous, 2=system msg, 3=mod msg)<br />
* date is the time the message was sent (in seconds since 1.1.1970)<br />
* sender uid/sender name are the user id and user name of the sender<br />
* subject is the message subject<br />
* body is message body (can be truncated)<br />
* mid is message id and can be used with NOTIFYACK<br />
<br />
'''Buddy Event Notify:'''<br />
753 {int4 notify_packet_id} NOTIFICATION - BUDDY<br />
{int4 buddy uid}|{int2 event type}<br />
* Possible event types:<br />
** 0 => LOGIN<br />
** 1 => LOGOUT<br />
** 2 => ACCEPTED<br />
** 3 => ADDED<br />
<br />
<br />
'''Going Down Event Notify:'''<br />
799 {int4 notify_packet_id} NOTIFICATION - SHUTTING DOWN<br />
{int4 time offline}|{int4 comment}<br />
<br />
* Clients with any notification on will receive the SHUTTING DOWN message before the API goes offline.<br />
* Time offline is the time in minutes the API will be down, 0 if indefinite (client can direct user to the AniDB site for status updates).<br />
* The comment is a short explanation for the downtime.<br />
* Only one datagram will be sent, and the server will not listen for replies.<br />
<br />
<br />
=== PUSHACK: UDP Notification Acknowledge ===<br />
Used to acknowledge notification packets (720-799). A client must be prepared to issue this command before using '''PUSH'''.<br />
<br />
'''Command String:'''<br />
* PUSHACK nid={int4 notify_packet_id}<br />
<br />
'''Possible Replies:'''<br />
* 701 PUSHACK CONFIRMED<br />
* 702 NO SUCH PACKET PENDING<br />
<br />
'''Info:'''<br />
* See: '''PUSH'''<br />
<br />
== Buddy Commands ==<br />
Group of commands used to administrate your buddylist.<br />
<br />
=== BUDDYADD: Add a user to Buddy List ===<br />
'''Command String:'''<br />
* BUDDYADD uid={int4 buddy uid}<br />
* BUDDYADD uname={int4 buddy name}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 255 BUDDY ADDED<br />
* 355 BUDDY ALREADY ADDED<br />
<br />
----<br />
=== BUDDYDEL: Remove a user from Buddy List ===<br />
'''Command String:'''<br />
* BUDDYDEL uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 256 BUDDY DELETED<br />
<br />
----<br />
=== BUDDYACCEPT: Accept user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYACCEPT uid={int4 user uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 257 BUDDY ACCEPTED<br />
* 357 BUDDY ALREADY ACCEPTED<br />
<br />
----<br />
=== BUDDYDENY: Deny user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYDENY uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 258 BUDDY DENIED<br />
* 358 BUDDY ALREADY DENIED<br />
<br />
----<br />
=== BUDDYLIST: Retrieve Buddy List ===<br />
'''Command String:'''<br />
* BUDDYLIST startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 253 {int2 start} {int2 end} {int2 total} BUDDY LIST<br />
: {int4 uid}|{str username}|{int2 state}<br />
: ...<br />
'''Info:'''<br />
* state is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = this user is in your buddylist<br />
* bit 2 = this user has accepted you<br />
* bit 3 = this user is waiting for your approval<br />
<br />
----<br />
=== BUDDYSTATE: Retrieve Buddy States===<br />
'''Command String:'''<br />
* BUDDYSTATE startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 254 {int2 start} {int2 end} {int2 total} BUDDY STATE<br />
: {int4 uid}|{int2 onlinestate}<br />
: ...<br />
<br />
'''Info:'''<br />
* onlinestate is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = http online (user has issued a HTTP request within the last 10 minutes)<br />
* bit 2 = udp api online (user is currently connected to the udp api server)<br />
* example: 0=offline, 1=http online, 2=udp api online, 3=http&udp api online<br />
<br />
== Data Commands ==<br />
=== ANIME: Retrieve Anime Data ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIME aid={int4 id}[&amask={hexstr}]<br />
by name<br />
* ANIME aname={str anime name}[&amask={hexstr}]<br />
<br />
'''Possible Replies:'''<br />
<br />
If no ''amask'' is provided:<br />
* 230 ANIME<br />
: {int4 aid}|{int4 eps}|{int4 ep count}|{int4 special cnt}|{int4 rating}|{int4 votes}|{int4 tmprating}|{int4 tmpvotes}|{int4 review rating average}|{int4 reviews}|{str year}|{str type}|{str romaji}|{str kanji}|{str english}|{str other}|{str short names}|{str synonyms}|{str category list}<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* Fields are returned in the same order they appear in the ''amask'' field list: byte 1, bit 7 first<br />
* Synonyms and short names are separated with '<br />
* Category fields are separated with ',' and ordered by weight (desc).<br />
* By name: must be perfect match of romaji/kanji/english/other/synonym/short name.<br />
* 'Producer id list' and 'producer name list' match the data returned by the former producer bits (but using the revised creator ids)<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
* '''Note:''' The character id list is the first data to be truncated if needed. And then: tag list, synonym list, short name list. This applies to the FILE command too.<br />
* Selecting an 'unused' or 'reserved' bit will return an "illegal input" (505) response.<br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="5" align="center"><b>amask</b></td></tr><br />
<tr><br />
<td align="center"><b>Byte 1</b></td><br />
<td align="center"><b>Byte 2</b></td><br />
<td align="center"><b>Byte 3</b></td><br />
<td align="center"><b>Byte 4</b></td><br />
<td align="center"><b>Byte 5</b></td><br />
<td align="center"><b>Byte 6</b></td><br />
<td align="center"><b>Byte 7</b></td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int aid</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int dateflags</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 special ep count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int air date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int end date</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str url</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str picname</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int vote count</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 temp rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int temp vote count</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 average review rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int review count</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str award list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>bool is 18+ restricted</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int ANN id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int allcinema id</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str AnimeNfo id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td><i>reserved</i></td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td><i>reserved</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>reserved</i></td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int date record updated</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int character id list</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int creator id list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int main creator id list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str main creator name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 specials count</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 credits count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 other count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 trailer count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 parody count</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<br />
'''Related aid type (Byte 1, Bit 2):'''<br />
<pre><br />
value meaning<br />
<br />
1 sequel<br />
2 prequel<br />
11 same setting<br />
12 alternative setting<br />
32 alternative version<br />
41 music video<br />
42 character<br />
51 side story<br />
52 parent story<br />
61 summary<br />
62 full story<br />
100 other<br />
</pre><br />
<br />
'''Examples:''' (note that the given amask gives the same result as the default request)<br />
> ANIME aid=1&amask=b2f0e0fc000000&s=xxxxx<br />
< 230 ANIME<br />
1|1999-1999|TV Series|Space,Future,Plot Continuity,SciFi,Space Travel,Shipboard,Other Planet,Novel,Genetic Modification,Action,Romance,Military,Large Breasts,Gunfights,Adventure,Human Enhancement,Nudity|Seikai no Monshou|星界の紋章|Crest of the Stars||13|13|3|853|3225|756|110|875|11<br />
<br />
<br />
----<br />
<br />
=== ANIMEDESC: Retrieve Anime Description ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIMEDESC aid={int4 id}&part={int4 partno}<br />
<br />
'''Possible Replies:'''<br />
* 233 ANIMEDESC<br />
: {int4 current part}|{int4 max parts}|{str description}<br />
* 330 NO SUCH ANIME<br />
* 333 NO SUCH DESCRIPTION<br />
<br />
'''Info:'''<br />
* The maximum length of the anime description is roughly 5000 characters, but the maximum length of a UDP packet is 1400 bytes<br />
* Multiple calls to ANIMEDESC may be necessary to retrieve the complete text, retrieving separate 1400 byte parts with each call<br />
* ''part'' is zero-based<br />
* '''Note:''' No support, at present, for retrieving descriptions by title. ''aid'' only<br />
<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> ANIMEDESC aid=3169&part=0&s=xxxxx<br />
< 233 ANIMEDESC<br />
0|1|As summer break arrives for the students, Jun Sakurada is busily studying on his own in the library, making up for time lost <cut><br />
<br />
----<br />
=== CALENDAR: Get Upcoming Titles ===<br />
Returns the anime ids of the 25 most recently aired / released anime, directly followed by the next 25 anime due to be aired / released, ordered by start date.<br />
<br />
'''Command String:'''<br />
* CALENDAR<br />
<br />
'''Possible Replies:'''<br />
* 297 CALENDAR<br />
{int aid}|{int startdate}|{int dateflags}/n<br />
<br />
..repeated n times<br />
<br />
* 397 CALENDAR EMPTY<br />
<br />
'''Info:'''<br />
* Takes no parameters (other than the session string)<br />
* Titles returned are filtered by the 'show adult' preference of the logged in user. That is, users who have elected to hide adult content will have it hidden here as well.<br />
* Do not depend on the command always returning exactly 50 titles; there may not always be 25 future titles pending, depending on the user's 'adult' preferences, and the date in relation to the relation to the current anime season.<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
<br />
----<br />
=== CHARACTER: Get Character Information ===<br />
Returns character details associated with a given character ID, including associated anime ids, episode ids, and seiyuu.<br />
<br />
'''Command String:'''<br />
* CHARACTER charid={int characterid}<br />
<br />
'''Possible Replies:'''<br />
* 235 CHARACTER<br />
: {int charid}|{str character name kanji}|{str character name transcription}|{str pic}|{anime blocks}|{int episode list}|{int last update date}|{int2 type}|{str gender}<br />
<br />
: An 'anime block' is {int anime id},{int appearance},{int creatorid},{boolean is_main_seiyuu} repeated as many times as necessary, separated by a single quote ( ' ). <br />
<br />
* 335 NO SUCH CHARACTER<br />
<br />
'''Info:'''<br />
* If no seiyuu is associated with the character for a given aid, the 'creatorid' and 'is_main_seiyuu' fields will be empty, but the commas will remain.<br />
* An empty episode list is "undefined": no episode values have been added.<br />
* ''appearance'' values: 0='appears in', 1='cameo appearance in', 2='main character in', 3='secondary cast in'<br />
* ''type'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** 1 => 'Character'<br />
** 2 => 'Mecha'<br />
** 3 => 'Organisation'<br />
** 4 => 'Vessel' <br />
* ''gender'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** "M" => 'Male'<br />
** "F" => 'Female'<br />
** "I" => 'Intersexual'<br />
** "D" => 'Dimorphic'<br />
** "-" => 'none/does not apply'<br />
** "?" => 'unknown'<br />
<br />
'''Example:'''<br />
<br />
CHARACTER charid=488&s=DChan<br />
235 CHARACTER<br />
488|ニコ・ロビン|Nico Robin|14789.jpg|4097,2,1900,1'69,2,1901,0'6199,0,1900,1'5691,0,1900,1'2644,0,,'4851,0,1900,1||1236938094<br />
<br />
=== CREATOR: Get Creator Information ===<br />
<br />
'''Command String:'''<br />
* CREATOR creatorid={int creatorid}<br />
<br />
'''Possible Replies:'''<br />
* 245 CREATOR<br />
: {int creatorid}|{str creator name kanji}|{str creator name transcription}|{int type}|{str pic_name}|{str url_english}|{str url_japanese}|{str wiki_url_english}|{str wiki_url_japanese}|{int last update date}<br />
<br />
* 345 NO SUCH CREATOR<br />
<br />
'''Info:'''<br />
* ANIME AMASK byte6, bit5<br />
* ''type'' values: 1='person', 2='company', 3='collaboration'<br />
<br />
Example:<br />
<br />
245 CREATOR<br />
718|GAINAX|Gainax|2|10092.png||http://www.gainax.co.jp/|Gainax|Gainax|1237048093<br />
<br />
=== EPISODE: Retrieve Episode Data ===<br />
'''Command String:'''<br><br />
by eid<br />
* EPISODE eid={int eid}<br />
by anime and episode number<br />
* EPISODE aname={str anime name}&epno={int4 episode number}<br />
* EPISODE aid={int anime id}&epno={int4 episode number}<br />
<br />
'''Possible Replies:'''<br />
* 240 EPISODE<br />
: {int eid}|{int aid}|{int4 length}|{int4 rating}|{int votes}|{str epno}|{str eng}|{str romaji}|{str kanji}|{int aired}|{int type}<br />
* 340 NO SUCH EPISODE<br />
<br />
'''Info:'''<br />
* length is in minutes<br />
* Returned 'epno' includes special character (only if special) and padding (only if normal).<br />
** Special characters are S(special), C(credits), T(trailer), P(parody), O(other).<br />
* The ''type'' is the raw episode type, used to indicate numerically what the special character will be<br />
** 1: regular episode (no prefix), 2: special ("S"), 3: credit ("C"), 4: trailer ("T"), 5: parody ("P"), 6: other ("O")<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> EPISODE eid=1&s=xxxxx<br />
< 240 EPISODE<br />
1|1|24|400|4|01|Invasion|shinryaku|??<br />
<br />
> EPISODE aname=Seikai no Monshou&epno=2&s=xxxxx<br />
< 240 EPISODE<br />
2|1|24|750|2|02|Kin of the Stars|Hoshi-tachi no Kenzoku|??????|1295059229|1<br />
<br />
----<br />
<br />
=== FILE: Retrieve File Data ===<br />
'''Command String:'''<br><br />
by fid:<br />
* FILE fid={int4 id}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by size+ed2k hash:<br />
* FILE size={int8 size}&ed2k={str ed2khash}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by anime, group and epno<br />
* FILE aname={str anime name}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aname={str anime name}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
<br />
'''Possible Replies:'''<br />
* 220 FILE<br />
: {int4 fid}|{int4 aid}|{int4 eid}|{int4 gid}|{int4 state}|{int8 size}|{str ed2k}|{str anidbfilename}<br />
* 220 FILE<br />
: {int4 fid}|...(data list)<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 0}|{int4 fid 1}|...|{int4 fid n}<br />
* 320 NO SUCH FILE<br />
<br />
'''Info:'''<br />
* fid, aid, eid, gid are the unique ids for the file, anime, ep, group entries at AniDB.<br />
: You can use those to create links to the corresponding pages at AniDB.<br />
* anidbfilename is the AniDB filename for the file.<br />
: However this name does not contain all the extra information of the filenames on AniDB and might be composed slightly different.<br />
* fmask and amask are hexidecimal strings where each bit corresponds to a data field related to the specified file (see below). The data list received is sorted and returned in the same order as the tables: top to bottom, left to right, with fmask preceding amask. There is '''no''' provision to retrieve all fields. Further, requesting a 'unusued' or 'reserved' bit will return an "illegal input" error.<br />
* fid is always returned as the first value, regardless of what masks are provided.<br />
* Only the first matching file is returned when aname, gname and epno is used.<br />
* "audio codec" and "audio bitrate" will return multiple values if there are multiple audio streams present in the file. Values will be separated by a single quote. <br />
* For byte 1, bit 2 (other episodes): episode IDs will be followed by an integer '''percentage''' that indicate the percentage of the related episode this file covers. Typically 100%, there are cases where it will be 50, 30, or other values. This value provides no indication where, within an episode, the file represents. That is, 50% could mean the file covers the first half of the episode, the second half, or some 50% range in between.<br />
'''State:'''<br />
<pre><br />
bit / int value meaning<br />
1 / 1 FILE_CRCOK: file matched official CRC (displayed with green background in AniDB)<br />
2 / 2 FILE_CRCERR: file DID NOT match official CRC (displayed with red background in AniDB)<br />
3 / 4 FILE_ISV2: file is version 2<br />
4 / 8 FILE_ISV3: file is version 3<br />
5 / 16 FILE_ISV4: file is version 4<br />
6 / 32 FILE_ISV5: file is version 5<br />
7 / 64 FILE_UNC: file is uncensored<br />
8 / 128 FILE_CEN: file is censored<br />
<br />
examples:<br />
state ==== 9 ==> FILE_CRCOK+FILE_ISV3 ==> file matched official CRC and is version 3<br />
state ==== 0 ==> - ==> file was not crc checked and is version 1<br />
state ==== 34 ==> FILE_CRCERR+FILE_ISV5 ==> file DID NOT match official CRC and is version 5<br />
state ==== 1 ==> FILE_CRCOK ==> file matched official CRC and is version 1<br />
state ==== 8 ==> FILE_ISV3 ==> file was not CRC checked and is version 3<br />
</pre><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''fmask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
<td align="center">'''Byte 5'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 aid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 eid</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 gid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 mylist id</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>list other episodes</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>int2 IsDeprecated</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int2 state</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int8 size</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ed2k</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str md5</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str sha1</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str crc32</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>video colour depth</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str quality</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str audio codec list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 audio bitrate list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str video codec</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 video bitrate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str video resolution</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str file type (extension)</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str dub language</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str sub language</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 length in seconds</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str description</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 aired date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str anidb file name</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 mylist state</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 mylist filestate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 mylist viewed</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 mylist viewdate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str mylist storage</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str mylist source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str mylist other</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''amask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 anime total episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str category list</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str epno</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ep name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str ep romaji name</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str ep kanji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 episode rating</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 episode vote count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str group name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str group short name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int4 date aid record updated</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
'''Examples:''' (html escaped code intended)<br />
> FILE size=177747474&ed2k=70cd93fd3981cc80a8ea6a646ff805c9&fmask=7FF8FEF8&amask=C000F0C0&s=xxxxx<br />
< 220 FILE<br />
312498|4688|69260|4243|0||0|1|177747474|70cd93fd3981cc80a8ea6a646ff805c9|b2a7c7d591333e20495de3571b235c28|7af9b962c17ff729baeee67533e5219526cd5095|a200fe73|high|DTV|Vorbis (Ogg Vorbis)|104|H264/AVC|800|704x400|japanese|english'english'english|1560||1175472000|26|26|01|The Wings to the Sky|Sora he no Tsubasa|????|#nanoha-DamagedGoodz|Nanoha-DGz<br />
<br />
----<br />
<br />
=== GROUP: Retrieve Group Data ===<br />
'''Command String:'''<br><br />
by gid<br />
* GROUP gid={int gid}<br />
by name/shortname<br />
* GROUP gname={str group name}<br />
<br />
'''Possible Replies:'''<br />
* 250 GROUP<br />
: {int gid}|{int4 rating}|{int votes}|{int4 acount}|{int fcount}|{str name}|{str short}|{str irc channel}|{str irc server}|{str url}|{str picname}|{int4 foundeddate}|{int4 disbandeddate}|{int2 dateflags}|{int4 lastreleasedate}|{int4 lastactivitydate}|{list grouprelations}<br />
* 350 NO SUCH GROUP<br />
<br />
'''Info:'''<br />
* Requires login<br />
* ''gname'' is an exact match of either a group name or short name<br />
* As either name and short names are unique if there is a result from GROUP request by name that will be the only match<br />
* ''dateflags'' values:<br />
** bit0 set == Foundeddate, Unknown Day<br />
** bit1 set == Foundeddate, Unknown Month, Day<br />
** bit2 set == Disbandeddate, Unknown Day<br />
** bit3 set == Disbandeddate, Unknown Month, Day<br />
** bit5 set == Foundeddate, Unknown Year<br />
** bit6 set == Disbandeddate, Unknown Year<br />
* ''releasedate'' and ''activitydate'' are distinct. ''releasedate'' is the date a file was actually released by the group, where ''activitydate'' is the date of a file being added to AniDB. As such, lastrelease may very well be much older than lastactivity.<br />
* ''groupreleations'' is a list of apostrophe-separated pairs, where each pair consists of {int4 othergroupid},{int2 relationtype}<br />
** relationtype:<br />
*** 1 => "Participant in"<br />
*** 2 => "Parent of"<br />
*** 4 => "Merged from"<br />
*** 5 => "Now known as"<br />
*** 6 => "Other"<br />
<br />
'''Example:'''<br />
> GROUP gid=7091&s=bunny<br />
< 250 GROUP<br />
7091|832|1445|43|566|Frostii|Frostii|#frostii|irc.rizon.net|http://frostii.com|15844.jpg|1228089600|0|1|1301875200|1304222640|7255,1'3097,4'748,4'8106,1'8159,2'8402,1'8696,1'9022,1<br />
<br />
----<br />
<br />
=== GROUPSTATUS: Get Completed Episode ===<br />
Returns a list of group names and ranges of episodes released by the group for a given anime.<br />
<br />
'''Command String:'''<br />
* GROUPSTATUS aid={int animeid}[&state={int completion_state}]<br />
<br />
'''Possible Replies:'''<br />
* 225 GROUPSTATUS<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: ... (repeated)<br />
<br />
* 325 NO SUCH GROUPS FOUND<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* The seven fields will be repeated as necessary, one for each group, separated by a new line character<br />
* Groups will be filtered by the languages selected in the user's profile<br />
* If ''state'' is not supplied, groups with a completion state of <i>'ongoing'</i>, <i>'finished'</i>, or <i>'complete'</i> are returned<br />
* Groups are returned in order of descending episode count<br />
* If there are more groups to return than can be stored in a UDP packet, additional groups will be silently discarded<br />
* ''state'' values: <br />
#ongoing<br />
#stalled<br />
#complete<br />
#dropped<br />
#finished<br />
#specials only<br />
<br />
'''Example:'''<br />
> GROUP GROUPSTATUS aid=8692&s=vLl1N<br />
< 225 GROUPSTATUS<br />
7407|Coalgirls|3|25|839|12|1-25<br />
9863|Hadena Subs|3|25|374|1|1-25<br />
11951|ChaosBlades|3|25|0|0|1-25<br />
[truncated]<br />
<br />
== MyList Commands ==<br />
=== MYLIST: Retrieve MyList Data ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLIST lid={int4 lid}<br />
by fid:<br />
* MYLIST fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLIST size={int4 size}&ed2k={str ed2khash}<br />
by anime + group + epno<br />
* MYLIST aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 221 MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 312 MULTIPLE MYLIST ENTRIES<br />
: {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}<br />
* 321 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* The state field provides information about the location and sharing state of a file in MyList.<br />
* 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).<br />
* eps is a list of episodes, e.g. "1-12,14-16,T1"<br />
<br />
'''States:'''<br />
0 - unknown - state is unknown or the user doesn't want to provide this information<br />
1 - on hdd - the file is stored on hdd (but is not shared)<br />
2 - on cd - the file is stored on cd<br />
3 - deleted - the file has been deleted or is not available for other reasons (i.e. reencoded)<br />
<br />
'''Filestates:''' (for normal files, i.e. not generic)<br />
0 => normal/original<br />
1 => corrupted version/invalid crc<br />
2 => self edited<br />
10 => self ripped<br />
11 => on dvd<br />
12 => on vhs<br />
13 => on tv<br />
14 => in theaters<br />
15 => streamed<br />
100 => other<br />
<br />
'''Example:'''<br />
> MYLIST aname=gits sac&s=xxxxx<br />
< 322 MULTIPLE FILES FOUND<br />
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<br />
<br />
----<br />
=== MYLISTADD: Add file to MyList ===<br />
The command string for MYLISTADD is made of up two blocks: a 'fileinfo' block, which limits the command to a specific file, or an 'animeinfo'/'groupinfo'/'episodeinfo' block, which can be used to specify a range of files, including generics. Additionally, a number of optional parameters can be included with either set.<br />
<br />
'''Adding a single file to the MyList with the 'fileinfo' block'''<br />
<br />
* MYLISTADD fid={int4 fid}<br />
'''or'''<br />
* MYLISTADD size={int4 size}&ed2k={str ed2khash}<br />
'''or'''<br />
* MYLISTADD lid={int4 lid}&edit=1 (valid for edit only)<br />
<br />
'''Adding one or more files to the MyList with the 'animeinfo'/'groupinfo'/'episodeinfo' block'''<br />
<br />
Here, you have a number of options, depending on what data you have available. In brief, 'animeinfo' represents a choice between anime id and anime name. 'groupinfo' represents a choice between group id, group name, and generic=1. 'episodeinfo' represents a range of one or more episodes.<br />
<br />
* MYLISTADD aid={int4 aid}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&generic=1&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&generic=1&epno={int4 episode number}<br />
<br />
Each command listed can have, in addition, a number of optional components to provide further MyList details. Append these as desired.<br />
<br />
* &state={int2 state}<br />
* &viewed={boolean viewed}<br />
* &viewdate={int4 viewdate}<br />
* &source={str source}<br />
* &storage={str storage}<br />
* &other={str other}<br />
<br />
Finally, edit=1 can be included to edit a MyList entry instead of creating a new one. When editing, optional values that are not supplied retain their original value. That is, they are ''not'' replaced with default or empty values. Only values supplied are updated.<br />
<br />
'''Possible Replies:'''<br />
* 320 NO SUCH FILE<br />
* 330 NO SUCH ANIME<br />
* 350 NO SUCH GROUP<br />
when edit=0 and adding by fid, size/ed2k<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 mylist id of new entry}<br />
when edit=0 and adding by aname, aid<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 number of entries added}<br />
* 310 FILE ALREADY IN MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 1}|{int4 fid 2}|...|{int4 fid n}<br />
when edit=1<br />
* 311 MYLIST ENTRY EDITED<br />
* 311 MYLIST ENTRY EDITED<br />
: {int4 number of entries edited}<br />
* 411 NO SUCH MYLIST ENTRY<br />
<br />
'''Info:'''<br />
* All data except lid/fid/size+hash/generic is optional.<br />
* Viewed should be 0 for unwatched files and 1 for watched files.<br />
* If viewdate is not specified, the current time will be used. The field will be disregarded if viewed=0.<br />
* Other is the only field which may contain newlines, but they have to be stored as &lt;br /&gt;<br />
* For state values refer to: '''MYLIST'''<br />
* If you want to change an existing entry and already know its MyList id (lid) please use the lid-version of this command. It put less load on the server.<br />
* epno=0 means all eps (default), negative numbers means upto. (-12 -> upto 12)<br />
* group is optional only when edit=1, meaning you can't add every file for an anime<br />
* If the file already exists (response code 310), the ''current'' record will be returned, in the same format as the MYLIST response.<br />
----<br />
<br />
=== MYLISTDEL: Remove file from MyList ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLISTDEL lid={int4 lid}<br />
by fid:<br />
* MYLISTDEL fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLISTDEL size={int4 size}&ed2k={str ed2k hash}<br />
by anime + group + epno<br />
* MYLISTDEL aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 211 MYLIST ENTRY DELETED<br />
: {int4 number of entries}<br />
* 411 NO SUCH MYLIST ENTRY<br />
'''Info:'''<br />
* group is optional<br />
* command will delete all enties found<br />
<br />
----<br />
=== MYLISTSTATS : Retrieve MyList stats ===<br />
'''Command String:'''<br />
* MYLISTSTATS<br />
'''Possible Replies:'''<br />
* 222 MYLIST STATS<br />
{animes}|{eps}|{files}|{size of files}|{added animes}|{added eps}|{added files}|{added groups}|{leech %}|{glory %}|{viewed % of db}|{mylist % of db}|{viewed % of mylist}|{number of viewed eps}|{votes}|{reviews}|{viewed length in minutes}<br />
<br />
'''Info:'''<br />
* All fields are int<br />
<br />
----<br />
<br />
=== VOTE: Vote for specified anime/episode/group ===<br />
'''Command String:'''<br><br />
by id<br />
* VOTE type={int2 type}&id={int4 id}[&value={int4 vote value}&epno={int4 episode number}]<br />
by name<br />
* VOTE type={int2 type}&name={string name}[&value={int4 vote value}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 260 VOTED<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 261 VOTE FOUND<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 262 VOTE UPDATED<br />
: {str entity name}|{old vote value}|{vote type}|{entity id}<br />
* 263 VOTE REVOKED<br />
: {str entity name}|{revoked vote value}|{vote type}|{entity id}<br />
* 360 NO SUCH VOTE<br />
: {str entity name}|0|{vote type}|{entity id}<br />
* 361 INVALID VOTE TYPE<br />
* 362 INVALID VOTE VALUE<br />
* 363 PERMVOTE NOT ALLOWED<br />
: {str aname}|{vote value}|{type}|{entity id}<br />
* 364 ALREADY PERMVOTED<br />
: {str entity name}|{existing vote value}|{vote type}|{entity id}<br />
<br />
'''Info:'''<br />
* type: 1=anime, 2=anime tmpvote, 3=group<br />
* entity: anime, episode, or group<br />
* for episode voting add epno on type=1<br />
* value: negative number means revoke, 0 means retrieve (default), 100-1000 are valid vote values, rest is illegal<br />
* votes will be updated automatically (no questions asked)<br />
* tmpvoting when there exist a perm vote is not possible<br />
<br />
----<br />
<br />
=== RANDOM: Get a random anime ===<br />
'''Command String:'''<br />
* RANDOMANIME type={int4 type}<br />
<br />
'''Possible Replies:'''<br />
* 230 ANIME ... (see ANIME)<br />
<br />
'''Info:'''<br />
* type: 0=from db, 1=watched, 2=unwatched, 3=all mylist<br />
<br />
== Misc Commands ==<br />
=== MYLISTEXPORT: Schedule a MyList Export ===<br />
Queues a {{AniDBLink|export|MyList Export}} by the AniDB Servers. As with a manual export request, exports are only done during periods when server load is low. As a result, exports may take up to 24 hours. The client submitting the request will receive an AniDB message when the export is ready to be collected.<br />
<br />
Only one export can be in the queue at a time.<br />
<br />
'''Command String:'''<br />
* MYLISTEXPORT [template={str template_name}|cancel=1]<br />
<br />
'''Possible Replies:'''<br />
* 217 EXPORT QUEUED<br />
* 218 EXPORT CANCELLED<br />
* 317 EXPORT NO SUCH TEMPLATE<br />
* 318 EXPORT ALREADY IN QUEUE<br />
* 319 EXPORT NO EXPORT QUEUED OR IS PROCESSING<br />
<br />
'''Info:'''<br />
* ''template_name'' must match an available export template on the {{AniDBLink|export|MyList Export}} page.<br />
* ''cancel'' will cancel any pending export request, queued either through UDP or the web server.<br />
* Clients can subscribe the message notifications if they wish to be notified when an export is complete.<br />
<br />
----<br />
<br />
=== PING: Ping Command ===<br />
'''Command String:'''<br />
* PING [nat=1]<br />
<br />
'''Possible Replies:'''<br />
* 300 PONG<br />
: {int4 port} ''(when nat=1)''<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* May be used by a frontend to determine if the API is still available.<br />
* May be executed even if not yet logged in.<br />
* The option <tt>nat=1</tt> provides an easy way to determine if the router has changed the outgoing port. ({{t|587}})<br />
<br />
----<br />
<br />
=== VERSION: Retrieve Server Version ===<br />
'''Command String:'''<br />
* VERSION<br />
<br />
'''Possible Replies:'''<br />
* 998 VERSION<br />
: {str server version}<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
<br />
----<br />
=== UPTIME: Retrieve Server Uptime ===<br />
'''Command String:'''<br />
* UPTIME<br />
<br />
'''Possible Replies:'''<br />
* 208 UPTIME<br />
: {int4 udpserver uptime in milliseconds}<br />
<br />
'''Info:'''<br />
* This command is the preferred way to check that the session is OK.<br />
<br />
----<br />
=== ENCODING: Change Encoding for Session ===<br />
Sets preferred [[Wikipedia:Character encoding|encoding]] per session. The preferred way to do this is to use the '''enc''' argument for AUTH. This command is mostly for testing.<br />
<br />
'''Command String:'''<br />
* ENCODING name={str encoding name}<br />
<br />
'''Possible Replies:'''<br />
* 219 ENCODING CHANGED<br />
* 519 ENCODING NOT SUPPORTED<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* Supported encodings: http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html<br />
* Default: ASCII.<br />
* Resets to default on logout.<br />
<br />
----<br />
<br />
=== SENDMSG: Send Message ===<br />
'''Command String:'''<br />
* SENDMSG to={str username}&title={str title}&body={str body}<br />
<br />
'''Possible Replies:'''<br />
* 294 SENDMSG SUCCESSFUL<br />
* 394 NO SUCH USER<br />
* 501 LOGIN FIRST<br />
<br />
'''Note:'''<br />
* This command allows you to send an AniDB message.<br />
{{eyecatch|Important|<br />
title must not be longer than 50 chars.<br><br />
body must not be longer than 900 chars.<br />
}}<br />
<br />
----<br />
=== USER: Retrieve User UID ===<br />
'''Command String:'''<br />
* USER [user={str user name}|uid={int user id}]<br />
<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 295 USER<br />
: {int4 uid}|{str username}<br />
<br />
----<br />
<br />
=== STATS [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* STATS<br />
<br />
'''Possible Replies:'''<br />
* 206 STATS<br />
: {int4 animes)|{int4 eps}|{int4 files}|{int4 groups}|{int4 users}|{int8 total file size in bytes}|{int4 open [[creq|creqs]]}<br />
<br />
----<br />
=== TOP [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* TOP<br />
<br />
'''Possible Replies:'''<br />
* 207 TOP<br />
: {str longest mylist}|{int count}<br />
: {str largest mylist}|{int count}<br />
: {str most lame files}|{int count}<br />
: {str most indep. user}|{int count}<br />
: {str biggest leecher}|{int count}<br />
: {str most anime added}|{int count}<br />
: {str most eps added}|{int count}<br />
: {str most files added}|{int count}<br />
: {str most groups added}|{int count}<br />
: {str most votes}|{int count}<br />
: {str most reviews}|{int count}<br />
<br />
'''Info:'''<br />
* All strings are user names.<br />
* 'Hide myself in IRC stats' applies for this too.<br />
<br />
== Fatal Errors ==<br />
At anypoint int the retrieval process you have to expect the following output:<br />
* 6xx INTERNAL SERVER ERROR<br />
: ERROR: {str errormessage}<br />
OR<br />
*6xx INTERNAL SERVER ERROR - {str errormessage}<br />
<br />
Such errors should be reported back to [[User:Ommina|Ommina]].<br />
(xx is a number between 00 and 99)<br />
<br />
If you supply an unknown or unimplemented command you will get an error:<br />
* 598 UNKNOWN COMMAND<br />
<br />
== Return Codes ==<br />
{{eyecatch|Note|While the names below '''are''' the actual code strings returned by the server, clients are nonetheless encouraged to work with the numeric codes instead. }}<br />
<pre><br />
LOGIN_ACCEPTED = 200<br />
LOGIN_ACCEPTED_NEW_VERSION = 201<br />
LOGGED_OUT = 203<br />
RESOURCE = 205<br />
STATS = 206<br />
TOP = 207<br />
UPTIME = 208<br />
ENCRYPTION_ENABLED = 209<br />
MYLIST_ENTRY_ADDED = 210<br />
MYLIST_ENTRY_DELETED = 211<br />
ADDED_FILE = 214<br />
ADDED_STREAM = 215<br />
EXPORT_QUEUED = 217<br />
EXPORT_CANCELLED = 218<br />
ENCODING_CHANGED = 219<br />
FILE = 220<br />
MYLIST = 221<br />
MYLIST_STATS = 222<br />
WISHLIST = 223<br />
NOTIFICATION = 224<br />
GROUP_STATUS = 225<br />
WISHLIST_ENTRY_ADDED = 226<br />
WISHLIST_ENTRY_DELETED = 227<br />
WISHLIST_ENTRY_UPDATED = 228<br />
MULTIPLE_WISHLIST = 229<br />
ANIME = 230<br />
ANIME_BEST_MATCH = 231<br />
RANDOM_ANIME = 232<br />
ANIME_DESCRIPTION = 233<br />
REVIEW = 234<br />
CHARACTER = 235<br />
SONG = 236<br />
ANIMETAG = 237<br />
CHARACTERTAG = 238<br />
EPISODE = 240<br />
UPDATED = 243<br />
TITLE = 244<br />
CREATOR = 245<br />
NOTIFICATION_ENTRY_ADDED = 246<br />
NOTIFICATION_ENTRY_DELETED = 247<br />
NOTIFICATION_ENTRY_UPDATE = 248<br />
MULTIPLE_NOTIFICATION = 249<br />
GROUP = 250<br />
CATEGORY = 251<br />
BUDDY_LIST = 253<br />
BUDDY_STATE = 254<br />
BUDDY_ADDED = 255<br />
BUDDY_DELETED = 256<br />
BUDDY_ACCEPTED = 257<br />
BUDDY_DENIED = 258<br />
VOTED = 260<br />
VOTE_FOUND = 261<br />
VOTE_UPDATED = 262<br />
VOTE_REVOKED = 263<br />
HOT_ANIME = 265<br />
RANDOM_RECOMMENDATION = 266<br />
RANDOM_SIMILAR = 267<br />
NOTIFICATION_ENABLED = 270<br />
NOTIFYACK_SUCCESSFUL_MESSAGE = 281<br />
NOTIFYACK_SUCCESSFUL_NOTIFIATION = 282<br />
NOTIFICATION_STATE = 290<br />
NOTIFYLIST = 291<br />
NOTIFYGET_MESSAGE = 292<br />
NOTIFYGET_NOTIFY = 293<br />
SENDMESSAGE_SUCCESSFUL = 294<br />
USER_ID = 295<br />
CALENDAR = 297<br />
<br />
PONG = 300<br />
AUTHPONG = 301<br />
NO_SUCH_RESOURCE = 305<br />
API_PASSWORD_NOT_DEFINED = 309<br />
FILE_ALREADY_IN_MYLIST = 310<br />
MYLIST_ENTRY_EDITED = 311<br />
MULTIPLE_MYLIST_ENTRIES = 312<br />
WATCHED = 313<br />
SIZE_HASH_EXISTS = 314<br />
INVALID_DATA = 315<br />
STREAMNOID_USED = 316<br />
EXPORT_NO_SUCH_TEMPLATE = 317<br />
EXPORT_ALREADY_IN_QUEUE = 318<br />
EXPORT_NO_EXPORT_QUEUED_OR_IS_PROCESSING = 319<br />
NO_SUCH_FILE = 320<br />
NO_SUCH_ENTRY = 321<br />
MULTIPLE_FILES_FOUND = 322<br />
NO_SUCH_WISHLIST = 323<br />
NO_SUCH_NOTIFICATION = 324<br />
NO_GROUPS_FOUND = 325<br />
NO_SUCH_ANIME = 330<br />
NO_SUCH_DESCRIPTION = 333<br />
NO_SUCH_REVIEW = 334<br />
NO_SUCH_CHARACTER = 335<br />
NO_SUCH_SONG = 336<br />
NO_SUCH_ANIMETAG = 337<br />
NO_SUCH_CHARACTERTAG = 338<br />
NO_SUCH_EPISODE = 340<br />
NO_SUCH_UPDATES = 343<br />
NO_SUCH_TITLES = 344<br />
NO_SUCH_CREATOR = 345<br />
NO_SUCH_GROUP = 350<br />
NO_SUCH_CATEGORY = 351<br />
BUDDY_ALREADY_ADDED = 355<br />
NO_SUCH_BUDDY = 356<br />
BUDDY_ALREADY_ACCEPTED = 357<br />
BUDDY_ALREADY_DENIED = 358<br />
NO_SUCH_VOTE = 360<br />
INVALID_VOTE_TYPE = 361<br />
INVALID_VOTE_VALUE = 362<br />
PERMVOTE_NOT_ALLOWED = 363<br />
ALREADY_PERMVOTED = 364<br />
HOT_ANIME_EMPTY = 365<br />
RANDOM_RECOMMENDATION_EMPTY = 366<br />
RANDOM_SIMILAR_EMPTY = 367<br />
NOTIFICATION_DISABLED = 370<br />
NO_SUCH_ENTRY_MESSAGE = 381<br />
NO_SUCH_ENTRY_NOTIFICATION = 382<br />
NO_SUCH_MESSAGE = 392<br />
NO_SUCH_NOTIFY = 393<br />
NO_SUCH_USER = 394<br />
CALENDAR_EMPTY = 397<br />
NO_CHANGES = 399<br />
<br />
NOT_LOGGED_IN = 403<br />
NO_SUCH_MYLIST_FILE = 410<br />
NO_SUCH_MYLIST_ENTRY = 411<br />
MYLIST_UNAVAILABLE = 412<br />
<br />
LOGIN_FAILED = 500<br />
LOGIN_FIRST = 501<br />
ACCESS_DENIED = 502<br />
CLIENT_VERSION_OUTDATED = 503<br />
CLIENT_BANNED = 504<br />
ILLEGAL_INPUT_OR_ACCESS_DENIED = 505<br />
INVALID_SESSION = 506<br />
NO_SUCH_ENCRYPTION_TYPE = 509<br />
ENCODING_NOT_SUPPORTED = 519<br />
BANNED = 555<br />
UNKNOWN_COMMAND = 598<br />
<br />
INTERNAL_SERVER_ERROR = 600<br />
ANIDB_OUT_OF_SERVICE = 601<br />
SERVER_BUSY = 602<br />
NO_DATA = 603<br />
TIMEOUT - DELAY AND RESUBMIT = 604<br />
API_VIOLATION = 666<br />
<br />
PUSHACK_CONFIRMED = 701<br />
NO_SUCH_PACKET_PENDING = 702<br />
<br />
VERSION = 998</pre><br />
<br />
[[Category:Development]]<br />
[[Category:UDP]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=UDP_API_Definition&diff=18433UDP API Definition2015-03-27T08:00:30Z<p>Ommina: /* ANIME: Retrieve Anime Data */</p>
<hr />
<div>{{TOCright}}<br />
<br />
== General Information ==<br />
'''Author:''' [[User:Exp|Exp]] & [[User:Epoximator|Epoximator]] & [[User:Ommina|Ommina]]<br><br />
'''Version:''' 0.03.730 (2015-03-25)<br><br />
'''Version number used for protover parameter:''' "3"<br />
<br />
'''IMPORTANT INFORMATION FOR ALL INTERESTED:'''<br />
* If you are mainly interested in notifications and private messaging, check out our [[Jabber]] and [[RSSRDF]] support first.<br />
* The UDP API is not an appropriate choice if you desire to download a local copy of the AniDB database.<br />
* If you want to create a client you have to register it {{AniDBLink|client|here}} and [[UDP Clients|here]].<br />
** Check out the clients that are being developed. There exists usable code in many different languages already.<br />
* If you have suggestions for improvements or new features use the [[UDP API DEV|development]] page.<br />
* Please also take a look at the [[API]] page.<br />
<br />
== Formats used in this Spec ==<br />
* {vartype varname} - Specifies what shall be inserted at this point and its type.<br />
* [...] - Everything between [ and ] is optional.<br />
<br />
=== Used types ===<br />
* ''int2'' - 2 byte Integer (in string representation)<br />
* ''int4'' - 4 byte Integer (in string representation)<br />
* ''boolean'' - true or false - use '1' for ''true'', '0' for ''false''<br />
* ''str'' - String (UDP packet length restricts string size to 1400 bytes)<br />
* ''hexstr'' -- a hex representation of a decimal value, two characters per byte. If multiple bytes are represented, byte one is the first two characters of the string, byte two the next two, and so on.<br />
<br />
=== Content Encoding ===<br />
* Default character encoding: ''ASCII''<br />
* Escape scheme for option values (to server): ''html form encoding'' + ''newline''<br />
** This means you have to encode at least <tt>&</tt> in your option values in html form encoding style (<tt>&amp;amp;</tt>) before sending them to the api server. All other html form encodings are optional.<br />
** All newlines should be replaced by &lt;br /&gt;<br />
* Escape scheme for returned data fields (from server): ', | and newline<br />
** Content newlines are encoded as &lt;br /&gt;, ' is encoded as ` and | is not allowed in data fields.<br />
** Dates are returned in unix time (number of seconds elapsed since January 1, 1970 00:00:00 UTC)<br />
<br />
== Basics ==<br />
=== General ===<br />
The network communication is ''packet'' and ''line'' based. Each AniDB API command is exactly one UDP packet containing one line. Results are sent as one packet but may consist out of multiple lines. A return value always starts with a 3 byte result code followed by a human readable version of the result code. Be aware that important data fields may be returned directly after the return code (see: 200,201,271,272,504).<br />
The meaning for all result codes can be found in this document. If there is more than one entry returned, it's one entry per line. Lines are terminated by a <tt>\n</tt> (no dos linefeed <tt>\r</tt>). The elements of a format string are separated by a "|" character.<br />
<br />
<tt>{three digit return code} {str return string}\n</tt><br><br />
<tt>{data field 0}|{data field 1}|...|{data field n}</tt><br />
<br />
'''IMPORTANT:'''<br />
* All commands except PING, ENCRYPT, ENCODING, AUTH and VERSION '''requires''' login, meaning that the ''session tag'' must be set (<tt>s=xxxxx</tt>).<br />
* A client should ignore any additional trailing data fields it doesn't expect. Additional fields are going to be added to the output of some commands from time to time. Those additional fields will simply be appended to the end of the existing output. A client should be written in a way so that it is not affected by such new fields.<br />
* Due to the length constraints of an UDP package (over PPPoE) the replies from the server will never exceed 1400 bytes. String fields will be truncated if necessary to ensure this. No warnings are given when this happens.<br />
* A client should handle all possible return codes for each command.<br />
** Possible return codes for '''all commands''':<br />
*** 505 ILLEGAL INPUT OR ACCESS DENIED<br />
*** 555 BANNED<br />
***: {str reason}<br />
*** 598 UNKNOWN COMMAND<br />
*** 600 INTERNAL SERVER ERROR<br />
*** 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
*** 602 SERVER BUSY - TRY AGAIN LATER<br />
*** 604 TIMEOUT - DELAY AND RESUBMIT<br />
** Additional return codes for all commands that '''require login''':<br />
*** 501 LOGIN FIRST<br />
*** 502 ACCESS DENIED<br />
*** 506 INVALID SESSION<br />
<br />
{{eyecatch|Note|The '555 BANNED' message should not be expected by the client. This message is only enabled temporary to help developers understand what they are doing wrong.}}<br><br />
<br />
{{eyecatch|Note|<br />
While in daily maintenance the AniDB API will reply with<br />
<br />
601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
<br />
to all commands. If a client receives such a return value it should wait at least 30 minutes before trying again.}}<br />
<br />
=== Server / UDP Connection ===<br />
The Client has to send data packets to:<br />
* '''Server:''' api.anidb.net<br />
* '''Port:''' 9000/UDP<br />
The servername and port should not be hardcoded into a frontend but should be read from a configuration file.<br />
<br />
=== Server Errors ===<br />
* At any time the API might return a fatal error of the form:<br />
: <tt>6xx ERROR DESCRIPTION</tt><br />
* Possible codes are 600-699.<br />
* Occurrences of these errors (except 601 and 602) should be reported to [[User:Ommina|Ommina]].<br />
{{eyecatch|Note|6XX messages do not always return the tags given with the command which caused the error!}}<br />
<br />
=== Connection Problems ===<br />
There are many ways for a client to end up banned or the API might currently be handling too many concurrent connections.<br />
If a client does not get any reply to an AUTH command it should start to increase the retry delay exponentially with every failed login attempt. (i.e. try again after 30 seconds if the first login attempt failed, if the second fails too retry after 2 minutes, then 5 minutes, then 10 minutes, then 30 minutes, ... until you reach a retry delay of ~2-4h.)<br />
<br />
=== Local Port ===<br />
A client should select a fixed local port >1024 at install time and reuse it for local UDP Sockets. If the API sees too many different UDP Ports from one IP within ~1 hour it will ban the IP. (So make sure you're reusing your UDP ports also for testing/debugging!)<br />
<br />
The local port may be hardcoded, however, an option to manually specify another port should be offered.<br />
<br />
'''Note when behind a [[Wikipedia:Network address translation|NAT]]/masquerading router:'''<br><br />
A session between the server and a client is identified by the ''IP and port'' used by the client. So when the port (or IP) changes within a session the client has to authenticate again. If a client is behind a NAT router it can’t actually control the local port used for the connection. The router will normally ''translate'' the port to support several computers on a LAN to share the Internet connection. The public port (as determined by the router and seen by the server) which has been assigned to the connection will only be reserved for as long as it is in use. This means that the router will usually ''deallocate the port after a fixed timeout period'' (eg. five, ten or 15 minutes). Once that happens the client will no longer be able to receive UDP messages from the server (the messages will be discarded as undeliverable by the router) and a new port will be selected once the client tries to send a message to the server (which will result in a new connection session - '''Note:''' This could get you banned!, see above). So in order to keep a session over a NAT router alive, the client has to ping the server within the router's deallocation period to prevent a timeout.<br />
<br />
The client can decide whether it is behind a NAT router or not by adding <tt>nat=1</tt> to the AUTH command. This will cause the response to include the IP and port as seen by the server. If the port differs from the port reported by the local socket, the connection subject to NAT and the client should issue PING commands in regular intervals. Please do not send pings more often than is necessary to keep NAT connections alive.<br />
<br />
=== Flood Protection ===<br />
To prevent high server load the UDP API server enforces a strict flood protection policy.<br />
* Short Term:<br />
** A Client MUST NOT send more than 0.5 packets per second (that's one packet every two seconds, not two packets a second!)<br />
** The server will start to enforce the limit after the first 5 packets have been received.<br />
* Long Term:<br />
** A Client MUST NOT send more than one packet every four seconds over an extended amount of time.<br />
** ''An extended amount of time'' is not defined. Use common sense.<br />
<br />
Once a client exceeds a rate limit all further UDP packets from that client will be dropped without feedback until the client's packet rate is back down to acceptable levels.<br />
<br />
{{eyecatch|Note|Dropped packets are still taken into account for the packet rate. Meaning if you continuously send packets your client will be banned forever.}}<br />
<br />
Generally clients should be written in a way to minimize server and network load. You should always keep that in mind.<br />
<br />
Abusive clients may be banned completely.<br />
<br />
{{eyecatch|Note|<br />
If you suddenly stop getting replies from the AniDB API or you normally don't have a notable packetloss and from one point on you suddenly note a high packetloss percentage you have most likely entered a critical flood ratio.<br />
If the AniDB API isn't answering at all it might either be down or you have been banned, this is normally caused by violating the API specs (i.e. too many connections using different ports from one IP, too many auth failures, ...) (usually lasts 30 minutes).<br />
If you're experiencing packet loss you have probably reached the rate limit and the API starts to randomly drop incoming packets from your IP. (can be solved by enforcing a delay between multiple commands when you're sending a batch)}}<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Caching ===<br />
To minimize server and network load a client should use local caching in order to prevent repeated API requests for the same data.<br />
<br />
A client should locally cache FILE/EP/ANIME/GROUP/... info wherever possible for extended amounts of time.<br />
(I.e. if a client is used to scan a local folder with anime files and add them via API to a users MyList then it shall only ask for all files in the first run and cache the info for all files known to AniDB. If run again over the same folder it shall only check those files which were unknown to AniDB at the time of the last check.)<br />
<br />
Later versions of the API might enforce this by banning clients which ask for the same information more than once every week/month.<br />
<br />
=== Tag option ===<br />
The API will add a user defined string at the beginning of each reply line separated with a space, if desired.<br />
* To enable add the <tt>tag={str usertag}</tt> option to a command.<br />
* A tag is only valid for the command it was send with, meaning it is not persistent. If you want to have tags in front of all reply lines you will have to append the tag option to each command you send to the server.<br />
* Tags are meant to enable a client to handle more than one request/reply at a time.<br />
<br />
Usage example:<br />
AUTH user=baka&pass=baka&protover=25&client=someclient&clientver=1&tag=abc123<br />
abc123 200 Jxqxb LOGIN ACCEPTED<br />
or<br />
LOGOUT s=Jxqxb&tag=byebye<br />
byebye 203 LOGGED OUT<br />
<br />
{{eyecatch|Note|The tag option is valid for all api commands and is thus not explicitly listed in the description of each command.}}<br />
<br />
=== Data Indexes (fid,aid,eid,gid,lid) ===<br />
* All indexes start at 1 (not 0).<br />
* It is possible for table entries to have id fields with a value of 0 (i.e. gid). Those are to be interpreted as "NONE" or "NULL".<br />
* An ID is '''never''' reused. That means after an entry is deleted no new entry will ever have that ID again.<br />
* Mylist IDs (lid) are globally unique, not per-user unique.<br />
<br />
== Authing Commands ==<br />
{{eyecatch|Note|'''ANY''' command which requires parameters may return: 505 ILLEGAL INPUT OR ACCESS DENIED}}<br />
<br />
----<br />
=== AUTH: Authing to the AnimeDB ===<br />
'''Command String:'''<br />
* AUTH user={str username}&pass={str password}&protover={int4 apiversion}&client={str clientname}&clientver={int4 clientversion}[&nat=1&comp=1&enc={str encoding}&mtu{int4 mtu value}&imgserver=1]<br />
<br />
'''Possible Replies:'''<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
* 500 LOGIN FAILED<br />
* 503 CLIENT VERSION OUTDATED<br />
* 504 CLIENT BANNED - {str reason}<br />
* 505 ILLEGAL INPUT OR ACCESS DENIED<br />
* 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
when nat=1<br />
* 200 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED<br />
* 201 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
when imgserver=1<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
{str image server name}<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
{str image server name}<br />
<br />
'''Info:'''<br />
{{eyecatch|Note|The password is the normal AniDB website password! The password listed in the profile as API Password in only used for the optional encryption feature.}}<br />
* The ''session_key'' is a String containing only ''a-z,A-Z,0-9'' chars of a length of ''4-8'' characters.<br />
: It has to be stored by the client and needs to be sent as parameter with every command which requires the user to logged in.<br />
* The ''session_key'' String is appended as parameter "s", i.e. "PUSH notify=1&msg=1&s={str session_key}".<br />
* On a '''500 LOGIN FAILED''' message the client should request the user to enter username and password again.<br />
* In case of a '''501 LOGIN FIRST''' message the client should silently resend an auth command and send the failed command again.<br />
* A '''502 ACCESS DENIED''' message should abort the current action on the client side and display a message to the user.<br />
* A '''503 CLIENT VERSION OUTDATED''' message states that the udp server has been updated and does not support your client any longer. (protover is too low). A 201 message refers to a new version of the client software.<br />
* A '''506 INVALID SESSION''' means that either the session key parameter "s" was not provided with a command that requires it or the session key is no longer valid. The client should reissue an AUTH command.<br />
{{eyecatch|Note|A frontend shall expect 501 and 502 messages to be returned on ANY command.}}<br><br />
{{eyecatch|Note|AniDB usernames may only contain characters (a-z,A-Z), numbers (0-9), underscores (_) and hyphens (-).}}<br />
* The client should send the apiversion of the AnimeDB API version it supports as value of the protover parameter.<br />
* The client MAY NOT send anything but the version of the API Specs the author used to write the client! (as it is stated at the top of this file @ "Version number used for protover parameter")<br />
: The API will compare that value to it's own version of the API and if the version of the client is older the API will decide whether the changes were significant enough to deny the old client access to the DB.<br />
* The clientname shall be a lower-case string containing only the chars ''a-z'' of ''4-16 chars'' length which identifies the client. (i.e. mykickassclient)<br />
* The clientversion shall be a number starting with 1, increased on every change in the client.<br />
: clientname and clientversion might be used by the API to distinguish between different clients and client versions if that should ever become necessary.<br />
{{eyecatch|Important|<br />
* DO NOT use the clientname of an existing client. If you modify an existing client's code to meet your own needs, create a new client name for yourself.<br />
* ALWAYS increase the clientversion number if you release a new client version.}}<br />
* A Login and its assigned ''session_key'' is valid until the virtual UDP connection times out or until a LOGOUT command is issued.<br />
* The virtual UDP connection times out if no data was received from the client for '''35 minutes'''.<br />
* A client should issue a UPTIME command once every 30 minutes to keep the connection alive should that be required.<br />
* If the client does not use any of the notification/push features of the API it should NOT keep the connection alive, furthermore it should explicitly terminate the connection by issuing a LOGOUT command once it finished it's work.<br />
* If it is very likely that another command will be issued shortly (within the next 20 minutes) a client SHOULD keep the current connection open, by not sending a LOGOUT command.<br />
{{eyecatch|Important|<br />
* A client should NOT perform a full AUTH / command / LOGOUT cycle for each command it wants to send. Again, if another command is likely within 20 minutes, remain logged in.}}<br />
* The client shall notify the user if it received a 201 message at login.<br />
: This means a new version of the client is available, however the old version is still supported otherwise a client banned message would have been returned.<br />
* The user should get a pop-up message on 503 and 504 messages telling him to update his client software.<br />
: ('''Note:''' 504 means that this version of the client is banned, not the user!)<br />
* The 'nat' option makes the client able to detect whether it is behind a nat router or not. When the client is behind a nat router it should keep the "connection" alive with the PING command.<br />
{{eyecatch|Important|Make sure your client handles ALL possible AUTH return codes before giving out any versions!}}<br />
* When ''enc=x'' is defined the server will change the encoding used to x.<br />
**If the encoding is supported it will change right away (including the response) and be reset on logout/timeout.<br />
**If not supported then the argument will be silently ignored. Use ENCODING to test what works.<br />
**Supported encodings are [http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html these].<br />
* ''comp=1'' means that the client supports compression ([http://java.sun.com/j2se/1.5.0/docs/api/java/util/zip/Deflater.html DEFLATE]).<br />
**The server will compress (instead of truncating) the datagrams when needed if this option is enabled.<br />
**The first two bytes of compressed datagrams will always be set to zero. (So tags should never start with that.)<br />
* Default [[Wikipedia:MTU (networking)|''MTU'']] is 1400. Minimum allowed is 400, maximum 1400, due [[Wikipedia:Point-to-Point Protocol over Ethernet|PPPoE]].<br />
<br />
----<br />
<br />
=== LOGOUT: Logout ===<br />
'''Command String:'''<br />
* LOGOUT<br />
<br />
'''Possible Replies:'''<br />
* 203 LOGGED OUT<br />
* 403 NOT LOGGED IN<br />
<br />
'''Info:'''<br />
* This command only works if you are already logged in.<br />
* A logout should ALWAYS be issued if the client is currently logged in and is either exiting or not expecting to send/receive any AniDB API packets for the next >= 30 minutes.<br />
<br />
----<br />
=== ENCRYPT: Start Encrypted Session ===<br />
Will cause all future messages from the server, except the first (the reply to the ENCRYPT command itself), to be encrypted (128 bit [[Wikipedia:Advanced Encryption Standard|AES]]). The client will also have to encrypt all future requests sent to the server. All non-encrypted messages will be discarded by the server. The encryption key is the [[Wikipedia:MD5|MD5]] hash of a special ''UDP API Key'' (defined in the users profile) concatenated with the salt string as given in the reply to the ENCRYPT message. A normal AUTH message is still necessary to authenticate and should follow the ENCRYPT command once the API has acknowledged the encryption.<br />
<br />
'''Command String:'''<br />
* ENCRYPT user={str name}&type={int2 type}<br />
<br />
'''Possible Replies:'''<br />
* 209 {str salt} ENCRYPTION ENABLED<br />
* 309 API PASSWORD NOT DEFINED<br />
* 509 NO SUCH ENCRYPTION TYPE<br />
* 394 NO SUCH USER<br />
<br />
'''Info:'''<br />
* ''user'' is the user name.<br />
* ''type'' is the type of encryption; 1 => 128 bit AES (only one defined).<br />
* ''API Key'' is the one defined in the {{AniDBLink|profile|profile settings page}}.<br />
* It is not possible to disable the encryption once enabled while staying logged in.<br />
** A logout (the logout message needs to be correctly encrypted) or timeout will disable the encryption.<br />
* In order to minimize server load, encryption should be disabled by default and should have to be enabled manually by the user in the configuration options.<br />
* The encryption key is md5(api_key_of_user+''salt'').<br />
* Padding of the message needs to be done according to the PKCS5Padding scheme.<br />
<br />
== Notify Commands ==<br />
=== Introduction ===<br />
Broadly speaking, notifications provide an indication to the client that some event has occurred within the AniDB database.<br />
<br />
There are three types:<br />
* New file [[Notifications|notification]]. (Only anime type supported.)<br />
* New private message notification.<br />
* New buddy event notification.<br />
<br />
Note that, while a user can subscribe to multiple 'new file' events (see [[Notifications|notifications]]), at present, the UDP API only supports notifications of new files by anime. New files by group, or new files by producer, are NOT presently supported. Just the same, keeping in mind that the API is designed to potentially support such notifications in the future will help in understanding why some of the commands are structured the way they are.<br />
<br />
The word "notification" is also used a bit inconsistently in this document. An AniDB notification is originally a "new file [[Notifications|notification]]". It might be more correct to use the term "event" for the original "happening" and then "notification" as the means to notify the user (client). New-file, new-message, buddy-* and going-down are all events that results in notifications. Only the first two type of events are persistent, though, meaning they exist and remain in the same state until some user action affects them.<br />
<br />
=== Getting Notifications ===<br />
Clients that wish to receive notifications have two routes available to them. They are by no means mutually exclusive and selecting one does not imply a client is unable to use commands from another.<br />
<br />
'''Method One: Polling'''<br />
<br />
With this method, the client contacts the server at some interval (no more than once every 20 minutes) to see if there are new file notifications waiting. If there are, the client can the get further details of the files in question. This is analogous to checking an email server every half hour to see if new email has arrived.<br />
<br />
Its principal advantage is that it is easy to design and code. Blocking sockets are sufficient as the client can expect the reply received to correspond with the command sent.<br />
<br />
The disadvantage of this approach is that it introduces a delay and some uncertainty in receiving notifications. If, for example, the user clears the notification on the website before the client collects it, the client will not learn of the new file. Similarly, if the user does not dismiss notifications via the site, the client will have an increasing amount of stale data to work though. Finally, notifications cleared by the client also clears them from the website, so users will need to be made aware of what is going on.<br />
<br />
A polling HOWTO:<br />
<br />
* Use NOTIFY (no more than once every 20 minutes) to get the number of pending notifications<br />
* IF there are new notifications pending, use NOTIFYLIST to get a list of notification types and associated IDs.<br />
* Use NOTIFYGET to receive a notification, supplying the ID provided by NOTIFYLIST<br />
* Use NOTIFYACK to acknowledge a notification, supplying the ID provided by NOTIFYLIST (if desired)<br />
<br />
{{eyecatch|Note|The ID supplied by NOTIFYLIST will be the ID of the affected notification type. Since, at present, only the anime type is supported, this value is always an aid. In the future, it may represent a group or producer ID. In these cases, the str '''type''' value will indicate what entity the ID represents.}}<br />
<br />
'''Method Two: Server PUSH'''<br />
<br />
With this method, the server takes the active role in advising the client that a new file has arrived. The client must register with the server to receive further advice information, and will be responsible for keeping the login session from timing out, and any NAT router ports open. The UDP packet is sent to the ip and port from which the AUTH command was received.<br />
<br />
This method compensates for the disadvantages of the polling method, but is more difficult to code. Blocking sockets are no longer an option, nor can a client make any assumptions that an incoming packet will necessarily be a reply to the last command sent. The tag option may be helpful here.<br />
<br />
A PUSH HOWTO:<br />
<br />
* PUSH to register your client session.<br />
* Listen for 720-799 NOTIFICATIONs ('''not 290''').<br />
* Use PUSHACK to to acknowledge the notification using the nid supplied with NOTIFICATION<br />
* Use NOTIFYGET to receive a notification, suppling the relid provided by NOTIFICATION (NOT the packet ID)<br />
* Use NOTIFYACK to acknowledge a notification, suppling the relid provided by NOTIFICATION (if desired)<br />
* Use UPTIME (with an interval between 30 and 35 minutes) to keep login session valid<br />
<br />
It is probably a good idea to use tags to separate NOTIFICATIONs from the other communication. NOTIFICATIONs will '''never''' have tags.<br />
<br />
=== PUSH: UDP Notification Registration ===<br />
Register your client as an observer for AniDB notification events for the current user. If you are registered for one or more event types the AniDB server will send an UDP packet (format see below) on each change which affects the current user.<br />
<br />
'''Command String:'''<br />
* PUSH notify={boolean on_new_file}&msg={boolean on_new_private_message}[&buddy={boolean on_buddy_event}]<br />
<br />
'''Possible Replies:'''<br />
* 270 NOTIFICATION ENABLED<br />
OR (if both values are 0)<br />
* 370 NOTIFICATION DISABLED<br />
<br />
'''Info:'''<br />
* A client which has registered to receive UDP notification packets must:<br />
** Issue a PUSHACK command for each notification received with ''notify_packet_id'' provided in the notification packet.<br />
** Use PING to keep the connection alive (< 30 min).<br />
** Use UPTIME to ensure that the session is OK (>= 30 min).<br />
* Every notification generated is resent 3 times unless acknowledged. After that the client is logged out.<br />
<br />
=== NOTIFY: Notifications ===<br />
Get number of pending notifications (and number of online buddies).<br />
<br />
'''Command String:'''<br />
* NOTIFY [buddy=1]<br />
<br />
'''Possible Replies:'''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}<br />
when ''buddy=1''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}|{int4 number_of_online_buddies}<br />
<br />
'''Info:'''<br />
* If the client did send a NOTIFY within the last 35 minutes and it was confirmed by AniDB then receiving a 501 LOGIN FIRST message for the next NOTIFY command shows that AniDB logged the client out because it did not respond to a PUSH Notification packet.<br />
* There is no command to retrieve missed PUSH Notifications.<br />
{{eyecatch|Note|This command MUST NOT be issued more than once every 20 minutes.}}<br />
<br />
----<br />
=== NOTIFYLIST: List Notification/Message IDs ===<br />
List id of all pending (not acknowledged) ''new private message'' and ''new file'' notifications. Buddy events cannot be acknowledged.<br />
<br />
'''Command String:'''<br />
* NOTIFYLIST<br />
<br />
'''Possible Replies:'''<br />
*291 NOTIFYLIST<br />
: {str type}|{int4 id}<br />
: {str type}|{int4 id}<br />
: ...<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as required by NOTIFYGET. For messages it is the actual message id, for notifications it is the id of the related type; anime, group or producer. Since only file notifications related to anime is implemented atm, it is the anime id (aid).<br />
* NOTIFYLIST returns one line per entry, if no entries are available only the first line of the reply is returned.<br />
{{eyecatch|Note|This command MUST NOT be issued regularly but should only be triggered by either a push message received by the client or a reply to a NOTIFY command which tells you that there are messages/notifications waiting.}}<br />
<br />
----<br />
=== NOTIFYGET: Get Notification/Message ===<br />
Receive private message or file notification.<br />
<br />
'''Command String:'''<br />
* NOTIFYGET type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 292 NOTIFYGET<br />
: {int4 id}|{int4 from_user_id}|{str from_user_name}|{int4 date}|{int4 type}|{str title}|{str body}<br />
* 392 NO SUCH ENTRY<br />
when type = N<br />
* 293 NOTIFYGET<br />
: {int4 relid}|{int4 type}|{int2 count}|{int4 date}|{str relidname}|{str fids}<br />
* 393 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as given by NOTIFYLIST (or ''relid'' from 271 NOTIFICATION and mid from 272 NOTIFICATION)<br />
* for message entries (M):<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: type is the type of the message (0=normal msg, 1=annonymous, 2=system msg, 3=mod msg)<br />
* for notification entries (N):<br />
: relid is the id of the related type (anime)<br />
: relname is the name of the related type (anime)<br />
: type is the notification type (0=all, 1=new, 2=group, 3=complete)<br />
: count is the number of events pending for this subscription<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: fids is a comma separated list with the affected file ids<br />
<br />
----<br />
=== NOTIFYACK: Acknowledge Notification/Message ===<br />
This command will mark a message read or clear a ''new file'' notification. Buddy events are not acknowledgeable.<br />
<br />
'''Command String:'''<br />
* NOTIFYACK type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 281 NOTIFYACK SUCCESSFUL<br />
* 381 NO SUCH ENTRY<br />
when type = N<br />
* 282 NOTIFYACK SUCCESSFUL<br />
* 382 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
<br />
====Notification Packet Format====<br />
'''New File Notify:'''<br />
<br />
720 {int4 notify_packet_id} NOTIFICATION - NEW FILE<br />
{int4 fidlist}|{int2 reltype}|{int2 priority}<br />
<br />
* fidlist is a comma separated list of file ids<br />
* reltype is: 1 = anime, 2 = group, 3 = producer<br />
* priority is: 0 = low, 1 = medium, 2 = high<br />
* new file notifications are created as a batch, so it is not unusual to get several new files for a particular anime at once. It is in this case that a comma separated list of fids will be returned<br />
<br />
{{eyecatch|Note|Group (and producer) related file notifications are not implemented yet.}}<br />
<br />
<br />
'''New Private Message Notify:'''<br />
<br />
794 {int4 notify_packet_id} NOTIFICATION - NEW MESSAGE<br />
{int2 type}|{int4 date}|{int4 sent_by_uid}|{str sent_by_name}|{str subject}|{str body}|{int mid}<br />
<br />
* type is the type of the message (0=normal msg, 1=anonymous, 2=system msg, 3=mod msg)<br />
* date is the time the message was sent (in seconds since 1.1.1970)<br />
* sender uid/sender name are the user id and user name of the sender<br />
* subject is the message subject<br />
* body is message body (can be truncated)<br />
* mid is message id and can be used with NOTIFYACK<br />
<br />
'''Buddy Event Notify:'''<br />
753 {int4 notify_packet_id} NOTIFICATION - BUDDY<br />
{int4 buddy uid}|{int2 event type}<br />
* Possible event types:<br />
** 0 => LOGIN<br />
** 1 => LOGOUT<br />
** 2 => ACCEPTED<br />
** 3 => ADDED<br />
<br />
<br />
'''Going Down Event Notify:'''<br />
799 {int4 notify_packet_id} NOTIFICATION - SHUTTING DOWN<br />
{int4 time offline}|{int4 comment}<br />
<br />
* Clients with any notification on will receive the SHUTTING DOWN message before the API goes offline.<br />
* Time offline is the time in minutes the API will be down, 0 if indefinite (client can direct user to the AniDB site for status updates).<br />
* The comment is a short explanation for the downtime.<br />
* Only one datagram will be sent, and the server will not listen for replies.<br />
<br />
<br />
=== PUSHACK: UDP Notification Acknowledge ===<br />
Used to acknowledge notification packets (720-799). A client must be prepared to issue this command before using '''PUSH'''.<br />
<br />
'''Command String:'''<br />
* PUSHACK nid={int4 notify_packet_id}<br />
<br />
'''Possible Replies:'''<br />
* 701 PUSHACK CONFIRMED<br />
* 702 NO SUCH PACKET PENDING<br />
<br />
'''Info:'''<br />
* See: '''PUSH'''<br />
<br />
== Buddy Commands ==<br />
Group of commands used to administrate your buddylist.<br />
<br />
=== BUDDYADD: Add a user to Buddy List ===<br />
'''Command String:'''<br />
* BUDDYADD uid={int4 buddy uid}<br />
* BUDDYADD uname={int4 buddy name}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 255 BUDDY ADDED<br />
* 355 BUDDY ALREADY ADDED<br />
<br />
----<br />
=== BUDDYDEL: Remove a user from Buddy List ===<br />
'''Command String:'''<br />
* BUDDYDEL uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 256 BUDDY DELETED<br />
<br />
----<br />
=== BUDDYACCEPT: Accept user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYACCEPT uid={int4 user uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 257 BUDDY ACCEPTED<br />
* 357 BUDDY ALREADY ACCEPTED<br />
<br />
----<br />
=== BUDDYDENY: Deny user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYDENY uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 258 BUDDY DENIED<br />
* 358 BUDDY ALREADY DENIED<br />
<br />
----<br />
=== BUDDYLIST: Retrieve Buddy List ===<br />
'''Command String:'''<br />
* BUDDYLIST startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 253 {int2 start} {int2 end} {int2 total} BUDDY LIST<br />
: {int4 uid}|{str username}|{int2 state}<br />
: ...<br />
'''Info:'''<br />
* state is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = this user is in your buddylist<br />
* bit 2 = this user has accepted you<br />
* bit 3 = this user is waiting for your approval<br />
<br />
----<br />
=== BUDDYSTATE: Retrieve Buddy States===<br />
'''Command String:'''<br />
* BUDDYSTATE startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 254 {int2 start} {int2 end} {int2 total} BUDDY STATE<br />
: {int4 uid}|{int2 onlinestate}<br />
: ...<br />
<br />
'''Info:'''<br />
* onlinestate is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = http online (user has issued a HTTP request within the last 10 minutes)<br />
* bit 2 = udp api online (user is currently connected to the udp api server)<br />
* example: 0=offline, 1=http online, 2=udp api online, 3=http&udp api online<br />
<br />
== Data Commands ==<br />
=== ANIME: Retrieve Anime Data ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIME aid={int4 id}[&amask={hexstr}]<br />
by name<br />
* ANIME aname={str anime name}[&amask={hexstr}]<br />
<br />
'''Possible Replies:'''<br />
<br />
If no ''amask'' is provided:<br />
* 230 ANIME<br />
: {int4 aid}|{int4 eps}|{int4 ep count}|{int4 special cnt}|{int4 rating}|{int4 votes}|{int4 tmprating}|{int4 tmpvotes}|{int4 review rating average}|{int4 reviews}|{str year}|{str type}|{str romaji}|{str kanji}|{str english}|{str other}|{str short names}|{str synonyms}|{str category list}<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* Fields are returned in the same order they appear in the ''amask'' field list: byte 1, bit 7 first<br />
* Synonyms and short names are separated with '<br />
* Category fields are separated with ',' and ordered by weight (desc).<br />
* By name: must be perfect match of romaji/kanji/english/other/synonym/short name.<br />
* 'Producer id list' and 'producer name list' match the data returned by the former producer bits (but using the revised creator ids)<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
* '''Note:''' The character id list is the first data to be truncated if needed. And then: tag list, synonym list, short name list. This applies to the FILE command too.<br />
* Selecting an 'unused' or 'reserved' bit will return an "illegal input" (505) response.<br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="5" align="center"><b>amask</b></td></tr><br />
<tr><br />
<td align="center"><b>Byte 1</b></td><br />
<td align="center"><b>Byte 2</b></td><br />
<td align="center"><b>Byte 3</b></td><br />
<td align="center"><b>Byte 4</b></td><br />
<td align="center"><b>Byte 5</b></td><br />
<td align="center"><b>Byte 6</b></td><br />
<td align="center"><b>Byte 7</b></td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int aid</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int dateflags</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 special ep count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int air date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int end date</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str url</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str picname</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int vote count</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 temp rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int temp vote count</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 average review rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int review count</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str award list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>bool is 18+ restricted</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int anime planet id</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int ANN id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int allcinema id</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str AnimeNfo id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td><i>reserved</i></td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td><i>reserved</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>reserved</i></td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int date record updated</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int character id list</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int creator id list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int main creator id list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str main creator name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 specials count</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 credits count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 other count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 trailer count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 parody count</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<br />
'''Related aid type (Byte 1, Bit 2):'''<br />
<pre><br />
value meaning<br />
<br />
1 sequel<br />
2 prequel<br />
11 same setting<br />
12 alternative setting<br />
32 alternative version<br />
41 music video<br />
42 character<br />
51 side story<br />
52 parent story<br />
61 summary<br />
62 full story<br />
100 other<br />
</pre><br />
<br />
'''Examples:''' (note that the given amask gives the same result as the default request)<br />
> ANIME aid=1&amask=b2f0e0fc000000&s=xxxxx<br />
< 230 ANIME<br />
1|1999-1999|TV Series|Space,Future,Plot Continuity,SciFi,Space Travel,Shipboard,Other Planet,Novel,Genetic Modification,Action,Romance,Military,Large Breasts,Gunfights,Adventure,Human Enhancement,Nudity|Seikai no Monshou|星界の紋章|Crest of the Stars||13|13|3|853|3225|756|110|875|11<br />
<br />
<br />
----<br />
<br />
=== ANIMEDESC: Retrieve Anime Description ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIMEDESC aid={int4 id}&part={int4 partno}<br />
<br />
'''Possible Replies:'''<br />
* 233 ANIMEDESC<br />
: {int4 current part}|{int4 max parts}|{str description}<br />
* 330 NO SUCH ANIME<br />
* 333 NO SUCH DESCRIPTION<br />
<br />
'''Info:'''<br />
* The maximum length of the anime description is roughly 5000 characters, but the maximum length of a UDP packet is 1400 bytes<br />
* Multiple calls to ANIMEDESC may be necessary to retrieve the complete text, retrieving separate 1400 byte parts with each call<br />
* ''part'' is zero-based<br />
* '''Note:''' No support, at present, for retrieving descriptions by title. ''aid'' only<br />
<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> ANIMEDESC aid=3169&part=0&s=xxxxx<br />
< 233 ANIMEDESC<br />
0|1|As summer break arrives for the students, Jun Sakurada is busily studying on his own in the library, making up for time lost <cut><br />
<br />
----<br />
=== CALENDAR: Get Upcoming Titles ===<br />
Returns the anime ids of the 25 most recently aired / released anime, directly followed by the next 25 anime due to be aired / released, ordered by start date.<br />
<br />
'''Command String:'''<br />
* CALENDAR<br />
<br />
'''Possible Replies:'''<br />
* 297 CALENDAR<br />
{int aid}|{int startdate}|{int dateflags}/n<br />
<br />
..repeated n times<br />
<br />
* 397 CALENDAR EMPTY<br />
<br />
'''Info:'''<br />
* Takes no parameters (other than the session string)<br />
* Titles returned are filtered by the 'show adult' preference of the logged in user. That is, users who have elected to hide adult content will have it hidden here as well.<br />
* Do not depend on the command always returning exactly 50 titles; there may not always be 25 future titles pending, depending on the user's 'adult' preferences, and the date in relation to the relation to the current anime season.<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
<br />
----<br />
=== CHARACTER: Get Character Information ===<br />
Returns character details associated with a given character ID, including associated anime ids, episode ids, and seiyuu.<br />
<br />
'''Command String:'''<br />
* CHARACTER charid={int characterid}<br />
<br />
'''Possible Replies:'''<br />
* 235 CHARACTER<br />
: {int charid}|{str character name kanji}|{str character name transcription}|{str pic}|{anime blocks}|{int episode list}|{int last update date}|{int2 type}|{str gender}<br />
<br />
: An 'anime block' is {int anime id},{int appearance},{int creatorid},{boolean is_main_seiyuu} repeated as many times as necessary, separated by a single quote ( ' ). <br />
<br />
* 335 NO SUCH CHARACTER<br />
<br />
'''Info:'''<br />
* If no seiyuu is associated with the character for a given aid, the 'creatorid' and 'is_main_seiyuu' fields will be empty, but the commas will remain.<br />
* An empty episode list is "undefined": no episode values have been added.<br />
* ''appearance'' values: 0='appears in', 1='cameo appearance in', 2='main character in', 3='secondary cast in'<br />
* ''type'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** 1 => 'Character'<br />
** 2 => 'Mecha'<br />
** 3 => 'Organisation'<br />
** 4 => 'Vessel' <br />
* ''gender'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** "M" => 'Male'<br />
** "F" => 'Female'<br />
** "I" => 'Intersexual'<br />
** "D" => 'Dimorphic'<br />
** "-" => 'none/does not apply'<br />
** "?" => 'unknown'<br />
<br />
'''Example:'''<br />
<br />
CHARACTER charid=488&s=DChan<br />
235 CHARACTER<br />
488|ニコ・ロビン|Nico Robin|14789.jpg|4097,2,1900,1'69,2,1901,0'6199,0,1900,1'5691,0,1900,1'2644,0,,'4851,0,1900,1||1236938094<br />
<br />
=== CREATOR: Get Creator Information ===<br />
<br />
'''Command String:'''<br />
* CREATOR creatorid={int creatorid}<br />
<br />
'''Possible Replies:'''<br />
* 245 CREATOR<br />
: {int creatorid}|{str creator name kanji}|{str creator name transcription}|{int type}|{str pic_name}|{str url_english}|{str url_japanese}|{str wiki_url_english}|{str wiki_url_japanese}|{int last update date}<br />
<br />
* 345 NO SUCH CREATOR<br />
<br />
'''Info:'''<br />
* ANIME AMASK byte6, bit5<br />
* ''type'' values: 1='person', 2='company', 3='collaboration'<br />
<br />
Example:<br />
<br />
245 CREATOR<br />
718|GAINAX|Gainax|2|10092.png||http://www.gainax.co.jp/|Gainax|Gainax|1237048093<br />
<br />
=== EPISODE: Retrieve Episode Data ===<br />
'''Command String:'''<br><br />
by eid<br />
* EPISODE eid={int eid}<br />
by anime and episode number<br />
* EPISODE aname={str anime name}&epno={int4 episode number}<br />
* EPISODE aid={int anime id}&epno={int4 episode number}<br />
<br />
'''Possible Replies:'''<br />
* 240 EPISODE<br />
: {int eid}|{int aid}|{int4 length}|{int4 rating}|{int votes}|{str epno}|{str eng}|{str romaji}|{str kanji}|{int aired}|{int type}<br />
* 340 NO SUCH EPISODE<br />
<br />
'''Info:'''<br />
* length is in minutes<br />
* Returned 'epno' includes special character (only if special) and padding (only if normal).<br />
** Special characters are S(special), C(credits), T(trailer), P(parody), O(other).<br />
* The ''type'' is the raw episode type, used to indicate numerically what the special character will be<br />
** 1: regular episode (no prefix), 2: special ("S"), 3: credit ("C"), 4: trailer ("T"), 5: parody ("P"), 6: other ("O")<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> EPISODE eid=1&s=xxxxx<br />
< 240 EPISODE<br />
1|1|24|400|4|01|Invasion|shinryaku|??<br />
<br />
> EPISODE aname=Seikai no Monshou&epno=2&s=xxxxx<br />
< 240 EPISODE<br />
2|1|24|750|2|02|Kin of the Stars|Hoshi-tachi no Kenzoku|??????|1295059229|1<br />
<br />
----<br />
<br />
=== FILE: Retrieve File Data ===<br />
'''Command String:'''<br><br />
by fid:<br />
* FILE fid={int4 id}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by size+ed2k hash:<br />
* FILE size={int8 size}&ed2k={str ed2khash}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by anime, group and epno<br />
* FILE aname={str anime name}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aname={str anime name}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
<br />
'''Possible Replies:'''<br />
* 220 FILE<br />
: {int4 fid}|{int4 aid}|{int4 eid}|{int4 gid}|{int4 state}|{int8 size}|{str ed2k}|{str anidbfilename}<br />
* 220 FILE<br />
: {int4 fid}|...(data list)<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 0}|{int4 fid 1}|...|{int4 fid n}<br />
* 320 NO SUCH FILE<br />
<br />
'''Info:'''<br />
* fid, aid, eid, gid are the unique ids for the file, anime, ep, group entries at AniDB.<br />
: You can use those to create links to the corresponding pages at AniDB.<br />
* anidbfilename is the AniDB filename for the file.<br />
: However this name does not contain all the extra information of the filenames on AniDB and might be composed slightly different.<br />
* fmask and amask are hexidecimal strings where each bit corresponds to a data field related to the specified file (see below). The data list received is sorted and returned in the same order as the tables: top to bottom, left to right, with fmask preceding amask. There is '''no''' provision to retrieve all fields. Further, requesting a 'unusued' or 'reserved' bit will return an "illegal input" error.<br />
* fid is always returned as the first value, regardless of what masks are provided.<br />
* Only the first matching file is returned when aname, gname and epno is used.<br />
* "audio codec" and "audio bitrate" will return multiple values if there are multiple audio streams present in the file. Values will be separated by a single quote. <br />
* For byte 1, bit 2 (other episodes): episode IDs will be followed by an integer '''percentage''' that indicate the percentage of the related episode this file covers. Typically 100%, there are cases where it will be 50, 30, or other values. This value provides no indication where, within an episode, the file represents. That is, 50% could mean the file covers the first half of the episode, the second half, or some 50% range in between.<br />
'''State:'''<br />
<pre><br />
bit / int value meaning<br />
1 / 1 FILE_CRCOK: file matched official CRC (displayed with green background in AniDB)<br />
2 / 2 FILE_CRCERR: file DID NOT match official CRC (displayed with red background in AniDB)<br />
3 / 4 FILE_ISV2: file is version 2<br />
4 / 8 FILE_ISV3: file is version 3<br />
5 / 16 FILE_ISV4: file is version 4<br />
6 / 32 FILE_ISV5: file is version 5<br />
7 / 64 FILE_UNC: file is uncensored<br />
8 / 128 FILE_CEN: file is censored<br />
<br />
examples:<br />
state ==== 9 ==> FILE_CRCOK+FILE_ISV3 ==> file matched official CRC and is version 3<br />
state ==== 0 ==> - ==> file was not crc checked and is version 1<br />
state ==== 34 ==> FILE_CRCERR+FILE_ISV5 ==> file DID NOT match official CRC and is version 5<br />
state ==== 1 ==> FILE_CRCOK ==> file matched official CRC and is version 1<br />
state ==== 8 ==> FILE_ISV3 ==> file was not CRC checked and is version 3<br />
</pre><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''fmask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
<td align="center">'''Byte 5'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 aid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 eid</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 gid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 mylist id</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>list other episodes</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>int2 IsDeprecated</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int2 state</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int8 size</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ed2k</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str md5</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str sha1</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str crc32</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>video colour depth</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str quality</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str audio codec list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 audio bitrate list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str video codec</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 video bitrate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str video resolution</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str file type (extension)</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str dub language</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str sub language</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 length in seconds</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str description</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 aired date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str anidb file name</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 mylist state</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 mylist filestate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 mylist viewed</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 mylist viewdate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str mylist storage</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str mylist source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str mylist other</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''amask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 anime total episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str category list</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str epno</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ep name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str ep romaji name</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str ep kanji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 episode rating</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 episode vote count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str group name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str group short name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int4 date aid record updated</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
'''Examples:''' (html escaped code intended)<br />
> FILE size=177747474&ed2k=70cd93fd3981cc80a8ea6a646ff805c9&fmask=7FF8FEF8&amask=C000F0C0&s=xxxxx<br />
< 220 FILE<br />
312498|4688|69260|4243|0||0|1|177747474|70cd93fd3981cc80a8ea6a646ff805c9|b2a7c7d591333e20495de3571b235c28|7af9b962c17ff729baeee67533e5219526cd5095|a200fe73|high|DTV|Vorbis (Ogg Vorbis)|104|H264/AVC|800|704x400|japanese|english'english'english|1560||1175472000|26|26|01|The Wings to the Sky|Sora he no Tsubasa|????|#nanoha-DamagedGoodz|Nanoha-DGz<br />
<br />
----<br />
<br />
=== GROUP: Retrieve Group Data ===<br />
'''Command String:'''<br><br />
by gid<br />
* GROUP gid={int gid}<br />
by name/shortname<br />
* GROUP gname={str group name}<br />
<br />
'''Possible Replies:'''<br />
* 250 GROUP<br />
: {int gid}|{int4 rating}|{int votes}|{int4 acount}|{int fcount}|{str name}|{str short}|{str irc channel}|{str irc server}|{str url}|{str picname}|{int4 foundeddate}|{int4 disbandeddate}|{int2 dateflags}|{int4 lastreleasedate}|{int4 lastactivitydate}|{list grouprelations}<br />
* 350 NO SUCH GROUP<br />
<br />
'''Info:'''<br />
* Requires login<br />
* ''gname'' is an exact match of either a group name or short name<br />
* As either name and short names are unique if there is a result from GROUP request by name that will be the only match<br />
* ''dateflags'' values:<br />
** bit0 set == Foundeddate, Unknown Day<br />
** bit1 set == Foundeddate, Unknown Month, Day<br />
** bit2 set == Disbandeddate, Unknown Day<br />
** bit3 set == Disbandeddate, Unknown Month, Day<br />
** bit5 set == Foundeddate, Unknown Year<br />
** bit6 set == Disbandeddate, Unknown Year<br />
* ''releasedate'' and ''activitydate'' are distinct. ''releasedate'' is the date a file was actually released by the group, where ''activitydate'' is the date of a file being added to AniDB. As such, lastrelease may very well be much older than lastactivity.<br />
* ''groupreleations'' is a list of apostrophe-separated pairs, where each pair consists of {int4 othergroupid},{int2 relationtype}<br />
** relationtype:<br />
*** 1 => "Participant in"<br />
*** 2 => "Parent of"<br />
*** 4 => "Merged from"<br />
*** 5 => "Now known as"<br />
*** 6 => "Other"<br />
<br />
'''Example:'''<br />
> GROUP gid=7091&s=bunny<br />
< 250 GROUP<br />
7091|832|1445|43|566|Frostii|Frostii|#frostii|irc.rizon.net|http://frostii.com|15844.jpg|1228089600|0|1|1301875200|1304222640|7255,1'3097,4'748,4'8106,1'8159,2'8402,1'8696,1'9022,1<br />
<br />
----<br />
<br />
=== GROUPSTATUS: Get Completed Episode ===<br />
Returns a list of group names and ranges of episodes released by the group for a given anime.<br />
<br />
'''Command String:'''<br />
* GROUPSTATUS aid={int animeid}[&state={int completion_state}]<br />
<br />
'''Possible Replies:'''<br />
* 225 GROUPSTATUS<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: ... (repeated)<br />
<br />
* 325 NO SUCH GROUPS FOUND<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* The seven fields will be repeated as necessary, one for each group, separated by a new line character<br />
* Groups will be filtered by the languages selected in the user's profile<br />
* If ''state'' is not supplied, groups with a completion state of <i>'ongoing'</i>, <i>'finished'</i>, or <i>'complete'</i> are returned<br />
* Groups are returned in order of descending episode count<br />
* If there are more groups to return than can be stored in a UDP packet, additional groups will be silently discarded<br />
* ''state'' values: <br />
#ongoing<br />
#stalled<br />
#complete<br />
#dropped<br />
#finished<br />
#specials only<br />
<br />
'''Example:'''<br />
> GROUP GROUPSTATUS aid=8692&s=vLl1N<br />
< 225 GROUPSTATUS<br />
7407|Coalgirls|3|25|839|12|1-25<br />
9863|Hadena Subs|3|25|374|1|1-25<br />
11951|ChaosBlades|3|25|0|0|1-25<br />
[truncated]<br />
<br />
== MyList Commands ==<br />
=== MYLIST: Retrieve MyList Data ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLIST lid={int4 lid}<br />
by fid:<br />
* MYLIST fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLIST size={int4 size}&ed2k={str ed2khash}<br />
by anime + group + epno<br />
* MYLIST aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 221 MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 312 MULTIPLE MYLIST ENTRIES<br />
: {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}<br />
* 321 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* The state field provides information about the location and sharing state of a file in MyList.<br />
* 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).<br />
* eps is a list of episodes, e.g. "1-12,14-16,T1"<br />
<br />
'''States:'''<br />
0 - unknown - state is unknown or the user doesn't want to provide this information<br />
1 - on hdd - the file is stored on hdd (but is not shared)<br />
2 - on cd - the file is stored on cd<br />
3 - deleted - the file has been deleted or is not available for other reasons (i.e. reencoded)<br />
<br />
'''Filestates:''' (for normal files, i.e. not generic)<br />
0 => normal/original<br />
1 => corrupted version/invalid crc<br />
2 => self edited<br />
10 => self ripped<br />
11 => on dvd<br />
12 => on vhs<br />
13 => on tv<br />
14 => in theaters<br />
15 => streamed<br />
100 => other<br />
<br />
'''Example:'''<br />
> MYLIST aname=gits sac&s=xxxxx<br />
< 322 MULTIPLE FILES FOUND<br />
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<br />
<br />
----<br />
=== MYLISTADD: Add file to MyList ===<br />
The command string for MYLISTADD is made of up two blocks: a 'fileinfo' block, which limits the command to a specific file, or an 'animeinfo'/'groupinfo'/'episodeinfo' block, which can be used to specify a range of files, including generics. Additionally, a number of optional parameters can be included with either set.<br />
<br />
'''Adding a single file to the MyList with the 'fileinfo' block'''<br />
<br />
* MYLISTADD fid={int4 fid}<br />
'''or'''<br />
* MYLISTADD size={int4 size}&ed2k={str ed2khash}<br />
'''or'''<br />
* MYLISTADD lid={int4 lid}&edit=1 (valid for edit only)<br />
<br />
'''Adding one or more files to the MyList with the 'animeinfo'/'groupinfo'/'episodeinfo' block'''<br />
<br />
Here, you have a number of options, depending on what data you have available. In brief, 'animeinfo' represents a choice between anime id and anime name. 'groupinfo' represents a choice between group id, group name, and generic=1. 'episodeinfo' represents a range of one or more episodes.<br />
<br />
* MYLISTADD aid={int4 aid}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&generic=1&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&generic=1&epno={int4 episode number}<br />
<br />
Each command listed can have, in addition, a number of optional components to provide further MyList details. Append these as desired.<br />
<br />
* &state={int2 state}<br />
* &viewed={boolean viewed}<br />
* &viewdate={int4 viewdate}<br />
* &source={str source}<br />
* &storage={str storage}<br />
* &other={str other}<br />
<br />
Finally, edit=1 can be included to edit a MyList entry instead of creating a new one. When editing, optional values that are not supplied retain their original value. That is, they are ''not'' replaced with default or empty values. Only values supplied are updated.<br />
<br />
'''Possible Replies:'''<br />
* 320 NO SUCH FILE<br />
* 330 NO SUCH ANIME<br />
* 350 NO SUCH GROUP<br />
when edit=0 and adding by fid, size/ed2k<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 mylist id of new entry}<br />
when edit=0 and adding by aname, aid<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 number of entries added}<br />
* 310 FILE ALREADY IN MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 1}|{int4 fid 2}|...|{int4 fid n}<br />
when edit=1<br />
* 311 MYLIST ENTRY EDITED<br />
* 311 MYLIST ENTRY EDITED<br />
: {int4 number of entries edited}<br />
* 411 NO SUCH MYLIST ENTRY<br />
<br />
'''Info:'''<br />
* All data except lid/fid/size+hash/generic is optional.<br />
* Viewed should be 0 for unwatched files and 1 for watched files.<br />
* If viewdate is not specified, the current time will be used. The field will be disregarded if viewed=0.<br />
* Other is the only field which may contain newlines, but they have to be stored as &lt;br /&gt;<br />
* For state values refer to: '''MYLIST'''<br />
* If you want to change an existing entry and already know its MyList id (lid) please use the lid-version of this command. It put less load on the server.<br />
* epno=0 means all eps (default), negative numbers means upto. (-12 -> upto 12)<br />
* group is optional only when edit=1, meaning you can't add every file for an anime<br />
* If the file already exists (response code 310), the ''current'' record will be returned, in the same format as the MYLIST response.<br />
----<br />
<br />
=== MYLISTDEL: Remove file from MyList ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLISTDEL lid={int4 lid}<br />
by fid:<br />
* MYLISTDEL fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLISTDEL size={int4 size}&ed2k={str ed2k hash}<br />
by anime + group + epno<br />
* MYLISTDEL aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 211 MYLIST ENTRY DELETED<br />
: {int4 number of entries}<br />
* 411 NO SUCH MYLIST ENTRY<br />
'''Info:'''<br />
* group is optional<br />
* command will delete all enties found<br />
<br />
----<br />
=== MYLISTSTATS : Retrieve MyList stats ===<br />
'''Command String:'''<br />
* MYLISTSTATS<br />
'''Possible Replies:'''<br />
* 222 MYLIST STATS<br />
{animes}|{eps}|{files}|{size of files}|{added animes}|{added eps}|{added files}|{added groups}|{leech %}|{glory %}|{viewed % of db}|{mylist % of db}|{viewed % of mylist}|{number of viewed eps}|{votes}|{reviews}|{viewed length in minutes}<br />
<br />
'''Info:'''<br />
* All fields are int<br />
<br />
----<br />
<br />
=== VOTE: Vote for specified anime/episode/group ===<br />
'''Command String:'''<br><br />
by id<br />
* VOTE type={int2 type}&id={int4 id}[&value={int4 vote value}&epno={int4 episode number}]<br />
by name<br />
* VOTE type={int2 type}&name={string name}[&value={int4 vote value}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 260 VOTED<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 261 VOTE FOUND<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 262 VOTE UPDATED<br />
: {str entity name}|{old vote value}|{vote type}|{entity id}<br />
* 263 VOTE REVOKED<br />
: {str entity name}|{revoked vote value}|{vote type}|{entity id}<br />
* 360 NO SUCH VOTE<br />
: {str entity name}|0|{vote type}|{entity id}<br />
* 361 INVALID VOTE TYPE<br />
* 362 INVALID VOTE VALUE<br />
* 363 PERMVOTE NOT ALLOWED<br />
: {str aname}|{vote value}|{type}|{entity id}<br />
* 364 ALREADY PERMVOTED<br />
: {str entity name}|{existing vote value}|{vote type}|{entity id}<br />
<br />
'''Info:'''<br />
* type: 1=anime, 2=anime tmpvote, 3=group<br />
* entity: anime, episode, or group<br />
* for episode voting add epno on type=1<br />
* value: negative number means revoke, 0 means retrieve (default), 100-1000 are valid vote values, rest is illegal<br />
* votes will be updated automatically (no questions asked)<br />
* tmpvoting when there exist a perm vote is not possible<br />
<br />
----<br />
<br />
=== RANDOM: Get a random anime ===<br />
'''Command String:'''<br />
* RANDOMANIME type={int4 type}<br />
<br />
'''Possible Replies:'''<br />
* 230 ANIME ... (see ANIME)<br />
<br />
'''Info:'''<br />
* type: 0=from db, 1=watched, 2=unwatched, 3=all mylist<br />
<br />
== Misc Commands ==<br />
=== MYLISTEXPORT: Schedule a MyList Export ===<br />
Queues a {{AniDBLink|export|MyList Export}} by the AniDB Servers. As with a manual export request, exports are only done during periods when server load is low. As a result, exports may take up to 24 hours. The client submitting the request will receive an AniDB message when the export is ready to be collected.<br />
<br />
Only one export can be in the queue at a time.<br />
<br />
'''Command String:'''<br />
* MYLISTEXPORT [template={str template_name}|cancel=1]<br />
<br />
'''Possible Replies:'''<br />
* 217 EXPORT QUEUED<br />
* 218 EXPORT CANCELLED<br />
* 317 EXPORT NO SUCH TEMPLATE<br />
* 318 EXPORT ALREADY IN QUEUE<br />
* 319 EXPORT NO EXPORT QUEUED OR IS PROCESSING<br />
<br />
'''Info:'''<br />
* ''template_name'' must match an available export template on the {{AniDBLink|export|MyList Export}} page.<br />
* ''cancel'' will cancel any pending export request, queued either through UDP or the web server.<br />
* Clients can subscribe the message notifications if they wish to be notified when an export is complete.<br />
<br />
----<br />
<br />
=== PING: Ping Command ===<br />
'''Command String:'''<br />
* PING [nat=1]<br />
<br />
'''Possible Replies:'''<br />
* 300 PONG<br />
: {int4 port} ''(when nat=1)''<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* May be used by a frontend to determine if the API is still available.<br />
* May be executed even if not yet logged in.<br />
* The option <tt>nat=1</tt> provides an easy way to determine if the router has changed the outgoing port. ({{t|587}})<br />
<br />
----<br />
<br />
=== VERSION: Retrieve Server Version ===<br />
'''Command String:'''<br />
* VERSION<br />
<br />
'''Possible Replies:'''<br />
* 998 VERSION<br />
: {str server version}<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
<br />
----<br />
=== UPTIME: Retrieve Server Uptime ===<br />
'''Command String:'''<br />
* UPTIME<br />
<br />
'''Possible Replies:'''<br />
* 208 UPTIME<br />
: {int4 udpserver uptime in milliseconds}<br />
<br />
'''Info:'''<br />
* This command is the preferred way to check that the session is OK.<br />
<br />
----<br />
=== ENCODING: Change Encoding for Session ===<br />
Sets preferred [[Wikipedia:Character encoding|encoding]] per session. The preferred way to do this is to use the '''enc''' argument for AUTH. This command is mostly for testing.<br />
<br />
'''Command String:'''<br />
* ENCODING name={str encoding name}<br />
<br />
'''Possible Replies:'''<br />
* 219 ENCODING CHANGED<br />
* 519 ENCODING NOT SUPPORTED<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* Supported encodings: http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html<br />
* Default: ASCII.<br />
* Resets to default on logout.<br />
<br />
----<br />
<br />
=== SENDMSG: Send Message ===<br />
'''Command String:'''<br />
* SENDMSG to={str username}&title={str title}&body={str body}<br />
<br />
'''Possible Replies:'''<br />
* 294 SENDMSG SUCCESSFUL<br />
* 394 NO SUCH USER<br />
* 501 LOGIN FIRST<br />
<br />
'''Note:'''<br />
* This command allows you to send an AniDB message.<br />
{{eyecatch|Important|<br />
title must not be longer than 50 chars.<br><br />
body must not be longer than 900 chars.<br />
}}<br />
<br />
----<br />
=== USER: Retrieve User UID ===<br />
'''Command String:'''<br />
* USER [user={str user name}|uid={int user id}]<br />
<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 295 USER<br />
: {int4 uid}|{str username}<br />
<br />
----<br />
<br />
=== STATS [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* STATS<br />
<br />
'''Possible Replies:'''<br />
* 206 STATS<br />
: {int4 animes)|{int4 eps}|{int4 files}|{int4 groups}|{int4 users}|{int8 total file size in bytes}|{int4 open [[creq|creqs]]}<br />
<br />
----<br />
=== TOP [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* TOP<br />
<br />
'''Possible Replies:'''<br />
* 207 TOP<br />
: {str longest mylist}|{int count}<br />
: {str largest mylist}|{int count}<br />
: {str most lame files}|{int count}<br />
: {str most indep. user}|{int count}<br />
: {str biggest leecher}|{int count}<br />
: {str most anime added}|{int count}<br />
: {str most eps added}|{int count}<br />
: {str most files added}|{int count}<br />
: {str most groups added}|{int count}<br />
: {str most votes}|{int count}<br />
: {str most reviews}|{int count}<br />
<br />
'''Info:'''<br />
* All strings are user names.<br />
* 'Hide myself in IRC stats' applies for this too.<br />
<br />
== Fatal Errors ==<br />
At anypoint int the retrieval process you have to expect the following output:<br />
* 6xx INTERNAL SERVER ERROR<br />
: ERROR: {str errormessage}<br />
OR<br />
*6xx INTERNAL SERVER ERROR - {str errormessage}<br />
<br />
Such errors should be reported back to [[User:Ommina|Ommina]].<br />
(xx is a number between 00 and 99)<br />
<br />
If you supply an unknown or unimplemented command you will get an error:<br />
* 598 UNKNOWN COMMAND<br />
<br />
== Return Codes ==<br />
{{eyecatch|Note|While the names below '''are''' the actual code strings returned by the server, clients are nonetheless encouraged to work with the numeric codes instead. }}<br />
<pre><br />
LOGIN_ACCEPTED = 200<br />
LOGIN_ACCEPTED_NEW_VERSION = 201<br />
LOGGED_OUT = 203<br />
RESOURCE = 205<br />
STATS = 206<br />
TOP = 207<br />
UPTIME = 208<br />
ENCRYPTION_ENABLED = 209<br />
MYLIST_ENTRY_ADDED = 210<br />
MYLIST_ENTRY_DELETED = 211<br />
ADDED_FILE = 214<br />
ADDED_STREAM = 215<br />
EXPORT_QUEUED = 217<br />
EXPORT_CANCELLED = 218<br />
ENCODING_CHANGED = 219<br />
FILE = 220<br />
MYLIST = 221<br />
MYLIST_STATS = 222<br />
WISHLIST = 223<br />
NOTIFICATION = 224<br />
GROUP_STATUS = 225<br />
WISHLIST_ENTRY_ADDED = 226<br />
WISHLIST_ENTRY_DELETED = 227<br />
WISHLIST_ENTRY_UPDATED = 228<br />
MULTIPLE_WISHLIST = 229<br />
ANIME = 230<br />
ANIME_BEST_MATCH = 231<br />
RANDOM_ANIME = 232<br />
ANIME_DESCRIPTION = 233<br />
REVIEW = 234<br />
CHARACTER = 235<br />
SONG = 236<br />
ANIMETAG = 237<br />
CHARACTERTAG = 238<br />
EPISODE = 240<br />
UPDATED = 243<br />
TITLE = 244<br />
CREATOR = 245<br />
NOTIFICATION_ENTRY_ADDED = 246<br />
NOTIFICATION_ENTRY_DELETED = 247<br />
NOTIFICATION_ENTRY_UPDATE = 248<br />
MULTIPLE_NOTIFICATION = 249<br />
GROUP = 250<br />
CATEGORY = 251<br />
BUDDY_LIST = 253<br />
BUDDY_STATE = 254<br />
BUDDY_ADDED = 255<br />
BUDDY_DELETED = 256<br />
BUDDY_ACCEPTED = 257<br />
BUDDY_DENIED = 258<br />
VOTED = 260<br />
VOTE_FOUND = 261<br />
VOTE_UPDATED = 262<br />
VOTE_REVOKED = 263<br />
HOT_ANIME = 265<br />
RANDOM_RECOMMENDATION = 266<br />
RANDOM_SIMILAR = 267<br />
NOTIFICATION_ENABLED = 270<br />
NOTIFYACK_SUCCESSFUL_MESSAGE = 281<br />
NOTIFYACK_SUCCESSFUL_NOTIFIATION = 282<br />
NOTIFICATION_STATE = 290<br />
NOTIFYLIST = 291<br />
NOTIFYGET_MESSAGE = 292<br />
NOTIFYGET_NOTIFY = 293<br />
SENDMESSAGE_SUCCESSFUL = 294<br />
USER_ID = 295<br />
CALENDAR = 297<br />
<br />
PONG = 300<br />
AUTHPONG = 301<br />
NO_SUCH_RESOURCE = 305<br />
API_PASSWORD_NOT_DEFINED = 309<br />
FILE_ALREADY_IN_MYLIST = 310<br />
MYLIST_ENTRY_EDITED = 311<br />
MULTIPLE_MYLIST_ENTRIES = 312<br />
WATCHED = 313<br />
SIZE_HASH_EXISTS = 314<br />
INVALID_DATA = 315<br />
STREAMNOID_USED = 316<br />
EXPORT_NO_SUCH_TEMPLATE = 317<br />
EXPORT_ALREADY_IN_QUEUE = 318<br />
EXPORT_NO_EXPORT_QUEUED_OR_IS_PROCESSING = 319<br />
NO_SUCH_FILE = 320<br />
NO_SUCH_ENTRY = 321<br />
MULTIPLE_FILES_FOUND = 322<br />
NO_SUCH_WISHLIST = 323<br />
NO_SUCH_NOTIFICATION = 324<br />
NO_GROUPS_FOUND = 325<br />
NO_SUCH_ANIME = 330<br />
NO_SUCH_DESCRIPTION = 333<br />
NO_SUCH_REVIEW = 334<br />
NO_SUCH_CHARACTER = 335<br />
NO_SUCH_SONG = 336<br />
NO_SUCH_ANIMETAG = 337<br />
NO_SUCH_CHARACTERTAG = 338<br />
NO_SUCH_EPISODE = 340<br />
NO_SUCH_UPDATES = 343<br />
NO_SUCH_TITLES = 344<br />
NO_SUCH_CREATOR = 345<br />
NO_SUCH_GROUP = 350<br />
NO_SUCH_CATEGORY = 351<br />
BUDDY_ALREADY_ADDED = 355<br />
NO_SUCH_BUDDY = 356<br />
BUDDY_ALREADY_ACCEPTED = 357<br />
BUDDY_ALREADY_DENIED = 358<br />
NO_SUCH_VOTE = 360<br />
INVALID_VOTE_TYPE = 361<br />
INVALID_VOTE_VALUE = 362<br />
PERMVOTE_NOT_ALLOWED = 363<br />
ALREADY_PERMVOTED = 364<br />
HOT_ANIME_EMPTY = 365<br />
RANDOM_RECOMMENDATION_EMPTY = 366<br />
RANDOM_SIMILAR_EMPTY = 367<br />
NOTIFICATION_DISABLED = 370<br />
NO_SUCH_ENTRY_MESSAGE = 381<br />
NO_SUCH_ENTRY_NOTIFICATION = 382<br />
NO_SUCH_MESSAGE = 392<br />
NO_SUCH_NOTIFY = 393<br />
NO_SUCH_USER = 394<br />
CALENDAR_EMPTY = 397<br />
NO_CHANGES = 399<br />
<br />
NOT_LOGGED_IN = 403<br />
NO_SUCH_MYLIST_FILE = 410<br />
NO_SUCH_MYLIST_ENTRY = 411<br />
MYLIST_UNAVAILABLE = 412<br />
<br />
LOGIN_FAILED = 500<br />
LOGIN_FIRST = 501<br />
ACCESS_DENIED = 502<br />
CLIENT_VERSION_OUTDATED = 503<br />
CLIENT_BANNED = 504<br />
ILLEGAL_INPUT_OR_ACCESS_DENIED = 505<br />
INVALID_SESSION = 506<br />
NO_SUCH_ENCRYPTION_TYPE = 509<br />
ENCODING_NOT_SUPPORTED = 519<br />
BANNED = 555<br />
UNKNOWN_COMMAND = 598<br />
<br />
INTERNAL_SERVER_ERROR = 600<br />
ANIDB_OUT_OF_SERVICE = 601<br />
SERVER_BUSY = 602<br />
NO_DATA = 603<br />
TIMEOUT - DELAY AND RESUBMIT = 604<br />
API_VIOLATION = 666<br />
<br />
PUSHACK_CONFIRMED = 701<br />
NO_SUCH_PACKET_PENDING = 702<br />
<br />
VERSION = 998</pre><br />
<br />
[[Category:Development]]<br />
[[Category:UDP]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=UDP_API_Definition&diff=18432UDP API Definition2015-03-27T07:18:35Z<p>Ommina: /* General Information */</p>
<hr />
<div>{{TOCright}}<br />
<br />
== General Information ==<br />
'''Author:''' [[User:Exp|Exp]] & [[User:Epoximator|Epoximator]] & [[User:Ommina|Ommina]]<br><br />
'''Version:''' 0.03.730 (2015-03-25)<br><br />
'''Version number used for protover parameter:''' "3"<br />
<br />
'''IMPORTANT INFORMATION FOR ALL INTERESTED:'''<br />
* If you are mainly interested in notifications and private messaging, check out our [[Jabber]] and [[RSSRDF]] support first.<br />
* The UDP API is not an appropriate choice if you desire to download a local copy of the AniDB database.<br />
* If you want to create a client you have to register it {{AniDBLink|client|here}} and [[UDP Clients|here]].<br />
** Check out the clients that are being developed. There exists usable code in many different languages already.<br />
* If you have suggestions for improvements or new features use the [[UDP API DEV|development]] page.<br />
* Please also take a look at the [[API]] page.<br />
<br />
== Formats used in this Spec ==<br />
* {vartype varname} - Specifies what shall be inserted at this point and its type.<br />
* [...] - Everything between [ and ] is optional.<br />
<br />
=== Used types ===<br />
* ''int2'' - 2 byte Integer (in string representation)<br />
* ''int4'' - 4 byte Integer (in string representation)<br />
* ''boolean'' - true or false - use '1' for ''true'', '0' for ''false''<br />
* ''str'' - String (UDP packet length restricts string size to 1400 bytes)<br />
* ''hexstr'' -- a hex representation of a decimal value, two characters per byte. If multiple bytes are represented, byte one is the first two characters of the string, byte two the next two, and so on.<br />
<br />
=== Content Encoding ===<br />
* Default character encoding: ''ASCII''<br />
* Escape scheme for option values (to server): ''html form encoding'' + ''newline''<br />
** This means you have to encode at least <tt>&</tt> in your option values in html form encoding style (<tt>&amp;amp;</tt>) before sending them to the api server. All other html form encodings are optional.<br />
** All newlines should be replaced by &lt;br /&gt;<br />
* Escape scheme for returned data fields (from server): ', | and newline<br />
** Content newlines are encoded as &lt;br /&gt;, ' is encoded as ` and | is not allowed in data fields.<br />
** Dates are returned in unix time (number of seconds elapsed since January 1, 1970 00:00:00 UTC)<br />
<br />
== Basics ==<br />
=== General ===<br />
The network communication is ''packet'' and ''line'' based. Each AniDB API command is exactly one UDP packet containing one line. Results are sent as one packet but may consist out of multiple lines. A return value always starts with a 3 byte result code followed by a human readable version of the result code. Be aware that important data fields may be returned directly after the return code (see: 200,201,271,272,504).<br />
The meaning for all result codes can be found in this document. If there is more than one entry returned, it's one entry per line. Lines are terminated by a <tt>\n</tt> (no dos linefeed <tt>\r</tt>). The elements of a format string are separated by a "|" character.<br />
<br />
<tt>{three digit return code} {str return string}\n</tt><br><br />
<tt>{data field 0}|{data field 1}|...|{data field n}</tt><br />
<br />
'''IMPORTANT:'''<br />
* All commands except PING, ENCRYPT, ENCODING, AUTH and VERSION '''requires''' login, meaning that the ''session tag'' must be set (<tt>s=xxxxx</tt>).<br />
* A client should ignore any additional trailing data fields it doesn't expect. Additional fields are going to be added to the output of some commands from time to time. Those additional fields will simply be appended to the end of the existing output. A client should be written in a way so that it is not affected by such new fields.<br />
* Due to the length constraints of an UDP package (over PPPoE) the replies from the server will never exceed 1400 bytes. String fields will be truncated if necessary to ensure this. No warnings are given when this happens.<br />
* A client should handle all possible return codes for each command.<br />
** Possible return codes for '''all commands''':<br />
*** 505 ILLEGAL INPUT OR ACCESS DENIED<br />
*** 555 BANNED<br />
***: {str reason}<br />
*** 598 UNKNOWN COMMAND<br />
*** 600 INTERNAL SERVER ERROR<br />
*** 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
*** 602 SERVER BUSY - TRY AGAIN LATER<br />
*** 604 TIMEOUT - DELAY AND RESUBMIT<br />
** Additional return codes for all commands that '''require login''':<br />
*** 501 LOGIN FIRST<br />
*** 502 ACCESS DENIED<br />
*** 506 INVALID SESSION<br />
<br />
{{eyecatch|Note|The '555 BANNED' message should not be expected by the client. This message is only enabled temporary to help developers understand what they are doing wrong.}}<br><br />
<br />
{{eyecatch|Note|<br />
While in daily maintenance the AniDB API will reply with<br />
<br />
601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
<br />
to all commands. If a client receives such a return value it should wait at least 30 minutes before trying again.}}<br />
<br />
=== Server / UDP Connection ===<br />
The Client has to send data packets to:<br />
* '''Server:''' api.anidb.net<br />
* '''Port:''' 9000/UDP<br />
The servername and port should not be hardcoded into a frontend but should be read from a configuration file.<br />
<br />
=== Server Errors ===<br />
* At any time the API might return a fatal error of the form:<br />
: <tt>6xx ERROR DESCRIPTION</tt><br />
* Possible codes are 600-699.<br />
* Occurrences of these errors (except 601 and 602) should be reported to [[User:Ommina|Ommina]].<br />
{{eyecatch|Note|6XX messages do not always return the tags given with the command which caused the error!}}<br />
<br />
=== Connection Problems ===<br />
There are many ways for a client to end up banned or the API might currently be handling too many concurrent connections.<br />
If a client does not get any reply to an AUTH command it should start to increase the retry delay exponentially with every failed login attempt. (i.e. try again after 30 seconds if the first login attempt failed, if the second fails too retry after 2 minutes, then 5 minutes, then 10 minutes, then 30 minutes, ... until you reach a retry delay of ~2-4h.)<br />
<br />
=== Local Port ===<br />
A client should select a fixed local port >1024 at install time and reuse it for local UDP Sockets. If the API sees too many different UDP Ports from one IP within ~1 hour it will ban the IP. (So make sure you're reusing your UDP ports also for testing/debugging!)<br />
<br />
The local port may be hardcoded, however, an option to manually specify another port should be offered.<br />
<br />
'''Note when behind a [[Wikipedia:Network address translation|NAT]]/masquerading router:'''<br><br />
A session between the server and a client is identified by the ''IP and port'' used by the client. So when the port (or IP) changes within a session the client has to authenticate again. If a client is behind a NAT router it can’t actually control the local port used for the connection. The router will normally ''translate'' the port to support several computers on a LAN to share the Internet connection. The public port (as determined by the router and seen by the server) which has been assigned to the connection will only be reserved for as long as it is in use. This means that the router will usually ''deallocate the port after a fixed timeout period'' (eg. five, ten or 15 minutes). Once that happens the client will no longer be able to receive UDP messages from the server (the messages will be discarded as undeliverable by the router) and a new port will be selected once the client tries to send a message to the server (which will result in a new connection session - '''Note:''' This could get you banned!, see above). So in order to keep a session over a NAT router alive, the client has to ping the server within the router's deallocation period to prevent a timeout.<br />
<br />
The client can decide whether it is behind a NAT router or not by adding <tt>nat=1</tt> to the AUTH command. This will cause the response to include the IP and port as seen by the server. If the port differs from the port reported by the local socket, the connection subject to NAT and the client should issue PING commands in regular intervals. Please do not send pings more often than is necessary to keep NAT connections alive.<br />
<br />
=== Flood Protection ===<br />
To prevent high server load the UDP API server enforces a strict flood protection policy.<br />
* Short Term:<br />
** A Client MUST NOT send more than 0.5 packets per second (that's one packet every two seconds, not two packets a second!)<br />
** The server will start to enforce the limit after the first 5 packets have been received.<br />
* Long Term:<br />
** A Client MUST NOT send more than one packet every four seconds over an extended amount of time.<br />
** ''An extended amount of time'' is not defined. Use common sense.<br />
<br />
Once a client exceeds a rate limit all further UDP packets from that client will be dropped without feedback until the client's packet rate is back down to acceptable levels.<br />
<br />
{{eyecatch|Note|Dropped packets are still taken into account for the packet rate. Meaning if you continuously send packets your client will be banned forever.}}<br />
<br />
Generally clients should be written in a way to minimize server and network load. You should always keep that in mind.<br />
<br />
Abusive clients may be banned completely.<br />
<br />
{{eyecatch|Note|<br />
If you suddenly stop getting replies from the AniDB API or you normally don't have a notable packetloss and from one point on you suddenly note a high packetloss percentage you have most likely entered a critical flood ratio.<br />
If the AniDB API isn't answering at all it might either be down or you have been banned, this is normally caused by violating the API specs (i.e. too many connections using different ports from one IP, too many auth failures, ...) (usually lasts 30 minutes).<br />
If you're experiencing packet loss you have probably reached the rate limit and the API starts to randomly drop incoming packets from your IP. (can be solved by enforcing a delay between multiple commands when you're sending a batch)}}<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Caching ===<br />
To minimize server and network load a client should use local caching in order to prevent repeated API requests for the same data.<br />
<br />
A client should locally cache FILE/EP/ANIME/GROUP/... info wherever possible for extended amounts of time.<br />
(I.e. if a client is used to scan a local folder with anime files and add them via API to a users MyList then it shall only ask for all files in the first run and cache the info for all files known to AniDB. If run again over the same folder it shall only check those files which were unknown to AniDB at the time of the last check.)<br />
<br />
Later versions of the API might enforce this by banning clients which ask for the same information more than once every week/month.<br />
<br />
=== Tag option ===<br />
The API will add a user defined string at the beginning of each reply line separated with a space, if desired.<br />
* To enable add the <tt>tag={str usertag}</tt> option to a command.<br />
* A tag is only valid for the command it was send with, meaning it is not persistent. If you want to have tags in front of all reply lines you will have to append the tag option to each command you send to the server.<br />
* Tags are meant to enable a client to handle more than one request/reply at a time.<br />
<br />
Usage example:<br />
AUTH user=baka&pass=baka&protover=25&client=someclient&clientver=1&tag=abc123<br />
abc123 200 Jxqxb LOGIN ACCEPTED<br />
or<br />
LOGOUT s=Jxqxb&tag=byebye<br />
byebye 203 LOGGED OUT<br />
<br />
{{eyecatch|Note|The tag option is valid for all api commands and is thus not explicitly listed in the description of each command.}}<br />
<br />
=== Data Indexes (fid,aid,eid,gid,lid) ===<br />
* All indexes start at 1 (not 0).<br />
* It is possible for table entries to have id fields with a value of 0 (i.e. gid). Those are to be interpreted as "NONE" or "NULL".<br />
* An ID is '''never''' reused. That means after an entry is deleted no new entry will ever have that ID again.<br />
* Mylist IDs (lid) are globally unique, not per-user unique.<br />
<br />
== Authing Commands ==<br />
{{eyecatch|Note|'''ANY''' command which requires parameters may return: 505 ILLEGAL INPUT OR ACCESS DENIED}}<br />
<br />
----<br />
=== AUTH: Authing to the AnimeDB ===<br />
'''Command String:'''<br />
* AUTH user={str username}&pass={str password}&protover={int4 apiversion}&client={str clientname}&clientver={int4 clientversion}[&nat=1&comp=1&enc={str encoding}&mtu{int4 mtu value}&imgserver=1]<br />
<br />
'''Possible Replies:'''<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
* 500 LOGIN FAILED<br />
* 503 CLIENT VERSION OUTDATED<br />
* 504 CLIENT BANNED - {str reason}<br />
* 505 ILLEGAL INPUT OR ACCESS DENIED<br />
* 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
when nat=1<br />
* 200 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED<br />
* 201 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
when imgserver=1<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
{str image server name}<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
{str image server name}<br />
<br />
'''Info:'''<br />
{{eyecatch|Note|The password is the normal AniDB website password! The password listed in the profile as API Password in only used for the optional encryption feature.}}<br />
* The ''session_key'' is a String containing only ''a-z,A-Z,0-9'' chars of a length of ''4-8'' characters.<br />
: It has to be stored by the client and needs to be sent as parameter with every command which requires the user to logged in.<br />
* The ''session_key'' String is appended as parameter "s", i.e. "PUSH notify=1&msg=1&s={str session_key}".<br />
* On a '''500 LOGIN FAILED''' message the client should request the user to enter username and password again.<br />
* In case of a '''501 LOGIN FIRST''' message the client should silently resend an auth command and send the failed command again.<br />
* A '''502 ACCESS DENIED''' message should abort the current action on the client side and display a message to the user.<br />
* A '''503 CLIENT VERSION OUTDATED''' message states that the udp server has been updated and does not support your client any longer. (protover is too low). A 201 message refers to a new version of the client software.<br />
* A '''506 INVALID SESSION''' means that either the session key parameter "s" was not provided with a command that requires it or the session key is no longer valid. The client should reissue an AUTH command.<br />
{{eyecatch|Note|A frontend shall expect 501 and 502 messages to be returned on ANY command.}}<br><br />
{{eyecatch|Note|AniDB usernames may only contain characters (a-z,A-Z), numbers (0-9), underscores (_) and hyphens (-).}}<br />
* The client should send the apiversion of the AnimeDB API version it supports as value of the protover parameter.<br />
* The client MAY NOT send anything but the version of the API Specs the author used to write the client! (as it is stated at the top of this file @ "Version number used for protover parameter")<br />
: The API will compare that value to it's own version of the API and if the version of the client is older the API will decide whether the changes were significant enough to deny the old client access to the DB.<br />
* The clientname shall be a lower-case string containing only the chars ''a-z'' of ''4-16 chars'' length which identifies the client. (i.e. mykickassclient)<br />
* The clientversion shall be a number starting with 1, increased on every change in the client.<br />
: clientname and clientversion might be used by the API to distinguish between different clients and client versions if that should ever become necessary.<br />
{{eyecatch|Important|<br />
* DO NOT use the clientname of an existing client. If you modify an existing client's code to meet your own needs, create a new client name for yourself.<br />
* ALWAYS increase the clientversion number if you release a new client version.}}<br />
* A Login and its assigned ''session_key'' is valid until the virtual UDP connection times out or until a LOGOUT command is issued.<br />
* The virtual UDP connection times out if no data was received from the client for '''35 minutes'''.<br />
* A client should issue a UPTIME command once every 30 minutes to keep the connection alive should that be required.<br />
* If the client does not use any of the notification/push features of the API it should NOT keep the connection alive, furthermore it should explicitly terminate the connection by issuing a LOGOUT command once it finished it's work.<br />
* If it is very likely that another command will be issued shortly (within the next 20 minutes) a client SHOULD keep the current connection open, by not sending a LOGOUT command.<br />
{{eyecatch|Important|<br />
* A client should NOT perform a full AUTH / command / LOGOUT cycle for each command it wants to send. Again, if another command is likely within 20 minutes, remain logged in.}}<br />
* The client shall notify the user if it received a 201 message at login.<br />
: This means a new version of the client is available, however the old version is still supported otherwise a client banned message would have been returned.<br />
* The user should get a pop-up message on 503 and 504 messages telling him to update his client software.<br />
: ('''Note:''' 504 means that this version of the client is banned, not the user!)<br />
* The 'nat' option makes the client able to detect whether it is behind a nat router or not. When the client is behind a nat router it should keep the "connection" alive with the PING command.<br />
{{eyecatch|Important|Make sure your client handles ALL possible AUTH return codes before giving out any versions!}}<br />
* When ''enc=x'' is defined the server will change the encoding used to x.<br />
**If the encoding is supported it will change right away (including the response) and be reset on logout/timeout.<br />
**If not supported then the argument will be silently ignored. Use ENCODING to test what works.<br />
**Supported encodings are [http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html these].<br />
* ''comp=1'' means that the client supports compression ([http://java.sun.com/j2se/1.5.0/docs/api/java/util/zip/Deflater.html DEFLATE]).<br />
**The server will compress (instead of truncating) the datagrams when needed if this option is enabled.<br />
**The first two bytes of compressed datagrams will always be set to zero. (So tags should never start with that.)<br />
* Default [[Wikipedia:MTU (networking)|''MTU'']] is 1400. Minimum allowed is 400, maximum 1400, due [[Wikipedia:Point-to-Point Protocol over Ethernet|PPPoE]].<br />
<br />
----<br />
<br />
=== LOGOUT: Logout ===<br />
'''Command String:'''<br />
* LOGOUT<br />
<br />
'''Possible Replies:'''<br />
* 203 LOGGED OUT<br />
* 403 NOT LOGGED IN<br />
<br />
'''Info:'''<br />
* This command only works if you are already logged in.<br />
* A logout should ALWAYS be issued if the client is currently logged in and is either exiting or not expecting to send/receive any AniDB API packets for the next >= 30 minutes.<br />
<br />
----<br />
=== ENCRYPT: Start Encrypted Session ===<br />
Will cause all future messages from the server, except the first (the reply to the ENCRYPT command itself), to be encrypted (128 bit [[Wikipedia:Advanced Encryption Standard|AES]]). The client will also have to encrypt all future requests sent to the server. All non-encrypted messages will be discarded by the server. The encryption key is the [[Wikipedia:MD5|MD5]] hash of a special ''UDP API Key'' (defined in the users profile) concatenated with the salt string as given in the reply to the ENCRYPT message. A normal AUTH message is still necessary to authenticate and should follow the ENCRYPT command once the API has acknowledged the encryption.<br />
<br />
'''Command String:'''<br />
* ENCRYPT user={str name}&type={int2 type}<br />
<br />
'''Possible Replies:'''<br />
* 209 {str salt} ENCRYPTION ENABLED<br />
* 309 API PASSWORD NOT DEFINED<br />
* 509 NO SUCH ENCRYPTION TYPE<br />
* 394 NO SUCH USER<br />
<br />
'''Info:'''<br />
* ''user'' is the user name.<br />
* ''type'' is the type of encryption; 1 => 128 bit AES (only one defined).<br />
* ''API Key'' is the one defined in the {{AniDBLink|profile|profile settings page}}.<br />
* It is not possible to disable the encryption once enabled while staying logged in.<br />
** A logout (the logout message needs to be correctly encrypted) or timeout will disable the encryption.<br />
* In order to minimize server load, encryption should be disabled by default and should have to be enabled manually by the user in the configuration options.<br />
* The encryption key is md5(api_key_of_user+''salt'').<br />
* Padding of the message needs to be done according to the PKCS5Padding scheme.<br />
<br />
== Notify Commands ==<br />
=== Introduction ===<br />
Broadly speaking, notifications provide an indication to the client that some event has occurred within the AniDB database.<br />
<br />
There are three types:<br />
* New file [[Notifications|notification]]. (Only anime type supported.)<br />
* New private message notification.<br />
* New buddy event notification.<br />
<br />
Note that, while a user can subscribe to multiple 'new file' events (see [[Notifications|notifications]]), at present, the UDP API only supports notifications of new files by anime. New files by group, or new files by producer, are NOT presently supported. Just the same, keeping in mind that the API is designed to potentially support such notifications in the future will help in understanding why some of the commands are structured the way they are.<br />
<br />
The word "notification" is also used a bit inconsistently in this document. An AniDB notification is originally a "new file [[Notifications|notification]]". It might be more correct to use the term "event" for the original "happening" and then "notification" as the means to notify the user (client). New-file, new-message, buddy-* and going-down are all events that results in notifications. Only the first two type of events are persistent, though, meaning they exist and remain in the same state until some user action affects them.<br />
<br />
=== Getting Notifications ===<br />
Clients that wish to receive notifications have two routes available to them. They are by no means mutually exclusive and selecting one does not imply a client is unable to use commands from another.<br />
<br />
'''Method One: Polling'''<br />
<br />
With this method, the client contacts the server at some interval (no more than once every 20 minutes) to see if there are new file notifications waiting. If there are, the client can the get further details of the files in question. This is analogous to checking an email server every half hour to see if new email has arrived.<br />
<br />
Its principal advantage is that it is easy to design and code. Blocking sockets are sufficient as the client can expect the reply received to correspond with the command sent.<br />
<br />
The disadvantage of this approach is that it introduces a delay and some uncertainty in receiving notifications. If, for example, the user clears the notification on the website before the client collects it, the client will not learn of the new file. Similarly, if the user does not dismiss notifications via the site, the client will have an increasing amount of stale data to work though. Finally, notifications cleared by the client also clears them from the website, so users will need to be made aware of what is going on.<br />
<br />
A polling HOWTO:<br />
<br />
* Use NOTIFY (no more than once every 20 minutes) to get the number of pending notifications<br />
* IF there are new notifications pending, use NOTIFYLIST to get a list of notification types and associated IDs.<br />
* Use NOTIFYGET to receive a notification, supplying the ID provided by NOTIFYLIST<br />
* Use NOTIFYACK to acknowledge a notification, supplying the ID provided by NOTIFYLIST (if desired)<br />
<br />
{{eyecatch|Note|The ID supplied by NOTIFYLIST will be the ID of the affected notification type. Since, at present, only the anime type is supported, this value is always an aid. In the future, it may represent a group or producer ID. In these cases, the str '''type''' value will indicate what entity the ID represents.}}<br />
<br />
'''Method Two: Server PUSH'''<br />
<br />
With this method, the server takes the active role in advising the client that a new file has arrived. The client must register with the server to receive further advice information, and will be responsible for keeping the login session from timing out, and any NAT router ports open. The UDP packet is sent to the ip and port from which the AUTH command was received.<br />
<br />
This method compensates for the disadvantages of the polling method, but is more difficult to code. Blocking sockets are no longer an option, nor can a client make any assumptions that an incoming packet will necessarily be a reply to the last command sent. The tag option may be helpful here.<br />
<br />
A PUSH HOWTO:<br />
<br />
* PUSH to register your client session.<br />
* Listen for 720-799 NOTIFICATIONs ('''not 290''').<br />
* Use PUSHACK to to acknowledge the notification using the nid supplied with NOTIFICATION<br />
* Use NOTIFYGET to receive a notification, suppling the relid provided by NOTIFICATION (NOT the packet ID)<br />
* Use NOTIFYACK to acknowledge a notification, suppling the relid provided by NOTIFICATION (if desired)<br />
* Use UPTIME (with an interval between 30 and 35 minutes) to keep login session valid<br />
<br />
It is probably a good idea to use tags to separate NOTIFICATIONs from the other communication. NOTIFICATIONs will '''never''' have tags.<br />
<br />
=== PUSH: UDP Notification Registration ===<br />
Register your client as an observer for AniDB notification events for the current user. If you are registered for one or more event types the AniDB server will send an UDP packet (format see below) on each change which affects the current user.<br />
<br />
'''Command String:'''<br />
* PUSH notify={boolean on_new_file}&msg={boolean on_new_private_message}[&buddy={boolean on_buddy_event}]<br />
<br />
'''Possible Replies:'''<br />
* 270 NOTIFICATION ENABLED<br />
OR (if both values are 0)<br />
* 370 NOTIFICATION DISABLED<br />
<br />
'''Info:'''<br />
* A client which has registered to receive UDP notification packets must:<br />
** Issue a PUSHACK command for each notification received with ''notify_packet_id'' provided in the notification packet.<br />
** Use PING to keep the connection alive (< 30 min).<br />
** Use UPTIME to ensure that the session is OK (>= 30 min).<br />
* Every notification generated is resent 3 times unless acknowledged. After that the client is logged out.<br />
<br />
=== NOTIFY: Notifications ===<br />
Get number of pending notifications (and number of online buddies).<br />
<br />
'''Command String:'''<br />
* NOTIFY [buddy=1]<br />
<br />
'''Possible Replies:'''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}<br />
when ''buddy=1''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}|{int4 number_of_online_buddies}<br />
<br />
'''Info:'''<br />
* If the client did send a NOTIFY within the last 35 minutes and it was confirmed by AniDB then receiving a 501 LOGIN FIRST message for the next NOTIFY command shows that AniDB logged the client out because it did not respond to a PUSH Notification packet.<br />
* There is no command to retrieve missed PUSH Notifications.<br />
{{eyecatch|Note|This command MUST NOT be issued more than once every 20 minutes.}}<br />
<br />
----<br />
=== NOTIFYLIST: List Notification/Message IDs ===<br />
List id of all pending (not acknowledged) ''new private message'' and ''new file'' notifications. Buddy events cannot be acknowledged.<br />
<br />
'''Command String:'''<br />
* NOTIFYLIST<br />
<br />
'''Possible Replies:'''<br />
*291 NOTIFYLIST<br />
: {str type}|{int4 id}<br />
: {str type}|{int4 id}<br />
: ...<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as required by NOTIFYGET. For messages it is the actual message id, for notifications it is the id of the related type; anime, group or producer. Since only file notifications related to anime is implemented atm, it is the anime id (aid).<br />
* NOTIFYLIST returns one line per entry, if no entries are available only the first line of the reply is returned.<br />
{{eyecatch|Note|This command MUST NOT be issued regularly but should only be triggered by either a push message received by the client or a reply to a NOTIFY command which tells you that there are messages/notifications waiting.}}<br />
<br />
----<br />
=== NOTIFYGET: Get Notification/Message ===<br />
Receive private message or file notification.<br />
<br />
'''Command String:'''<br />
* NOTIFYGET type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 292 NOTIFYGET<br />
: {int4 id}|{int4 from_user_id}|{str from_user_name}|{int4 date}|{int4 type}|{str title}|{str body}<br />
* 392 NO SUCH ENTRY<br />
when type = N<br />
* 293 NOTIFYGET<br />
: {int4 relid}|{int4 type}|{int2 count}|{int4 date}|{str relidname}|{str fids}<br />
* 393 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as given by NOTIFYLIST (or ''relid'' from 271 NOTIFICATION and mid from 272 NOTIFICATION)<br />
* for message entries (M):<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: type is the type of the message (0=normal msg, 1=annonymous, 2=system msg, 3=mod msg)<br />
* for notification entries (N):<br />
: relid is the id of the related type (anime)<br />
: relname is the name of the related type (anime)<br />
: type is the notification type (0=all, 1=new, 2=group, 3=complete)<br />
: count is the number of events pending for this subscription<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: fids is a comma separated list with the affected file ids<br />
<br />
----<br />
=== NOTIFYACK: Acknowledge Notification/Message ===<br />
This command will mark a message read or clear a ''new file'' notification. Buddy events are not acknowledgeable.<br />
<br />
'''Command String:'''<br />
* NOTIFYACK type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 281 NOTIFYACK SUCCESSFUL<br />
* 381 NO SUCH ENTRY<br />
when type = N<br />
* 282 NOTIFYACK SUCCESSFUL<br />
* 382 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
<br />
====Notification Packet Format====<br />
'''New File Notify:'''<br />
<br />
720 {int4 notify_packet_id} NOTIFICATION - NEW FILE<br />
{int4 fidlist}|{int2 reltype}|{int2 priority}<br />
<br />
* fidlist is a comma separated list of file ids<br />
* reltype is: 1 = anime, 2 = group, 3 = producer<br />
* priority is: 0 = low, 1 = medium, 2 = high<br />
* new file notifications are created as a batch, so it is not unusual to get several new files for a particular anime at once. It is in this case that a comma separated list of fids will be returned<br />
<br />
{{eyecatch|Note|Group (and producer) related file notifications are not implemented yet.}}<br />
<br />
<br />
'''New Private Message Notify:'''<br />
<br />
794 {int4 notify_packet_id} NOTIFICATION - NEW MESSAGE<br />
{int2 type}|{int4 date}|{int4 sent_by_uid}|{str sent_by_name}|{str subject}|{str body}|{int mid}<br />
<br />
* type is the type of the message (0=normal msg, 1=anonymous, 2=system msg, 3=mod msg)<br />
* date is the time the message was sent (in seconds since 1.1.1970)<br />
* sender uid/sender name are the user id and user name of the sender<br />
* subject is the message subject<br />
* body is message body (can be truncated)<br />
* mid is message id and can be used with NOTIFYACK<br />
<br />
'''Buddy Event Notify:'''<br />
753 {int4 notify_packet_id} NOTIFICATION - BUDDY<br />
{int4 buddy uid}|{int2 event type}<br />
* Possible event types:<br />
** 0 => LOGIN<br />
** 1 => LOGOUT<br />
** 2 => ACCEPTED<br />
** 3 => ADDED<br />
<br />
<br />
'''Going Down Event Notify:'''<br />
799 {int4 notify_packet_id} NOTIFICATION - SHUTTING DOWN<br />
{int4 time offline}|{int4 comment}<br />
<br />
* Clients with any notification on will receive the SHUTTING DOWN message before the API goes offline.<br />
* Time offline is the time in minutes the API will be down, 0 if indefinite (client can direct user to the AniDB site for status updates).<br />
* The comment is a short explanation for the downtime.<br />
* Only one datagram will be sent, and the server will not listen for replies.<br />
<br />
<br />
=== PUSHACK: UDP Notification Acknowledge ===<br />
Used to acknowledge notification packets (720-799). A client must be prepared to issue this command before using '''PUSH'''.<br />
<br />
'''Command String:'''<br />
* PUSHACK nid={int4 notify_packet_id}<br />
<br />
'''Possible Replies:'''<br />
* 701 PUSHACK CONFIRMED<br />
* 702 NO SUCH PACKET PENDING<br />
<br />
'''Info:'''<br />
* See: '''PUSH'''<br />
<br />
== Buddy Commands ==<br />
Group of commands used to administrate your buddylist.<br />
<br />
=== BUDDYADD: Add a user to Buddy List ===<br />
'''Command String:'''<br />
* BUDDYADD uid={int4 buddy uid}<br />
* BUDDYADD uname={int4 buddy name}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 255 BUDDY ADDED<br />
* 355 BUDDY ALREADY ADDED<br />
<br />
----<br />
=== BUDDYDEL: Remove a user from Buddy List ===<br />
'''Command String:'''<br />
* BUDDYDEL uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 256 BUDDY DELETED<br />
<br />
----<br />
=== BUDDYACCEPT: Accept user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYACCEPT uid={int4 user uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 257 BUDDY ACCEPTED<br />
* 357 BUDDY ALREADY ACCEPTED<br />
<br />
----<br />
=== BUDDYDENY: Deny user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYDENY uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 258 BUDDY DENIED<br />
* 358 BUDDY ALREADY DENIED<br />
<br />
----<br />
=== BUDDYLIST: Retrieve Buddy List ===<br />
'''Command String:'''<br />
* BUDDYLIST startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 253 {int2 start} {int2 end} {int2 total} BUDDY LIST<br />
: {int4 uid}|{str username}|{int2 state}<br />
: ...<br />
'''Info:'''<br />
* state is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = this user is in your buddylist<br />
* bit 2 = this user has accepted you<br />
* bit 3 = this user is waiting for your approval<br />
<br />
----<br />
=== BUDDYSTATE: Retrieve Buddy States===<br />
'''Command String:'''<br />
* BUDDYSTATE startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 254 {int2 start} {int2 end} {int2 total} BUDDY STATE<br />
: {int4 uid}|{int2 onlinestate}<br />
: ...<br />
<br />
'''Info:'''<br />
* onlinestate is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = http online (user has issued a HTTP request within the last 10 minutes)<br />
* bit 2 = udp api online (user is currently connected to the udp api server)<br />
* example: 0=offline, 1=http online, 2=udp api online, 3=http&udp api online<br />
<br />
== Data Commands ==<br />
=== ANIME: Retrieve Anime Data ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIME aid={int4 id}[&amask={hexstr}]<br />
by name<br />
* ANIME aname={str anime name}[&amask={hexstr}]<br />
<br />
'''Possible Replies:'''<br />
<br />
If no ''amask'' is provided:<br />
* 230 ANIME<br />
: {int4 aid}|{int4 eps}|{int4 ep count}|{int4 special cnt}|{int4 rating}|{int4 votes}|{int4 tmprating}|{int4 tmpvotes}|{int4 review rating average}|{int4 reviews}|{str year}|{str type}|{str romaji}|{str kanji}|{str english}|{str other}|{str short names}|{str synonyms}|{str category list}<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* Fields are returned in the same order they appear in the ''amask'' field list: byte 1, bit 7 first<br />
* Synonyms and short names are separated with '<br />
* Category fields are separated with ',' and ordered by weight (desc).<br />
* By name: must be perfect match of romaji/kanji/english/other/synonym/short name.<br />
* 'Producer id list' and 'producer name list' match the data returned by the former producer bits (but using the revised creator ids)<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
* '''Note:''' The character id list is the first data to be truncated if needed. And then: tag list, synonym list, short name list. This applies to the FILE command too.<br />
* Selecting an 'unused' or 'reserved' bit will return an "illegal input" (505) response.<br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="5" align="center"><b>amask</b></td></tr><br />
<tr><br />
<td align="center"><b>Byte 1</b></td><br />
<td align="center"><b>Byte 2</b></td><br />
<td align="center"><b>Byte 3</b></td><br />
<td align="center"><b>Byte 4</b></td><br />
<td align="center"><b>Byte 5</b></td><br />
<td align="center"><b>Byte 6</b></td><br />
<td align="center"><b>Byte 7</b></td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int aid</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int dateflags</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 special ep count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int air date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int end date</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str url</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str picname</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str category id list</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int vote count</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 temp rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int temp vote count</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 average review rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int review count</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str award list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>bool is 18+ restricted</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int anime planet id</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int ANN id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int allcinema id</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str AnimeNfo id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int date record updated</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int character id list</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int creator id list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int main creator id list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str main creator name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 specials count</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 credits count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 other count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 trailer count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 parody count</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<br />
'''Related aid type (Byte 1, Bit 2):'''<br />
<pre><br />
value meaning<br />
<br />
1 sequel<br />
2 prequel<br />
11 same setting<br />
12 alternative setting<br />
32 alternative version<br />
41 music video<br />
42 character<br />
51 side story<br />
52 parent story<br />
61 summary<br />
62 full story<br />
100 other<br />
</pre><br />
<br />
'''Examples:''' (note that the given amask gives the same result as the default request)<br />
> ANIME aid=1&amask=b2f0e0fc000000&s=xxxxx<br />
< 230 ANIME<br />
1|1999-1999|TV Series|Space,Future,Plot Continuity,SciFi,Space Travel,Shipboard,Other Planet,Novel,Genetic Modification,Action,Romance,Military,Large Breasts,Gunfights,Adventure,Human Enhancement,Nudity|Seikai no Monshou|星界の紋章|Crest of the Stars||13|13|3|853|3225|756|110|875|11<br />
<br />
<br />
----<br />
<br />
=== ANIMEDESC: Retrieve Anime Description ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIMEDESC aid={int4 id}&part={int4 partno}<br />
<br />
'''Possible Replies:'''<br />
* 233 ANIMEDESC<br />
: {int4 current part}|{int4 max parts}|{str description}<br />
* 330 NO SUCH ANIME<br />
* 333 NO SUCH DESCRIPTION<br />
<br />
'''Info:'''<br />
* The maximum length of the anime description is roughly 5000 characters, but the maximum length of a UDP packet is 1400 bytes<br />
* Multiple calls to ANIMEDESC may be necessary to retrieve the complete text, retrieving separate 1400 byte parts with each call<br />
* ''part'' is zero-based<br />
* '''Note:''' No support, at present, for retrieving descriptions by title. ''aid'' only<br />
<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> ANIMEDESC aid=3169&part=0&s=xxxxx<br />
< 233 ANIMEDESC<br />
0|1|As summer break arrives for the students, Jun Sakurada is busily studying on his own in the library, making up for time lost <cut><br />
<br />
----<br />
=== CALENDAR: Get Upcoming Titles ===<br />
Returns the anime ids of the 25 most recently aired / released anime, directly followed by the next 25 anime due to be aired / released, ordered by start date.<br />
<br />
'''Command String:'''<br />
* CALENDAR<br />
<br />
'''Possible Replies:'''<br />
* 297 CALENDAR<br />
{int aid}|{int startdate}|{int dateflags}/n<br />
<br />
..repeated n times<br />
<br />
* 397 CALENDAR EMPTY<br />
<br />
'''Info:'''<br />
* Takes no parameters (other than the session string)<br />
* Titles returned are filtered by the 'show adult' preference of the logged in user. That is, users who have elected to hide adult content will have it hidden here as well.<br />
* Do not depend on the command always returning exactly 50 titles; there may not always be 25 future titles pending, depending on the user's 'adult' preferences, and the date in relation to the relation to the current anime season.<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
<br />
----<br />
=== CHARACTER: Get Character Information ===<br />
Returns character details associated with a given character ID, including associated anime ids, episode ids, and seiyuu.<br />
<br />
'''Command String:'''<br />
* CHARACTER charid={int characterid}<br />
<br />
'''Possible Replies:'''<br />
* 235 CHARACTER<br />
: {int charid}|{str character name kanji}|{str character name transcription}|{str pic}|{anime blocks}|{int episode list}|{int last update date}|{int2 type}|{str gender}<br />
<br />
: An 'anime block' is {int anime id},{int appearance},{int creatorid},{boolean is_main_seiyuu} repeated as many times as necessary, separated by a single quote ( ' ). <br />
<br />
* 335 NO SUCH CHARACTER<br />
<br />
'''Info:'''<br />
* If no seiyuu is associated with the character for a given aid, the 'creatorid' and 'is_main_seiyuu' fields will be empty, but the commas will remain.<br />
* An empty episode list is "undefined": no episode values have been added.<br />
* ''appearance'' values: 0='appears in', 1='cameo appearance in', 2='main character in', 3='secondary cast in'<br />
* ''type'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** 1 => 'Character'<br />
** 2 => 'Mecha'<br />
** 3 => 'Organisation'<br />
** 4 => 'Vessel' <br />
* ''gender'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** "M" => 'Male'<br />
** "F" => 'Female'<br />
** "I" => 'Intersexual'<br />
** "D" => 'Dimorphic'<br />
** "-" => 'none/does not apply'<br />
** "?" => 'unknown'<br />
<br />
'''Example:'''<br />
<br />
CHARACTER charid=488&s=DChan<br />
235 CHARACTER<br />
488|ニコ・ロビン|Nico Robin|14789.jpg|4097,2,1900,1'69,2,1901,0'6199,0,1900,1'5691,0,1900,1'2644,0,,'4851,0,1900,1||1236938094<br />
<br />
=== CREATOR: Get Creator Information ===<br />
<br />
'''Command String:'''<br />
* CREATOR creatorid={int creatorid}<br />
<br />
'''Possible Replies:'''<br />
* 245 CREATOR<br />
: {int creatorid}|{str creator name kanji}|{str creator name transcription}|{int type}|{str pic_name}|{str url_english}|{str url_japanese}|{str wiki_url_english}|{str wiki_url_japanese}|{int last update date}<br />
<br />
* 345 NO SUCH CREATOR<br />
<br />
'''Info:'''<br />
* ANIME AMASK byte6, bit5<br />
* ''type'' values: 1='person', 2='company', 3='collaboration'<br />
<br />
Example:<br />
<br />
245 CREATOR<br />
718|GAINAX|Gainax|2|10092.png||http://www.gainax.co.jp/|Gainax|Gainax|1237048093<br />
<br />
=== EPISODE: Retrieve Episode Data ===<br />
'''Command String:'''<br><br />
by eid<br />
* EPISODE eid={int eid}<br />
by anime and episode number<br />
* EPISODE aname={str anime name}&epno={int4 episode number}<br />
* EPISODE aid={int anime id}&epno={int4 episode number}<br />
<br />
'''Possible Replies:'''<br />
* 240 EPISODE<br />
: {int eid}|{int aid}|{int4 length}|{int4 rating}|{int votes}|{str epno}|{str eng}|{str romaji}|{str kanji}|{int aired}|{int type}<br />
* 340 NO SUCH EPISODE<br />
<br />
'''Info:'''<br />
* length is in minutes<br />
* Returned 'epno' includes special character (only if special) and padding (only if normal).<br />
** Special characters are S(special), C(credits), T(trailer), P(parody), O(other).<br />
* The ''type'' is the raw episode type, used to indicate numerically what the special character will be<br />
** 1: regular episode (no prefix), 2: special ("S"), 3: credit ("C"), 4: trailer ("T"), 5: parody ("P"), 6: other ("O")<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> EPISODE eid=1&s=xxxxx<br />
< 240 EPISODE<br />
1|1|24|400|4|01|Invasion|shinryaku|??<br />
<br />
> EPISODE aname=Seikai no Monshou&epno=2&s=xxxxx<br />
< 240 EPISODE<br />
2|1|24|750|2|02|Kin of the Stars|Hoshi-tachi no Kenzoku|??????|1295059229|1<br />
<br />
----<br />
<br />
=== FILE: Retrieve File Data ===<br />
'''Command String:'''<br><br />
by fid:<br />
* FILE fid={int4 id}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by size+ed2k hash:<br />
* FILE size={int8 size}&ed2k={str ed2khash}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by anime, group and epno<br />
* FILE aname={str anime name}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aname={str anime name}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
<br />
'''Possible Replies:'''<br />
* 220 FILE<br />
: {int4 fid}|{int4 aid}|{int4 eid}|{int4 gid}|{int4 state}|{int8 size}|{str ed2k}|{str anidbfilename}<br />
* 220 FILE<br />
: {int4 fid}|...(data list)<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 0}|{int4 fid 1}|...|{int4 fid n}<br />
* 320 NO SUCH FILE<br />
<br />
'''Info:'''<br />
* fid, aid, eid, gid are the unique ids for the file, anime, ep, group entries at AniDB.<br />
: You can use those to create links to the corresponding pages at AniDB.<br />
* anidbfilename is the AniDB filename for the file.<br />
: However this name does not contain all the extra information of the filenames on AniDB and might be composed slightly different.<br />
* fmask and amask are hexidecimal strings where each bit corresponds to a data field related to the specified file (see below). The data list received is sorted and returned in the same order as the tables: top to bottom, left to right, with fmask preceding amask. There is '''no''' provision to retrieve all fields. Further, requesting a 'unusued' or 'reserved' bit will return an "illegal input" error.<br />
* fid is always returned as the first value, regardless of what masks are provided.<br />
* Only the first matching file is returned when aname, gname and epno is used.<br />
* "audio codec" and "audio bitrate" will return multiple values if there are multiple audio streams present in the file. Values will be separated by a single quote. <br />
* For byte 1, bit 2 (other episodes): episode IDs will be followed by an integer '''percentage''' that indicate the percentage of the related episode this file covers. Typically 100%, there are cases where it will be 50, 30, or other values. This value provides no indication where, within an episode, the file represents. That is, 50% could mean the file covers the first half of the episode, the second half, or some 50% range in between.<br />
'''State:'''<br />
<pre><br />
bit / int value meaning<br />
1 / 1 FILE_CRCOK: file matched official CRC (displayed with green background in AniDB)<br />
2 / 2 FILE_CRCERR: file DID NOT match official CRC (displayed with red background in AniDB)<br />
3 / 4 FILE_ISV2: file is version 2<br />
4 / 8 FILE_ISV3: file is version 3<br />
5 / 16 FILE_ISV4: file is version 4<br />
6 / 32 FILE_ISV5: file is version 5<br />
7 / 64 FILE_UNC: file is uncensored<br />
8 / 128 FILE_CEN: file is censored<br />
<br />
examples:<br />
state ==== 9 ==> FILE_CRCOK+FILE_ISV3 ==> file matched official CRC and is version 3<br />
state ==== 0 ==> - ==> file was not crc checked and is version 1<br />
state ==== 34 ==> FILE_CRCERR+FILE_ISV5 ==> file DID NOT match official CRC and is version 5<br />
state ==== 1 ==> FILE_CRCOK ==> file matched official CRC and is version 1<br />
state ==== 8 ==> FILE_ISV3 ==> file was not CRC checked and is version 3<br />
</pre><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''fmask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
<td align="center">'''Byte 5'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 aid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 eid</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 gid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 mylist id</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>list other episodes</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>int2 IsDeprecated</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int2 state</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int8 size</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ed2k</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str md5</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str sha1</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str crc32</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>video colour depth</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str quality</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str audio codec list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 audio bitrate list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str video codec</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 video bitrate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str video resolution</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str file type (extension)</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str dub language</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str sub language</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 length in seconds</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str description</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 aired date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str anidb file name</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 mylist state</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 mylist filestate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 mylist viewed</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 mylist viewdate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str mylist storage</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str mylist source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str mylist other</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''amask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 anime total episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str category list</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str epno</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ep name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str ep romaji name</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str ep kanji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 episode rating</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 episode vote count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str group name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str group short name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int4 date aid record updated</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
'''Examples:''' (html escaped code intended)<br />
> FILE size=177747474&ed2k=70cd93fd3981cc80a8ea6a646ff805c9&fmask=7FF8FEF8&amask=C000F0C0&s=xxxxx<br />
< 220 FILE<br />
312498|4688|69260|4243|0||0|1|177747474|70cd93fd3981cc80a8ea6a646ff805c9|b2a7c7d591333e20495de3571b235c28|7af9b962c17ff729baeee67533e5219526cd5095|a200fe73|high|DTV|Vorbis (Ogg Vorbis)|104|H264/AVC|800|704x400|japanese|english'english'english|1560||1175472000|26|26|01|The Wings to the Sky|Sora he no Tsubasa|????|#nanoha-DamagedGoodz|Nanoha-DGz<br />
<br />
----<br />
<br />
=== GROUP: Retrieve Group Data ===<br />
'''Command String:'''<br><br />
by gid<br />
* GROUP gid={int gid}<br />
by name/shortname<br />
* GROUP gname={str group name}<br />
<br />
'''Possible Replies:'''<br />
* 250 GROUP<br />
: {int gid}|{int4 rating}|{int votes}|{int4 acount}|{int fcount}|{str name}|{str short}|{str irc channel}|{str irc server}|{str url}|{str picname}|{int4 foundeddate}|{int4 disbandeddate}|{int2 dateflags}|{int4 lastreleasedate}|{int4 lastactivitydate}|{list grouprelations}<br />
* 350 NO SUCH GROUP<br />
<br />
'''Info:'''<br />
* Requires login<br />
* ''gname'' is an exact match of either a group name or short name<br />
* As either name and short names are unique if there is a result from GROUP request by name that will be the only match<br />
* ''dateflags'' values:<br />
** bit0 set == Foundeddate, Unknown Day<br />
** bit1 set == Foundeddate, Unknown Month, Day<br />
** bit2 set == Disbandeddate, Unknown Day<br />
** bit3 set == Disbandeddate, Unknown Month, Day<br />
** bit5 set == Foundeddate, Unknown Year<br />
** bit6 set == Disbandeddate, Unknown Year<br />
* ''releasedate'' and ''activitydate'' are distinct. ''releasedate'' is the date a file was actually released by the group, where ''activitydate'' is the date of a file being added to AniDB. As such, lastrelease may very well be much older than lastactivity.<br />
* ''groupreleations'' is a list of apostrophe-separated pairs, where each pair consists of {int4 othergroupid},{int2 relationtype}<br />
** relationtype:<br />
*** 1 => "Participant in"<br />
*** 2 => "Parent of"<br />
*** 4 => "Merged from"<br />
*** 5 => "Now known as"<br />
*** 6 => "Other"<br />
<br />
'''Example:'''<br />
> GROUP gid=7091&s=bunny<br />
< 250 GROUP<br />
7091|832|1445|43|566|Frostii|Frostii|#frostii|irc.rizon.net|http://frostii.com|15844.jpg|1228089600|0|1|1301875200|1304222640|7255,1'3097,4'748,4'8106,1'8159,2'8402,1'8696,1'9022,1<br />
<br />
----<br />
<br />
=== GROUPSTATUS: Get Completed Episode ===<br />
Returns a list of group names and ranges of episodes released by the group for a given anime.<br />
<br />
'''Command String:'''<br />
* GROUPSTATUS aid={int animeid}[&state={int completion_state}]<br />
<br />
'''Possible Replies:'''<br />
* 225 GROUPSTATUS<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: ... (repeated)<br />
<br />
* 325 NO SUCH GROUPS FOUND<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* The seven fields will be repeated as necessary, one for each group, separated by a new line character<br />
* Groups will be filtered by the languages selected in the user's profile<br />
* If ''state'' is not supplied, groups with a completion state of <i>'ongoing'</i>, <i>'finished'</i>, or <i>'complete'</i> are returned<br />
* Groups are returned in order of descending episode count<br />
* If there are more groups to return than can be stored in a UDP packet, additional groups will be silently discarded<br />
* ''state'' values: <br />
#ongoing<br />
#stalled<br />
#complete<br />
#dropped<br />
#finished<br />
#specials only<br />
<br />
'''Example:'''<br />
> GROUP GROUPSTATUS aid=8692&s=vLl1N<br />
< 225 GROUPSTATUS<br />
7407|Coalgirls|3|25|839|12|1-25<br />
9863|Hadena Subs|3|25|374|1|1-25<br />
11951|ChaosBlades|3|25|0|0|1-25<br />
[truncated]<br />
<br />
== MyList Commands ==<br />
=== MYLIST: Retrieve MyList Data ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLIST lid={int4 lid}<br />
by fid:<br />
* MYLIST fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLIST size={int4 size}&ed2k={str ed2khash}<br />
by anime + group + epno<br />
* MYLIST aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 221 MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 312 MULTIPLE MYLIST ENTRIES<br />
: {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}<br />
* 321 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* The state field provides information about the location and sharing state of a file in MyList.<br />
* 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).<br />
* eps is a list of episodes, e.g. "1-12,14-16,T1"<br />
<br />
'''States:'''<br />
0 - unknown - state is unknown or the user doesn't want to provide this information<br />
1 - on hdd - the file is stored on hdd (but is not shared)<br />
2 - on cd - the file is stored on cd<br />
3 - deleted - the file has been deleted or is not available for other reasons (i.e. reencoded)<br />
<br />
'''Filestates:''' (for normal files, i.e. not generic)<br />
0 => normal/original<br />
1 => corrupted version/invalid crc<br />
2 => self edited<br />
10 => self ripped<br />
11 => on dvd<br />
12 => on vhs<br />
13 => on tv<br />
14 => in theaters<br />
15 => streamed<br />
100 => other<br />
<br />
'''Example:'''<br />
> MYLIST aname=gits sac&s=xxxxx<br />
< 322 MULTIPLE FILES FOUND<br />
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<br />
<br />
----<br />
=== MYLISTADD: Add file to MyList ===<br />
The command string for MYLISTADD is made of up two blocks: a 'fileinfo' block, which limits the command to a specific file, or an 'animeinfo'/'groupinfo'/'episodeinfo' block, which can be used to specify a range of files, including generics. Additionally, a number of optional parameters can be included with either set.<br />
<br />
'''Adding a single file to the MyList with the 'fileinfo' block'''<br />
<br />
* MYLISTADD fid={int4 fid}<br />
'''or'''<br />
* MYLISTADD size={int4 size}&ed2k={str ed2khash}<br />
'''or'''<br />
* MYLISTADD lid={int4 lid}&edit=1 (valid for edit only)<br />
<br />
'''Adding one or more files to the MyList with the 'animeinfo'/'groupinfo'/'episodeinfo' block'''<br />
<br />
Here, you have a number of options, depending on what data you have available. In brief, 'animeinfo' represents a choice between anime id and anime name. 'groupinfo' represents a choice between group id, group name, and generic=1. 'episodeinfo' represents a range of one or more episodes.<br />
<br />
* MYLISTADD aid={int4 aid}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&generic=1&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&generic=1&epno={int4 episode number}<br />
<br />
Each command listed can have, in addition, a number of optional components to provide further MyList details. Append these as desired.<br />
<br />
* &state={int2 state}<br />
* &viewed={boolean viewed}<br />
* &viewdate={int4 viewdate}<br />
* &source={str source}<br />
* &storage={str storage}<br />
* &other={str other}<br />
<br />
Finally, edit=1 can be included to edit a MyList entry instead of creating a new one. When editing, optional values that are not supplied retain their original value. That is, they are ''not'' replaced with default or empty values. Only values supplied are updated.<br />
<br />
'''Possible Replies:'''<br />
* 320 NO SUCH FILE<br />
* 330 NO SUCH ANIME<br />
* 350 NO SUCH GROUP<br />
when edit=0 and adding by fid, size/ed2k<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 mylist id of new entry}<br />
when edit=0 and adding by aname, aid<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 number of entries added}<br />
* 310 FILE ALREADY IN MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 1}|{int4 fid 2}|...|{int4 fid n}<br />
when edit=1<br />
* 311 MYLIST ENTRY EDITED<br />
* 311 MYLIST ENTRY EDITED<br />
: {int4 number of entries edited}<br />
* 411 NO SUCH MYLIST ENTRY<br />
<br />
'''Info:'''<br />
* All data except lid/fid/size+hash/generic is optional.<br />
* Viewed should be 0 for unwatched files and 1 for watched files.<br />
* If viewdate is not specified, the current time will be used. The field will be disregarded if viewed=0.<br />
* Other is the only field which may contain newlines, but they have to be stored as &lt;br /&gt;<br />
* For state values refer to: '''MYLIST'''<br />
* If you want to change an existing entry and already know its MyList id (lid) please use the lid-version of this command. It put less load on the server.<br />
* epno=0 means all eps (default), negative numbers means upto. (-12 -> upto 12)<br />
* group is optional only when edit=1, meaning you can't add every file for an anime<br />
* If the file already exists (response code 310), the ''current'' record will be returned, in the same format as the MYLIST response.<br />
----<br />
<br />
=== MYLISTDEL: Remove file from MyList ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLISTDEL lid={int4 lid}<br />
by fid:<br />
* MYLISTDEL fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLISTDEL size={int4 size}&ed2k={str ed2k hash}<br />
by anime + group + epno<br />
* MYLISTDEL aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 211 MYLIST ENTRY DELETED<br />
: {int4 number of entries}<br />
* 411 NO SUCH MYLIST ENTRY<br />
'''Info:'''<br />
* group is optional<br />
* command will delete all enties found<br />
<br />
----<br />
=== MYLISTSTATS : Retrieve MyList stats ===<br />
'''Command String:'''<br />
* MYLISTSTATS<br />
'''Possible Replies:'''<br />
* 222 MYLIST STATS<br />
{animes}|{eps}|{files}|{size of files}|{added animes}|{added eps}|{added files}|{added groups}|{leech %}|{glory %}|{viewed % of db}|{mylist % of db}|{viewed % of mylist}|{number of viewed eps}|{votes}|{reviews}|{viewed length in minutes}<br />
<br />
'''Info:'''<br />
* All fields are int<br />
<br />
----<br />
<br />
=== VOTE: Vote for specified anime/episode/group ===<br />
'''Command String:'''<br><br />
by id<br />
* VOTE type={int2 type}&id={int4 id}[&value={int4 vote value}&epno={int4 episode number}]<br />
by name<br />
* VOTE type={int2 type}&name={string name}[&value={int4 vote value}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 260 VOTED<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 261 VOTE FOUND<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 262 VOTE UPDATED<br />
: {str entity name}|{old vote value}|{vote type}|{entity id}<br />
* 263 VOTE REVOKED<br />
: {str entity name}|{revoked vote value}|{vote type}|{entity id}<br />
* 360 NO SUCH VOTE<br />
: {str entity name}|0|{vote type}|{entity id}<br />
* 361 INVALID VOTE TYPE<br />
* 362 INVALID VOTE VALUE<br />
* 363 PERMVOTE NOT ALLOWED<br />
: {str aname}|{vote value}|{type}|{entity id}<br />
* 364 ALREADY PERMVOTED<br />
: {str entity name}|{existing vote value}|{vote type}|{entity id}<br />
<br />
'''Info:'''<br />
* type: 1=anime, 2=anime tmpvote, 3=group<br />
* entity: anime, episode, or group<br />
* for episode voting add epno on type=1<br />
* value: negative number means revoke, 0 means retrieve (default), 100-1000 are valid vote values, rest is illegal<br />
* votes will be updated automatically (no questions asked)<br />
* tmpvoting when there exist a perm vote is not possible<br />
<br />
----<br />
<br />
=== RANDOM: Get a random anime ===<br />
'''Command String:'''<br />
* RANDOMANIME type={int4 type}<br />
<br />
'''Possible Replies:'''<br />
* 230 ANIME ... (see ANIME)<br />
<br />
'''Info:'''<br />
* type: 0=from db, 1=watched, 2=unwatched, 3=all mylist<br />
<br />
== Misc Commands ==<br />
=== MYLISTEXPORT: Schedule a MyList Export ===<br />
Queues a {{AniDBLink|export|MyList Export}} by the AniDB Servers. As with a manual export request, exports are only done during periods when server load is low. As a result, exports may take up to 24 hours. The client submitting the request will receive an AniDB message when the export is ready to be collected.<br />
<br />
Only one export can be in the queue at a time.<br />
<br />
'''Command String:'''<br />
* MYLISTEXPORT [template={str template_name}|cancel=1]<br />
<br />
'''Possible Replies:'''<br />
* 217 EXPORT QUEUED<br />
* 218 EXPORT CANCELLED<br />
* 317 EXPORT NO SUCH TEMPLATE<br />
* 318 EXPORT ALREADY IN QUEUE<br />
* 319 EXPORT NO EXPORT QUEUED OR IS PROCESSING<br />
<br />
'''Info:'''<br />
* ''template_name'' must match an available export template on the {{AniDBLink|export|MyList Export}} page.<br />
* ''cancel'' will cancel any pending export request, queued either through UDP or the web server.<br />
* Clients can subscribe the message notifications if they wish to be notified when an export is complete.<br />
<br />
----<br />
<br />
=== PING: Ping Command ===<br />
'''Command String:'''<br />
* PING [nat=1]<br />
<br />
'''Possible Replies:'''<br />
* 300 PONG<br />
: {int4 port} ''(when nat=1)''<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* May be used by a frontend to determine if the API is still available.<br />
* May be executed even if not yet logged in.<br />
* The option <tt>nat=1</tt> provides an easy way to determine if the router has changed the outgoing port. ({{t|587}})<br />
<br />
----<br />
<br />
=== VERSION: Retrieve Server Version ===<br />
'''Command String:'''<br />
* VERSION<br />
<br />
'''Possible Replies:'''<br />
* 998 VERSION<br />
: {str server version}<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
<br />
----<br />
=== UPTIME: Retrieve Server Uptime ===<br />
'''Command String:'''<br />
* UPTIME<br />
<br />
'''Possible Replies:'''<br />
* 208 UPTIME<br />
: {int4 udpserver uptime in milliseconds}<br />
<br />
'''Info:'''<br />
* This command is the preferred way to check that the session is OK.<br />
<br />
----<br />
=== ENCODING: Change Encoding for Session ===<br />
Sets preferred [[Wikipedia:Character encoding|encoding]] per session. The preferred way to do this is to use the '''enc''' argument for AUTH. This command is mostly for testing.<br />
<br />
'''Command String:'''<br />
* ENCODING name={str encoding name}<br />
<br />
'''Possible Replies:'''<br />
* 219 ENCODING CHANGED<br />
* 519 ENCODING NOT SUPPORTED<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* Supported encodings: http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html<br />
* Default: ASCII.<br />
* Resets to default on logout.<br />
<br />
----<br />
<br />
=== SENDMSG: Send Message ===<br />
'''Command String:'''<br />
* SENDMSG to={str username}&title={str title}&body={str body}<br />
<br />
'''Possible Replies:'''<br />
* 294 SENDMSG SUCCESSFUL<br />
* 394 NO SUCH USER<br />
* 501 LOGIN FIRST<br />
<br />
'''Note:'''<br />
* This command allows you to send an AniDB message.<br />
{{eyecatch|Important|<br />
title must not be longer than 50 chars.<br><br />
body must not be longer than 900 chars.<br />
}}<br />
<br />
----<br />
=== USER: Retrieve User UID ===<br />
'''Command String:'''<br />
* USER [user={str user name}|uid={int user id}]<br />
<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 295 USER<br />
: {int4 uid}|{str username}<br />
<br />
----<br />
<br />
=== STATS [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* STATS<br />
<br />
'''Possible Replies:'''<br />
* 206 STATS<br />
: {int4 animes)|{int4 eps}|{int4 files}|{int4 groups}|{int4 users}|{int8 total file size in bytes}|{int4 open [[creq|creqs]]}<br />
<br />
----<br />
=== TOP [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* TOP<br />
<br />
'''Possible Replies:'''<br />
* 207 TOP<br />
: {str longest mylist}|{int count}<br />
: {str largest mylist}|{int count}<br />
: {str most lame files}|{int count}<br />
: {str most indep. user}|{int count}<br />
: {str biggest leecher}|{int count}<br />
: {str most anime added}|{int count}<br />
: {str most eps added}|{int count}<br />
: {str most files added}|{int count}<br />
: {str most groups added}|{int count}<br />
: {str most votes}|{int count}<br />
: {str most reviews}|{int count}<br />
<br />
'''Info:'''<br />
* All strings are user names.<br />
* 'Hide myself in IRC stats' applies for this too.<br />
<br />
== Fatal Errors ==<br />
At anypoint int the retrieval process you have to expect the following output:<br />
* 6xx INTERNAL SERVER ERROR<br />
: ERROR: {str errormessage}<br />
OR<br />
*6xx INTERNAL SERVER ERROR - {str errormessage}<br />
<br />
Such errors should be reported back to [[User:Ommina|Ommina]].<br />
(xx is a number between 00 and 99)<br />
<br />
If you supply an unknown or unimplemented command you will get an error:<br />
* 598 UNKNOWN COMMAND<br />
<br />
== Return Codes ==<br />
{{eyecatch|Note|While the names below '''are''' the actual code strings returned by the server, clients are nonetheless encouraged to work with the numeric codes instead. }}<br />
<pre><br />
LOGIN_ACCEPTED = 200<br />
LOGIN_ACCEPTED_NEW_VERSION = 201<br />
LOGGED_OUT = 203<br />
RESOURCE = 205<br />
STATS = 206<br />
TOP = 207<br />
UPTIME = 208<br />
ENCRYPTION_ENABLED = 209<br />
MYLIST_ENTRY_ADDED = 210<br />
MYLIST_ENTRY_DELETED = 211<br />
ADDED_FILE = 214<br />
ADDED_STREAM = 215<br />
EXPORT_QUEUED = 217<br />
EXPORT_CANCELLED = 218<br />
ENCODING_CHANGED = 219<br />
FILE = 220<br />
MYLIST = 221<br />
MYLIST_STATS = 222<br />
WISHLIST = 223<br />
NOTIFICATION = 224<br />
GROUP_STATUS = 225<br />
WISHLIST_ENTRY_ADDED = 226<br />
WISHLIST_ENTRY_DELETED = 227<br />
WISHLIST_ENTRY_UPDATED = 228<br />
MULTIPLE_WISHLIST = 229<br />
ANIME = 230<br />
ANIME_BEST_MATCH = 231<br />
RANDOM_ANIME = 232<br />
ANIME_DESCRIPTION = 233<br />
REVIEW = 234<br />
CHARACTER = 235<br />
SONG = 236<br />
ANIMETAG = 237<br />
CHARACTERTAG = 238<br />
EPISODE = 240<br />
UPDATED = 243<br />
TITLE = 244<br />
CREATOR = 245<br />
NOTIFICATION_ENTRY_ADDED = 246<br />
NOTIFICATION_ENTRY_DELETED = 247<br />
NOTIFICATION_ENTRY_UPDATE = 248<br />
MULTIPLE_NOTIFICATION = 249<br />
GROUP = 250<br />
CATEGORY = 251<br />
BUDDY_LIST = 253<br />
BUDDY_STATE = 254<br />
BUDDY_ADDED = 255<br />
BUDDY_DELETED = 256<br />
BUDDY_ACCEPTED = 257<br />
BUDDY_DENIED = 258<br />
VOTED = 260<br />
VOTE_FOUND = 261<br />
VOTE_UPDATED = 262<br />
VOTE_REVOKED = 263<br />
HOT_ANIME = 265<br />
RANDOM_RECOMMENDATION = 266<br />
RANDOM_SIMILAR = 267<br />
NOTIFICATION_ENABLED = 270<br />
NOTIFYACK_SUCCESSFUL_MESSAGE = 281<br />
NOTIFYACK_SUCCESSFUL_NOTIFIATION = 282<br />
NOTIFICATION_STATE = 290<br />
NOTIFYLIST = 291<br />
NOTIFYGET_MESSAGE = 292<br />
NOTIFYGET_NOTIFY = 293<br />
SENDMESSAGE_SUCCESSFUL = 294<br />
USER_ID = 295<br />
CALENDAR = 297<br />
<br />
PONG = 300<br />
AUTHPONG = 301<br />
NO_SUCH_RESOURCE = 305<br />
API_PASSWORD_NOT_DEFINED = 309<br />
FILE_ALREADY_IN_MYLIST = 310<br />
MYLIST_ENTRY_EDITED = 311<br />
MULTIPLE_MYLIST_ENTRIES = 312<br />
WATCHED = 313<br />
SIZE_HASH_EXISTS = 314<br />
INVALID_DATA = 315<br />
STREAMNOID_USED = 316<br />
EXPORT_NO_SUCH_TEMPLATE = 317<br />
EXPORT_ALREADY_IN_QUEUE = 318<br />
EXPORT_NO_EXPORT_QUEUED_OR_IS_PROCESSING = 319<br />
NO_SUCH_FILE = 320<br />
NO_SUCH_ENTRY = 321<br />
MULTIPLE_FILES_FOUND = 322<br />
NO_SUCH_WISHLIST = 323<br />
NO_SUCH_NOTIFICATION = 324<br />
NO_GROUPS_FOUND = 325<br />
NO_SUCH_ANIME = 330<br />
NO_SUCH_DESCRIPTION = 333<br />
NO_SUCH_REVIEW = 334<br />
NO_SUCH_CHARACTER = 335<br />
NO_SUCH_SONG = 336<br />
NO_SUCH_ANIMETAG = 337<br />
NO_SUCH_CHARACTERTAG = 338<br />
NO_SUCH_EPISODE = 340<br />
NO_SUCH_UPDATES = 343<br />
NO_SUCH_TITLES = 344<br />
NO_SUCH_CREATOR = 345<br />
NO_SUCH_GROUP = 350<br />
NO_SUCH_CATEGORY = 351<br />
BUDDY_ALREADY_ADDED = 355<br />
NO_SUCH_BUDDY = 356<br />
BUDDY_ALREADY_ACCEPTED = 357<br />
BUDDY_ALREADY_DENIED = 358<br />
NO_SUCH_VOTE = 360<br />
INVALID_VOTE_TYPE = 361<br />
INVALID_VOTE_VALUE = 362<br />
PERMVOTE_NOT_ALLOWED = 363<br />
ALREADY_PERMVOTED = 364<br />
HOT_ANIME_EMPTY = 365<br />
RANDOM_RECOMMENDATION_EMPTY = 366<br />
RANDOM_SIMILAR_EMPTY = 367<br />
NOTIFICATION_DISABLED = 370<br />
NO_SUCH_ENTRY_MESSAGE = 381<br />
NO_SUCH_ENTRY_NOTIFICATION = 382<br />
NO_SUCH_MESSAGE = 392<br />
NO_SUCH_NOTIFY = 393<br />
NO_SUCH_USER = 394<br />
CALENDAR_EMPTY = 397<br />
NO_CHANGES = 399<br />
<br />
NOT_LOGGED_IN = 403<br />
NO_SUCH_MYLIST_FILE = 410<br />
NO_SUCH_MYLIST_ENTRY = 411<br />
MYLIST_UNAVAILABLE = 412<br />
<br />
LOGIN_FAILED = 500<br />
LOGIN_FIRST = 501<br />
ACCESS_DENIED = 502<br />
CLIENT_VERSION_OUTDATED = 503<br />
CLIENT_BANNED = 504<br />
ILLEGAL_INPUT_OR_ACCESS_DENIED = 505<br />
INVALID_SESSION = 506<br />
NO_SUCH_ENCRYPTION_TYPE = 509<br />
ENCODING_NOT_SUPPORTED = 519<br />
BANNED = 555<br />
UNKNOWN_COMMAND = 598<br />
<br />
INTERNAL_SERVER_ERROR = 600<br />
ANIDB_OUT_OF_SERVICE = 601<br />
SERVER_BUSY = 602<br />
NO_DATA = 603<br />
TIMEOUT - DELAY AND RESUBMIT = 604<br />
API_VIOLATION = 666<br />
<br />
PUSHACK_CONFIRMED = 701<br />
NO_SUCH_PACKET_PENDING = 702<br />
<br />
VERSION = 998</pre><br />
<br />
[[Category:Development]]<br />
[[Category:UDP]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=UDP_API_Definition&diff=18431UDP API Definition2015-03-27T07:10:26Z<p>Ommina: /* ANIME: Retrieve Anime Data */</p>
<hr />
<div>{{TOCright}}<br />
<br />
== General Information ==<br />
'''Author:''' [[User:Exp|Exp]] & [[User:Epoximator|Epoximator]] & [[User:Ommina|Ommina]]<br><br />
'''Version:''' 0.03.610 (2010-05-01)<br><br />
'''Version number used for protover parameter:''' "3"<br />
<br />
'''IMPORTANT INFORMATION FOR ALL INTERESTED:'''<br />
* If you are mainly interested in notifications and private messaging, check out our [[Jabber]] and [[RSSRDF]] support first.<br />
* The UDP API is not an appropriate choice if you desire to download a local copy of the AniDB database.<br />
* If you want to create a client you have to register it {{AniDBLink|client|here}} and [[UDP Clients|here]].<br />
** Check out the clients that are being developed. There exists usable code in many different languages already.<br />
* If you have suggestions for improvements or new features use the [[UDP API DEV|development]] page.<br />
* Please also take a look at the [[API]] page.<br />
<br />
== Formats used in this Spec ==<br />
* {vartype varname} - Specifies what shall be inserted at this point and its type.<br />
* [...] - Everything between [ and ] is optional.<br />
<br />
=== Used types ===<br />
* ''int2'' - 2 byte Integer (in string representation)<br />
* ''int4'' - 4 byte Integer (in string representation)<br />
* ''boolean'' - true or false - use '1' for ''true'', '0' for ''false''<br />
* ''str'' - String (UDP packet length restricts string size to 1400 bytes)<br />
* ''hexstr'' -- a hex representation of a decimal value, two characters per byte. If multiple bytes are represented, byte one is the first two characters of the string, byte two the next two, and so on.<br />
<br />
=== Content Encoding ===<br />
* Default character encoding: ''ASCII''<br />
* Escape scheme for option values (to server): ''html form encoding'' + ''newline''<br />
** This means you have to encode at least <tt>&</tt> in your option values in html form encoding style (<tt>&amp;amp;</tt>) before sending them to the api server. All other html form encodings are optional.<br />
** All newlines should be replaced by &lt;br /&gt;<br />
* Escape scheme for returned data fields (from server): ', | and newline<br />
** Content newlines are encoded as &lt;br /&gt;, ' is encoded as ` and | is not allowed in data fields.<br />
** Dates are returned in unix time (number of seconds elapsed since January 1, 1970 00:00:00 UTC)<br />
<br />
== Basics ==<br />
=== General ===<br />
The network communication is ''packet'' and ''line'' based. Each AniDB API command is exactly one UDP packet containing one line. Results are sent as one packet but may consist out of multiple lines. A return value always starts with a 3 byte result code followed by a human readable version of the result code. Be aware that important data fields may be returned directly after the return code (see: 200,201,271,272,504).<br />
The meaning for all result codes can be found in this document. If there is more than one entry returned, it's one entry per line. Lines are terminated by a <tt>\n</tt> (no dos linefeed <tt>\r</tt>). The elements of a format string are separated by a "|" character.<br />
<br />
<tt>{three digit return code} {str return string}\n</tt><br><br />
<tt>{data field 0}|{data field 1}|...|{data field n}</tt><br />
<br />
'''IMPORTANT:'''<br />
* All commands except PING, ENCRYPT, ENCODING, AUTH and VERSION '''requires''' login, meaning that the ''session tag'' must be set (<tt>s=xxxxx</tt>).<br />
* A client should ignore any additional trailing data fields it doesn't expect. Additional fields are going to be added to the output of some commands from time to time. Those additional fields will simply be appended to the end of the existing output. A client should be written in a way so that it is not affected by such new fields.<br />
* Due to the length constraints of an UDP package (over PPPoE) the replies from the server will never exceed 1400 bytes. String fields will be truncated if necessary to ensure this. No warnings are given when this happens.<br />
* A client should handle all possible return codes for each command.<br />
** Possible return codes for '''all commands''':<br />
*** 505 ILLEGAL INPUT OR ACCESS DENIED<br />
*** 555 BANNED<br />
***: {str reason}<br />
*** 598 UNKNOWN COMMAND<br />
*** 600 INTERNAL SERVER ERROR<br />
*** 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
*** 602 SERVER BUSY - TRY AGAIN LATER<br />
*** 604 TIMEOUT - DELAY AND RESUBMIT<br />
** Additional return codes for all commands that '''require login''':<br />
*** 501 LOGIN FIRST<br />
*** 502 ACCESS DENIED<br />
*** 506 INVALID SESSION<br />
<br />
{{eyecatch|Note|The '555 BANNED' message should not be expected by the client. This message is only enabled temporary to help developers understand what they are doing wrong.}}<br><br />
<br />
{{eyecatch|Note|<br />
While in daily maintenance the AniDB API will reply with<br />
<br />
601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
<br />
to all commands. If a client receives such a return value it should wait at least 30 minutes before trying again.}}<br />
<br />
=== Server / UDP Connection ===<br />
The Client has to send data packets to:<br />
* '''Server:''' api.anidb.net<br />
* '''Port:''' 9000/UDP<br />
The servername and port should not be hardcoded into a frontend but should be read from a configuration file.<br />
<br />
=== Server Errors ===<br />
* At any time the API might return a fatal error of the form:<br />
: <tt>6xx ERROR DESCRIPTION</tt><br />
* Possible codes are 600-699.<br />
* Occurrences of these errors (except 601 and 602) should be reported to [[User:Ommina|Ommina]].<br />
{{eyecatch|Note|6XX messages do not always return the tags given with the command which caused the error!}}<br />
<br />
=== Connection Problems ===<br />
There are many ways for a client to end up banned or the API might currently be handling too many concurrent connections.<br />
If a client does not get any reply to an AUTH command it should start to increase the retry delay exponentially with every failed login attempt. (i.e. try again after 30 seconds if the first login attempt failed, if the second fails too retry after 2 minutes, then 5 minutes, then 10 minutes, then 30 minutes, ... until you reach a retry delay of ~2-4h.)<br />
<br />
=== Local Port ===<br />
A client should select a fixed local port >1024 at install time and reuse it for local UDP Sockets. If the API sees too many different UDP Ports from one IP within ~1 hour it will ban the IP. (So make sure you're reusing your UDP ports also for testing/debugging!)<br />
<br />
The local port may be hardcoded, however, an option to manually specify another port should be offered.<br />
<br />
'''Note when behind a [[Wikipedia:Network address translation|NAT]]/masquerading router:'''<br><br />
A session between the server and a client is identified by the ''IP and port'' used by the client. So when the port (or IP) changes within a session the client has to authenticate again. If a client is behind a NAT router it can’t actually control the local port used for the connection. The router will normally ''translate'' the port to support several computers on a LAN to share the Internet connection. The public port (as determined by the router and seen by the server) which has been assigned to the connection will only be reserved for as long as it is in use. This means that the router will usually ''deallocate the port after a fixed timeout period'' (eg. five, ten or 15 minutes). Once that happens the client will no longer be able to receive UDP messages from the server (the messages will be discarded as undeliverable by the router) and a new port will be selected once the client tries to send a message to the server (which will result in a new connection session - '''Note:''' This could get you banned!, see above). So in order to keep a session over a NAT router alive, the client has to ping the server within the router's deallocation period to prevent a timeout.<br />
<br />
The client can decide whether it is behind a NAT router or not by adding <tt>nat=1</tt> to the AUTH command. This will cause the response to include the IP and port as seen by the server. If the port differs from the port reported by the local socket, the connection subject to NAT and the client should issue PING commands in regular intervals. Please do not send pings more often than is necessary to keep NAT connections alive.<br />
<br />
=== Flood Protection ===<br />
To prevent high server load the UDP API server enforces a strict flood protection policy.<br />
* Short Term:<br />
** A Client MUST NOT send more than 0.5 packets per second (that's one packet every two seconds, not two packets a second!)<br />
** The server will start to enforce the limit after the first 5 packets have been received.<br />
* Long Term:<br />
** A Client MUST NOT send more than one packet every four seconds over an extended amount of time.<br />
** ''An extended amount of time'' is not defined. Use common sense.<br />
<br />
Once a client exceeds a rate limit all further UDP packets from that client will be dropped without feedback until the client's packet rate is back down to acceptable levels.<br />
<br />
{{eyecatch|Note|Dropped packets are still taken into account for the packet rate. Meaning if you continuously send packets your client will be banned forever.}}<br />
<br />
Generally clients should be written in a way to minimize server and network load. You should always keep that in mind.<br />
<br />
Abusive clients may be banned completely.<br />
<br />
{{eyecatch|Note|<br />
If you suddenly stop getting replies from the AniDB API or you normally don't have a notable packetloss and from one point on you suddenly note a high packetloss percentage you have most likely entered a critical flood ratio.<br />
If the AniDB API isn't answering at all it might either be down or you have been banned, this is normally caused by violating the API specs (i.e. too many connections using different ports from one IP, too many auth failures, ...) (usually lasts 30 minutes).<br />
If you're experiencing packet loss you have probably reached the rate limit and the API starts to randomly drop incoming packets from your IP. (can be solved by enforcing a delay between multiple commands when you're sending a batch)}}<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Caching ===<br />
To minimize server and network load a client should use local caching in order to prevent repeated API requests for the same data.<br />
<br />
A client should locally cache FILE/EP/ANIME/GROUP/... info wherever possible for extended amounts of time.<br />
(I.e. if a client is used to scan a local folder with anime files and add them via API to a users MyList then it shall only ask for all files in the first run and cache the info for all files known to AniDB. If run again over the same folder it shall only check those files which were unknown to AniDB at the time of the last check.)<br />
<br />
Later versions of the API might enforce this by banning clients which ask for the same information more than once every week/month.<br />
<br />
=== Tag option ===<br />
The API will add a user defined string at the beginning of each reply line separated with a space, if desired.<br />
* To enable add the <tt>tag={str usertag}</tt> option to a command.<br />
* A tag is only valid for the command it was send with, meaning it is not persistent. If you want to have tags in front of all reply lines you will have to append the tag option to each command you send to the server.<br />
* Tags are meant to enable a client to handle more than one request/reply at a time.<br />
<br />
Usage example:<br />
AUTH user=baka&pass=baka&protover=25&client=someclient&clientver=1&tag=abc123<br />
abc123 200 Jxqxb LOGIN ACCEPTED<br />
or<br />
LOGOUT s=Jxqxb&tag=byebye<br />
byebye 203 LOGGED OUT<br />
<br />
{{eyecatch|Note|The tag option is valid for all api commands and is thus not explicitly listed in the description of each command.}}<br />
<br />
=== Data Indexes (fid,aid,eid,gid,lid) ===<br />
* All indexes start at 1 (not 0).<br />
* It is possible for table entries to have id fields with a value of 0 (i.e. gid). Those are to be interpreted as "NONE" or "NULL".<br />
* An ID is '''never''' reused. That means after an entry is deleted no new entry will ever have that ID again.<br />
* Mylist IDs (lid) are globally unique, not per-user unique.<br />
<br />
== Authing Commands ==<br />
{{eyecatch|Note|'''ANY''' command which requires parameters may return: 505 ILLEGAL INPUT OR ACCESS DENIED}}<br />
<br />
----<br />
=== AUTH: Authing to the AnimeDB ===<br />
'''Command String:'''<br />
* AUTH user={str username}&pass={str password}&protover={int4 apiversion}&client={str clientname}&clientver={int4 clientversion}[&nat=1&comp=1&enc={str encoding}&mtu{int4 mtu value}&imgserver=1]<br />
<br />
'''Possible Replies:'''<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
* 500 LOGIN FAILED<br />
* 503 CLIENT VERSION OUTDATED<br />
* 504 CLIENT BANNED - {str reason}<br />
* 505 ILLEGAL INPUT OR ACCESS DENIED<br />
* 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
when nat=1<br />
* 200 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED<br />
* 201 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
when imgserver=1<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
{str image server name}<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
{str image server name}<br />
<br />
'''Info:'''<br />
{{eyecatch|Note|The password is the normal AniDB website password! The password listed in the profile as API Password in only used for the optional encryption feature.}}<br />
* The ''session_key'' is a String containing only ''a-z,A-Z,0-9'' chars of a length of ''4-8'' characters.<br />
: It has to be stored by the client and needs to be sent as parameter with every command which requires the user to logged in.<br />
* The ''session_key'' String is appended as parameter "s", i.e. "PUSH notify=1&msg=1&s={str session_key}".<br />
* On a '''500 LOGIN FAILED''' message the client should request the user to enter username and password again.<br />
* In case of a '''501 LOGIN FIRST''' message the client should silently resend an auth command and send the failed command again.<br />
* A '''502 ACCESS DENIED''' message should abort the current action on the client side and display a message to the user.<br />
* A '''503 CLIENT VERSION OUTDATED''' message states that the udp server has been updated and does not support your client any longer. (protover is too low). A 201 message refers to a new version of the client software.<br />
* A '''506 INVALID SESSION''' means that either the session key parameter "s" was not provided with a command that requires it or the session key is no longer valid. The client should reissue an AUTH command.<br />
{{eyecatch|Note|A frontend shall expect 501 and 502 messages to be returned on ANY command.}}<br><br />
{{eyecatch|Note|AniDB usernames may only contain characters (a-z,A-Z), numbers (0-9), underscores (_) and hyphens (-).}}<br />
* The client should send the apiversion of the AnimeDB API version it supports as value of the protover parameter.<br />
* The client MAY NOT send anything but the version of the API Specs the author used to write the client! (as it is stated at the top of this file @ "Version number used for protover parameter")<br />
: The API will compare that value to it's own version of the API and if the version of the client is older the API will decide whether the changes were significant enough to deny the old client access to the DB.<br />
* The clientname shall be a lower-case string containing only the chars ''a-z'' of ''4-16 chars'' length which identifies the client. (i.e. mykickassclient)<br />
* The clientversion shall be a number starting with 1, increased on every change in the client.<br />
: clientname and clientversion might be used by the API to distinguish between different clients and client versions if that should ever become necessary.<br />
{{eyecatch|Important|<br />
* DO NOT use the clientname of an existing client. If you modify an existing client's code to meet your own needs, create a new client name for yourself.<br />
* ALWAYS increase the clientversion number if you release a new client version.}}<br />
* A Login and its assigned ''session_key'' is valid until the virtual UDP connection times out or until a LOGOUT command is issued.<br />
* The virtual UDP connection times out if no data was received from the client for '''35 minutes'''.<br />
* A client should issue a UPTIME command once every 30 minutes to keep the connection alive should that be required.<br />
* If the client does not use any of the notification/push features of the API it should NOT keep the connection alive, furthermore it should explicitly terminate the connection by issuing a LOGOUT command once it finished it's work.<br />
* If it is very likely that another command will be issued shortly (within the next 20 minutes) a client SHOULD keep the current connection open, by not sending a LOGOUT command.<br />
{{eyecatch|Important|<br />
* A client should NOT perform a full AUTH / command / LOGOUT cycle for each command it wants to send. Again, if another command is likely within 20 minutes, remain logged in.}}<br />
* The client shall notify the user if it received a 201 message at login.<br />
: This means a new version of the client is available, however the old version is still supported otherwise a client banned message would have been returned.<br />
* The user should get a pop-up message on 503 and 504 messages telling him to update his client software.<br />
: ('''Note:''' 504 means that this version of the client is banned, not the user!)<br />
* The 'nat' option makes the client able to detect whether it is behind a nat router or not. When the client is behind a nat router it should keep the "connection" alive with the PING command.<br />
{{eyecatch|Important|Make sure your client handles ALL possible AUTH return codes before giving out any versions!}}<br />
* When ''enc=x'' is defined the server will change the encoding used to x.<br />
**If the encoding is supported it will change right away (including the response) and be reset on logout/timeout.<br />
**If not supported then the argument will be silently ignored. Use ENCODING to test what works.<br />
**Supported encodings are [http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html these].<br />
* ''comp=1'' means that the client supports compression ([http://java.sun.com/j2se/1.5.0/docs/api/java/util/zip/Deflater.html DEFLATE]).<br />
**The server will compress (instead of truncating) the datagrams when needed if this option is enabled.<br />
**The first two bytes of compressed datagrams will always be set to zero. (So tags should never start with that.)<br />
* Default [[Wikipedia:MTU (networking)|''MTU'']] is 1400. Minimum allowed is 400, maximum 1400, due [[Wikipedia:Point-to-Point Protocol over Ethernet|PPPoE]].<br />
<br />
----<br />
<br />
=== LOGOUT: Logout ===<br />
'''Command String:'''<br />
* LOGOUT<br />
<br />
'''Possible Replies:'''<br />
* 203 LOGGED OUT<br />
* 403 NOT LOGGED IN<br />
<br />
'''Info:'''<br />
* This command only works if you are already logged in.<br />
* A logout should ALWAYS be issued if the client is currently logged in and is either exiting or not expecting to send/receive any AniDB API packets for the next >= 30 minutes.<br />
<br />
----<br />
=== ENCRYPT: Start Encrypted Session ===<br />
Will cause all future messages from the server, except the first (the reply to the ENCRYPT command itself), to be encrypted (128 bit [[Wikipedia:Advanced Encryption Standard|AES]]). The client will also have to encrypt all future requests sent to the server. All non-encrypted messages will be discarded by the server. The encryption key is the [[Wikipedia:MD5|MD5]] hash of a special ''UDP API Key'' (defined in the users profile) concatenated with the salt string as given in the reply to the ENCRYPT message. A normal AUTH message is still necessary to authenticate and should follow the ENCRYPT command once the API has acknowledged the encryption.<br />
<br />
'''Command String:'''<br />
* ENCRYPT user={str name}&type={int2 type}<br />
<br />
'''Possible Replies:'''<br />
* 209 {str salt} ENCRYPTION ENABLED<br />
* 309 API PASSWORD NOT DEFINED<br />
* 509 NO SUCH ENCRYPTION TYPE<br />
* 394 NO SUCH USER<br />
<br />
'''Info:'''<br />
* ''user'' is the user name.<br />
* ''type'' is the type of encryption; 1 => 128 bit AES (only one defined).<br />
* ''API Key'' is the one defined in the {{AniDBLink|profile|profile settings page}}.<br />
* It is not possible to disable the encryption once enabled while staying logged in.<br />
** A logout (the logout message needs to be correctly encrypted) or timeout will disable the encryption.<br />
* In order to minimize server load, encryption should be disabled by default and should have to be enabled manually by the user in the configuration options.<br />
* The encryption key is md5(api_key_of_user+''salt'').<br />
* Padding of the message needs to be done according to the PKCS5Padding scheme.<br />
<br />
== Notify Commands ==<br />
=== Introduction ===<br />
Broadly speaking, notifications provide an indication to the client that some event has occurred within the AniDB database.<br />
<br />
There are three types:<br />
* New file [[Notifications|notification]]. (Only anime type supported.)<br />
* New private message notification.<br />
* New buddy event notification.<br />
<br />
Note that, while a user can subscribe to multiple 'new file' events (see [[Notifications|notifications]]), at present, the UDP API only supports notifications of new files by anime. New files by group, or new files by producer, are NOT presently supported. Just the same, keeping in mind that the API is designed to potentially support such notifications in the future will help in understanding why some of the commands are structured the way they are.<br />
<br />
The word "notification" is also used a bit inconsistently in this document. An AniDB notification is originally a "new file [[Notifications|notification]]". It might be more correct to use the term "event" for the original "happening" and then "notification" as the means to notify the user (client). New-file, new-message, buddy-* and going-down are all events that results in notifications. Only the first two type of events are persistent, though, meaning they exist and remain in the same state until some user action affects them.<br />
<br />
=== Getting Notifications ===<br />
Clients that wish to receive notifications have two routes available to them. They are by no means mutually exclusive and selecting one does not imply a client is unable to use commands from another.<br />
<br />
'''Method One: Polling'''<br />
<br />
With this method, the client contacts the server at some interval (no more than once every 20 minutes) to see if there are new file notifications waiting. If there are, the client can the get further details of the files in question. This is analogous to checking an email server every half hour to see if new email has arrived.<br />
<br />
Its principal advantage is that it is easy to design and code. Blocking sockets are sufficient as the client can expect the reply received to correspond with the command sent.<br />
<br />
The disadvantage of this approach is that it introduces a delay and some uncertainty in receiving notifications. If, for example, the user clears the notification on the website before the client collects it, the client will not learn of the new file. Similarly, if the user does not dismiss notifications via the site, the client will have an increasing amount of stale data to work though. Finally, notifications cleared by the client also clears them from the website, so users will need to be made aware of what is going on.<br />
<br />
A polling HOWTO:<br />
<br />
* Use NOTIFY (no more than once every 20 minutes) to get the number of pending notifications<br />
* IF there are new notifications pending, use NOTIFYLIST to get a list of notification types and associated IDs.<br />
* Use NOTIFYGET to receive a notification, supplying the ID provided by NOTIFYLIST<br />
* Use NOTIFYACK to acknowledge a notification, supplying the ID provided by NOTIFYLIST (if desired)<br />
<br />
{{eyecatch|Note|The ID supplied by NOTIFYLIST will be the ID of the affected notification type. Since, at present, only the anime type is supported, this value is always an aid. In the future, it may represent a group or producer ID. In these cases, the str '''type''' value will indicate what entity the ID represents.}}<br />
<br />
'''Method Two: Server PUSH'''<br />
<br />
With this method, the server takes the active role in advising the client that a new file has arrived. The client must register with the server to receive further advice information, and will be responsible for keeping the login session from timing out, and any NAT router ports open. The UDP packet is sent to the ip and port from which the AUTH command was received.<br />
<br />
This method compensates for the disadvantages of the polling method, but is more difficult to code. Blocking sockets are no longer an option, nor can a client make any assumptions that an incoming packet will necessarily be a reply to the last command sent. The tag option may be helpful here.<br />
<br />
A PUSH HOWTO:<br />
<br />
* PUSH to register your client session.<br />
* Listen for 720-799 NOTIFICATIONs ('''not 290''').<br />
* Use PUSHACK to to acknowledge the notification using the nid supplied with NOTIFICATION<br />
* Use NOTIFYGET to receive a notification, suppling the relid provided by NOTIFICATION (NOT the packet ID)<br />
* Use NOTIFYACK to acknowledge a notification, suppling the relid provided by NOTIFICATION (if desired)<br />
* Use UPTIME (with an interval between 30 and 35 minutes) to keep login session valid<br />
<br />
It is probably a good idea to use tags to separate NOTIFICATIONs from the other communication. NOTIFICATIONs will '''never''' have tags.<br />
<br />
=== PUSH: UDP Notification Registration ===<br />
Register your client as an observer for AniDB notification events for the current user. If you are registered for one or more event types the AniDB server will send an UDP packet (format see below) on each change which affects the current user.<br />
<br />
'''Command String:'''<br />
* PUSH notify={boolean on_new_file}&msg={boolean on_new_private_message}[&buddy={boolean on_buddy_event}]<br />
<br />
'''Possible Replies:'''<br />
* 270 NOTIFICATION ENABLED<br />
OR (if both values are 0)<br />
* 370 NOTIFICATION DISABLED<br />
<br />
'''Info:'''<br />
* A client which has registered to receive UDP notification packets must:<br />
** Issue a PUSHACK command for each notification received with ''notify_packet_id'' provided in the notification packet.<br />
** Use PING to keep the connection alive (< 30 min).<br />
** Use UPTIME to ensure that the session is OK (>= 30 min).<br />
* Every notification generated is resent 3 times unless acknowledged. After that the client is logged out.<br />
<br />
=== NOTIFY: Notifications ===<br />
Get number of pending notifications (and number of online buddies).<br />
<br />
'''Command String:'''<br />
* NOTIFY [buddy=1]<br />
<br />
'''Possible Replies:'''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}<br />
when ''buddy=1''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}|{int4 number_of_online_buddies}<br />
<br />
'''Info:'''<br />
* If the client did send a NOTIFY within the last 35 minutes and it was confirmed by AniDB then receiving a 501 LOGIN FIRST message for the next NOTIFY command shows that AniDB logged the client out because it did not respond to a PUSH Notification packet.<br />
* There is no command to retrieve missed PUSH Notifications.<br />
{{eyecatch|Note|This command MUST NOT be issued more than once every 20 minutes.}}<br />
<br />
----<br />
=== NOTIFYLIST: List Notification/Message IDs ===<br />
List id of all pending (not acknowledged) ''new private message'' and ''new file'' notifications. Buddy events cannot be acknowledged.<br />
<br />
'''Command String:'''<br />
* NOTIFYLIST<br />
<br />
'''Possible Replies:'''<br />
*291 NOTIFYLIST<br />
: {str type}|{int4 id}<br />
: {str type}|{int4 id}<br />
: ...<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as required by NOTIFYGET. For messages it is the actual message id, for notifications it is the id of the related type; anime, group or producer. Since only file notifications related to anime is implemented atm, it is the anime id (aid).<br />
* NOTIFYLIST returns one line per entry, if no entries are available only the first line of the reply is returned.<br />
{{eyecatch|Note|This command MUST NOT be issued regularly but should only be triggered by either a push message received by the client or a reply to a NOTIFY command which tells you that there are messages/notifications waiting.}}<br />
<br />
----<br />
=== NOTIFYGET: Get Notification/Message ===<br />
Receive private message or file notification.<br />
<br />
'''Command String:'''<br />
* NOTIFYGET type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 292 NOTIFYGET<br />
: {int4 id}|{int4 from_user_id}|{str from_user_name}|{int4 date}|{int4 type}|{str title}|{str body}<br />
* 392 NO SUCH ENTRY<br />
when type = N<br />
* 293 NOTIFYGET<br />
: {int4 relid}|{int4 type}|{int2 count}|{int4 date}|{str relidname}|{str fids}<br />
* 393 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as given by NOTIFYLIST (or ''relid'' from 271 NOTIFICATION and mid from 272 NOTIFICATION)<br />
* for message entries (M):<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: type is the type of the message (0=normal msg, 1=annonymous, 2=system msg, 3=mod msg)<br />
* for notification entries (N):<br />
: relid is the id of the related type (anime)<br />
: relname is the name of the related type (anime)<br />
: type is the notification type (0=all, 1=new, 2=group, 3=complete)<br />
: count is the number of events pending for this subscription<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: fids is a comma separated list with the affected file ids<br />
<br />
----<br />
=== NOTIFYACK: Acknowledge Notification/Message ===<br />
This command will mark a message read or clear a ''new file'' notification. Buddy events are not acknowledgeable.<br />
<br />
'''Command String:'''<br />
* NOTIFYACK type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 281 NOTIFYACK SUCCESSFUL<br />
* 381 NO SUCH ENTRY<br />
when type = N<br />
* 282 NOTIFYACK SUCCESSFUL<br />
* 382 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
<br />
====Notification Packet Format====<br />
'''New File Notify:'''<br />
<br />
720 {int4 notify_packet_id} NOTIFICATION - NEW FILE<br />
{int4 fidlist}|{int2 reltype}|{int2 priority}<br />
<br />
* fidlist is a comma separated list of file ids<br />
* reltype is: 1 = anime, 2 = group, 3 = producer<br />
* priority is: 0 = low, 1 = medium, 2 = high<br />
* new file notifications are created as a batch, so it is not unusual to get several new files for a particular anime at once. It is in this case that a comma separated list of fids will be returned<br />
<br />
{{eyecatch|Note|Group (and producer) related file notifications are not implemented yet.}}<br />
<br />
<br />
'''New Private Message Notify:'''<br />
<br />
794 {int4 notify_packet_id} NOTIFICATION - NEW MESSAGE<br />
{int2 type}|{int4 date}|{int4 sent_by_uid}|{str sent_by_name}|{str subject}|{str body}|{int mid}<br />
<br />
* type is the type of the message (0=normal msg, 1=anonymous, 2=system msg, 3=mod msg)<br />
* date is the time the message was sent (in seconds since 1.1.1970)<br />
* sender uid/sender name are the user id and user name of the sender<br />
* subject is the message subject<br />
* body is message body (can be truncated)<br />
* mid is message id and can be used with NOTIFYACK<br />
<br />
'''Buddy Event Notify:'''<br />
753 {int4 notify_packet_id} NOTIFICATION - BUDDY<br />
{int4 buddy uid}|{int2 event type}<br />
* Possible event types:<br />
** 0 => LOGIN<br />
** 1 => LOGOUT<br />
** 2 => ACCEPTED<br />
** 3 => ADDED<br />
<br />
<br />
'''Going Down Event Notify:'''<br />
799 {int4 notify_packet_id} NOTIFICATION - SHUTTING DOWN<br />
{int4 time offline}|{int4 comment}<br />
<br />
* Clients with any notification on will receive the SHUTTING DOWN message before the API goes offline.<br />
* Time offline is the time in minutes the API will be down, 0 if indefinite (client can direct user to the AniDB site for status updates).<br />
* The comment is a short explanation for the downtime.<br />
* Only one datagram will be sent, and the server will not listen for replies.<br />
<br />
<br />
=== PUSHACK: UDP Notification Acknowledge ===<br />
Used to acknowledge notification packets (720-799). A client must be prepared to issue this command before using '''PUSH'''.<br />
<br />
'''Command String:'''<br />
* PUSHACK nid={int4 notify_packet_id}<br />
<br />
'''Possible Replies:'''<br />
* 701 PUSHACK CONFIRMED<br />
* 702 NO SUCH PACKET PENDING<br />
<br />
'''Info:'''<br />
* See: '''PUSH'''<br />
<br />
== Buddy Commands ==<br />
Group of commands used to administrate your buddylist.<br />
<br />
=== BUDDYADD: Add a user to Buddy List ===<br />
'''Command String:'''<br />
* BUDDYADD uid={int4 buddy uid}<br />
* BUDDYADD uname={int4 buddy name}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 255 BUDDY ADDED<br />
* 355 BUDDY ALREADY ADDED<br />
<br />
----<br />
=== BUDDYDEL: Remove a user from Buddy List ===<br />
'''Command String:'''<br />
* BUDDYDEL uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 256 BUDDY DELETED<br />
<br />
----<br />
=== BUDDYACCEPT: Accept user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYACCEPT uid={int4 user uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 257 BUDDY ACCEPTED<br />
* 357 BUDDY ALREADY ACCEPTED<br />
<br />
----<br />
=== BUDDYDENY: Deny user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYDENY uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 258 BUDDY DENIED<br />
* 358 BUDDY ALREADY DENIED<br />
<br />
----<br />
=== BUDDYLIST: Retrieve Buddy List ===<br />
'''Command String:'''<br />
* BUDDYLIST startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 253 {int2 start} {int2 end} {int2 total} BUDDY LIST<br />
: {int4 uid}|{str username}|{int2 state}<br />
: ...<br />
'''Info:'''<br />
* state is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = this user is in your buddylist<br />
* bit 2 = this user has accepted you<br />
* bit 3 = this user is waiting for your approval<br />
<br />
----<br />
=== BUDDYSTATE: Retrieve Buddy States===<br />
'''Command String:'''<br />
* BUDDYSTATE startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 254 {int2 start} {int2 end} {int2 total} BUDDY STATE<br />
: {int4 uid}|{int2 onlinestate}<br />
: ...<br />
<br />
'''Info:'''<br />
* onlinestate is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = http online (user has issued a HTTP request within the last 10 minutes)<br />
* bit 2 = udp api online (user is currently connected to the udp api server)<br />
* example: 0=offline, 1=http online, 2=udp api online, 3=http&udp api online<br />
<br />
== Data Commands ==<br />
=== ANIME: Retrieve Anime Data ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIME aid={int4 id}[&amask={hexstr}]<br />
by name<br />
* ANIME aname={str anime name}[&amask={hexstr}]<br />
<br />
'''Possible Replies:'''<br />
<br />
If no ''amask'' is provided:<br />
* 230 ANIME<br />
: {int4 aid}|{int4 eps}|{int4 ep count}|{int4 special cnt}|{int4 rating}|{int4 votes}|{int4 tmprating}|{int4 tmpvotes}|{int4 review rating average}|{int4 reviews}|{str year}|{str type}|{str romaji}|{str kanji}|{str english}|{str other}|{str short names}|{str synonyms}|{str category list}<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* Fields are returned in the same order they appear in the ''amask'' field list: byte 1, bit 7 first<br />
* Synonyms and short names are separated with '<br />
* Category fields are separated with ',' and ordered by weight (desc).<br />
* By name: must be perfect match of romaji/kanji/english/other/synonym/short name.<br />
* 'Producer id list' and 'producer name list' match the data returned by the former producer bits (but using the revised creator ids)<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
* '''Note:''' The character id list is the first data to be truncated if needed. And then: tag list, synonym list, short name list. This applies to the FILE command too.<br />
* Selecting an 'unused' or 'reserved' bit will return an "illegal input" (505) response.<br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="5" align="center"><b>amask</b></td></tr><br />
<tr><br />
<td align="center"><b>Byte 1</b></td><br />
<td align="center"><b>Byte 2</b></td><br />
<td align="center"><b>Byte 3</b></td><br />
<td align="center"><b>Byte 4</b></td><br />
<td align="center"><b>Byte 5</b></td><br />
<td align="center"><b>Byte 6</b></td><br />
<td align="center"><b>Byte 7</b></td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int aid</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int dateflags</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 special ep count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int air date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int end date</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str url</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str picname</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str category id list</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int vote count</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 temp rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int temp vote count</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 average review rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int review count</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str award list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>bool is 18+ restricted</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int anime planet id</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int ANN id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int allcinema id</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str AnimeNfo id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int date record updated</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int character id list</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int creator id list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int main creator id list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str main creator name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 specials count</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 credits count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 other count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 trailer count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 parody count</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<br />
'''Related aid type (Byte 1, Bit 2):'''<br />
<pre><br />
value meaning<br />
<br />
1 sequel<br />
2 prequel<br />
11 same setting<br />
12 alternative setting<br />
32 alternative version<br />
41 music video<br />
42 character<br />
51 side story<br />
52 parent story<br />
61 summary<br />
62 full story<br />
100 other<br />
</pre><br />
<br />
'''Examples:''' (note that the given amask gives the same result as the default request)<br />
> ANIME aid=1&amask=b2f0e0fc000000&s=xxxxx<br />
< 230 ANIME<br />
1|1999-1999|TV Series|Space,Future,Plot Continuity,SciFi,Space Travel,Shipboard,Other Planet,Novel,Genetic Modification,Action,Romance,Military,Large Breasts,Gunfights,Adventure,Human Enhancement,Nudity|Seikai no Monshou|星界の紋章|Crest of the Stars||13|13|3|853|3225|756|110|875|11<br />
<br />
<br />
----<br />
<br />
=== ANIMEDESC: Retrieve Anime Description ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIMEDESC aid={int4 id}&part={int4 partno}<br />
<br />
'''Possible Replies:'''<br />
* 233 ANIMEDESC<br />
: {int4 current part}|{int4 max parts}|{str description}<br />
* 330 NO SUCH ANIME<br />
* 333 NO SUCH DESCRIPTION<br />
<br />
'''Info:'''<br />
* The maximum length of the anime description is roughly 5000 characters, but the maximum length of a UDP packet is 1400 bytes<br />
* Multiple calls to ANIMEDESC may be necessary to retrieve the complete text, retrieving separate 1400 byte parts with each call<br />
* ''part'' is zero-based<br />
* '''Note:''' No support, at present, for retrieving descriptions by title. ''aid'' only<br />
<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> ANIMEDESC aid=3169&part=0&s=xxxxx<br />
< 233 ANIMEDESC<br />
0|1|As summer break arrives for the students, Jun Sakurada is busily studying on his own in the library, making up for time lost <cut><br />
<br />
----<br />
=== CALENDAR: Get Upcoming Titles ===<br />
Returns the anime ids of the 25 most recently aired / released anime, directly followed by the next 25 anime due to be aired / released, ordered by start date.<br />
<br />
'''Command String:'''<br />
* CALENDAR<br />
<br />
'''Possible Replies:'''<br />
* 297 CALENDAR<br />
{int aid}|{int startdate}|{int dateflags}/n<br />
<br />
..repeated n times<br />
<br />
* 397 CALENDAR EMPTY<br />
<br />
'''Info:'''<br />
* Takes no parameters (other than the session string)<br />
* Titles returned are filtered by the 'show adult' preference of the logged in user. That is, users who have elected to hide adult content will have it hidden here as well.<br />
* Do not depend on the command always returning exactly 50 titles; there may not always be 25 future titles pending, depending on the user's 'adult' preferences, and the date in relation to the relation to the current anime season.<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
<br />
----<br />
=== CHARACTER: Get Character Information ===<br />
Returns character details associated with a given character ID, including associated anime ids, episode ids, and seiyuu.<br />
<br />
'''Command String:'''<br />
* CHARACTER charid={int characterid}<br />
<br />
'''Possible Replies:'''<br />
* 235 CHARACTER<br />
: {int charid}|{str character name kanji}|{str character name transcription}|{str pic}|{anime blocks}|{int episode list}|{int last update date}|{int2 type}|{str gender}<br />
<br />
: An 'anime block' is {int anime id},{int appearance},{int creatorid},{boolean is_main_seiyuu} repeated as many times as necessary, separated by a single quote ( ' ). <br />
<br />
* 335 NO SUCH CHARACTER<br />
<br />
'''Info:'''<br />
* If no seiyuu is associated with the character for a given aid, the 'creatorid' and 'is_main_seiyuu' fields will be empty, but the commas will remain.<br />
* An empty episode list is "undefined": no episode values have been added.<br />
* ''appearance'' values: 0='appears in', 1='cameo appearance in', 2='main character in', 3='secondary cast in'<br />
* ''type'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** 1 => 'Character'<br />
** 2 => 'Mecha'<br />
** 3 => 'Organisation'<br />
** 4 => 'Vessel' <br />
* ''gender'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** "M" => 'Male'<br />
** "F" => 'Female'<br />
** "I" => 'Intersexual'<br />
** "D" => 'Dimorphic'<br />
** "-" => 'none/does not apply'<br />
** "?" => 'unknown'<br />
<br />
'''Example:'''<br />
<br />
CHARACTER charid=488&s=DChan<br />
235 CHARACTER<br />
488|ニコ・ロビン|Nico Robin|14789.jpg|4097,2,1900,1'69,2,1901,0'6199,0,1900,1'5691,0,1900,1'2644,0,,'4851,0,1900,1||1236938094<br />
<br />
=== CREATOR: Get Creator Information ===<br />
<br />
'''Command String:'''<br />
* CREATOR creatorid={int creatorid}<br />
<br />
'''Possible Replies:'''<br />
* 245 CREATOR<br />
: {int creatorid}|{str creator name kanji}|{str creator name transcription}|{int type}|{str pic_name}|{str url_english}|{str url_japanese}|{str wiki_url_english}|{str wiki_url_japanese}|{int last update date}<br />
<br />
* 345 NO SUCH CREATOR<br />
<br />
'''Info:'''<br />
* ANIME AMASK byte6, bit5<br />
* ''type'' values: 1='person', 2='company', 3='collaboration'<br />
<br />
Example:<br />
<br />
245 CREATOR<br />
718|GAINAX|Gainax|2|10092.png||http://www.gainax.co.jp/|Gainax|Gainax|1237048093<br />
<br />
=== EPISODE: Retrieve Episode Data ===<br />
'''Command String:'''<br><br />
by eid<br />
* EPISODE eid={int eid}<br />
by anime and episode number<br />
* EPISODE aname={str anime name}&epno={int4 episode number}<br />
* EPISODE aid={int anime id}&epno={int4 episode number}<br />
<br />
'''Possible Replies:'''<br />
* 240 EPISODE<br />
: {int eid}|{int aid}|{int4 length}|{int4 rating}|{int votes}|{str epno}|{str eng}|{str romaji}|{str kanji}|{int aired}|{int type}<br />
* 340 NO SUCH EPISODE<br />
<br />
'''Info:'''<br />
* length is in minutes<br />
* Returned 'epno' includes special character (only if special) and padding (only if normal).<br />
** Special characters are S(special), C(credits), T(trailer), P(parody), O(other).<br />
* The ''type'' is the raw episode type, used to indicate numerically what the special character will be<br />
** 1: regular episode (no prefix), 2: special ("S"), 3: credit ("C"), 4: trailer ("T"), 5: parody ("P"), 6: other ("O")<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> EPISODE eid=1&s=xxxxx<br />
< 240 EPISODE<br />
1|1|24|400|4|01|Invasion|shinryaku|??<br />
<br />
> EPISODE aname=Seikai no Monshou&epno=2&s=xxxxx<br />
< 240 EPISODE<br />
2|1|24|750|2|02|Kin of the Stars|Hoshi-tachi no Kenzoku|??????|1295059229|1<br />
<br />
----<br />
<br />
=== FILE: Retrieve File Data ===<br />
'''Command String:'''<br><br />
by fid:<br />
* FILE fid={int4 id}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by size+ed2k hash:<br />
* FILE size={int8 size}&ed2k={str ed2khash}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by anime, group and epno<br />
* FILE aname={str anime name}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aname={str anime name}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
<br />
'''Possible Replies:'''<br />
* 220 FILE<br />
: {int4 fid}|{int4 aid}|{int4 eid}|{int4 gid}|{int4 state}|{int8 size}|{str ed2k}|{str anidbfilename}<br />
* 220 FILE<br />
: {int4 fid}|...(data list)<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 0}|{int4 fid 1}|...|{int4 fid n}<br />
* 320 NO SUCH FILE<br />
<br />
'''Info:'''<br />
* fid, aid, eid, gid are the unique ids for the file, anime, ep, group entries at AniDB.<br />
: You can use those to create links to the corresponding pages at AniDB.<br />
* anidbfilename is the AniDB filename for the file.<br />
: However this name does not contain all the extra information of the filenames on AniDB and might be composed slightly different.<br />
* fmask and amask are hexidecimal strings where each bit corresponds to a data field related to the specified file (see below). The data list received is sorted and returned in the same order as the tables: top to bottom, left to right, with fmask preceding amask. There is '''no''' provision to retrieve all fields. Further, requesting a 'unusued' or 'reserved' bit will return an "illegal input" error.<br />
* fid is always returned as the first value, regardless of what masks are provided.<br />
* Only the first matching file is returned when aname, gname and epno is used.<br />
* "audio codec" and "audio bitrate" will return multiple values if there are multiple audio streams present in the file. Values will be separated by a single quote. <br />
* For byte 1, bit 2 (other episodes): episode IDs will be followed by an integer '''percentage''' that indicate the percentage of the related episode this file covers. Typically 100%, there are cases where it will be 50, 30, or other values. This value provides no indication where, within an episode, the file represents. That is, 50% could mean the file covers the first half of the episode, the second half, or some 50% range in between.<br />
'''State:'''<br />
<pre><br />
bit / int value meaning<br />
1 / 1 FILE_CRCOK: file matched official CRC (displayed with green background in AniDB)<br />
2 / 2 FILE_CRCERR: file DID NOT match official CRC (displayed with red background in AniDB)<br />
3 / 4 FILE_ISV2: file is version 2<br />
4 / 8 FILE_ISV3: file is version 3<br />
5 / 16 FILE_ISV4: file is version 4<br />
6 / 32 FILE_ISV5: file is version 5<br />
7 / 64 FILE_UNC: file is uncensored<br />
8 / 128 FILE_CEN: file is censored<br />
<br />
examples:<br />
state ==== 9 ==> FILE_CRCOK+FILE_ISV3 ==> file matched official CRC and is version 3<br />
state ==== 0 ==> - ==> file was not crc checked and is version 1<br />
state ==== 34 ==> FILE_CRCERR+FILE_ISV5 ==> file DID NOT match official CRC and is version 5<br />
state ==== 1 ==> FILE_CRCOK ==> file matched official CRC and is version 1<br />
state ==== 8 ==> FILE_ISV3 ==> file was not CRC checked and is version 3<br />
</pre><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''fmask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
<td align="center">'''Byte 5'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 aid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 eid</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 gid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 mylist id</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>list other episodes</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>int2 IsDeprecated</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int2 state</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int8 size</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ed2k</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str md5</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str sha1</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str crc32</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>video colour depth</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str quality</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str audio codec list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 audio bitrate list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str video codec</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 video bitrate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str video resolution</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str file type (extension)</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str dub language</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str sub language</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 length in seconds</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str description</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 aired date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str anidb file name</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 mylist state</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 mylist filestate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 mylist viewed</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 mylist viewdate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str mylist storage</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str mylist source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str mylist other</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''amask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 anime total episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str category list</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str epno</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ep name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str ep romaji name</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str ep kanji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 episode rating</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 episode vote count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str group name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str group short name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int4 date aid record updated</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
'''Examples:''' (html escaped code intended)<br />
> FILE size=177747474&ed2k=70cd93fd3981cc80a8ea6a646ff805c9&fmask=7FF8FEF8&amask=C000F0C0&s=xxxxx<br />
< 220 FILE<br />
312498|4688|69260|4243|0||0|1|177747474|70cd93fd3981cc80a8ea6a646ff805c9|b2a7c7d591333e20495de3571b235c28|7af9b962c17ff729baeee67533e5219526cd5095|a200fe73|high|DTV|Vorbis (Ogg Vorbis)|104|H264/AVC|800|704x400|japanese|english'english'english|1560||1175472000|26|26|01|The Wings to the Sky|Sora he no Tsubasa|????|#nanoha-DamagedGoodz|Nanoha-DGz<br />
<br />
----<br />
<br />
=== GROUP: Retrieve Group Data ===<br />
'''Command String:'''<br><br />
by gid<br />
* GROUP gid={int gid}<br />
by name/shortname<br />
* GROUP gname={str group name}<br />
<br />
'''Possible Replies:'''<br />
* 250 GROUP<br />
: {int gid}|{int4 rating}|{int votes}|{int4 acount}|{int fcount}|{str name}|{str short}|{str irc channel}|{str irc server}|{str url}|{str picname}|{int4 foundeddate}|{int4 disbandeddate}|{int2 dateflags}|{int4 lastreleasedate}|{int4 lastactivitydate}|{list grouprelations}<br />
* 350 NO SUCH GROUP<br />
<br />
'''Info:'''<br />
* Requires login<br />
* ''gname'' is an exact match of either a group name or short name<br />
* As either name and short names are unique if there is a result from GROUP request by name that will be the only match<br />
* ''dateflags'' values:<br />
** bit0 set == Foundeddate, Unknown Day<br />
** bit1 set == Foundeddate, Unknown Month, Day<br />
** bit2 set == Disbandeddate, Unknown Day<br />
** bit3 set == Disbandeddate, Unknown Month, Day<br />
** bit5 set == Foundeddate, Unknown Year<br />
** bit6 set == Disbandeddate, Unknown Year<br />
* ''releasedate'' and ''activitydate'' are distinct. ''releasedate'' is the date a file was actually released by the group, where ''activitydate'' is the date of a file being added to AniDB. As such, lastrelease may very well be much older than lastactivity.<br />
* ''groupreleations'' is a list of apostrophe-separated pairs, where each pair consists of {int4 othergroupid},{int2 relationtype}<br />
** relationtype:<br />
*** 1 => "Participant in"<br />
*** 2 => "Parent of"<br />
*** 4 => "Merged from"<br />
*** 5 => "Now known as"<br />
*** 6 => "Other"<br />
<br />
'''Example:'''<br />
> GROUP gid=7091&s=bunny<br />
< 250 GROUP<br />
7091|832|1445|43|566|Frostii|Frostii|#frostii|irc.rizon.net|http://frostii.com|15844.jpg|1228089600|0|1|1301875200|1304222640|7255,1'3097,4'748,4'8106,1'8159,2'8402,1'8696,1'9022,1<br />
<br />
----<br />
<br />
=== GROUPSTATUS: Get Completed Episode ===<br />
Returns a list of group names and ranges of episodes released by the group for a given anime.<br />
<br />
'''Command String:'''<br />
* GROUPSTATUS aid={int animeid}[&state={int completion_state}]<br />
<br />
'''Possible Replies:'''<br />
* 225 GROUPSTATUS<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: ... (repeated)<br />
<br />
* 325 NO SUCH GROUPS FOUND<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* The seven fields will be repeated as necessary, one for each group, separated by a new line character<br />
* Groups will be filtered by the languages selected in the user's profile<br />
* If ''state'' is not supplied, groups with a completion state of <i>'ongoing'</i>, <i>'finished'</i>, or <i>'complete'</i> are returned<br />
* Groups are returned in order of descending episode count<br />
* If there are more groups to return than can be stored in a UDP packet, additional groups will be silently discarded<br />
* ''state'' values: <br />
#ongoing<br />
#stalled<br />
#complete<br />
#dropped<br />
#finished<br />
#specials only<br />
<br />
'''Example:'''<br />
> GROUP GROUPSTATUS aid=8692&s=vLl1N<br />
< 225 GROUPSTATUS<br />
7407|Coalgirls|3|25|839|12|1-25<br />
9863|Hadena Subs|3|25|374|1|1-25<br />
11951|ChaosBlades|3|25|0|0|1-25<br />
[truncated]<br />
<br />
== MyList Commands ==<br />
=== MYLIST: Retrieve MyList Data ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLIST lid={int4 lid}<br />
by fid:<br />
* MYLIST fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLIST size={int4 size}&ed2k={str ed2khash}<br />
by anime + group + epno<br />
* MYLIST aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 221 MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 312 MULTIPLE MYLIST ENTRIES<br />
: {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}<br />
* 321 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* The state field provides information about the location and sharing state of a file in MyList.<br />
* 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).<br />
* eps is a list of episodes, e.g. "1-12,14-16,T1"<br />
<br />
'''States:'''<br />
0 - unknown - state is unknown or the user doesn't want to provide this information<br />
1 - on hdd - the file is stored on hdd (but is not shared)<br />
2 - on cd - the file is stored on cd<br />
3 - deleted - the file has been deleted or is not available for other reasons (i.e. reencoded)<br />
<br />
'''Filestates:''' (for normal files, i.e. not generic)<br />
0 => normal/original<br />
1 => corrupted version/invalid crc<br />
2 => self edited<br />
10 => self ripped<br />
11 => on dvd<br />
12 => on vhs<br />
13 => on tv<br />
14 => in theaters<br />
15 => streamed<br />
100 => other<br />
<br />
'''Example:'''<br />
> MYLIST aname=gits sac&s=xxxxx<br />
< 322 MULTIPLE FILES FOUND<br />
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<br />
<br />
----<br />
=== MYLISTADD: Add file to MyList ===<br />
The command string for MYLISTADD is made of up two blocks: a 'fileinfo' block, which limits the command to a specific file, or an 'animeinfo'/'groupinfo'/'episodeinfo' block, which can be used to specify a range of files, including generics. Additionally, a number of optional parameters can be included with either set.<br />
<br />
'''Adding a single file to the MyList with the 'fileinfo' block'''<br />
<br />
* MYLISTADD fid={int4 fid}<br />
'''or'''<br />
* MYLISTADD size={int4 size}&ed2k={str ed2khash}<br />
'''or'''<br />
* MYLISTADD lid={int4 lid}&edit=1 (valid for edit only)<br />
<br />
'''Adding one or more files to the MyList with the 'animeinfo'/'groupinfo'/'episodeinfo' block'''<br />
<br />
Here, you have a number of options, depending on what data you have available. In brief, 'animeinfo' represents a choice between anime id and anime name. 'groupinfo' represents a choice between group id, group name, and generic=1. 'episodeinfo' represents a range of one or more episodes.<br />
<br />
* MYLISTADD aid={int4 aid}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&generic=1&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&generic=1&epno={int4 episode number}<br />
<br />
Each command listed can have, in addition, a number of optional components to provide further MyList details. Append these as desired.<br />
<br />
* &state={int2 state}<br />
* &viewed={boolean viewed}<br />
* &viewdate={int4 viewdate}<br />
* &source={str source}<br />
* &storage={str storage}<br />
* &other={str other}<br />
<br />
Finally, edit=1 can be included to edit a MyList entry instead of creating a new one. When editing, optional values that are not supplied retain their original value. That is, they are ''not'' replaced with default or empty values. Only values supplied are updated.<br />
<br />
'''Possible Replies:'''<br />
* 320 NO SUCH FILE<br />
* 330 NO SUCH ANIME<br />
* 350 NO SUCH GROUP<br />
when edit=0 and adding by fid, size/ed2k<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 mylist id of new entry}<br />
when edit=0 and adding by aname, aid<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 number of entries added}<br />
* 310 FILE ALREADY IN MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 1}|{int4 fid 2}|...|{int4 fid n}<br />
when edit=1<br />
* 311 MYLIST ENTRY EDITED<br />
* 311 MYLIST ENTRY EDITED<br />
: {int4 number of entries edited}<br />
* 411 NO SUCH MYLIST ENTRY<br />
<br />
'''Info:'''<br />
* All data except lid/fid/size+hash/generic is optional.<br />
* Viewed should be 0 for unwatched files and 1 for watched files.<br />
* If viewdate is not specified, the current time will be used. The field will be disregarded if viewed=0.<br />
* Other is the only field which may contain newlines, but they have to be stored as &lt;br /&gt;<br />
* For state values refer to: '''MYLIST'''<br />
* If you want to change an existing entry and already know its MyList id (lid) please use the lid-version of this command. It put less load on the server.<br />
* epno=0 means all eps (default), negative numbers means upto. (-12 -> upto 12)<br />
* group is optional only when edit=1, meaning you can't add every file for an anime<br />
* If the file already exists (response code 310), the ''current'' record will be returned, in the same format as the MYLIST response.<br />
----<br />
<br />
=== MYLISTDEL: Remove file from MyList ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLISTDEL lid={int4 lid}<br />
by fid:<br />
* MYLISTDEL fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLISTDEL size={int4 size}&ed2k={str ed2k hash}<br />
by anime + group + epno<br />
* MYLISTDEL aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 211 MYLIST ENTRY DELETED<br />
: {int4 number of entries}<br />
* 411 NO SUCH MYLIST ENTRY<br />
'''Info:'''<br />
* group is optional<br />
* command will delete all enties found<br />
<br />
----<br />
=== MYLISTSTATS : Retrieve MyList stats ===<br />
'''Command String:'''<br />
* MYLISTSTATS<br />
'''Possible Replies:'''<br />
* 222 MYLIST STATS<br />
{animes}|{eps}|{files}|{size of files}|{added animes}|{added eps}|{added files}|{added groups}|{leech %}|{glory %}|{viewed % of db}|{mylist % of db}|{viewed % of mylist}|{number of viewed eps}|{votes}|{reviews}|{viewed length in minutes}<br />
<br />
'''Info:'''<br />
* All fields are int<br />
<br />
----<br />
<br />
=== VOTE: Vote for specified anime/episode/group ===<br />
'''Command String:'''<br><br />
by id<br />
* VOTE type={int2 type}&id={int4 id}[&value={int4 vote value}&epno={int4 episode number}]<br />
by name<br />
* VOTE type={int2 type}&name={string name}[&value={int4 vote value}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 260 VOTED<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 261 VOTE FOUND<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 262 VOTE UPDATED<br />
: {str entity name}|{old vote value}|{vote type}|{entity id}<br />
* 263 VOTE REVOKED<br />
: {str entity name}|{revoked vote value}|{vote type}|{entity id}<br />
* 360 NO SUCH VOTE<br />
: {str entity name}|0|{vote type}|{entity id}<br />
* 361 INVALID VOTE TYPE<br />
* 362 INVALID VOTE VALUE<br />
* 363 PERMVOTE NOT ALLOWED<br />
: {str aname}|{vote value}|{type}|{entity id}<br />
* 364 ALREADY PERMVOTED<br />
: {str entity name}|{existing vote value}|{vote type}|{entity id}<br />
<br />
'''Info:'''<br />
* type: 1=anime, 2=anime tmpvote, 3=group<br />
* entity: anime, episode, or group<br />
* for episode voting add epno on type=1<br />
* value: negative number means revoke, 0 means retrieve (default), 100-1000 are valid vote values, rest is illegal<br />
* votes will be updated automatically (no questions asked)<br />
* tmpvoting when there exist a perm vote is not possible<br />
<br />
----<br />
<br />
=== RANDOM: Get a random anime ===<br />
'''Command String:'''<br />
* RANDOMANIME type={int4 type}<br />
<br />
'''Possible Replies:'''<br />
* 230 ANIME ... (see ANIME)<br />
<br />
'''Info:'''<br />
* type: 0=from db, 1=watched, 2=unwatched, 3=all mylist<br />
<br />
== Misc Commands ==<br />
=== MYLISTEXPORT: Schedule a MyList Export ===<br />
Queues a {{AniDBLink|export|MyList Export}} by the AniDB Servers. As with a manual export request, exports are only done during periods when server load is low. As a result, exports may take up to 24 hours. The client submitting the request will receive an AniDB message when the export is ready to be collected.<br />
<br />
Only one export can be in the queue at a time.<br />
<br />
'''Command String:'''<br />
* MYLISTEXPORT [template={str template_name}|cancel=1]<br />
<br />
'''Possible Replies:'''<br />
* 217 EXPORT QUEUED<br />
* 218 EXPORT CANCELLED<br />
* 317 EXPORT NO SUCH TEMPLATE<br />
* 318 EXPORT ALREADY IN QUEUE<br />
* 319 EXPORT NO EXPORT QUEUED OR IS PROCESSING<br />
<br />
'''Info:'''<br />
* ''template_name'' must match an available export template on the {{AniDBLink|export|MyList Export}} page.<br />
* ''cancel'' will cancel any pending export request, queued either through UDP or the web server.<br />
* Clients can subscribe the message notifications if they wish to be notified when an export is complete.<br />
<br />
----<br />
<br />
=== PING: Ping Command ===<br />
'''Command String:'''<br />
* PING [nat=1]<br />
<br />
'''Possible Replies:'''<br />
* 300 PONG<br />
: {int4 port} ''(when nat=1)''<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* May be used by a frontend to determine if the API is still available.<br />
* May be executed even if not yet logged in.<br />
* The option <tt>nat=1</tt> provides an easy way to determine if the router has changed the outgoing port. ({{t|587}})<br />
<br />
----<br />
<br />
=== VERSION: Retrieve Server Version ===<br />
'''Command String:'''<br />
* VERSION<br />
<br />
'''Possible Replies:'''<br />
* 998 VERSION<br />
: {str server version}<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
<br />
----<br />
=== UPTIME: Retrieve Server Uptime ===<br />
'''Command String:'''<br />
* UPTIME<br />
<br />
'''Possible Replies:'''<br />
* 208 UPTIME<br />
: {int4 udpserver uptime in milliseconds}<br />
<br />
'''Info:'''<br />
* This command is the preferred way to check that the session is OK.<br />
<br />
----<br />
=== ENCODING: Change Encoding for Session ===<br />
Sets preferred [[Wikipedia:Character encoding|encoding]] per session. The preferred way to do this is to use the '''enc''' argument for AUTH. This command is mostly for testing.<br />
<br />
'''Command String:'''<br />
* ENCODING name={str encoding name}<br />
<br />
'''Possible Replies:'''<br />
* 219 ENCODING CHANGED<br />
* 519 ENCODING NOT SUPPORTED<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* Supported encodings: http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html<br />
* Default: ASCII.<br />
* Resets to default on logout.<br />
<br />
----<br />
<br />
=== SENDMSG: Send Message ===<br />
'''Command String:'''<br />
* SENDMSG to={str username}&title={str title}&body={str body}<br />
<br />
'''Possible Replies:'''<br />
* 294 SENDMSG SUCCESSFUL<br />
* 394 NO SUCH USER<br />
* 501 LOGIN FIRST<br />
<br />
'''Note:'''<br />
* This command allows you to send an AniDB message.<br />
{{eyecatch|Important|<br />
title must not be longer than 50 chars.<br><br />
body must not be longer than 900 chars.<br />
}}<br />
<br />
----<br />
=== USER: Retrieve User UID ===<br />
'''Command String:'''<br />
* USER [user={str user name}|uid={int user id}]<br />
<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 295 USER<br />
: {int4 uid}|{str username}<br />
<br />
----<br />
<br />
=== STATS [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* STATS<br />
<br />
'''Possible Replies:'''<br />
* 206 STATS<br />
: {int4 animes)|{int4 eps}|{int4 files}|{int4 groups}|{int4 users}|{int8 total file size in bytes}|{int4 open [[creq|creqs]]}<br />
<br />
----<br />
=== TOP [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* TOP<br />
<br />
'''Possible Replies:'''<br />
* 207 TOP<br />
: {str longest mylist}|{int count}<br />
: {str largest mylist}|{int count}<br />
: {str most lame files}|{int count}<br />
: {str most indep. user}|{int count}<br />
: {str biggest leecher}|{int count}<br />
: {str most anime added}|{int count}<br />
: {str most eps added}|{int count}<br />
: {str most files added}|{int count}<br />
: {str most groups added}|{int count}<br />
: {str most votes}|{int count}<br />
: {str most reviews}|{int count}<br />
<br />
'''Info:'''<br />
* All strings are user names.<br />
* 'Hide myself in IRC stats' applies for this too.<br />
<br />
== Fatal Errors ==<br />
At anypoint int the retrieval process you have to expect the following output:<br />
* 6xx INTERNAL SERVER ERROR<br />
: ERROR: {str errormessage}<br />
OR<br />
*6xx INTERNAL SERVER ERROR - {str errormessage}<br />
<br />
Such errors should be reported back to [[User:Ommina|Ommina]].<br />
(xx is a number between 00 and 99)<br />
<br />
If you supply an unknown or unimplemented command you will get an error:<br />
* 598 UNKNOWN COMMAND<br />
<br />
== Return Codes ==<br />
{{eyecatch|Note|While the names below '''are''' the actual code strings returned by the server, clients are nonetheless encouraged to work with the numeric codes instead. }}<br />
<pre><br />
LOGIN_ACCEPTED = 200<br />
LOGIN_ACCEPTED_NEW_VERSION = 201<br />
LOGGED_OUT = 203<br />
RESOURCE = 205<br />
STATS = 206<br />
TOP = 207<br />
UPTIME = 208<br />
ENCRYPTION_ENABLED = 209<br />
MYLIST_ENTRY_ADDED = 210<br />
MYLIST_ENTRY_DELETED = 211<br />
ADDED_FILE = 214<br />
ADDED_STREAM = 215<br />
EXPORT_QUEUED = 217<br />
EXPORT_CANCELLED = 218<br />
ENCODING_CHANGED = 219<br />
FILE = 220<br />
MYLIST = 221<br />
MYLIST_STATS = 222<br />
WISHLIST = 223<br />
NOTIFICATION = 224<br />
GROUP_STATUS = 225<br />
WISHLIST_ENTRY_ADDED = 226<br />
WISHLIST_ENTRY_DELETED = 227<br />
WISHLIST_ENTRY_UPDATED = 228<br />
MULTIPLE_WISHLIST = 229<br />
ANIME = 230<br />
ANIME_BEST_MATCH = 231<br />
RANDOM_ANIME = 232<br />
ANIME_DESCRIPTION = 233<br />
REVIEW = 234<br />
CHARACTER = 235<br />
SONG = 236<br />
ANIMETAG = 237<br />
CHARACTERTAG = 238<br />
EPISODE = 240<br />
UPDATED = 243<br />
TITLE = 244<br />
CREATOR = 245<br />
NOTIFICATION_ENTRY_ADDED = 246<br />
NOTIFICATION_ENTRY_DELETED = 247<br />
NOTIFICATION_ENTRY_UPDATE = 248<br />
MULTIPLE_NOTIFICATION = 249<br />
GROUP = 250<br />
CATEGORY = 251<br />
BUDDY_LIST = 253<br />
BUDDY_STATE = 254<br />
BUDDY_ADDED = 255<br />
BUDDY_DELETED = 256<br />
BUDDY_ACCEPTED = 257<br />
BUDDY_DENIED = 258<br />
VOTED = 260<br />
VOTE_FOUND = 261<br />
VOTE_UPDATED = 262<br />
VOTE_REVOKED = 263<br />
HOT_ANIME = 265<br />
RANDOM_RECOMMENDATION = 266<br />
RANDOM_SIMILAR = 267<br />
NOTIFICATION_ENABLED = 270<br />
NOTIFYACK_SUCCESSFUL_MESSAGE = 281<br />
NOTIFYACK_SUCCESSFUL_NOTIFIATION = 282<br />
NOTIFICATION_STATE = 290<br />
NOTIFYLIST = 291<br />
NOTIFYGET_MESSAGE = 292<br />
NOTIFYGET_NOTIFY = 293<br />
SENDMESSAGE_SUCCESSFUL = 294<br />
USER_ID = 295<br />
CALENDAR = 297<br />
<br />
PONG = 300<br />
AUTHPONG = 301<br />
NO_SUCH_RESOURCE = 305<br />
API_PASSWORD_NOT_DEFINED = 309<br />
FILE_ALREADY_IN_MYLIST = 310<br />
MYLIST_ENTRY_EDITED = 311<br />
MULTIPLE_MYLIST_ENTRIES = 312<br />
WATCHED = 313<br />
SIZE_HASH_EXISTS = 314<br />
INVALID_DATA = 315<br />
STREAMNOID_USED = 316<br />
EXPORT_NO_SUCH_TEMPLATE = 317<br />
EXPORT_ALREADY_IN_QUEUE = 318<br />
EXPORT_NO_EXPORT_QUEUED_OR_IS_PROCESSING = 319<br />
NO_SUCH_FILE = 320<br />
NO_SUCH_ENTRY = 321<br />
MULTIPLE_FILES_FOUND = 322<br />
NO_SUCH_WISHLIST = 323<br />
NO_SUCH_NOTIFICATION = 324<br />
NO_GROUPS_FOUND = 325<br />
NO_SUCH_ANIME = 330<br />
NO_SUCH_DESCRIPTION = 333<br />
NO_SUCH_REVIEW = 334<br />
NO_SUCH_CHARACTER = 335<br />
NO_SUCH_SONG = 336<br />
NO_SUCH_ANIMETAG = 337<br />
NO_SUCH_CHARACTERTAG = 338<br />
NO_SUCH_EPISODE = 340<br />
NO_SUCH_UPDATES = 343<br />
NO_SUCH_TITLES = 344<br />
NO_SUCH_CREATOR = 345<br />
NO_SUCH_GROUP = 350<br />
NO_SUCH_CATEGORY = 351<br />
BUDDY_ALREADY_ADDED = 355<br />
NO_SUCH_BUDDY = 356<br />
BUDDY_ALREADY_ACCEPTED = 357<br />
BUDDY_ALREADY_DENIED = 358<br />
NO_SUCH_VOTE = 360<br />
INVALID_VOTE_TYPE = 361<br />
INVALID_VOTE_VALUE = 362<br />
PERMVOTE_NOT_ALLOWED = 363<br />
ALREADY_PERMVOTED = 364<br />
HOT_ANIME_EMPTY = 365<br />
RANDOM_RECOMMENDATION_EMPTY = 366<br />
RANDOM_SIMILAR_EMPTY = 367<br />
NOTIFICATION_DISABLED = 370<br />
NO_SUCH_ENTRY_MESSAGE = 381<br />
NO_SUCH_ENTRY_NOTIFICATION = 382<br />
NO_SUCH_MESSAGE = 392<br />
NO_SUCH_NOTIFY = 393<br />
NO_SUCH_USER = 394<br />
CALENDAR_EMPTY = 397<br />
NO_CHANGES = 399<br />
<br />
NOT_LOGGED_IN = 403<br />
NO_SUCH_MYLIST_FILE = 410<br />
NO_SUCH_MYLIST_ENTRY = 411<br />
MYLIST_UNAVAILABLE = 412<br />
<br />
LOGIN_FAILED = 500<br />
LOGIN_FIRST = 501<br />
ACCESS_DENIED = 502<br />
CLIENT_VERSION_OUTDATED = 503<br />
CLIENT_BANNED = 504<br />
ILLEGAL_INPUT_OR_ACCESS_DENIED = 505<br />
INVALID_SESSION = 506<br />
NO_SUCH_ENCRYPTION_TYPE = 509<br />
ENCODING_NOT_SUPPORTED = 519<br />
BANNED = 555<br />
UNKNOWN_COMMAND = 598<br />
<br />
INTERNAL_SERVER_ERROR = 600<br />
ANIDB_OUT_OF_SERVICE = 601<br />
SERVER_BUSY = 602<br />
NO_DATA = 603<br />
TIMEOUT - DELAY AND RESUBMIT = 604<br />
API_VIOLATION = 666<br />
<br />
PUSHACK_CONFIRMED = 701<br />
NO_SUCH_PACKET_PENDING = 702<br />
<br />
VERSION = 998</pre><br />
<br />
[[Category:Development]]<br />
[[Category:UDP]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=HTTP_API_Definition&diff=18303HTTP API Definition2015-02-23T05:56:02Z<p>Ommina: </p>
<hr />
<div>{{TOCright}}<br />
<br />
{{eyecatch|Important!|2015-02-23<br />
<br />
Portions of the HTTP API have changed! A new version of the HTTP API will be deployed. The primary change are the transition to the new tag design, rolled out late last year.<br />
<br />
A fair bit has changed. While some concessions have been made to avoid breaking existing clients, such concessions will only last a number of weeks, not forever. Outdated nodes and attributes are scheduled to be removed on or very near 2015-06-01 (roughly three months from now.)<br />
<br />
So far:<br />
<br />
*<categories> will continue to be returned ''as is''. Later, will be removed entirely.<br />
*<tags> attribute 'spoiler' will be fixed to '''false'''. Later, will be removed entirely.<br />
*<tags> attribute 'approval' will be fixed to '''100'''. Later, will be removed entirely.<br />
*<tags> node 'count' will have a fixed content of '''1'''. Later, will be removed entirely.<br />
*The command 'categorylist' will continue to work ''as is''. Later, will be removed entirely.<br />
<br />
The 'id', 'localspoiler', 'globalspoiler' and 'updated' attributes, 'name' and 'description' nodes will remain.<br />
<br />
If your client is going to blow up with the removal of the above values, please considering taking this opportunity to make it less blowupy. }}<br />
<br />
== General ==<br />
The HTTP XML API is only a small part of the AniDB API framework, please refer to [[API]] for an overview.<br />
<br />
=== Clients ===<br />
<br />
If you want to create a client you have to register it {{AniDBLink|client|here}} and [[HTTP / UDP Clients|here]].<br />
<br />
=== Encoding ===<br />
All content is UTF8 encoded and gzip compressed (you may have to handle the decompressing yourself, if your HTTP library doesn't support compression of HTTP data). Transfer is in chunks, which are part of HTTP 1.1. This is the case even when your client requested uncompressed HTTP 1.0.<br />
<br />
=== Flooding and Caching ===<br />
All users of this API should employ heavy local caching. Requesting the same dataset multiple times on a single day can get you banned. The same goes for request flooding. You should not request more than one page every two seconds on average.<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Parameters ===<br />
These parameters apply to all HTTP XML API pages and should always be added to the request URLs.<br />
<br />
All users of the HTTP XML API need to be registered and have to provide their registered client identifier and version number on each request.<br />
<br />
Parameters:<br />
* <tt>client={string}</tt> [required]<br />
** client identification string, needs to be a registered client identifier, see: <br />
<br />
* <tt>clientver={integer}</tt> [required]<br />
** client version number, needs to be valid client version number for the given client identification string.<br />
<br />
* <tt>protover={integer}</tt> [required]<br />
** protocol version in use. Possible values: 1<br />
<br />
* <tt>request={string}</tt> [required]<br />
** HTTP XML datapage requested. See following sections.<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1</nowiki></u><br />
<br />
== Data Commands ==<br />
<br />
=== Anime ===<br />
Allows retrieval of non-file or episode related information for a specific anime by AID (AniDB anime id).<br />
<br />
==== Search ====<br />
* [[API#Anime_Titles|Look here]]<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=anime</tt><br />
* <tt>aid={integer}</tt> [required]<br />
** AniDB anime id of the anime you want to retrieve data for.<br />
<br />
<br />
{{eyecatch|Note|The tags node presently contains both 'spoiler' and 'localspoiler' attributes. Both represent the same value. Clients should use 'localspoiler'; in time, 'spoiler' will be removed.}}<br />
<br />
<br />
{{eyecatch|Important!|The meaning of the <temporary> vote node has changed since the HTTP API was put in place. To help keep clients compatible, the node will not be removed short term, but client consumers should be aware that this value now represents the mean of all votes (both permanent and temporary).}}<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime&client={str}&clientver={int}&protover=1&aid={int}</nowiki></u><br />
<br />
===== Data =====<br />
<code><pre><br />
<?xml version="1.0" encoding="UTF-8"?><br />
<anime id="1" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>1999-01-04</startdate><br />
<enddate>1999-03-29</enddate><br />
<titles><br />
<title xml:lang="x-jat" type="main">Seikai no Monshou</title><br />
<title xml:lang="zh-Hans" type="syn">星界之纹章</title><br />
<title xml:lang="en" type="short">CotS</title><br />
<title xml:lang="x-jat" type="short">SnM</title><br />
<title xml:lang="ja" type="official">星界の紋章</title><br />
<title xml:lang="en" type="official">Crest of the Stars</title><br />
<title xml:lang="fr" type="official">Crest of the Stars</title><br />
<title xml:lang="pl" type="official">Crest of the Stars</title><br />
</titles><br />
<relatedanime><br />
<anime id="4" type="Sequel">Seikai no Senki</anime><br />
<anime id="6" type="Prequel">Seikai no Danshou</anime><br />
<anime id="1623" type="Summary">Seikai no Monshou Tokubetsuhen</anime><br />
</relatedanime><br />
<url>http://www.sunrise-inc.co.jp/seikai/</url><br />
<creators><br />
<name id="4495" type="Original Work">Morioka Hiroyuki</name><br />
</creators><br />
<description>Jinto Lin`s life changes forever when the Humankind Empire Abh takes over his home planet of Martine without firing a single shot. He is soon sent off to study the Abh language and culture and to prepare himself for his future as a nobleman — a future he never dreamed of. Or wanted.Now, Jinto is entering the next phase of his training, and he is about to meet his first Abh, the lovely Lafiel. But Jinto is about to learn that she is more than she appears to be. And together they will have to fight for their very lives.</description><br />
<ratings><br />
<permanent count="2953">8.53</permanent><br />
<temporary count="96">7.58</temporary><br />
<review count="11">8.75</review><br />
</ratings><br />
<picture>440.jpg</picture><br />
<categories><br />
<category id="174" parentid="8" hentai="false" weight="500"><br />
<name>Space Travel</name><br />
<description>Space Travel usually refers going to space or travelling there with or without a spacecraft. There are different forms of space travel like Interplanetary travel, Interstellar travel or Intergalactic travel. Since it isn`t possible to travel faster than light, most anime series involve some sort "sub-space travel mechanism" as a way to travel faster than light.</description><br />
</category><br />
<category id="274" parentid="268" hentai="false" weight="400"><br />
<name>Novel</name><br />
<description>Note that novel means book with words in paper, so no comics and no "visual novels", which should go under manga and dating-sim - visual Novel/erotic game respectively.&#13;<br />
&#13;<br />
Note that it can be applied to novels as we know them but also the typical light novels for teens and young adults, which are common in Japan and aside from being short include a number of illustrations. </description><br />
</category><br />
</categories><br />
<tags><br />
<tag id="136" approval="20" spoiler="false" update="2009-05-23"><br />
<name>space opera</name><br />
<count>71</count><br />
</tag><br />
<tag id="175" approval="17" spoiler="false" update="2008-03-13"><br />
<name>space elves</name><br />
<count>12</count><br />
</tag><br />
<tag id="389" approval="15" spoiler="false" update="2008-06-03"><br />
<name>war setting</name><br />
<count>64</count><br />
</tag><br />
<tag id="393" approval="18" spoiler="false" update="2008-06-03"><br />
<name>space battles</name><br />
<count>43</count><br />
<description>There are space battles in this anime. Usually between Earth forces and some alien invader, but ship to ship skirmishes in deep space are just as common.</description><br />
</tag><br />
</tags><br />
<characters><br />
<character id="7493" type="appears in" update="2009-05-28"><br />
<name>Gosroth</name><br />
<description>The Resii Gothroth.The first Abh ship lost in the war.</description><br />
<episodes>1,1012</episodes><br />
<picture>26147.jpg</picture><br />
</character><br />
<character id="7501" type="appears in" update="2009-05-28"><br />
<name>Planet Martine</name><br />
<description>The homeworld of Jinto</description><br />
<episodes>1</episodes><br />
</character><br />
<character id="7503" type="appears in" update="2009-05-28"><br />
<name>Rock Lynn</name><br />
<description>The former president of Martine, later made count of the Hyde system, after striking a deal with the Abh (in episode 1)</description><br />
<episodes>1</episodes><br />
<picture>26165.jpg</picture><br />
</character><br />
</characters><br />
<episodes><br />
<episode id="1" update="2005-03-10"><br />
<epno>1</epno><br />
<length>24</length><br />
<airdate>1999-01-03</airdate><br />
<rating votes="17">5.66</rating><br />
<title xml:lang="ja">侵略</title><br />
<title xml:lang="en">Invasion</title><br />
<title xml:lang="fr">Invasion</title><br />
<title xml:lang="x-jat">shinryaku</title><br />
</episode><br />
<episode id="2" update="2005-03-11"><br />
<epno>2</epno><br />
<length>24</length><br />
<airdate>1999-01-10</airdate><br />
<rating votes="12">6.66</rating><br />
<title xml:lang="ja">星たちの眷族</title><br />
<title xml:lang="en">Kin of the Stars</title><br />
<title xml:lang="fr">Les parents des Étoiles</title><br />
<title xml:lang="x-jat">Hoshi-tachi no Kenzoku</title><br />
</episode><br />
</episodes><br />
</anime><br />
</pre></code><br />
<br />
==== Errors ====<br />
[http://anidb.net/perl-bin/animedb.pl?show=cmt&post=159118 According to ommina] the API does not use HTTP return code. Instead you will get XML consisting of one tag with a textual description.<br />
<code><pre><br />
<error>Banned</error><br />
</pre></code><br />
<br />
=== Random Recommendation ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random recommendations' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomrecommendation</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomrecommendation</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomrecommendation</nowiki></u><br />
<br />
<code><pre><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="7899" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>2010-10-04</startdate><br />
<enddate>2010-12-27</enddate><br />
<title xml:lang="x-jat" type="main">Arakawa Under the Bridge 2</title><br />
<picture>54734.jpg</picture><br />
<ratings><br />
<permanent count="781">623</permanent><br />
<recommendations>8</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
...<br />
<br />
<randomrecommendation><br />
</pre></code><br />
<br />
=== Random Similar ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random similar' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomsimilar</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomsimilar</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomsimilar</nowiki></u><br />
<br />
<code><pre><br />
<randomsimilar><br />
<similar><br />
<source aid="7056" restricted="false"><br />
<title xml:lang="x-jat" type="main">Aoi Bungaku Series</title><br />
<picture>37124.jpg</picture><br />
</source><br />
<target aid="3654" restricted="false"><br />
<title xml:lang="x-jat" type="main">Ayakashi: Japanese Classic Horror</title><br />
<picture>44085.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
</randomsimilar><br />
</pre></code><br />
<br />
=== Hot Anime ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Unlike the two random result commands, the results here will match the results as supplied by the main web page (with some possible variance of a few hours, depending on cache life.)<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=hotanime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=hotanime</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=hotanime</nowiki></u><br />
<br />
<code><pre><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
</pre></code><br />
<br />
=== Main ===<br />
<br />
A one-stop command returning the combined results of random recommendation, random similar, and hot anime. Use this command instead of scraping the HTML, and if you need more than one of the individual replies.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=main</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=main</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=main</nowiki></u><br />
<br />
<code><pre><br />
<main><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
<randomsimilar><br />
<similar><br />
<source aid="8107" restricted="false"><br />
<title xml:lang="x-jat" type="main">A Channel: The Animation</title><br />
<picture>59870.jpg</picture><br />
</source><br />
<target aid="4777" restricted="false"><br />
<title xml:lang="x-jat" type="main">Lucky Star</title><br />
<picture>65555.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
<randomsimilar><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="44" restricted="false"><br />
<type>OVA</type><br />
<episodecount>1</episodecount><br />
<startdate>2000-05-24</startdate><br />
<enddate>2000-05-24</enddate><br />
<title xml:lang="x-jat" type="main">Amon Devilman Mokushiroku</title><br />
<picture>14016.jpg</picture><br />
<ratings><br />
<permanent count="317">387</permanent><br />
<recommendations>1</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
....<br />
<br />
</randomrecommendation><br />
</main><br />
</pre></code><br />
<br />
== User Data Commands ==<br />
<br />
=== User Mylist Summary ===<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=mylistsummary&user={str anidb username}&pass={str anidb password}</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=mylistsummary</tt><br />
** Returns a list of the user's anime list in summary form, roughly matching the data in the "my list" page of the web interface.<br />
* <tt>user={str username}&pass={str password}</tt><br />
** The user name and password of the desired user. This is their main password, not the API password specified in the profile.<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=mylistsummary&user={str}&pass={str}</nowiki></u><br />
<br />
<code><pre><br />
<mylistsummary uid="40237"><br />
<mylistitem aid="5841" state="2"><br />
<episodecount>22</episodecount><br />
<seencount>22</seencount><br />
<specialcount>9</specialcount><br />
<seenspecialcount>4</seenspecialcount><br />
</mylistitem><br />
<mylistsummary><br />
</pre></code><br />
<br />
[[Category:Development]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=HTTP_API_Definition&diff=18284HTTP API Definition2015-02-20T08:43:04Z<p>Ommina: </p>
<hr />
<div>{{TOCright}}<br />
<br />
{{eyecatch|Important!|2015-02-20<br />
<br />
Portions of the HTTP API are changing! Sometime over the next two days, a new version of the HTTP API will be deployed. The primary change will be the transition to the new tag design, rolled out late last year.<br />
<br />
A fair bit is changing. While some concessions are being made to avoid breaking existing clients, such concessions will only last a number of weeks, not forever.<br />
<br />
So far:<br />
<br />
*<categories> will continue to be returned ''as is''. Later, will be removed entirely.<br />
*<tags> attribute 'spoiler' will be fixed to '''false'''. Later, will be removed entirely.<br />
*<tags> attribute 'approval' will be fixed to '''100'''. Later, will be removed entirely.<br />
*<tags> node 'count' will have a fixed content of '''1'''. Later, will be removed entirely.<br />
*The command 'categorylist' will continue to work ''as is''. Later, will be removed entirely.<br />
<br />
The 'id', 'localspoiler', 'globalspoiler' and 'updated' attributes, 'name' and 'description' nodes will remain.<br />
<br />
If your client is going to blow up with the removal of the above values, please considering taking this opportunity to make it less blowupy. }}<br />
<br />
== General ==<br />
The HTTP XML API is only a small part of the AniDB API framework, please refer to [[API]] for an overview.<br />
<br />
=== Clients ===<br />
<br />
If you want to create a client you have to register it {{AniDBLink|client|here}} and [[HTTP / UDP Clients|here]].<br />
<br />
=== Encoding ===<br />
All content is UTF8 encoded and gzip compressed (you may have to handle the decompressing yourself, if your HTTP library doesn't support compression of HTTP data). Transfer is in chunks, which are part of HTTP 1.1. This is the case even when your client requested uncompressed HTTP 1.0.<br />
<br />
=== Flooding and Caching ===<br />
All users of this API should employ heavy local caching. Requesting the same dataset multiple times on a single day can get you banned. The same goes for request flooding. You should not request more than one page every two seconds on average.<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Parameters ===<br />
These parameters apply to all HTTP XML API pages and should always be added to the request URLs.<br />
<br />
All users of the HTTP XML API need to be registered and have to provide their registered client identifier and version number on each request.<br />
<br />
Parameters:<br />
* <tt>client={string}</tt> [required]<br />
** client identification string, needs to be a registered client identifier, see: <br />
<br />
* <tt>clientver={integer}</tt> [required]<br />
** client version number, needs to be valid client version number for the given client identification string.<br />
<br />
* <tt>protover={integer}</tt> [required]<br />
** protocol version in use. Possible values: 1<br />
<br />
* <tt>request={string}</tt> [required]<br />
** HTTP XML datapage requested. See following sections.<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1</nowiki></u><br />
<br />
== Data Commands ==<br />
<br />
=== Anime ===<br />
Allows retrieval of non-file or episode related information for a specific anime by AID (AniDB anime id).<br />
<br />
==== Search ====<br />
* [[API#Anime_Titles|Look here]]<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=anime</tt><br />
* <tt>aid={integer}</tt> [required]<br />
** AniDB anime id of the anime you want to retrieve data for.<br />
<br />
<br />
{{eyecatch|Note|The tags node presently contains both 'spoiler' and 'localspoiler' attributes. Both represent the same value. Clients should use 'localspoiler'; in time, 'spoiler' will be removed.}}<br />
<br />
<br />
{{eyecatch|Important!|The meaning of the <temporary> vote node has changed since the HTTP API was put in place. To help keep clients compatible, the node will not be removed short term, but client consumers should be aware that this value now represents the mean of all votes (both permanent and temporary).}}<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime&client={str}&clientver={int}&protover=1&aid={int}</nowiki></u><br />
<br />
===== Data =====<br />
<code><pre><br />
<?xml version="1.0" encoding="UTF-8"?><br />
<anime id="1" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>1999-01-04</startdate><br />
<enddate>1999-03-29</enddate><br />
<titles><br />
<title xml:lang="x-jat" type="main">Seikai no Monshou</title><br />
<title xml:lang="zh-Hans" type="syn">星界之纹章</title><br />
<title xml:lang="en" type="short">CotS</title><br />
<title xml:lang="x-jat" type="short">SnM</title><br />
<title xml:lang="ja" type="official">星界の紋章</title><br />
<title xml:lang="en" type="official">Crest of the Stars</title><br />
<title xml:lang="fr" type="official">Crest of the Stars</title><br />
<title xml:lang="pl" type="official">Crest of the Stars</title><br />
</titles><br />
<relatedanime><br />
<anime id="4" type="Sequel">Seikai no Senki</anime><br />
<anime id="6" type="Prequel">Seikai no Danshou</anime><br />
<anime id="1623" type="Summary">Seikai no Monshou Tokubetsuhen</anime><br />
</relatedanime><br />
<url>http://www.sunrise-inc.co.jp/seikai/</url><br />
<creators><br />
<name id="4495" type="Original Work">Morioka Hiroyuki</name><br />
</creators><br />
<description>Jinto Lin`s life changes forever when the Humankind Empire Abh takes over his home planet of Martine without firing a single shot. He is soon sent off to study the Abh language and culture and to prepare himself for his future as a nobleman — a future he never dreamed of. Or wanted.Now, Jinto is entering the next phase of his training, and he is about to meet his first Abh, the lovely Lafiel. But Jinto is about to learn that she is more than she appears to be. And together they will have to fight for their very lives.</description><br />
<ratings><br />
<permanent count="2953">8.53</permanent><br />
<temporary count="96">7.58</temporary><br />
<review count="11">8.75</review><br />
</ratings><br />
<picture>440.jpg</picture><br />
<categories><br />
<category id="174" parentid="8" hentai="false" weight="500"><br />
<name>Space Travel</name><br />
<description>Space Travel usually refers going to space or travelling there with or without a spacecraft. There are different forms of space travel like Interplanetary travel, Interstellar travel or Intergalactic travel. Since it isn`t possible to travel faster than light, most anime series involve some sort "sub-space travel mechanism" as a way to travel faster than light.</description><br />
</category><br />
<category id="274" parentid="268" hentai="false" weight="400"><br />
<name>Novel</name><br />
<description>Note that novel means book with words in paper, so no comics and no "visual novels", which should go under manga and dating-sim - visual Novel/erotic game respectively.&#13;<br />
&#13;<br />
Note that it can be applied to novels as we know them but also the typical light novels for teens and young adults, which are common in Japan and aside from being short include a number of illustrations. </description><br />
</category><br />
</categories><br />
<tags><br />
<tag id="136" approval="20" spoiler="false" update="2009-05-23"><br />
<name>space opera</name><br />
<count>71</count><br />
</tag><br />
<tag id="175" approval="17" spoiler="false" update="2008-03-13"><br />
<name>space elves</name><br />
<count>12</count><br />
</tag><br />
<tag id="389" approval="15" spoiler="false" update="2008-06-03"><br />
<name>war setting</name><br />
<count>64</count><br />
</tag><br />
<tag id="393" approval="18" spoiler="false" update="2008-06-03"><br />
<name>space battles</name><br />
<count>43</count><br />
<description>There are space battles in this anime. Usually between Earth forces and some alien invader, but ship to ship skirmishes in deep space are just as common.</description><br />
</tag><br />
</tags><br />
<characters><br />
<character id="7493" type="appears in" update="2009-05-28"><br />
<name>Gosroth</name><br />
<description>The Resii Gothroth.The first Abh ship lost in the war.</description><br />
<episodes>1,1012</episodes><br />
<picture>26147.jpg</picture><br />
</character><br />
<character id="7501" type="appears in" update="2009-05-28"><br />
<name>Planet Martine</name><br />
<description>The homeworld of Jinto</description><br />
<episodes>1</episodes><br />
</character><br />
<character id="7503" type="appears in" update="2009-05-28"><br />
<name>Rock Lynn</name><br />
<description>The former president of Martine, later made count of the Hyde system, after striking a deal with the Abh (in episode 1)</description><br />
<episodes>1</episodes><br />
<picture>26165.jpg</picture><br />
</character><br />
</characters><br />
<episodes><br />
<episode id="1" update="2005-03-10"><br />
<epno>1</epno><br />
<length>24</length><br />
<airdate>1999-01-03</airdate><br />
<rating votes="17">5.66</rating><br />
<title xml:lang="ja">侵略</title><br />
<title xml:lang="en">Invasion</title><br />
<title xml:lang="fr">Invasion</title><br />
<title xml:lang="x-jat">shinryaku</title><br />
</episode><br />
<episode id="2" update="2005-03-11"><br />
<epno>2</epno><br />
<length>24</length><br />
<airdate>1999-01-10</airdate><br />
<rating votes="12">6.66</rating><br />
<title xml:lang="ja">星たちの眷族</title><br />
<title xml:lang="en">Kin of the Stars</title><br />
<title xml:lang="fr">Les parents des Étoiles</title><br />
<title xml:lang="x-jat">Hoshi-tachi no Kenzoku</title><br />
</episode><br />
</episodes><br />
</anime><br />
</pre></code><br />
<br />
==== Errors ====<br />
[http://anidb.net/perl-bin/animedb.pl?show=cmt&post=159118 According to ommina] the API does not use HTTP return code. Instead you will get XML consisting of one tag with a textual description.<br />
<code><pre><br />
<error>Banned</error><br />
</pre></code><br />
<br />
=== Random Recommendation ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random recommendations' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomrecommendation</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomrecommendation</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomrecommendation</nowiki></u><br />
<br />
<code><pre><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="7899" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>2010-10-04</startdate><br />
<enddate>2010-12-27</enddate><br />
<title xml:lang="x-jat" type="main">Arakawa Under the Bridge 2</title><br />
<picture>54734.jpg</picture><br />
<ratings><br />
<permanent count="781">623</permanent><br />
<recommendations>8</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
...<br />
<br />
<randomrecommendation><br />
</pre></code><br />
<br />
=== Random Similar ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random similar' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomsimilar</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomsimilar</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomsimilar</nowiki></u><br />
<br />
<code><pre><br />
<randomsimilar><br />
<similar><br />
<source aid="7056" restricted="false"><br />
<title xml:lang="x-jat" type="main">Aoi Bungaku Series</title><br />
<picture>37124.jpg</picture><br />
</source><br />
<target aid="3654" restricted="false"><br />
<title xml:lang="x-jat" type="main">Ayakashi: Japanese Classic Horror</title><br />
<picture>44085.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
</randomsimilar><br />
</pre></code><br />
<br />
=== Hot Anime ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Unlike the two random result commands, the results here will match the results as supplied by the main web page (with some possible variance of a few hours, depending on cache life.)<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=hotanime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=hotanime</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=hotanime</nowiki></u><br />
<br />
<code><pre><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
</pre></code><br />
<br />
=== Main ===<br />
<br />
A one-stop command returning the combined results of random recommendation, random similar, and hot anime. Use this command instead of scraping the HTML, and if you need more than one of the individual replies.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=main</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=main</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=main</nowiki></u><br />
<br />
<code><pre><br />
<main><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
<randomsimilar><br />
<similar><br />
<source aid="8107" restricted="false"><br />
<title xml:lang="x-jat" type="main">A Channel: The Animation</title><br />
<picture>59870.jpg</picture><br />
</source><br />
<target aid="4777" restricted="false"><br />
<title xml:lang="x-jat" type="main">Lucky Star</title><br />
<picture>65555.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
<randomsimilar><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="44" restricted="false"><br />
<type>OVA</type><br />
<episodecount>1</episodecount><br />
<startdate>2000-05-24</startdate><br />
<enddate>2000-05-24</enddate><br />
<title xml:lang="x-jat" type="main">Amon Devilman Mokushiroku</title><br />
<picture>14016.jpg</picture><br />
<ratings><br />
<permanent count="317">387</permanent><br />
<recommendations>1</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
....<br />
<br />
</randomrecommendation><br />
</main><br />
</pre></code><br />
<br />
== User Data Commands ==<br />
<br />
=== User Mylist Summary ===<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=mylistsummary&user={str anidb username}&pass={str anidb password}</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=mylistsummary</tt><br />
** Returns a list of the user's anime list in summary form, roughly matching the data in the "my list" page of the web interface.<br />
* <tt>user={str username}&pass={str password}</tt><br />
** The user name and password of the desired user. This is their main password, not the API password specified in the profile.<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=mylistsummary&user={str}&pass={str}</nowiki></u><br />
<br />
<code><pre><br />
<mylistsummary uid="40237"><br />
<mylistitem aid="5841" state="2"><br />
<episodecount>22</episodecount><br />
<seencount>22</seencount><br />
<specialcount>9</specialcount><br />
<seenspecialcount>4</seenspecialcount><br />
</mylistitem><br />
<mylistsummary><br />
</pre></code><br />
<br />
[[Category:Development]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=HTTP_API_Definition&diff=18283HTTP API Definition2015-02-20T07:46:10Z<p>Ommina: /* Category List */</p>
<hr />
<div>{{TOCright}}<br />
<br />
== General ==<br />
The HTTP XML API is only a small part of the AniDB API framework, please refer to [[API]] for an overview.<br />
<br />
=== Clients ===<br />
<br />
If you want to create a client you have to register it {{AniDBLink|client|here}} and [[HTTP / UDP Clients|here]].<br />
<br />
=== Encoding ===<br />
All content is UTF8 encoded and gzip compressed (you may have to handle the decompressing yourself, if your HTTP library doesn't support compression of HTTP data). Transfer is in chunks, which are part of HTTP 1.1. This is the case even when your client requested uncompressed HTTP 1.0.<br />
<br />
=== Flooding and Caching ===<br />
All users of this API should employ heavy local caching. Requesting the same dataset multiple times on a single day can get you banned. The same goes for request flooding. You should not request more than one page every two seconds on average.<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Parameters ===<br />
These parameters apply to all HTTP XML API pages and should always be added to the request URLs.<br />
<br />
All users of the HTTP XML API need to be registered and have to provide their registered client identifier and version number on each request.<br />
<br />
Parameters:<br />
* <tt>client={string}</tt> [required]<br />
** client identification string, needs to be a registered client identifier, see: <br />
<br />
* <tt>clientver={integer}</tt> [required]<br />
** client version number, needs to be valid client version number for the given client identification string.<br />
<br />
* <tt>protover={integer}</tt> [required]<br />
** protocol version in use. Possible values: 1<br />
<br />
* <tt>request={string}</tt> [required]<br />
** HTTP XML datapage requested. See following sections.<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1</nowiki></u><br />
<br />
== Data Commands ==<br />
<br />
=== Anime ===<br />
Allows retrieval of non-file or episode related information for a specific anime by AID (AniDB anime id).<br />
<br />
==== Search ====<br />
* [[API#Anime_Titles|Look here]]<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=anime</tt><br />
* <tt>aid={integer}</tt> [required]<br />
** AniDB anime id of the anime you want to retrieve data for.<br />
<br />
<br />
{{eyecatch|Note|The tags node presently contains both 'spoiler' and 'localspoiler' attributes. Both represent the same value. Clients should use 'localspoiler'; in time, 'spoiler' will be removed.}}<br />
<br />
<br />
{{eyecatch|Important!|The meaning of the <temporary> vote node has changed since the HTTP API was put in place. To help keep clients compatible, the node will not be removed short term, but client consumers should be aware that this value now represents the mean of all votes (both permanent and temporary).}}<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime&client={str}&clientver={int}&protover=1&aid={int}</nowiki></u><br />
<br />
===== Data =====<br />
<code><pre><br />
<?xml version="1.0" encoding="UTF-8"?><br />
<anime id="1" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>1999-01-04</startdate><br />
<enddate>1999-03-29</enddate><br />
<titles><br />
<title xml:lang="x-jat" type="main">Seikai no Monshou</title><br />
<title xml:lang="zh-Hans" type="syn">星界之纹章</title><br />
<title xml:lang="en" type="short">CotS</title><br />
<title xml:lang="x-jat" type="short">SnM</title><br />
<title xml:lang="ja" type="official">星界の紋章</title><br />
<title xml:lang="en" type="official">Crest of the Stars</title><br />
<title xml:lang="fr" type="official">Crest of the Stars</title><br />
<title xml:lang="pl" type="official">Crest of the Stars</title><br />
</titles><br />
<relatedanime><br />
<anime id="4" type="Sequel">Seikai no Senki</anime><br />
<anime id="6" type="Prequel">Seikai no Danshou</anime><br />
<anime id="1623" type="Summary">Seikai no Monshou Tokubetsuhen</anime><br />
</relatedanime><br />
<url>http://www.sunrise-inc.co.jp/seikai/</url><br />
<creators><br />
<name id="4495" type="Original Work">Morioka Hiroyuki</name><br />
</creators><br />
<description>Jinto Lin`s life changes forever when the Humankind Empire Abh takes over his home planet of Martine without firing a single shot. He is soon sent off to study the Abh language and culture and to prepare himself for his future as a nobleman — a future he never dreamed of. Or wanted.Now, Jinto is entering the next phase of his training, and he is about to meet his first Abh, the lovely Lafiel. But Jinto is about to learn that she is more than she appears to be. And together they will have to fight for their very lives.</description><br />
<ratings><br />
<permanent count="2953">8.53</permanent><br />
<temporary count="96">7.58</temporary><br />
<review count="11">8.75</review><br />
</ratings><br />
<picture>440.jpg</picture><br />
<categories><br />
<category id="174" parentid="8" hentai="false" weight="500"><br />
<name>Space Travel</name><br />
<description>Space Travel usually refers going to space or travelling there with or without a spacecraft. There are different forms of space travel like Interplanetary travel, Interstellar travel or Intergalactic travel. Since it isn`t possible to travel faster than light, most anime series involve some sort "sub-space travel mechanism" as a way to travel faster than light.</description><br />
</category><br />
<category id="274" parentid="268" hentai="false" weight="400"><br />
<name>Novel</name><br />
<description>Note that novel means book with words in paper, so no comics and no "visual novels", which should go under manga and dating-sim - visual Novel/erotic game respectively.&#13;<br />
&#13;<br />
Note that it can be applied to novels as we know them but also the typical light novels for teens and young adults, which are common in Japan and aside from being short include a number of illustrations. </description><br />
</category><br />
</categories><br />
<tags><br />
<tag id="136" approval="20" spoiler="false" update="2009-05-23"><br />
<name>space opera</name><br />
<count>71</count><br />
</tag><br />
<tag id="175" approval="17" spoiler="false" update="2008-03-13"><br />
<name>space elves</name><br />
<count>12</count><br />
</tag><br />
<tag id="389" approval="15" spoiler="false" update="2008-06-03"><br />
<name>war setting</name><br />
<count>64</count><br />
</tag><br />
<tag id="393" approval="18" spoiler="false" update="2008-06-03"><br />
<name>space battles</name><br />
<count>43</count><br />
<description>There are space battles in this anime. Usually between Earth forces and some alien invader, but ship to ship skirmishes in deep space are just as common.</description><br />
</tag><br />
</tags><br />
<characters><br />
<character id="7493" type="appears in" update="2009-05-28"><br />
<name>Gosroth</name><br />
<description>The Resii Gothroth.The first Abh ship lost in the war.</description><br />
<episodes>1,1012</episodes><br />
<picture>26147.jpg</picture><br />
</character><br />
<character id="7501" type="appears in" update="2009-05-28"><br />
<name>Planet Martine</name><br />
<description>The homeworld of Jinto</description><br />
<episodes>1</episodes><br />
</character><br />
<character id="7503" type="appears in" update="2009-05-28"><br />
<name>Rock Lynn</name><br />
<description>The former president of Martine, later made count of the Hyde system, after striking a deal with the Abh (in episode 1)</description><br />
<episodes>1</episodes><br />
<picture>26165.jpg</picture><br />
</character><br />
</characters><br />
<episodes><br />
<episode id="1" update="2005-03-10"><br />
<epno>1</epno><br />
<length>24</length><br />
<airdate>1999-01-03</airdate><br />
<rating votes="17">5.66</rating><br />
<title xml:lang="ja">侵略</title><br />
<title xml:lang="en">Invasion</title><br />
<title xml:lang="fr">Invasion</title><br />
<title xml:lang="x-jat">shinryaku</title><br />
</episode><br />
<episode id="2" update="2005-03-11"><br />
<epno>2</epno><br />
<length>24</length><br />
<airdate>1999-01-10</airdate><br />
<rating votes="12">6.66</rating><br />
<title xml:lang="ja">星たちの眷族</title><br />
<title xml:lang="en">Kin of the Stars</title><br />
<title xml:lang="fr">Les parents des Étoiles</title><br />
<title xml:lang="x-jat">Hoshi-tachi no Kenzoku</title><br />
</episode><br />
</episodes><br />
</anime><br />
</pre></code><br />
<br />
==== Errors ====<br />
[http://anidb.net/perl-bin/animedb.pl?show=cmt&post=159118 According to ommina] the API does not use HTTP return code. Instead you will get XML consisting of one tag with a textual description.<br />
<code><pre><br />
<error>Banned</error><br />
</pre></code><br />
<br />
=== Random Recommendation ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random recommendations' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomrecommendation</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomrecommendation</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomrecommendation</nowiki></u><br />
<br />
<code><pre><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="7899" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>2010-10-04</startdate><br />
<enddate>2010-12-27</enddate><br />
<title xml:lang="x-jat" type="main">Arakawa Under the Bridge 2</title><br />
<picture>54734.jpg</picture><br />
<ratings><br />
<permanent count="781">623</permanent><br />
<recommendations>8</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
...<br />
<br />
<randomrecommendation><br />
</pre></code><br />
<br />
=== Random Similar ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random similar' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomsimilar</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomsimilar</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomsimilar</nowiki></u><br />
<br />
<code><pre><br />
<randomsimilar><br />
<similar><br />
<source aid="7056" restricted="false"><br />
<title xml:lang="x-jat" type="main">Aoi Bungaku Series</title><br />
<picture>37124.jpg</picture><br />
</source><br />
<target aid="3654" restricted="false"><br />
<title xml:lang="x-jat" type="main">Ayakashi: Japanese Classic Horror</title><br />
<picture>44085.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
</randomsimilar><br />
</pre></code><br />
<br />
=== Hot Anime ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Unlike the two random result commands, the results here will match the results as supplied by the main web page (with some possible variance of a few hours, depending on cache life.)<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=hotanime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=hotanime</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=hotanime</nowiki></u><br />
<br />
<code><pre><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
</pre></code><br />
<br />
=== Main ===<br />
<br />
A one-stop command returning the combined results of random recommendation, random similar, and hot anime. Use this command instead of scraping the HTML, and if you need more than one of the individual replies.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=main</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=main</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=main</nowiki></u><br />
<br />
<code><pre><br />
<main><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
<randomsimilar><br />
<similar><br />
<source aid="8107" restricted="false"><br />
<title xml:lang="x-jat" type="main">A Channel: The Animation</title><br />
<picture>59870.jpg</picture><br />
</source><br />
<target aid="4777" restricted="false"><br />
<title xml:lang="x-jat" type="main">Lucky Star</title><br />
<picture>65555.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
<randomsimilar><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="44" restricted="false"><br />
<type>OVA</type><br />
<episodecount>1</episodecount><br />
<startdate>2000-05-24</startdate><br />
<enddate>2000-05-24</enddate><br />
<title xml:lang="x-jat" type="main">Amon Devilman Mokushiroku</title><br />
<picture>14016.jpg</picture><br />
<ratings><br />
<permanent count="317">387</permanent><br />
<recommendations>1</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
....<br />
<br />
</randomrecommendation><br />
</main><br />
</pre></code><br />
<br />
== User Data Commands ==<br />
<br />
=== User Mylist Summary ===<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=mylistsummary&user={str anidb username}&pass={str anidb password}</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=mylistsummary</tt><br />
** Returns a list of the user's anime list in summary form, roughly matching the data in the "my list" page of the web interface.<br />
* <tt>user={str username}&pass={str password}</tt><br />
** The user name and password of the desired user. This is their main password, not the API password specified in the profile.<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=mylistsummary&user={str}&pass={str}</nowiki></u><br />
<br />
<code><pre><br />
<mylistsummary uid="40237"><br />
<mylistitem aid="5841" state="2"><br />
<episodecount>22</episodecount><br />
<seencount>22</seencount><br />
<specialcount>9</specialcount><br />
<seenspecialcount>4</seenspecialcount><br />
</mylistitem><br />
<mylistsummary><br />
</pre></code><br />
<br />
[[Category:Development]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=Achievements_Dev_DataTables&diff=18259Achievements Dev DataTables2015-02-13T06:39:10Z<p>Ommina: Created page with "[WIP] ===The Situation=== Badges (achievements) are fun, popular, and motivating. However, to date, there has been considerable resistance to adding badges to the bulk of t..."</p>
<hr />
<div>[WIP]<br />
<br />
===The Situation===<br />
<br />
Badges (achievements) are fun, popular, and motivating. However, to date, there has been considerable resistance to adding badges to the bulk of the 'data entry' tables, out of fear that it would lead to an excessive number of poor (incomplete, or outright fictitious) records. This is a shame, as the motivating power of the badge could also be used to encourage additional inserts by users who would otherwise not bother.<br />
<br />
===The Proposal===<br />
<br />
In order to address the concerns over 'poor data', I propose to take a different approach to assigning data-entry based tags. In this revised system, instead of using a raw count of inserts, a subset of fields for the table would be required. In addition, the code would consider not only the base insert, but subsequent change requests created against it. For example, it might be determined that all characters should have a picture and a name. Thus, at runtime, only characters that have both (or, possibly, some percentage of) fields filled in would count as credit toward a badge.<br />
<br />
===The Problems===<br />
<br />
This comes with its own set of problems.<br />
<br />
*In order for ample time to be pass for a base record to be corrected (if necessary), considerable lag would be necessary between the record (character, for example) being created, and credit toward the badge being assigned. This time is likely to be counted in weeks. Such lag is almost certain to work against the motivating value of the badge itself.<br />
*As follow-up creqs would be considered, it becomes quite likely that multiple users would be involved. The decision then must be made which (if any) of the users gets credit for the entry.<br />
**Further, the type of creq is also a factor. While adding is easy, a change of data is not. If User-A adds a character with (perfectly acceptable) picture-1, and User-B changes the picture to (also acceptable, but better) picture-2, this should not invalidate the work of User-A. Nor can this be automatically determined: from the perspective of Badgers, both bits of data are equally good. The question then, again, becomes a question of who gets credit.<br />
<br />
Depending how strict we want to be, the third problem may well kill the idea outright. That's fine too.<br />
<br />
Closing note: The proposal is a work in progress, not a promise to implement. As such, I'm keeping discussion to a limited audience for now. Which is to say, I'm not posting it on the forum.<br />
<br />
Discuss.<br />
<br />
Yours in Chocolate Bunnies,<br />
<br />
--[[User:Ommina|ommina]] ([[User talk:Ommina|talk]]) 07:39, 13 February 2015 (CET)</div>Omminahttps://wiki.anidb.net/index.php?title=Talk:UDP_API_Definition&diff=18071Talk:UDP API Definition2014-09-23T00:20:53Z<p>Ommina: </p>
<hr />
<div>=== UPDATED: Get List of Updated Anime IDs ===<br />
Returns a list of AniDB anime ids of anime that have been updated in in a given time frame, ordered by descending date.<br />
<br />
'''Command String:'''<br />
* UPDATED entity=1&[age={int4 id}|time={int4 date}]<br />
<br />
'''Possible Replies:'''<br />
* 243 UPDATED<br />
{int entity}|{int total count}|{int last update date}|{list aid}<br />
<br />
* 343 NO UPDATES<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1<br />
* Either ''age'' OR ''time'' can be specified, but not both<br />
* ''age'' is specified in days.<br />
** eg: age=30 requests a list of aid values of anime that have changed in the past 30 days<br />
* ''time'' is specified in unix time.<br />
** eg: time=1264982400 requests a list of aid values of anime that have changed since 2010-02-01<br />
* A maximum of 200 values will be returned<br />
* ''count'' specifies the total number of items found for the given time period. In short, if this value is great than 200, you have not retrieved all applicable ids.<br />
* ''last update date'' will contain the AniDB update time of the ''last'' aid to appear on the list<br />
<br />
'''An anime will be considered updated if:'''<br />
* A change is made to the anime record itself<br />
* An ''main'' or ''official'' anime title is added, edited, or deleted (not ''short'' or ''synonym'')<br />
* An episode for the anime is added, or delete (but NOT edited!) ( --> But perhaps airdate changes should <-- )<br />
* An episode title is added, edited, or delete<br />
* An anime category is added, or deleted (but NOT edited: eg, weight change)<br />
* An anime relation is added, or deleted</div>Omminahttps://wiki.anidb.net/index.php?title=Avdump2&diff=17198Avdump22013-04-17T21:50:57Z<p>Ommina: /* Download */</p>
<hr />
<div>Welcome to the remarkably sparse avdump2 wiki page, lovingly hand created over many minutes + some more.<br />
<br />
We gleefully embrace build 6647, yet another public release of avd2. It represents a complete rewrite of the original avd1 code, runs against a new build of MediaInfoLibrary, contains a number of custom solutions for a number of formats, represents a significant investment of time and energy by Arokh, and is just generally nifty.<br />
<br />
There is no need to reprocess existing files with this build, but do keep an eye out for misbehaviour.<br />
<br />
==What is it==<br />
'''Avdump2''' is a video/audio codec identification utility - identifies which video codec and audio compression method is used on video files. Furthermore it hashes the file with a set of common hashalgorithms and calculates the used bit rates, the length, identifies the number of used audio channels and more.<br><br />
It, like its predecessor, is mainly based on [http://mediainfo.sourceforge.net/en mediainfo], but significantly enhanced and changed to fit AniDB's needs by [[User:Arokh|Arokh]].<br><br />
<br />
===Supported formats===<br />
Most major file formats are supported to some degree. While hashes are created for all file types, stream details remain shakey for others (notably 'swf'). Because of that for some filetypes (underlined) only the hashes get auto-creqed.<br />
<br />
* '''Video files:''' asf/wmv, avi, flv, m2ts, mk3d, mkv, mov, mp4, mpg/mpeg, ogm, ogv, qt, rm/rmvb, <u>swf</u>, ts, webm<br />
* '''Subtitle files:''' ass, idx, js, lrc, mks, pjs, rt, smi, srt, ssa, sub, sup, tmp, tts, txt, xss<br />
* '''Audio files:''' aac, ac3, dts, dtshd, flac, m4a, mka, mp3, ogg, ra, thd, wav, wma<br />
* '''Archive files:''' <u>7z</u>, <u>ace</u>, <u>rar</u>, <u>zip</u><br />
* '''Linker files:''' mkv, smil<br />
<br />
===Download===<br />
[http://static.anidb.net/client/avdump2/avdump2_6647.rar DOWNLOAD(RAR)] (Build 6647) MD5 = 23D05EC42409ED003138ADFDC06A2FEC<br />
<br />
===Usage===<br />
'''Avdump2''' is a simple [[Wikipedia:Command line interface|command line]] client:<br />
:<tt>AVDump2CL.exe [--<Arg> -<OneLetterArg> ...] <media file/folder> [<media file/folder> ...]</tt><br />
<br />
While pre 4991 build arguments can still be used, it is recommended to use the new format shown below.<br />
The easiest way to convert them to the new format is to run the program with the old args which then displays a notice and the corresponding args in the new format.<br />
<br />
====Options====<br />
{|align="center" style="border: 1px solid #aaaaaa; border-collapse: collapse; background: #f9f9f9; line-height: 1.0; font-size: small; width: 95%"<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Switch<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Type<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Description<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Default<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Example<br />
|-<br />
|'''Auth'''=<username>:<udp_api_key>||Auto-Creqing||Enable automatic creqing. You should always use this option when dumping anime files! Also enables error reporting.||||--Auth=tard:monkey<br />
|-<br />
|'''Host'''=<hostname>:<port>||Auto-Creqing||Hostname of AniDB UDP API server||--Host=api.anidb.info:9002||<br />
|-<br />
|'''LPort'''=<port>||Auto-Creqing||Local UDP port used for autocreqing. Only needed when behind "strict" firewalls.||||--LPort=12345<br />
|-<br />
|'''TOut'''=<timeoutInSeconds>:<numOfRetries>||Auto-Creqing||Timeout for sending dumps||--TOut=10:3||--TOut=25:6<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''ACErr'''=<file path/name>||Logging||Write file paths of failed dumps to file.||||--ACErr=acerr.txt<br />
|-<br />
|'''CRCErr'''=<file path/name>||Logging||Checks if filename contains calculated crc||||--CRCErr=crcerr.txt<br />
|-<br />
|'''ExtDiff'''=<file path/name>||Logging||Write mismatched extensions and file paths to file.||||--ExtDiff=extdiff.txt<br />
|-<br />
|'''FixExt'''=<file path/name>||Logging||Changes the fileextension to the dectected extension and logs the action.||||--FixExt=fixext.txt<br />
|-<br />
|'''Done'''=<file path/name>||Logging||Skip paths present in log and append paths to newly processed files.||||--Done=done.txt<br />
|-<br />
|'''HLog'''=<file path/name>||Logging||Export hashes to file.||||--HLog="$CRC$ $ED2K$":hlog.txt<br />
|-<br />
|'''Log'''=<file path/name>||Logging||Write output to file.||||--Log=log.txt<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''M'''||Output||MediaInfo dump||||-M<br />
|-<br />
|'''m'''||Output||MediaInfo XML dump||||-m<br />
|-<br />
|'''t'''||Output||Simple text format||||-t<br />
|-<br />
|'''C'''||Output||XML creq format||||-C<br />
|-<br />
|'''c'''||Output||AVD2 creq dump||||-c<br />
|-<br />
|'''h'''||Output||Hash Dump||||-h<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''BSize'''=<KB_per_block>:<number_of_blocks>||Control||Buffer size for hashing.||||--BSize=512:16<br />
|-<br />
|'''Ext'''=<comma separated list>||Control||Comma separated extension list. Prepend with "-" to exclude. ||Process all supported extensions||--Ext=avi,mkv or --Ext=-zip,-sub or --Ext=*<br />
|-<br />
|'''Mon'''=<seconds>||Control||Monitor sleep duration in seconds.||--Mon=60||--Mon=120<br />
|-<br />
|'''NoErr'''||Control||Disable error reporting. You should not disable this as it helps finding and fixing bugs.||||--NoErr<br />
|-<br />
|'''R'''||Control||Do '''not''' recurse into subfolders.||||-R<br />
|-<br />
|'''p'''||Control||Pause when done (hold cmd window).||||-p<br />
|-<br />
|'''P'''||Control||Pause after each file.||||-P<br />
|-<br />
|'''r'''||Control||Random file order.||||-r<br />
|-<br />
|'''q'''||Control||Suppress progress (silent).||||-q<br />
|-<br />
|'''B'''||Control||Test pure hashingspeed without io limitations||||-B<br />
|-<br />
|'''U'''||Control||Use UTF8 as console output stream||||-U<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''0'''||Hashing||For CRC (because the CRC of a 0 byte file is 00000000).||||-0<br />
|-<br />
|'''1'''||Hashing||For SHA1 (because of the 1).||||-1<br />
|-<br />
|'''2'''||Hashing||For ED2K (because of the 2).||||-2<br />
|-<br />
|'''3'''||Hashing||For Tiger (because a tiger in the house minimizes the Three Great Risks -- thieves, fire, and evil spirits).||||-3<br />
|-<br />
|'''4'''||Hashing||For MD4 (because of the 4).||||-4<br />
|-<br />
|'''5'''||Hashing||For MD5 (because of the 5).||||-5<br />
|-<br />
|'''6'''||Hashing||For TTH ... because that's what's left :p||||-6<br />
|-<br />
|'''a'''||Hashing||All (available) hash algorithms.||||-a<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''Exp'''=<file path/name>||AniDB||Export ed2k-links to the specified file. Very useful when mass adding files.||||--Exp=ed2k.txt<br />
|-<br />
|'''PrintEd2kLink'''||AniDB|| ||||--PrintEd2kLink<br />
|-<br />
|'''PrintAniDBLink'''||AniDB|| ||||--PrintAniDBLink<br />
|-<br />
|'''OpenAniDBLink'''||AniDB|| ||||--OpenAniDBLink<br />
|-<br />
|}<br />
<br />
====Windows Shortcut====<br />
#Extract Avdump to a folder of choice.<br />
#:Example: <tt>"C:\Program Files\AVDump2\"</tt><br />
#Right-click <tt>AVDump2CL.exe</tt>, select ''Create Shortcut''.<br />
#Right-click the shortcut, add options to the ''Shortcut - Target'' line.<br />
#:Example, normal usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" -p</tt><br />
#:Example, auto-creq usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" --Auth=''myName'':''udp_api_key''</tt><br />
#::You can also set other options from the list above if you wish to do so.<br />
#::A commandline option to export ED2K links to a file is by adding <tt>--Exp=''C:\Path\ed2k.txt''</tt>, etc.<br />
#::Note that you need to set an '''UDP API Key''' in your AniDB profile for auto-creqing.<br />
#:Optional: Change ''Run'' to ''Maximized''.<br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
====Send to====<br />
#Move the shortcut created above to the SendTo folder.<br />
#:Example, under XP: <tt>"C:\Documents and Settings\''Username''\SendTo"</tt><br />
#:Example, under Vista: <tt>"C:\Users\''Username''\AppData\Roaming\Microsoft\Windows\SendTo"</tt><br />
#::Where ''Username'' is your Windows Login-Name.<br />
#:Note that ''SendTo'' is a hidden folder.<br />
#Right-click any media-file, go to "Send To", choose <tt>AVDump2CL.exe</tt><br />
#Get [[Creq|CReqing]]<br />
<br />
====MS-DOS Batch File====<br />
#Extract Avdump to a folder of choice.<br />
#Create a MS-DOS batch file with the 2 lines below, and save it as ''filename.bat''.<br />
#<tt>@ECHO OFF</tt><br />
#<tt>C:\Program Files\AVDump\AVDump2CL.exe %* --Exp=''C:\Path\ed2k.txt'' --Auth=''myName'':''udp_api_key''</tt><br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
==Changes From Avdump Classic==<br />
<br />
* AVD2 now runs on the managed .net platform. This will not affect most, as .net comes pre-installed with current versions of windows. XP or older may have to install the platform manually. While it has been tested on mono, such testing has not been exhaustive. We would be very interested in hearing how it behaves in such an environment.<br />
* While most command line parameters remain the same, there are some exceptions. <br />
** The "-o" parameter is no longer available in avd2.<br />
** The "-n" parameter is no longer available in avd2.<br />
** The meaning of the numeric parameters has changed.<br />
* In the event of an internal error, AVD2 ''will'' submit an error report back to AniDB. The error report contains no user-details (see sample), but ''is'' attached to the user name supplied with the -ac parameter. While error reports are ''only'' submitted if -ac is specified, they can be disabled by the addition of the -noerr parameter. That said, for the purposes of initial testing, we respectfully request that error reports not be disabled, so bugs can be found and fixed.<br />
<br />
====Sample Exception Report====<br />
<FileExceptions><br />
<Information><br />
<AVDump2CLVersion>0.1.3734.0</AVDump2CLVersion><br />
<RunOnBitness>64</RunOnBitness><br />
<OS>Microsoft Windows NT 6.1.7601 Service Pack 1</OS><br />
</Information><br />
<Exceptions><br />
<AVDump2CL.Exceptions.AVD2Exception thrownOn="20110303 05.27.26.9254"><br />
<Message>Error in DisplayBuffer</Message><br />
<System.ArgumentOutOfRangeException><br />
<Message><br />
Non-negative number required.<br />
Parameter name: totalWidth<br />
</Message><br />
<StackTrace><br />
<Frame><br />
at System.String.PadHelper(Int32 totalWidth, Char paddingChar, Boolean isRightPadded)<br />
</Frame><br />
<Frame>at l.a(f A_0, Progress A_1)</Frame><br />
<Frame>at l.a(f A_0, Dictionary`2& A_1)</Frame><br />
</StackTrace><br />
</System.ArgumentOutOfRangeException><br />
</AVDump2CL.Exceptions.AVD2Exception><br />
</Exceptions><br />
</FileExceptions><br />
<br />
===Avdump2 on Linux===<br />
Thanks to Mono, Avdump2 runs natively on Linux as well. However, as most development effort goes into the Windows version and due to the heterogenity of Linux distributions, running Avdump2 on Linux isn’t as straightforward as running it on Windows. All Linux-related usage notes can be found on the [[Avdump2 on Linux]] page.<br />
<br />
<br />
==Auto-creqing==<br />
[[Image:Autocreq.gif|thumb|Simple diagram of the way auto-creqing with Avdump2 works]]<br />
<br />
Avdump2 is the AniDB [[auto-creqing]] system. Some more or less important notes:<br />
* To be able to use this feature you’ll need an AniDB account '''and you have to define the ''UDP API Key'' in your [[profile]]'''. All data sent to the server will be logged with IP and uid.<br />
* It is possible to run more than one instance of Avdump2 at once, but not more than ten will work OK. At the moment ''only 10 sessions per ip are allowed by the server'', meaning the eleventh instance will terminate the first.<br />
* There is no direct connection between data sent to AniDB and creqs generated. The data received will just be stored for later processing. There is no way to check the current status for a dump. Usually, it should take ''at least 24 hours'' from the moment you dump a file till the data actually changes. If any irregularities occur, or when there is too much data pending, it will take more time.<br />
* The creqs generated will report the user who sent the data first (for a specific file) as the creqer.<br />
* You may dump files currently not in the database. The data is still stored and will be used later if/after the file has been registered.<br />
* Files creqed by the new system will be locked, meaning some fields will not be possible to change. Notify a moderator if you are '''sure''' that some of the data locked for a specific file is wrong.<br />
<br />
===Why didn't this file get dumped?===<br />
* The file in AniDB is registered with wrong size and/or ED2K hash.<br />
* The package never reached the server.<br />
* The decryption or decompression failed at server side (rare).<br />
* The dump is not valid XML (rare).<br />
<br />
===Why isn't this file verified?===<br />
Even if the file is dumped it doesn't mean it will get auto-creqed (and verified). Here are the reasons:<br />
* The file is corrupt/invalid ([http://anidb.net/perl-bin/animedb.pl?show=avmf&do=xml&avid=76226 example]).<br />
* The provided data is considered "incoherent". (Indicates a bug in Avdump.)<br />
* The dump was marked unfit for file verification by an AniDB Moderator.<br />
<br />
<br />
==Known issues==<br />
* In some cases MediaInfoLib (MIL) used by Avdump2 might report an audio stream to have 0 or 3 channels.<br />
* Anamorphic .asf/.wmv and .mpg/.mpeg files might not get detected correctly and will report the PAR instead of the DAR.<br />
* Some corrupted mkv files may throw a (Thread Aborted) exception, this will be fixed once the updated version of the mkv parser is introduced<br />
<br />
==Changelog==<br />
<div style="height: 280px; overflow: auto; padding: 3px; border:1px solid #AAAAAA; font-size: small"><br />
<br />
'''0.1.6647.0 : 2013.03.29'''<br />
* Another attempt to fix OOM issues<br />
* Now any byte array used to read files is reused (=> reduces mem usage jumpiness)<br />
* Fixed non default blocksize/blockcount crashes<br />
* Fixed stackoverflow crashes on some old mono versions (TraceSource)<br />
* Added --Version argument (Prints the AVDump2 version)<br />
* Fixed some spelling errors<br />
* Added resynching for Matroska files (=> less exceptions for corrupted files)<br />
<br />
'''0.1.6525.0 : 2012.11.??'''<br />
* Reuse datablocks in an attempt to fix OOM issues on 32 bit linux (=> also more stable mem usage on all platforms)<br />
* Changed Naming: Password to API Key to avoid confusion (Ommina)<br />
<br />
'''0.1.6489.0 : 2012.10.??'''<br />
* Accept extensionless files when --Ext=* is used<br />
* Added disabled client exception<br />
* Fixed NullExcpetion bug (Invalid program hashes)<br />
<br />
'''0.1.6452.0 : 2012.09.??+x+y+z'''<br />
* Added notice when the test acreq had an invalid format<br />
<br />
'''0.1.6435.0 : 2012.09.??+x+y'''<br />
* Removed "log" extension from acreqable extensions<br />
* Added Framework Node in error reports<br />
* Added MIL filesize sanity check<br />
<br />
'''0.1.6361.0 : 2012.09.??+x'''<br />
* Changed BlockConsumer error message to state more clearly if the ACReq was sent or not<br />
* UTF8 for Error messages<br />
<br />
'''0.1.6359.0 : 2012.09.??'''<br />
* Moved to git repository<br />
* Changes lost in the ether<br />
<br />
'''0.1.6248.0 : 2012.08.28'''<br />
* Shiny icon for the executable<br />
<br />
* New AniDB Communication, should be faster and more reliable.<br />
** Big file reports no longer fail to be ACReqed.<br />
** Wrong Version and Wrong UserName/Password errors are now separated<br />
** Update notification will be shown if a newer version is available<br />
<br />
* InfoProvider:<br />
** Trimming all value fields<br />
** Fixes serverside parsing errors<br />
<br />
* FileExtensionProvider:<br />
** Limit ReadLine length<br />
** Fixes errors which can happen when a binary file is parsed<br />
<br />
* <strike>Directory: Added workaround for "too long" filepaths</strike> <br/> FileAdding: On error, display the path of the causing file/directory<br />
<br />
* MatroskaParser:<br />
** Less strict with corrupted mkv files. <br/> (If enough data could be read, the ACReq will be sent despite errors)<br />
<br />
* FileSource: Fixed nullpointer excpetion<br />
<br />
* CL:<br />
** Shortcut for DoneLogFileNameOnly is now D instead of R (because it clashed with NoRecurse)<br />
** Added version check and notification of new version if present<br />
** Less jumping for the ETA display<br />
<br />
* Added extensive tracing (removed in public versions)<br />
<br />
* Lots of other small things<br />
<br />
'''0.1.5290.0 : 2012.05.12'''<br />
* Fixed FileExtensionParser (hopefully)<br />
* TXT Report should be fixed now<br />
* Fixed ACReq Send Thread crash<br />
* AVD2 no longer pauses when not on Windows<br />
* Fixed AVD2 not working when not started from same folder as the executable<br />
* Added switch --UseCWD<br />
* Other changes I haven't remembered yet<br />
<br />
'''0.1.5028.0 : 2011.09.11'''<br />
* Fixed shift of hashvalues (_Display_ only)<br />
* Fixed --Ext with "to remove" extensions<br />
* Fixed --Mon/--TOut to actually work<br />
* Fixed some bug in the old CLI converter<br />
* <no ponies><br />
<br />
'''0.1.5000.0 : 2011.09.11'''<br />
* all previous builds aside of 4991 have been disabled<br />
* <more ponies><br />
<br />
'''0.1.4964.0 : 2011.09.05'''<br />
* all previous builds have been disabled<br />
* Sending ACReqs asynchronous<br />
* <insert ponies riding down the rainbow and other stuff that has happened><br />
<br />
'''0.1.4334.0 : 2011.06.15'''<br />
* all previous builds have been disabled<br />
* should work under linux via mono now too<br />
<br />
'''0.1.4260.0 : 2011.05.25'''<br />
* all previous builds have been disabled<br />
* fix for rare case where all xml submitted would contain an incorrect hash<br />
<br />
'''0.1.4213.0 : 2011.05.14'''<br />
* all previous builds have been disabled<br />
* addition of support and detection of new video file type: .mk3d<br />
* addition of support and detection of new audio file type: .dtshd, .thd<br />
* addition of support and detection of new subtitle file type: .pjs, .rt, .tmp, .tts, .xss, new type of .sub files<br />
* addition of support and detection of new linker file type: .smil <br />
* addition of support and detection of .zip files starting with magic bytes "PK00PK"<br />
<br />
<br />
'''0.1.3958.0 : 2011.03.15''' - no need to redump everything<br />
* fixed the bug that caused avdump2 not to retry sending a dump when facing a timeout<br />
* video-only mp4 files got wrongly detected as m4v<br />
* automatic detection of 32/64bit and use of the correct mediainfolib<br />
* test if mediainfolib is accessible<br />
* check of mediainfolib version to prevent the usage of untested versions<br />
* updated to mediainfolib 0.7.42<br />
* added -crcerr parameter to log files where the calculated crc is not found in the filename<br />
* added -x parameter to create a "parameterless avdump1"-like output<br />
* new switch -H to test pure hashing speed<br />
* removed Tiger and MD4 checksums from dumps sent to the AniDB server<br />
<br />
'''0.1.3084.0 : 2011.03.12'''<br />
* initial release<br />
</div><br />
<br />
[[Category:Features]]<br />
[[Category:AniDB Clients]]<br />
[[Category:Avdump]]<br />
[[Category:Development]]</div>Omminahttps://wiki.anidb.net/index.php?title=UDP_API_Definition&diff=17031UDP API Definition2012-12-23T23:32:24Z<p>Ommina: /* EPISODE: Retrieve Episode Data */</p>
<hr />
<div>{{TOCright}}<br />
<br />
== General Information ==<br />
'''Author:''' [[User:Exp|Exp]] & [[User:Epoximator|Epoximator]] & [[User:Ommina|Ommina]]<br><br />
'''Version:''' 0.03.610 (2010-05-01)<br><br />
'''Version number used for protover parameter:''' "3"<br />
<br />
'''IMPORTANT INFORMATION FOR ALL INTERESTED:'''<br />
* If you are mainly interested in notifications and private messaging, check out our [[Jabber]] and [[RSSRDF]] support first.<br />
* The UDP API is not an appropriate choice if you desire to download a local copy of the AniDB database.<br />
* If you want to create a client you have to register it {{AniDBLink|client|here}} and [[UDP Clients|here]].<br />
** Check out the clients that are being developed. There exists usable code in many different languages already.<br />
* If you have suggestions for improvements or new features use the [[UDP API DEV|development]] page.<br />
* Please also take a look at the [[API]] page.<br />
<br />
== Formats used in this Spec ==<br />
* {vartype varname} - Specifies what shall be inserted at this point and its type.<br />
* [...] - Everything between [ and ] is optional.<br />
<br />
=== Used types ===<br />
* ''int2'' - 2 byte Integer (in string representation)<br />
* ''int4'' - 4 byte Integer (in string representation)<br />
* ''boolean'' - true or false - use '1' for ''true'', '0' for ''false''<br />
* ''str'' - String (UDP packet length restricts string size to 1400 bytes)<br />
* ''hexstr'' -- a hex representation of a decimal value, two characters per byte. If multiple bytes are represented, byte one is the first two characters of the string, byte two the next two, and so on.<br />
<br />
=== Content Encoding ===<br />
* Default character encoding: ''ASCII''<br />
* Escape scheme for option values (to server): ''html form encoding'' + ''newline''<br />
** This means you have to encode at least <tt>&</tt> in your option values in html form encoding style (<tt>&amp;amp;</tt>) before sending them to the api server. All other html form encodings are optional.<br />
** All newlines should be replaced by &lt;br /&gt;<br />
* Escape scheme for returned data fields (from server): ', | and newline<br />
** Content newlines are encoded as &lt;br /&gt;, ' is encoded as ` and | is not allowed in data fields.<br />
** Dates are returned in unix time (number of seconds elapsed since January 1, 1970 00:00:00 UTC)<br />
<br />
== Basics ==<br />
=== General ===<br />
The network communication is ''packet'' and ''line'' based. Each AniDB API command is exactly one UDP packet containing one line. Results are sent as one packet but may consist out of multiple lines. A return value always starts with a 3 byte result code followed by a human readable version of the result code. Be aware that important data fields may be returned directly after the return code (see: 200,201,271,272,504).<br />
The meaning for all result codes can be found in this document. If there is more than one entry returned, it's one entry per line. Lines are terminated by a <tt>\n</tt> (no dos linefeed <tt>\r</tt>). The elements of a format string are separated by a "|" character.<br />
<br />
<tt>{three digit return code} {str return string}\n</tt><br><br />
<tt>{data field 0}|{data field 1}|...|{data field n}</tt><br />
<br />
'''IMPORTANT:'''<br />
* All commands except PING, ENCRYPT, ENCODING, AUTH and VERSION '''requires''' login, meaning that the ''session tag'' must be set (<tt>s=xxxxx</tt>).<br />
* A client should ignore any additional trailing data fields it doesn't expect. Additional fields are going to be added to the output of some commands from time to time. Those additional fields will simply be appended to the end of the existing output. A client should be written in a way so that it is not affected by such new fields.<br />
* Due to the length constraints of an UDP package (over PPPoE) the replies from the server will never exceed 1400 bytes. String fields will be truncated if necessary to ensure this. No warnings are given when this happens.<br />
* A client should handle all possible return codes for each command.<br />
** Possible return codes for '''all commands''':<br />
*** 505 ILLEGAL INPUT OR ACCESS DENIED<br />
*** 555 BANNED<br />
***: {str reason}<br />
*** 598 UNKNOWN COMMAND<br />
*** 600 INTERNAL SERVER ERROR<br />
*** 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
*** 602 SERVER BUSY - TRY AGAIN LATER<br />
*** 604 TIMEOUT - DELAY AND RESUBMIT<br />
** Additional return codes for all commands that '''require login''':<br />
*** 501 LOGIN FIRST<br />
*** 502 ACCESS DENIED<br />
*** 506 INVALID SESSION<br />
<br />
{{eyecatch|Note|The '555 BANNED' message should not be expected by the client. This message is only enabled temporary to help developers understand what they are doing wrong.}}<br><br />
<br />
{{eyecatch|Note|<br />
While in daily maintenance the AniDB API will reply with<br />
<br />
601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
<br />
to all commands. If a client receives such a return value it should wait at least 30 minutes before trying again.}}<br />
<br />
=== Server / UDP Connection ===<br />
The Client has to send data packets to:<br />
* '''Server:''' api.anidb.net<br />
* '''Port:''' 9000/UDP<br />
The servername and port should not be hardcoded into a frontend but should be read from a configuration file.<br />
<br />
=== Server Errors ===<br />
* At any time the API might return a fatal error of the form:<br />
: <tt>6xx ERROR DESCRIPTION</tt><br />
* Possible codes are 600-699.<br />
* Occurrences of these errors (except 601 and 602) should be reported to [[User:Ommina|Ommina]].<br />
{{eyecatch|Note|6XX messages do not always return the tags given with the command which caused the error!}}<br />
<br />
=== Connection Problems ===<br />
There are many ways for a client to end up banned or the API might currently be handling too many concurrent connections.<br />
If a client does not get any reply to an AUTH command it should start to increase the retry delay exponentially with every failed login attempt. (i.e. try again after 30 seconds if the first login attempt failed, if the second fails too retry after 2 minutes, then 5 minutes, then 10 minutes, then 30 minutes, ... until you reach a retry delay of ~2-4h.)<br />
<br />
=== Local Port ===<br />
A client should select a fixed local port >1024 at install time and reuse it for local UDP Sockets. If the API sees too many different UDP Ports from one IP within ~1 hour it will ban the IP. (So make sure you're reusing your UDP ports also for testing/debugging!)<br />
<br />
The local port may be hardcoded, however, an option to manually specify another port should be offered.<br />
<br />
'''Note when behind a [[Wikipedia:Network address translation|NAT]]/masquerading router:'''<br><br />
A session between the server and a client is identified by the ''IP and port'' used by the client. So when the port (or IP) changes within a session the client has to authenticate again. If a client is behind a NAT router it can’t actually control the local port used for the connection. The router will normally ''translate'' the port to support several computers on a LAN to share the Internet connection. The public port (as determined by the router and seen by the server) which has been assigned to the connection will only be reserved for as long as it is in use. This means that the router will usually ''deallocate the port after a fixed timeout period'' (eg. five, ten or 15 minutes). Once that happens the client will no longer be able to receive UDP messages from the server (the messages will be discarded as undeliverable by the router) and a new port will be selected once the client tries to send a message to the server (which will result in a new connection session - '''Note:''' This could get you banned!, see above). So in order to keep a session over a NAT router alive, the client has to ping the server within the router's deallocation period to prevent a timeout.<br />
<br />
The client can decide whether it is behind a NAT router or not by adding <tt>nat=1</tt> to the AUTH command. This will cause the response to include the IP and port as seen by the server. If the port differs from the port reported by the local socket, the connection subject to NAT and the client should issue PING commands in regular intervals. Please do not send pings more often than is necessary to keep NAT connections alive.<br />
<br />
=== Flood Protection ===<br />
To prevent high server load the UDP API server enforces a strict flood protection policy.<br />
* Short Term:<br />
** A Client MUST NOT send more than 0.5 packets per second (that's one packet every two seconds, not two packets a second!)<br />
** The server will start to enforce the limit after the first 5 packets have been received.<br />
* Long Term:<br />
** A Client MUST NOT send more than one packet every four seconds over an extended amount of time.<br />
** ''An extended amount of time'' is not defined. Use common sense.<br />
<br />
Once a client exceeds a rate limit all further UDP packets from that client will be dropped without feedback until the client's packet rate is back down to acceptable levels.<br />
<br />
{{eyecatch|Note|Dropped packets are still taken into account for the packet rate. Meaning if you continuously send packets your client will be banned forever.}}<br />
<br />
Generally clients should be written in a way to minimize server and network load. You should always keep that in mind.<br />
<br />
Abusive clients may be banned completely.<br />
<br />
{{eyecatch|Note|<br />
If you suddenly stop getting replies from the AniDB API or you normally don't have a notable packetloss and from one point on you suddenly note a high packetloss percentage you have most likely entered a critical flood ratio.<br />
If the AniDB API isn't answering at all it might either be down or you have been banned, this is normally caused by violating the API specs (i.e. too many connections using different ports from one IP, too many auth failures, ...) (usually lasts 30 minutes).<br />
If you're experiencing packet loss you have probably reached the rate limit and the API starts to randomly drop incoming packets from your IP. (can be solved by enforcing a delay between multiple commands when you're sending a batch)}}<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Caching ===<br />
To minimize server and network load a client should use local caching in order to prevent repeated API requests for the same data.<br />
<br />
A client should locally cache FILE/EP/ANIME/GROUP/... info wherever possible for extended amounts of time.<br />
(I.e. if a client is used to scan a local folder with anime files and add them via API to a users MyList then it shall only ask for all files in the first run and cache the info for all files known to AniDB. If run again over the same folder it shall only check those files which were unknown to AniDB at the time of the last check.)<br />
<br />
Later versions of the API might enforce this by banning clients which ask for the same information more than once every week/month.<br />
<br />
=== Tag option ===<br />
The API will add a user defined string at the beginning of each reply line separated with a space, if desired.<br />
* To enable add the <tt>tag={str usertag}</tt> option to a command.<br />
* A tag is only valid for the command it was send with, meaning it is not persistent. If you want to have tags in front of all reply lines you will have to append the tag option to each command you send to the server.<br />
* Tags are meant to enable a client to handle more than one request/reply at a time.<br />
<br />
Usage example:<br />
AUTH user=baka&pass=baka&protover=25&client=someclient&clientver=1&tag=abc123<br />
abc123 200 Jxqxb LOGIN ACCEPTED<br />
or<br />
LOGOUT s=Jxqxb&tag=byebye<br />
byebye 203 LOGGED OUT<br />
<br />
{{eyecatch|Note|The tag option is valid for all api commands and is thus not explicitly listed in the description of each command.}}<br />
<br />
=== Data Indexes (fid,aid,eid,gid,lid) ===<br />
* All indexes start at 1 (not 0).<br />
* It is possible for table entries to have id fields with a value of 0 (i.e. gid). Those are to be interpreted as "NONE" or "NULL".<br />
* An ID is '''never''' reused. That means after an entry is deleted no new entry will ever have that ID again.<br />
* Mylist IDs (lid) are globally unique, not per-user unique.<br />
<br />
== Authing Commands ==<br />
{{eyecatch|Note|'''ANY''' command which requires parameters may return: 505 ILLEGAL INPUT OR ACCESS DENIED}}<br />
<br />
----<br />
=== AUTH: Authing to the AnimeDB ===<br />
'''Command String:'''<br />
* AUTH user={str username}&pass={str password}&protover={int4 apiversion}&client={str clientname}&clientver={int4 clientversion}[&nat=1&comp=1&enc={str encoding}&mtu{int4 mtu value}&imgserver=1]<br />
<br />
'''Possible Replies:'''<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
* 500 LOGIN FAILED<br />
* 503 CLIENT VERSION OUTDATED<br />
* 504 CLIENT BANNED - {str reason}<br />
* 505 ILLEGAL INPUT OR ACCESS DENIED<br />
* 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
when nat=1<br />
* 200 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED<br />
* 201 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
when imgserver=1<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
{str image server name}<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
{str image server name}<br />
<br />
'''Info:'''<br />
{{eyecatch|Note|The password is the normal AniDB website password! The password listed in the profile as API Password in only used for the optional encryption feature.}}<br />
* The ''session_key'' is a String containing only ''a-z,A-Z,0-9'' chars of a length of ''4-8'' characters.<br />
: It has to be stored by the client and needs to be sent as parameter with every command which requires the user to logged in.<br />
* The ''session_key'' String is appended as parameter "s", i.e. "PUSH notify=1&msg=1&s={str session_key}".<br />
* On a '''500 LOGIN FAILED''' message the client should request the user to enter username and password again.<br />
* In case of a '''501 LOGIN FIRST''' message the client should silently resend an auth command and send the failed command again.<br />
* A '''502 ACCESS DENIED''' message should abort the current action on the client side and display a message to the user.<br />
* A '''503 CLIENT VERSION OUTDATED''' message states that the udp server has been updated and does not support your client any longer. (protover is too low). A 201 message refers to a new version of the client software.<br />
* A '''506 INVALID SESSION''' means that either the session key parameter "s" was not provided with a command that requires it or the session key is no longer valid. The client should reissue an AUTH command.<br />
{{eyecatch|Note|A frontend shall expect 501 and 502 messages to be returned on ANY command.}}<br><br />
{{eyecatch|Note|AniDB usernames may only contain characters (a-z,A-Z), numbers (0-9), underscores (_) and hyphens (-).}}<br />
* The client should send the apiversion of the AnimeDB API version it supports as value of the protover parameter.<br />
* The client MAY NOT send anything but the version of the API Specs the author used to write the client! (as it is stated at the top of this file @ "Version number used for protover parameter")<br />
: The API will compare that value to it's own version of the API and if the version of the client is older the API will decide whether the changes were significant enough to deny the old client access to the DB.<br />
* The clientname shall be a lower-case string containing only the chars ''a-z'' of ''4-16 chars'' length which identifies the client. (i.e. mykickassclient)<br />
* The clientversion shall be a number starting with 1, increased on every change in the client.<br />
: clientname and clientversion might be used by the API to distinguish between different clients and client versions if that should ever become necessary.<br />
{{eyecatch|Important|<br />
* DO NOT use the clientname of an existing client. If you modify an existing client's code to meet your own needs, create a new client name for yourself.<br />
* ALWAYS increase the clientversion number if you release a new client version.}}<br />
* A Login and its assigned ''session_key'' is valid until the virtual UDP connection times out or until a LOGOUT command is issued.<br />
* The virtual UDP connection times out if no data was received from the client for '''35 minutes'''.<br />
* A client should issue a UPTIME command once every 30 minutes to keep the connection alive should that be required.<br />
* If the client does not use any of the notification/push features of the API it should NOT keep the connection alive, furthermore it should explicitly terminate the connection by issuing a LOGOUT command once it finished it's work.<br />
* If it is very likely that another command will be issued shortly (within the next 20 minutes) a client SHOULD keep the current connection open, by not sending a LOGOUT command.<br />
{{eyecatch|Important|<br />
* A client should NOT perform a full AUTH / command / LOGOUT cycle for each command it wants to send. Again, if another command is likely within 20 minutes, remain logged in.}}<br />
* The client shall notify the user if it received a 201 message at login.<br />
: This means a new version of the client is available, however the old version is still supported otherwise a client banned message would have been returned.<br />
* The user should get a pop-up message on 503 and 504 messages telling him to update his client software.<br />
: ('''Note:''' 504 means that this version of the client is banned, not the user!)<br />
* The 'nat' option makes the client able to detect whether it is behind a nat router or not. When the client is behind a nat router it should keep the "connection" alive with the PING command.<br />
{{eyecatch|Important|Make sure your client handles ALL possible AUTH return codes before giving out any versions!}}<br />
* When ''enc=x'' is defined the server will change the encoding used to x.<br />
**If the encoding is supported it will change right away (including the response) and be reset on logout/timeout.<br />
**If not supported then the argument will be silently ignored. Use ENCODING to test what works.<br />
**Supported encodings are [http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html these].<br />
* ''comp=1'' means that the client supports compression ([http://java.sun.com/j2se/1.5.0/docs/api/java/util/zip/Deflater.html DEFLATE]).<br />
**The server will compress (instead of truncating) the datagrams when needed if this option is enabled.<br />
**The first two bytes of compressed datagrams will always be set to zero. (So tags should never start with that.)<br />
* Default [[Wikipedia:MTU (networking)|''MTU'']] is 1400. Minimum allowed is 400, maximum 1400, due [[Wikipedia:Point-to-Point Protocol over Ethernet|PPPoE]].<br />
<br />
----<br />
<br />
=== LOGOUT: Logout ===<br />
'''Command String:'''<br />
* LOGOUT<br />
<br />
'''Possible Replies:'''<br />
* 203 LOGGED OUT<br />
* 403 NOT LOGGED IN<br />
<br />
'''Info:'''<br />
* This command only works if you are already logged in.<br />
* A logout should ALWAYS be issued if the client is currently logged in and is either exiting or not expecting to send/receive any AniDB API packets for the next >= 30 minutes.<br />
<br />
----<br />
=== ENCRYPT: Start Encrypted Session ===<br />
Will cause all future messages from the server, except the first (the reply to the ENCRYPT command itself), to be encrypted (128 bit [[Wikipedia:Advanced Encryption Standard|AES]]). The client will also have to encrypt all future requests sent to the server. All non-encrypted messages will be discarded by the server. The encryption key is the [[Wikipedia:MD5|MD5]] hash of a special ''UDP API Key'' (defined in the users profile) concatenated with the salt string as given in the reply to the ENCRYPT message. A normal AUTH message is still necessary to authenticate and should follow the ENCRYPT command once the API has acknowledged the encryption.<br />
<br />
'''Command String:'''<br />
* ENCRYPT user={str name}&type={int2 type}<br />
<br />
'''Possible Replies:'''<br />
* 209 {str salt} ENCRYPTION ENABLED<br />
* 309 API PASSWORD NOT DEFINED<br />
* 509 NO SUCH ENCRYPTION TYPE<br />
* 394 NO SUCH USER<br />
<br />
'''Info:'''<br />
* ''user'' is the user name.<br />
* ''type'' is the type of encryption; 1 => 128 bit AES (only one defined).<br />
* ''API Key'' is the one defined in the {{AniDBLink|profile|profile settings page}}.<br />
* It is not possible to disable the encryption once enabled while staying logged in.<br />
** A logout (the logout message needs to be correctly encrypted) or timeout will disable the encryption.<br />
* In order to minimize server load, encryption should be disabled by default and should have to be enabled manually by the user in the configuration options.<br />
* The encryption key is md5(api_key_of_user+''salt'').<br />
* Padding of the message needs to be done according to the PKCS5Padding scheme.<br />
<br />
== Notify Commands ==<br />
=== Introduction ===<br />
Broadly speaking, notifications provide an indication to the client that some event has occurred within the AniDB database.<br />
<br />
There are three types:<br />
* New file [[Notifications|notification]]. (Only anime type supported.)<br />
* New private message notification.<br />
* New buddy event notification.<br />
<br />
Note that, while a user can subscribe to multiple 'new file' events (see [[Notifications|notifications]]), at present, the UDP API only supports notifications of new files by anime. New files by group, or new files by producer, are NOT presently supported. Just the same, keeping in mind that the API is designed to potentially support such notifications in the future will help in understanding why some of the commands are structured the way they are.<br />
<br />
The word "notification" is also used a bit inconsistently in this document. An AniDB notification is originally a "new file [[Notifications|notification]]". It might be more correct to use the term "event" for the original "happening" and then "notification" as the means to notify the user (client). New-file, new-message, buddy-* and going-down are all events that results in notifications. Only the first two type of events are persistent, though, meaning they exist and remain in the same state until some user action affects them.<br />
<br />
=== Getting Notifications ===<br />
Clients that wish to receive notifications have two routes available to them. They are by no means mutually exclusive and selecting one does not imply a client is unable to use commands from another.<br />
<br />
'''Method One: Polling'''<br />
<br />
With this method, the client contacts the server at some interval (no more than once every 20 minutes) to see if there are new file notifications waiting. If there are, the client can the get further details of the files in question. This is analogous to checking an email server every half hour to see if new email has arrived.<br />
<br />
Its principal advantage is that it is easy to design and code. Blocking sockets are sufficient as the client can expect the reply received to correspond with the command sent.<br />
<br />
The disadvantage of this approach is that it introduces a delay and some uncertainty in receiving notifications. If, for example, the user clears the notification on the website before the client collects it, the client will not learn of the new file. Similarly, if the user does not dismiss notifications via the site, the client will have an increasing amount of stale data to work though. Finally, notifications cleared by the client also clears them from the website, so users will need to be made aware of what is going on.<br />
<br />
A polling HOWTO:<br />
<br />
* Use NOTIFY (no more than once every 20 minutes) to get the number of pending notifications<br />
* IF there are new notifications pending, use NOTIFYLIST to get a list of notification types and associated IDs.<br />
* Use NOTIFYGET to receive a notification, supplying the ID provided by NOTIFYLIST<br />
* Use NOTIFYACK to acknowledge a notification, supplying the ID provided by NOTIFYLIST (if desired)<br />
<br />
{{eyecatch|Note|The ID supplied by NOTIFYLIST will be the ID of the affected notification type. Since, at present, only the anime type is supported, this value is always an aid. In the future, it may represent a group or producer ID. In these cases, the str '''type''' value will indicate what entity the ID represents.}}<br />
<br />
'''Method Two: Server PUSH'''<br />
<br />
With this method, the server takes the active role in advising the client that a new file has arrived. The client must register with the server to receive further advice information, and will be responsible for keeping the login session from timing out, and any NAT router ports open. The UDP packet is sent to the ip and port from which the AUTH command was received.<br />
<br />
This method compensates for the disadvantages of the polling method, but is more difficult to code. Blocking sockets are no longer an option, nor can a client make any assumptions that an incoming packet will necessarily be a reply to the last command sent. The tag option may be helpful here.<br />
<br />
A PUSH HOWTO:<br />
<br />
* PUSH to register your client session.<br />
* Listen for 720-799 NOTIFICATIONs ('''not 290''').<br />
* Use PUSHACK to to acknowledge the notification using the nid supplied with NOTIFICATION<br />
* Use NOTIFYGET to receive a notification, suppling the relid provided by NOTIFICATION (NOT the packet ID)<br />
* Use NOTIFYACK to acknowledge a notification, suppling the relid provided by NOTIFICATION (if desired)<br />
* Use UPTIME (with an interval between 30 and 35 minutes) to keep login session valid<br />
<br />
It is probably a good idea to use tags to separate NOTIFICATIONs from the other communication. NOTIFICATIONs will '''never''' have tags.<br />
<br />
=== PUSH: UDP Notification Registration ===<br />
Register your client as an observer for AniDB notification events for the current user. If you are registered for one or more event types the AniDB server will send an UDP packet (format see below) on each change which affects the current user.<br />
<br />
'''Command String:'''<br />
* PUSH notify={boolean on_new_file}&msg={boolean on_new_private_message}[&buddy={boolean on_buddy_event}]<br />
<br />
'''Possible Replies:'''<br />
* 270 NOTIFICATION ENABLED<br />
OR (if both values are 0)<br />
* 370 NOTIFICATION DISABLED<br />
<br />
'''Info:'''<br />
* A client which has registered to receive UDP notification packets must:<br />
** Issue a PUSHACK command for each notification received with ''notify_packet_id'' provided in the notification packet.<br />
** Use PING to keep the connection alive (< 30 min).<br />
** Use UPTIME to ensure that the session is OK (>= 30 min).<br />
* Every notification generated is resent 3 times unless acknowledged. After that the client is logged out.<br />
<br />
=== NOTIFY: Notifications ===<br />
Get number of pending notifications (and number of online buddies).<br />
<br />
'''Command String:'''<br />
* NOTIFY [buddy=1]<br />
<br />
'''Possible Replies:'''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}<br />
when ''buddy=1''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}|{int4 number_of_online_buddies}<br />
<br />
'''Info:'''<br />
* If the client did send a NOTIFY within the last 35 minutes and it was confirmed by AniDB then receiving a 501 LOGIN FIRST message for the next NOTIFY command shows that AniDB logged the client out because it did not respond to a PUSH Notification packet.<br />
* There is no command to retrieve missed PUSH Notifications.<br />
{{eyecatch|Note|This command MUST NOT be issued more than once every 20 minutes.}}<br />
<br />
----<br />
=== NOTIFYLIST: List Notification/Message IDs ===<br />
List id of all pending (not acknowledged) ''new private message'' and ''new file'' notifications. Buddy events cannot be acknowledged.<br />
<br />
'''Command String:'''<br />
* NOTIFYLIST<br />
<br />
'''Possible Replies:'''<br />
*291 NOTIFYLIST<br />
: {str type}|{int4 id}<br />
: {str type}|{int4 id}<br />
: ...<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as required by NOTIFYGET. For messages it is the actual message id, for notifications it is the id of the related type; anime, group or producer. Since only file notifications related to anime is implemented atm, it is the anime id (aid).<br />
* NOTIFYLIST returns one line per entry, if no entries are available only the first line of the reply is returned.<br />
{{eyecatch|Note|This command MUST NOT be issued regularly but should only be triggered by either a push message received by the client or a reply to a NOTIFY command which tells you that there are messages/notifications waiting.}}<br />
<br />
----<br />
=== NOTIFYGET: Get Notification/Message ===<br />
Receive private message or file notification.<br />
<br />
'''Command String:'''<br />
* NOTIFYGET type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 292 NOTIFYGET<br />
: {int4 id}|{int4 from_user_id}|{str from_user_name}|{int4 date}|{int4 type}|{str title}|{str body}<br />
* 392 NO SUCH ENTRY<br />
when type = N<br />
* 293 NOTIFYGET<br />
: {int4 relid}|{int4 type}|{int2 count}|{int4 date}|{str relidname}|{str fids}<br />
* 393 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as given by NOTIFYLIST (or ''relid'' from 271 NOTIFICATION and mid from 272 NOTIFICATION)<br />
* for message entries (M):<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: type is the type of the message (0=normal msg, 1=annonymous, 2=system msg, 3=mod msg)<br />
* for notification entries (N):<br />
: relid is the id of the related type (anime)<br />
: relname is the name of the related type (anime)<br />
: type is the notification type (0=all, 1=new, 2=group, 3=complete)<br />
: count is the number of events pending for this subscription<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: fids is a comma separated list with the affected file ids<br />
<br />
----<br />
=== NOTIFYACK: Acknowledge Notification/Message ===<br />
This command will mark a message read or clear a ''new file'' notification. Buddy events are not acknowledgeable.<br />
<br />
'''Command String:'''<br />
* NOTIFYACK type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 281 NOTIFYACK SUCCESSFUL<br />
* 381 NO SUCH ENTRY<br />
when type = N<br />
* 282 NOTIFYACK SUCCESSFUL<br />
* 382 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
<br />
====Notification Packet Format====<br />
'''New File Notify:'''<br />
<br />
720 {int4 notify_packet_id} NOTIFICATION - NEW FILE<br />
{int4 fidlist}|{int2 reltype}|{int2 priority}<br />
<br />
* fidlist is a comma separated list of file ids<br />
* reltype is: 1 = anime, 2 = group, 3 = producer<br />
* priority is: 0 = low, 1 = medium, 2 = high<br />
* new file notifications are created as a batch, so it is not unusual to get several new files for a particular anime at once. It is in this case that a comma separated list of fids will be returned<br />
<br />
{{eyecatch|Note|Group (and producer) related file notifications are not implemented yet.}}<br />
<br />
<br />
'''New Private Message Notify:'''<br />
<br />
794 {int4 notify_packet_id} NOTIFICATION - NEW MESSAGE<br />
{int2 type}|{int4 date}|{int4 sent_by_uid}|{str sent_by_name}|{str subject}|{str body}|{int mid}<br />
<br />
* type is the type of the message (0=normal msg, 1=anonymous, 2=system msg, 3=mod msg)<br />
* date is the time the message was sent (in seconds since 1.1.1970)<br />
* sender uid/sender name are the user id and user name of the sender<br />
* subject is the message subject<br />
* body is message body (can be truncated)<br />
* mid is message id and can be used with NOTIFYACK<br />
<br />
'''Buddy Event Notify:'''<br />
753 {int4 notify_packet_id} NOTIFICATION - BUDDY<br />
{int4 buddy uid}|{int2 event type}<br />
* Possible event types:<br />
** 0 => LOGIN<br />
** 1 => LOGOUT<br />
** 2 => ACCEPTED<br />
** 3 => ADDED<br />
<br />
<br />
'''Going Down Event Notify:'''<br />
799 {int4 notify_packet_id} NOTIFICATION - SHUTTING DOWN<br />
{int4 time offline}|{int4 comment}<br />
<br />
* Clients with any notification on will receive the SHUTTING DOWN message before the API goes offline.<br />
* Time offline is the time in minutes the API will be down, 0 if indefinite (client can direct user to the AniDB site for status updates).<br />
* The comment is a short explanation for the downtime.<br />
* Only one datagram will be sent, and the server will not listen for replies.<br />
<br />
<br />
=== PUSHACK: UDP Notification Acknowledge ===<br />
Used to acknowledge notification packets (720-799). A client must be prepared to issue this command before using '''PUSH'''.<br />
<br />
'''Command String:'''<br />
* PUSHACK nid={int4 notify_packet_id}<br />
<br />
'''Possible Replies:'''<br />
* 701 PUSHACK CONFIRMED<br />
* 702 NO SUCH PACKET PENDING<br />
<br />
'''Info:'''<br />
* See: '''PUSH'''<br />
<br />
== Buddy Commands ==<br />
Group of commands used to administrate your buddylist.<br />
<br />
=== BUDDYADD: Add a user to Buddy List ===<br />
'''Command String:'''<br />
* BUDDYADD uid={int4 buddy uid}<br />
* BUDDYADD uname={int4 buddy name}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 255 BUDDY ADDED<br />
* 355 BUDDY ALREADY ADDED<br />
<br />
----<br />
=== BUDDYDEL: Remove a user from Buddy List ===<br />
'''Command String:'''<br />
* BUDDYDEL uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 256 BUDDY DELETED<br />
<br />
----<br />
=== BUDDYACCEPT: Accept user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYACCEPT uid={int4 user uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 257 BUDDY ACCEPTED<br />
* 357 BUDDY ALREADY ACCEPTED<br />
<br />
----<br />
=== BUDDYDENY: Deny user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYDENY uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 258 BUDDY DENIED<br />
* 358 BUDDY ALREADY DENIED<br />
<br />
----<br />
=== BUDDYLIST: Retrieve Buddy List ===<br />
'''Command String:'''<br />
* BUDDYLIST startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 253 {int2 start} {int2 end} {int2 total} BUDDY LIST<br />
: {int4 uid}|{str username}|{int2 state}<br />
: ...<br />
'''Info:'''<br />
* state is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = this user is in your buddylist<br />
* bit 2 = this user has accepted you<br />
* bit 3 = this user is waiting for your approval<br />
<br />
----<br />
=== BUDDYSTATE: Retrieve Buddy States===<br />
'''Command String:'''<br />
* BUDDYSTATE startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 254 {int2 start} {int2 end} {int2 total} BUDDY STATE<br />
: {int4 uid}|{int2 onlinestate}<br />
: ...<br />
<br />
'''Info:'''<br />
* onlinestate is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = http online (user has issued a HTTP request within the last 10 minutes)<br />
* bit 2 = udp api online (user is currently connected to the udp api server)<br />
* example: 0=offline, 1=http online, 2=udp api online, 3=http&udp api online<br />
<br />
== Data Commands ==<br />
=== ANIME: Retrieve Anime Data ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIME aid={int4 id}[&amask={hexstr}]<br />
by name<br />
* ANIME aname={str anime name}[&amask={hexstr}]<br />
<br />
'''Possible Replies:'''<br />
<br />
If no ''amask'' is provided:<br />
* 230 ANIME<br />
: {int4 aid}|{int4 eps}|{int4 ep count}|{int4 special cnt}|{int4 rating}|{int4 votes}|{int4 tmprating}|{int4 tmpvotes}|{int4 review rating average}|{int4 reviews}|{str year}|{str type}|{str romaji}|{str kanji}|{str english}|{str other}|{str short names}|{str synonyms}|{str category list}<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* Fields are returned in the same order they appear in the ''amask'' field list: byte 1, bit 7 first<br />
* Synonyms and short names are separated with '<br />
* Category fields are separated with ',' and ordered by weight (desc).<br />
* By name: must be perfect match of romaji/kanji/english/other/synonym/short name.<br />
* 'Producer id list' and 'producer name list' match the data returned by the former producer bits (but using the revised creator ids)<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
* '''Note:''' The character id list is the first data to be truncated if needed. And then: category list, synonym list, short name list. This applies to the FILE command too.<br />
* Selecting an 'unused' or 'reserved' bit will return an "illegal input" (505) response.<br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="5" align="center"><b>amask</b></td></tr><br />
<tr><br />
<td align="center"><b>Byte 1</b></td><br />
<td align="center"><b>Byte 2</b></td><br />
<td align="center"><b>Byte 3</b></td><br />
<td align="center"><b>Byte 4</b></td><br />
<td align="center"><b>Byte 5</b></td><br />
<td align="center"><b>Byte 6</b></td><br />
<td align="center"><b>Byte 7</b></td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int aid</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int dateflags</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str category list</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str category weight list</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 special ep count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int air date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int end date</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str url</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str picname</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str category id list</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int vote count</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 temp rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int temp vote count</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 average review rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int review count</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str award list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>bool is 18+ restricted</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int anime planet id</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int ANN id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int allcinema id</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str AnimeNfo id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int date record updated</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int character id list</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int creator id list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int main creator id list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str main creator name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 specials count</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 credits count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 other count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 trailer count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 parody count</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<br />
'''Related aid type (Byte 1, Bit 2):'''<br />
<pre><br />
value meaning<br />
<br />
1 sequel<br />
2 prequel<br />
11 same setting<br />
21 alternative setting<br />
32 alternative version<br />
41 music video<br />
42 character<br />
51 side story<br />
52 parent story<br />
61 summary<br />
62 full story<br />
100 other<br />
</pre><br />
<br />
'''Examples:''' (note that the given amask gives the same result as the default request)<br />
> ANIME aid=1&amask=b2f0e0fc000000&s=xxxxx<br />
< 230 ANIME<br />
1|1999-1999|TV Series|Space,Future,Plot Continuity,SciFi,Space Travel,Shipboard,Other Planet,Novel,Genetic Modification,Action,Romance,Military,Large Breasts,Gunfights,Adventure,Human Enhancement,Nudity|Seikai no Monshou|星界の紋章|Crest of the Stars||13|13|3|853|3225|756|110|875|11<br />
<br />
<br />
----<br />
<br />
=== ANIMEDESC: Retrieve Anime Description ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIMEDESC aid={int4 id}&part={int4 partno}<br />
<br />
'''Possible Replies:'''<br />
* 233 ANIMEDESC<br />
: {int4 current part}|{int4 max parts}|{str description}<br />
* 330 NO SUCH ANIME<br />
* 333 NO SUCH DESCRIPTION<br />
<br />
'''Info:'''<br />
* The maximum length of the anime description is roughly 5000 characters, but the maximum length of a UDP packet is 1400 bytes<br />
* Multiple calls to ANIMEDESC may be necessary to retrieve the complete text, retrieving separate 1400 byte parts with each call<br />
* ''part'' is zero-based<br />
* '''Note:''' No support, at present, for retrieving descriptions by title. ''aid'' only<br />
<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> ANIMEDESC aid=3169&part=0&s=xxxxx<br />
< 233 ANIMEDESC<br />
0|1|As summer break arrives for the students, Jun Sakurada is busily studying on his own in the library, making up for time lost <cut><br />
<br />
----<br />
=== CALENDAR: Get Upcoming Titles ===<br />
Returns the anime ids of the 25 most recently aired / released anime, directly followed by the next 25 anime due to be aired / released, ordered by start date.<br />
<br />
'''Command String:'''<br />
* CALENDAR<br />
<br />
'''Possible Replies:'''<br />
* 297 CALENDAR<br />
{int aid}|{int startdate}|{int dateflags}/n<br />
<br />
..repeated n times<br />
<br />
* 397 CALENDAR EMPTY<br />
<br />
'''Info:'''<br />
* Takes no parameters (other than the session string)<br />
* Titles returned are filtered by the 'show adult' preference of the logged in user. That is, users who have elected to hide adult content will have it hidden here as well.<br />
* Do not depend on the command always returning exactly 50 titles; there may not always be 25 future titles pending, depending on the user's 'adult' preferences, and the date in relation to the relation to the current anime season.<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
=== CHARACTER: Get Character Information ===<br />
Returns character details associated with a given character ID, including associated anime ids, episode ids, and seiyuu.<br />
<br />
'''Command String:'''<br />
* CHARACTER charid={int characterid}<br />
<br />
'''Possible Replies:'''<br />
* 235 CHARACTER<br />
: {int charid}|{str character name kanji}|{str character name transcription}|{str pic}|{anime blocks}|{int episode list}|{int last update date}|{int2 type}|{str gender}<br />
<br />
: An 'anime block' is {int anime id},{int appearance},{int creatorid},{boolean is_main_seiyuu} repeated as many times as necessary, separated by a single quote ( ' ). <br />
<br />
* 335 NO SUCH CHARACTER<br />
<br />
'''Info:'''<br />
* If no seiyuu is associated with the character for a given aid, the 'creatorid' and 'is_main_seiyuu' fields will be empty, but the commas will remain.<br />
* An empty episode list is "undefined": no episode values have been added.<br />
* ''appearance'' values: 0='appears in', 1='cameo appearance in', 2='main character in', 3='secondary cast in'<br />
* ''type'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** 1 => 'Character'<br />
** 2 => 'Mecha'<br />
** 3 => 'Organisation'<br />
** 4 => 'Vessel' <br />
* ''gender'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** "M" => 'Male'<br />
** "F" => 'Female'<br />
** "I" => 'Intersexual'<br />
** "D" => 'Dimorphic'<br />
** "-" => 'none/does not apply'<br />
** "?" => 'unknown'<br />
<br />
'''Example:'''<br />
<br />
CHARACTER charid=488&s=DChan<br />
235 CHARACTER<br />
488|ニコ・ロビン|Nico Robin|14789.jpg|4097,2,1900,1'69,2,1901,0'6199,0,1900,1'5691,0,1900,1'2644,0,,'4851,0,1900,1||1236938094<br />
<br />
=== CREATOR: Get Creator Information ===<br />
<br />
'''Command String:'''<br />
* CREATOR creatorid={int creatorid}<br />
<br />
'''Possible Replies:'''<br />
* 245 CREATOR<br />
: {int creatorid}|{str creator name kanji}|{str creator name transcription}|{int type}|{str pic_name}|{str url_english}|{str url_japanese}|{str wiki_url_english}|{str wiki_url_japanese}|{int last update date}<br />
<br />
* 345 NO SUCH CREATOR<br />
<br />
'''Info:'''<br />
* ANIME AMASK byte6, bit5<br />
* ''type'' values: 1='person', 2='company', 3='collaboration'<br />
<br />
Example:<br />
<br />
245 CREATOR<br />
718|GAINAX|Gainax|2|10092.png||http://www.gainax.co.jp/|Gainax|Gainax|1237048093<br />
<br />
=== EPISODE: Retrieve Episode Data ===<br />
'''Command String:'''<br><br />
by eid<br />
* EPISODE eid={int eid}<br />
by anime and episode number<br />
* EPISODE aname={str anime name}&epno={int4 episode number}<br />
* EPISODE aid={int anime id}&epno={int4 episode number}<br />
<br />
'''Possible Replies:'''<br />
* 240 EPISODE<br />
: {int eid}|{int aid}|{int4 length}|{int4 rating}|{int votes}|{str epno}|{str eng}|{str romaji}|{str kanji}|{int aired}|{int type}<br />
* 340 NO SUCH EPISODE<br />
<br />
'''Info:'''<br />
* length is in minutes<br />
* Returned 'epno' includes special character (only if special) and padding (only if normal).<br />
** Special characters are S(special), C(credits), T(trailer), P(parody), O(other).<br />
* The ''type'' is the raw episode type, used to indicate numerically what the special character will be<br />
** 1: regular episode (no prefix), 2: special ("S"), 3: credit ("C"), 4: trailer ("T"), 5: parody ("P"), 6: other ("O")<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> EPISODE eid=1&s=xxxxx<br />
< 240 EPISODE<br />
1|1|24|400|4|01|Invasion|shinryaku|??<br />
<br />
> EPISODE aname=Seikai no Monshou&epno=2&s=xxxxx<br />
< 240 EPISODE<br />
2|1|24|750|2|02|Kin of the Stars|Hoshi-tachi no Kenzoku|??????|1295059229|1<br />
<br />
----<br />
<br />
=== FILE: Retrieve File Data ===<br />
'''Command String:'''<br><br />
by fid:<br />
* FILE fid={int4 id}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by size+ed2k hash:<br />
* FILE size={int8 size}&ed2k={str ed2khash}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by anime, group and epno<br />
* FILE aname={str anime name}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aname={str anime name}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
<br />
'''Possible Replies:'''<br />
* 220 FILE<br />
: {int4 fid}|{int4 aid}|{int4 eid}|{int4 gid}|{int4 state}|{int8 size}|{str ed2k}|{str anidbfilename}<br />
* 220 FILE<br />
: {int4 fid}|...(data list)<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 0}|{int4 fid 1}|...|{int4 fid n}<br />
* 320 NO SUCH FILE<br />
<br />
'''Info:'''<br />
* fid, aid, eid, gid are the unique ids for the file, anime, ep, group entries at AniDB.<br />
: You can use those to create links to the corresponding pages at AniDB.<br />
* anidbfilename is the AniDB filename for the file.<br />
: However this name does not contain all the extra information of the filenames on AniDB and might be composed slightly different.<br />
* fmask and amask are hexidecimal strings where each bit corresponds to a data field related to the specified file (see below). The data list received is sorted and returned in the same order as the tables: top to bottom, left to right, with fmask preceding amask. There is '''no''' provision to retrieve all fields. Further, requesting a 'unusued' or 'reserved' bit will return an "illegal input" error.<br />
* fid is always returned as the first value, regardless of what masks are provided.<br />
* Only the first matching file is returned when aname, gname and epno is used.<br />
* "audio codec" and "audio bitrate" will return multiple values if there are multiple audio streams present in the file. Values will be separated by a single quote. <br />
* For byte 1, bit 2 (other episodes): episode IDs will be followed by an integer '''percentage''' that indicate the percentage of the related episode this file covers. Typically 100%, there are cases where it will be 50, 30, or other values. This value provides no indication where, within an episode, the file represents. That is, 50% could mean the file covers the first half of the episode, the second half, or some 50% range in between.<br />
'''State:'''<br />
<pre><br />
bit / int value meaning<br />
1 / 1 FILE_CRCOK: file matched official CRC (displayed with green background in AniDB)<br />
2 / 2 FILE_CRCERR: file DID NOT match official CRC (displayed with red background in AniDB)<br />
3 / 4 FILE_ISV2: file is version 2<br />
4 / 8 FILE_ISV3: file is version 3<br />
5 / 16 FILE_ISV4: file is version 4<br />
6 / 32 FILE_ISV5: file is version 5<br />
7 / 64 FILE_UNC: file is uncensored<br />
8 / 128 FILE_CEN: file is censored<br />
<br />
examples:<br />
state ==== 9 ==> FILE_CRCOK+FILE_ISV3 ==> file matched official CRC and is version 3<br />
state ==== 0 ==> - ==> file was not crc checked and is version 1<br />
state ==== 34 ==> FILE_CRCERR+FILE_ISV5 ==> file DID NOT match official CRC and is version 5<br />
state ==== 1 ==> FILE_CRCOK ==> file matched official CRC and is version 1<br />
state ==== 8 ==> FILE_ISV3 ==> file was not CRC checked and is version 3<br />
</pre><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''fmask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
<td align="center">'''Byte 5'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 aid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 eid</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 gid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 mylist id</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>list other episodes</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>int2 IsDeprecated</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int2 state</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int8 size</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ed2k</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str md5</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str sha1</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str crc32</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>video colour depth</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str quality</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str audio codec list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 audio bitrate list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str video codec</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 video bitrate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str video resolution</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str file type (extension)</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str dub language</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str sub language</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 length in seconds</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str description</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 aired date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str anidb file name</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 mylist state</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 mylist filestate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 mylist viewed</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 mylist viewdate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str mylist storage</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str mylist source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str mylist other</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''amask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 anime total episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str category list</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str epno</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ep name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str ep romaji name</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str ep kanji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 episode rating</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 episode vote count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str group name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str group short name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int4 date aid record updated</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
'''Examples:''' (html escaped code intended)<br />
> FILE size=177747474&ed2k=70cd93fd3981cc80a8ea6a646ff805c9&fmask=7FF8FEF8&amask=C000F0C0&s=xxxxx<br />
< 220 FILE<br />
312498|4688|69260|4243|0||0|1|177747474|70cd93fd3981cc80a8ea6a646ff805c9|b2a7c7d591333e20495de3571b235c28|7af9b962c17ff729baeee67533e5219526cd5095|a200fe73|high|DTV|Vorbis (Ogg Vorbis)|104|H264/AVC|800|704x400|japanese|english'english'english|1560||1175472000|26|26|01|The Wings to the Sky|Sora he no Tsubasa|????|#nanoha-DamagedGoodz|Nanoha-DGz<br />
<br />
----<br />
<br />
=== GROUP: Retrieve Group Data ===<br />
'''Command String:'''<br><br />
by gid<br />
* GROUP gid={int gid}<br />
by name/shortname<br />
* GROUP gname={str group name}<br />
<br />
'''Possible Replies:'''<br />
* 250 GROUP<br />
: {int gid}|{int4 rating}|{int votes}|{int4 acount}|{int fcount}|{str name}|{str short}|{str irc channel}|{str irc server}|{str url}|{str picname}|{int4 foundeddate}|{int4 disbandeddate}|{int2 dateflags}|{int4 lastreleasedate}|{int4 lastactivitydate}|{list grouprelations}<br />
* 350 NO SUCH GROUP<br />
<br />
'''Info:'''<br />
* Requires login<br />
* ''gname'' is an exact match of either a group name or short name<br />
* As either name and short names are unique if there is a result from GROUP request by name that will be the only match<br />
* ''dateflags'' values:<br />
** bit0 set == Foundeddate, Unknown Day<br />
** bit1 set == Foundeddate, Unknown Month, Day<br />
** bit2 set == Disbandeddate, Unknown Day<br />
** bit3 set == Disbandeddate, Unknown Month, Day<br />
** bit5 set == Foundeddate, Unknown Year<br />
** bit6 set == Disbandeddate, Unknown Year<br />
* ''releasedate'' and ''activitydate'' are distinct. ''releasedate'' is the date a file was actually released by the group, where ''activitydate'' is the date of a file being added to AniDB. As such, lastrelease may very well be much older than lastactivity.<br />
* ''groupreleations'' is a list of apostrophe-separated pairs, where each pair consists of {int4 othergroupid},{int2 relationtype}<br />
** relationtype:<br />
*** 1 => "Participant in"<br />
*** 2 => "Parent of"<br />
*** 4 => "Merged from"<br />
*** 5 => "Now known as"<br />
*** 6 => "Other"<br />
<br />
'''Example:'''<br />
> GROUP gid=7091&s=bunny<br />
< 250 GROUP<br />
7091|832|1445|43|566|Frostii|Frostii|#frostii|irc.rizon.net|http://frostii.com|15844.jpg|1228089600|0|1|1301875200|1304222640|7255,1'3097,4'748,4'8106,1'8159,2'8402,1'8696,1'9022,1<br />
<br />
----<br />
<br />
=== GROUPSTATUS: Get Completed Episode ===<br />
Returns a list of group names and ranges of episodes released by the group for a given anime.<br />
<br />
'''Command String:'''<br />
* GROUPSTATUS aid={int animeid}[&state={int completion_state}]<br />
<br />
'''Possible Replies:'''<br />
* 225 GROUPSTATUS<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: ... (repeated)<br />
<br />
* 325 NO GROUPS FOUND<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* The seven fields will be repeated as necessary, one for each group, separated by a new line character<br />
* Groups will be filtered by the languages selected in the user's profile<br />
* If ''state'' is not supplied, groups with a completion state of <i>'ongoing'</i>, <i>'finished'</i>, or <i>'complete'</i> are returned<br />
* Groups are returned in order of descending episode count<br />
* If there are more groups to return than can be stored in a UDP packet, additional groups will be silently discarded<br />
* ''state'' values: <br />
#ongoing<br />
#stalled<br />
#complete<br />
#dropped<br />
#finished<br />
#specials only<br />
<br />
== MyList Commands ==<br />
=== MYLIST: Retrieve MyList Data ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLIST lid={int4 lid}<br />
by fid:<br />
* MYLIST fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLIST size={int4 size}&ed2k={str ed2khash}<br />
by anime + group + epno<br />
* MYLIST aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 221 MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 312 MULTIPLE MYLIST ENTRIES<br />
: {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}<br />
* 321 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* The state field provides information about the location and sharing state of a file in MyList.<br />
* 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).<br />
* eps is a list of episodes, e.g. "1-12,14-16,T1"<br />
<br />
'''States:'''<br />
0 - unknown - state is unknown or the user doesn't want to provide this information<br />
1 - on hdd - the file is stored on hdd (but is not shared)<br />
2 - on cd - the file is stored on cd<br />
3 - deleted - the file has been deleted or is not available for other reasons (i.e. reencoded)<br />
<br />
'''Filestates:''' (for normal files, i.e. not generic)<br />
0 => normal/original<br />
1 => corrupted version/invalid crc<br />
2 => self edited<br />
10 => self ripped<br />
11 => on dvd<br />
12 => on vhs<br />
13 => on tv<br />
14 => in theaters<br />
15 => streamed<br />
100 => other<br />
<br />
'''Example:'''<br />
> MYLIST aname=gits sac&s=xxxxx<br />
< 322 MULTIPLE FILES FOUND<br />
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<br />
<br />
----<br />
=== MYLISTADD: Add file to MyList ===<br />
The command string for MYLISTADD is made of up two blocks: a 'fileinfo' block, which limits the command to a specific file, or an 'animeinfo'/'groupinfo'/'episodeinfo' block, which can be used to specify a range of files, including generics. Additionally, a number of optional parameters can be included with either set.<br />
<br />
'''Adding a single file to the MyList with the 'fileinfo' block'''<br />
<br />
* MYLISTADD fid={int4 fid}<br />
'''or'''<br />
* MYLISTADD size={int4 size}&ed2k={str ed2khash}<br />
'''or'''<br />
* MYLISTADD lid={int4 lid}&edit=1 (valid for edit only)<br />
<br />
'''Adding one or more files to the MyList with the 'animeinfo'/'groupinfo'/'episodeinfo' block'''<br />
<br />
Here, you have a number of options, depending on what data you have available. In brief, 'animeinfo' represents a choice between anime id and anime name. 'groupinfo' represents a choice between group id, group name, and generic=1. 'episodeinfo' represents a range of one or more episodes.<br />
<br />
* MYLISTADD aid={int4 aid}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&generic=1&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&generic=1&epno={int4 episode number}<br />
<br />
Each command listed can have, in addition, a number of optional components to provide further MyList details. Append these as desired.<br />
<br />
* &state={int2 state}<br />
* &viewed={boolean viewed}<br />
* &viewdate={int4 viewdate}<br />
* &source={str source}<br />
* &storage={str storage}<br />
* &other={str other}<br />
<br />
Finally, edit=1 can be included to edit a MyList entry instead of creating a new one. When editing, optional values that are not supplied retain their original value. That is, they are ''not'' replaced with default or empty values. Only values supplied are updated.<br />
<br />
'''Possible Replies:'''<br />
* 320 NO SUCH FILE<br />
* 330 NO SUCH ANIME<br />
* 350 NO SUCH GROUP<br />
when edit=0 and adding by fid, size/ed2k<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 mylist id of new entry}<br />
when edit=0 and adding by aname, aid<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 number of entries added}<br />
* 310 FILE ALREADY IN MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 1}|{int4 fid 2}|...|{int4 fid n}<br />
when edit=1<br />
* 311 MYLIST ENTRY EDITED<br />
* 311 MYLIST ENTRY EDITED<br />
: {int4 number of entries edited}<br />
* 411 NO SUCH MYLIST ENTRY<br />
<br />
'''Info:'''<br />
* All data except lid/fid/size+hash/generic is optional.<br />
* Viewed should be 0 for unwatched files and 1 for watched files.<br />
* If viewdate is not specified, the current time will be used. The field will be disregarded if viewed=0.<br />
* Other is the only field which may contain newlines, but they have to be stored as &lt;br /&gt;<br />
* For state values refer to: '''MYLIST'''<br />
* If you want to change an existing entry and already know its MyList id (lid) please use the lid-version of this command. It put less load on the server.<br />
* epno=0 means all eps (default), negative numbers means upto. (-12 -> upto 12)<br />
* group is optional only when edit=1, meaning you can't add every file for an anime<br />
* If the file already exists (response code 310), the ''current'' record will be returned, in the same format as the MYLIST response.<br />
----<br />
<br />
=== MYLISTDEL: Remove file from MyList ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLISTDEL lid={int4 lid}<br />
by fid:<br />
* MYLISTDEL fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLISTDEL size={int4 size}&ed2k={str ed2k hash}<br />
by anime + group + epno<br />
* MYLISTDEL aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 211 MYLIST ENTRY DELETED<br />
: {int4 number of entries}<br />
* 411 NO SUCH MYLIST ENTRY<br />
'''Info:'''<br />
* group is optional<br />
* command will delete all enties found<br />
<br />
----<br />
=== MYLISTSTATS : Retrieve MyList stats ===<br />
'''Command String:'''<br />
* MYLISTSTATS<br />
'''Possible Replies:'''<br />
* 222 MYLIST STATS<br />
{animes}|{eps}|{files}|{size of files}|{added animes}|{added eps}|{added files}|{added groups}|{leech %}|{glory %}|{viewed % of db}|{mylist % of db}|{viewed % of mylist}|{number of viewed eps}|{votes}|{reviews}|{viewed length in minutes}<br />
<br />
'''Info:'''<br />
* All fields are int<br />
<br />
----<br />
<br />
=== VOTE: Vote for specified anime/episode/group ===<br />
'''Command String:'''<br><br />
by id<br />
* VOTE type={int2 type}&id={int4 id}[&value={int4 vote value}&epno={int4 episode number}]<br />
by name<br />
* VOTE type={int2 type}&name={string name}[&value={int4 vote value}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 260 VOTED<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 261 VOTE FOUND<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 262 VOTE UPDATED<br />
: {str entity name}|{old vote value}|{vote type}|{entity id}<br />
* 263 VOTE REVOKED<br />
: {str entity name}|{revoked vote value}|{vote type}|{entity id}<br />
* 360 NO SUCH VOTE<br />
: {str entity name}|0|{vote type}|{entity id}<br />
* 361 INVALID VOTE TYPE<br />
* 362 INVALID VOTE VALUE<br />
* 363 PERMVOTE NOT ALLOWED<br />
: {str aname}|{vote value}|{type}|{entity id}<br />
* 364 ALREADY PERMVOTED<br />
: {str entity name}|{existing vote value}|{vote type}|{entity id}<br />
<br />
'''Info:'''<br />
* type: 1=anime, 2=anime tmpvote, 3=group<br />
* entity: anime, episode, or group<br />
* for episode voting add epno on type=1<br />
* value: negative number means revoke, 0 means retrieve (default), 100-1000 are valid vote values, rest is illegal<br />
* votes will be updated automatically (no questions asked)<br />
* tmpvoting when there exist a perm vote is not possible<br />
<br />
----<br />
<br />
=== RANDOM: Get a random anime ===<br />
'''Command String:'''<br />
* RANDOMANIME type={int4 type}<br />
<br />
'''Possible Replies:'''<br />
* 230 ANIME ... (see ANIME)<br />
<br />
'''Info:'''<br />
* type: 0=from db, 1=watched, 2=unwatched, 3=all mylist<br />
<br />
== Misc Commands ==<br />
=== MYLISTEXPORT: Schedule a MyList Export ===<br />
Queues a {{AniDBLink|export|MyList Export}} by the AniDB Servers. As with a manual export request, exports are only done during periods when server load is low. As a result, exports may take up to 24 hours. The client submitting the request will receive an AniDB message when the export is ready to be collected.<br />
<br />
Only one export can be in the queue at a time.<br />
<br />
'''Command String:'''<br />
* MYLISTEXPORT [template={str template_name}|cancel=1]<br />
<br />
'''Possible Replies:'''<br />
* 217 Export Queued<br />
* 218 Export Cancelled<br />
* 317 No Such Template<br />
* 318 Export Already In Queue<br />
* 319 No Export In Queue or Export In Progress<br />
<br />
'''Info:'''<br />
* ''template_name'' must match an available export template on the {{AniDBLink|export|MyList Export}} page.<br />
* ''cancel'' will cancel any pending export request, queued either through UDP or the web server.<br />
* Clients can subscribe the message notifications if they wish to be notified when an export is complete.<br />
<br />
----<br />
<br />
=== PING: Ping Command ===<br />
'''Command String:'''<br />
* PING [nat=1]<br />
<br />
'''Possible Replies:'''<br />
* 300 PONG<br />
: {int4 port} ''(when nat=1)''<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* May be used by a frontend to determine if the API is still available.<br />
* May be executed even if not yet logged in.<br />
* The option <tt>nat=1</tt> provides an easy way to determine if the router has changed the outgoing port. ({{t|587}})<br />
<br />
----<br />
<br />
=== VERSION: Retrieve Server Version ===<br />
'''Command String:'''<br />
* VERSION<br />
<br />
'''Possible Replies:'''<br />
* 998 VERSION<br />
: {str server version}<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
<br />
----<br />
=== UPTIME: Retrieve Server Uptime ===<br />
'''Command String:'''<br />
* UPTIME<br />
<br />
'''Possible Replies:'''<br />
* 208 UPTIME<br />
: {int4 udpserver uptime in milliseconds}<br />
<br />
'''Info:'''<br />
* This command is the preferred way to check that the session is OK.<br />
<br />
----<br />
=== ENCODING: Change Encoding for Session ===<br />
Sets preferred [[Wikipedia:Character encoding|encoding]] per session. The preferred way to do this is to use the '''enc''' argument for AUTH. This command is mostly for testing.<br />
<br />
'''Command String:'''<br />
* ENCODING name={str encoding name}<br />
<br />
'''Possible Replies:'''<br />
* 219 ENCODING CHANGED<br />
* 519 ENCODING NOT SUPPORTED<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* Supported encodings: http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html<br />
* Default: ASCII.<br />
* Resets to default on logout.<br />
<br />
----<br />
<br />
=== SENDMSG: Send Message ===<br />
'''Command String:'''<br />
* SENDMSG to={str username}&title={str title}&body={str body}<br />
<br />
'''Possible Replies:'''<br />
* 294 SENDMSG SUCCESSFUL<br />
* 394 NO SUCH USER<br />
* 501 LOGIN FIRST<br />
<br />
'''Note:'''<br />
* This command allows you to send an AniDB message.<br />
{{eyecatch|Important|<br />
title must not be longer than 50 chars.<br><br />
body must not be longer than 900 chars.<br />
}}<br />
<br />
----<br />
=== USER: Retrieve User UID ===<br />
'''Command String:'''<br />
* USER [user={str user name}|uid={int user id}]<br />
<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 295 USER<br />
: {int4 uid}|{str username}<br />
<br />
----<br />
<br />
=== STATS [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* STATS<br />
<br />
'''Possible Replies:'''<br />
* 206 STATS<br />
: {int4 animes)|{int4 eps}|{int4 files}|{int4 groups}|{int4 users}|{int8 total file size in bytes}|{int4 open [[creq|creqs]]}<br />
<br />
----<br />
=== TOP [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* TOP<br />
<br />
'''Possible Replies:'''<br />
* 207 TOP<br />
: {str longest mylist}|{int count}<br />
: {str largest mylist}|{int count}<br />
: {str most lame files}|{int count}<br />
: {str most indep. user}|{int count}<br />
: {str biggest leecher}|{int count}<br />
: {str most anime added}|{int count}<br />
: {str most eps added}|{int count}<br />
: {str most files added}|{int count}<br />
: {str most groups added}|{int count}<br />
: {str most votes}|{int count}<br />
: {str most reviews}|{int count}<br />
<br />
'''Info:'''<br />
* All strings are user names.<br />
* 'Hide myself in IRC stats' applies for this too.<br />
<br />
== Fatal Errors ==<br />
At anypoint int the retrieval process you have to expect the following output:<br />
* 6xx INTERNAL SERVER ERROR<br />
: ERROR: {str errormessage}<br />
OR<br />
*6xx INTERNAL SERVER ERROR - {str errormessage}<br />
<br />
Such errors should be reported back to [[User:Ommina|Ommina]].<br />
(xx is a number between 00 and 99)<br />
<br />
If you supply an unknown or unimplemented command you will get an error:<br />
* 598 UNKNOWN COMMAND<br />
<br />
== Return Codes ==<br />
{{eyecatch|Note|While the names below '''are''' the actual code strings returned by the server, clients are nonetheless encouraged to work with the numeric codes instead. }}<br />
<pre><br />
LOGIN_ACCEPTED = 200<br />
LOGIN_ACCEPTED_NEW_VERSION = 201<br />
LOGGED_OUT = 203<br />
RESOURCE = 205<br />
STATS = 206<br />
TOP = 207<br />
UPTIME = 208<br />
ENCRYPTION_ENABLED = 209<br />
MYLIST_ENTRY_ADDED = 210<br />
MYLIST_ENTRY_DELETED = 211<br />
ADDED_FILE = 214<br />
ADDED_STREAM = 215<br />
EXPORT_QUEUED = 217<br />
EXPORT_CANCELLED = 218<br />
ENCODING_CHANGED = 219<br />
FILE = 220<br />
MYLIST = 221<br />
MYLIST_STATS = 222<br />
WISHLIST = 223<br />
NOTIFICATION = 224<br />
GROUP_STATUS = 225<br />
WISHLIST_ENTRY_ADDED = 226<br />
WISHLIST_ENTRY_DELETED = 227<br />
WISHLIST_ENTRY_UPDATED = 228<br />
MULTIPLE_WISHLIST = 229<br />
ANIME = 230<br />
ANIME_BEST_MATCH = 231<br />
RANDOM_ANIME = 232<br />
ANIME_DESCRIPTION = 233<br />
REVIEW = 234<br />
CHARACTER = 235<br />
SONG = 236<br />
ANIMETAG = 237<br />
CHARACTERTAG = 238<br />
EPISODE = 240<br />
UPDATED = 243<br />
TITLE = 244<br />
CREATOR = 245<br />
NOTIFICATION_ENTRY_ADDED = 246<br />
NOTIFICATION_ENTRY_DELETED = 247<br />
NOTIFICATION_ENTRY_UPDATE = 248<br />
MULTIPLE_NOTIFICATION = 249<br />
GROUP = 250<br />
CATEGORY = 251<br />
BUDDY_LIST = 253<br />
BUDDY_STATE = 254<br />
BUDDY_ADDED = 255<br />
BUDDY_DELETED = 256<br />
BUDDY_ACCEPTED = 257<br />
BUDDY_DENIED = 258<br />
VOTED = 260<br />
VOTE_FOUND = 261<br />
VOTE_UPDATED = 262<br />
VOTE_REVOKED = 263<br />
HOT_ANIME = 265<br />
RANDOM_RECOMMENDATION = 266<br />
RANDOM_SIMILAR = 267<br />
NOTIFICATION_ENABLED = 270<br />
NOTIFYACK_SUCCESSFUL_MESSAGE = 281<br />
NOTIFYACK_SUCCESSFUL_NOTIFIATION = 282<br />
NOTIFICATION_STATE = 290<br />
NOTIFYLIST = 291<br />
NOTIFYGET_MESSAGE = 292<br />
NOTIFYGET_NOTIFY = 293<br />
SENDMESSAGE_SUCCESSFUL = 294<br />
USER_ID = 295<br />
CALENDAR = 297<br />
<br />
PONG = 300<br />
AUTHPONG = 301<br />
NO_SUCH_RESOURCE = 305<br />
API_PASSWORD_NOT_DEFINED = 309<br />
FILE_ALREADY_IN_MYLIST = 310<br />
MYLIST_ENTRY_EDITED = 311<br />
MULTIPLE_MYLIST_ENTRIES = 312<br />
WATCHED = 313<br />
SIZE_HASH_EXISTS = 314<br />
INVALID_DATA = 315<br />
STREAMNOID_USED = 316<br />
EXPORT_NO_SUCH_TEMPLATE = 317<br />
EXPORT_ALREADY_IN_QUEUE = 318<br />
EXPORT_NO_EXPORT_QUEUED_OR_IS_PROCESSING = 319<br />
NO_SUCH_FILE = 320<br />
NO_SUCH_ENTRY = 321<br />
MULTIPLE_FILES_FOUND = 322<br />
NO_SUCH_WISHLIST = 323<br />
NO_SUCH_NOTIFICATION = 324<br />
NO_GROUPS_FOUND = 325<br />
NO_SUCH_ANIME = 330<br />
NO_SUCH_DESCRIPTION = 333<br />
NO_SUCH_REVIEW = 334<br />
NO_SUCH_CHARACTER = 335<br />
NO_SUCH_SONG = 336<br />
NO_SUCH_ANIMETAG = 337<br />
NO_SUCH_CHARACTERTAG = 338<br />
NO_SUCH_EPISODE = 340<br />
NO_SUCH_UPDATES = 343<br />
NO_SUCH_TITLES = 344<br />
NO_SUCH_CREATOR = 345<br />
NO_SUCH_GROUP = 350<br />
NO_SUCH_CATEGORY = 351<br />
BUDDY_ALREADY_ADDED = 355<br />
NO_SUCH_BUDDY = 356<br />
BUDDY_ALREADY_ACCEPTED = 357<br />
BUDDY_ALREADY_DENIED = 358<br />
NO_SUCH_VOTE = 360<br />
INVALID_VOTE_TYPE = 361<br />
INVALID_VOTE_VALUE = 362<br />
PERMVOTE_NOT_ALLOWED = 363<br />
ALREADY_PERMVOTED = 364<br />
HOT_ANIME_EMPTY = 365<br />
RANDOM_RECOMMENDATION_EMPTY = 366<br />
RANDOM_SIMILAR_EMPTY = 367<br />
NOTIFICATION_DISABLED = 370<br />
NO_SUCH_ENTRY_MESSAGE = 381<br />
NO_SUCH_ENTRY_NOTIFICATION = 382<br />
NO_SUCH_MESSAGE = 392<br />
NO_SUCH_NOTIFY = 393<br />
NO_SUCH_USER = 394<br />
CALENDAR_EMPTY = 397<br />
NO_CHANGES = 399<br />
<br />
NOT_LOGGED_IN = 403<br />
NO_SUCH_MYLIST_FILE = 410<br />
NO_SUCH_MYLIST_ENTRY = 411<br />
MYLIST_UNAVAILABLE = 412<br />
<br />
LOGIN_FAILED = 500<br />
LOGIN_FIRST = 501<br />
ACCESS_DENIED = 502<br />
CLIENT_VERSION_OUTDATED = 503<br />
CLIENT_BANNED = 504<br />
ILLEGAL_INPUT_OR_ACCESS_DENIED = 505<br />
INVALID_SESSION = 506<br />
NO_SUCH_ENCRYPTION_TYPE = 509<br />
ENCODING_NOT_SUPPORTED = 519<br />
BANNED = 555<br />
UNKNOWN_COMMAND = 598<br />
<br />
INTERNAL_SERVER_ERROR = 600<br />
ANIDB_OUT_OF_SERVICE = 601<br />
SERVER_BUSY = 602<br />
NO_DATA = 603<br />
TIMEOUT - DELAY AND RESUBMIT = 604<br />
API_VIOLATION = 666<br />
<br />
PUSHACK_CONFIRMED = 701<br />
NO_SUCH_PACKET_PENDING = 702</pre><br />
<br />
[[Category:Development]]<br />
[[Category:UDP]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=Avdump2&diff=17011Avdump22012-11-11T23:37:59Z<p>Ommina: /* Known issues */</p>
<hr />
<div>Welcome to the remarkably sparse avdump2 wiki page, lovingly hand created over many minutes + some more.<br />
<br />
We gleefully embrace build 6525, yet another public release of avd2. It represents a complete rewrite of the original avd1 code, runs against a new build of MediaInfoLibrary, contains a number of custom solutions for a number of formats, represents a significant investment of time and energy by Arokh, and is just generally nifty.<br />
<br />
There is no need to reprocess existing files with this build, but do keep an eye out for misbehaviour.<br />
<br />
==What is it==<br />
'''Avdump2''' is a video/audio codec identification utility - identifies which video codec and audio compression method is used on video files. Furthermore it hashes the file with a set of common hashalgorithms and calculates the used bit rates, the length, identifies the number of used audio channels and more.<br><br />
It, like its predecessor, is mainly based on [http://mediainfo.sourceforge.net/en mediainfo], but significantly enhanced and changed to fit AniDB's needs by [[User:Arokh|Arokh]].<br><br />
<br />
===Supported formats===<br />
Most major file formats are supported to some degree. While hashes are created for all file types, stream details remain shakey for others (notably 'swf'). Because of that for some filetypes (underlined) only the hashes get auto-creqed.<br />
<br />
* '''Video files:''' asf/wmv, avi, flv, m2ts, mk3d, mkv, mov, mp4, mpg/mpeg, ogm, ogv, qt, rm/rmvb, <u>swf</u>, ts, webm<br />
* '''Subtitle files:''' ass, idx, js, lrc, mks, pjs, rt, smi, srt, ssa, sub, sup, tmp, tts, txt, xss<br />
* '''Audio files:''' aac, ac3, dts, dtshd, flac, m4a, mka, mp3, ogg, ra, thd, wav, wma<br />
* '''Archive files:''' <u>7z</u>, <u>ace</u>, <u>rar</u>, <u>zip</u><br />
* '''Linker files:''' mkv, smil<br />
<br />
===Download===<br />
<br />
[http://static.anidb.net/client/avdump2/avdump2_6525.rar DOWNLOAD(RAR)] (Build 6525) MD5 = e83a8e5afedd1e34e766daeb6d64d2d2<br />
<br />
===Usage===<br />
'''Avdump2''' is a simple [[Wikipedia:Command line interface|command line]] client:<br />
:<tt>AVDump2CL.exe [--<Arg> -<OneLetterArg> ...] <media file/folder> [<media file/folder> ...]</tt><br />
<br />
While pre 4991 build arguments can still be used, it is recommended to use the new format shown below.<br />
The easiest way to convert them to the new format is to run the program with the old args which then displays a notice and the corresponding args in the new format.<br />
<br />
====Options====<br />
{|align="center" style="border: 1px solid #aaaaaa; border-collapse: collapse; background: #f9f9f9; line-height: 1.0; font-size: small; width: 95%"<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Switch<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Type<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Description<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Default<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Example<br />
|-<br />
|'''Auth'''=<username>:<udp_api_key>||Auto-Creqing||Enable automatic creqing. You should always use this option when dumping anime files! Also enables error reporting.||||--Auth=tard:monkey<br />
|-<br />
|'''Host'''=<hostname>:<port>||Auto-Creqing||Hostname of AniDB UDP API server||--Host=api.anidb.info:9002||<br />
|-<br />
|'''LPort'''=<port>||Auto-Creqing||Local UDP port used for autocreqing. Only needed when behind "strict" firewalls.||||--LPort=12345<br />
|-<br />
|'''TOut'''=<timeoutInSeconds>:<numOfRetries>||Auto-Creqing||Timeout for sending dumps||--TOut=10:3||--TOut=25:6<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''ACErr'''=<file path/name>||Logging||Write file paths of failed dumps to file.||||--ACErr=acerr.txt<br />
|-<br />
|'''CRCErr'''=<file path/name>||Logging||Checks if filename contains calculated crc||||--CRCErr=crcerr.txt<br />
|-<br />
|'''ExtDiff'''=<file path/name>||Logging||Write mismatched extensions and file paths to file.||||--ExtDiff=extdiff.txt<br />
|-<br />
|'''FixExt'''=<file path/name>||Logging||Changes the fileextension to the dectected extension and logs the action.||||--FixExt=fixext.txt<br />
|-<br />
|'''Done'''=<file path/name>||Logging||Skip paths present in log and append paths to newly processed files.||||--Done=done.txt<br />
|-<br />
|'''HLog'''=<file path/name>||Logging||Export hashes to file.||||--HLog="$CRC$ $ED2K$":hlog.txt<br />
|-<br />
|'''Log'''=<file path/name>||Logging||Write output to file.||||--Log=log.txt<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''M'''||Output||MediaInfo dump||||-M<br />
|-<br />
|'''m'''||Output||MediaInfo XML dump||||-m<br />
|-<br />
|'''t'''||Output||Simple text format||||-t<br />
|-<br />
|'''C'''||Output||XML creq format||||-C<br />
|-<br />
|'''c'''||Output||AVD2 creq dump||||-c<br />
|-<br />
|'''h'''||Output||Hash Dump||||-h<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''BSize'''=<KB_per_block>:<number_of_blocks>||Control||Buffer size for hashing.||||--BSize=512:16<br />
|-<br />
|'''Ext'''=<comma separated list>||Control||Comma separated extension list. Prepend with "-" to exclude. ||Process all supported extensions||--Ext=avi,mkv or --Ext=-zip,-sub or --Ext=*<br />
|-<br />
|'''Mon'''=<seconds>||Control||Monitor sleep duration in seconds.||--Mon=60||--Mon=120<br />
|-<br />
|'''NoErr'''||Control||Disable error reporting. You should not disable this as it helps finding and fixing bugs.||||--NoErr<br />
|-<br />
|'''R'''||Control||Do '''not''' recurse into subfolders.||||-R<br />
|-<br />
|'''p'''||Control||Pause when done (hold cmd window).||||-p<br />
|-<br />
|'''P'''||Control||Pause after each file.||||-P<br />
|-<br />
|'''r'''||Control||Random file order.||||-r<br />
|-<br />
|'''q'''||Control||Suppress progress (silent).||||-q<br />
|-<br />
|'''B'''||Control||Test pure hashingspeed without io limitations||||-B<br />
|-<br />
|'''U'''||Control||Use UTF8 as console output stream||||-U<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''0'''||Hashing||For CRC (because the CRC of a 0 byte file is 00000000).||||-0<br />
|-<br />
|'''1'''||Hashing||For SHA1 (because of the 1).||||-1<br />
|-<br />
|'''2'''||Hashing||For ED2K (because of the 2).||||-2<br />
|-<br />
|'''3'''||Hashing||For Tiger (because a tiger in the house minimizes the Three Great Risks -- thieves, fire, and evil spirits).||||-3<br />
|-<br />
|'''4'''||Hashing||For MD4 (because of the 4).||||-4<br />
|-<br />
|'''5'''||Hashing||For MD5 (because of the 5).||||-5<br />
|-<br />
|'''6'''||Hashing||For TTH ... because that's what's left :p||||-6<br />
|-<br />
|'''a'''||Hashing||All (available) hash algorithms.||||-a<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''Exp'''=<file path/name>||AniDB||Export ed2k-links to the specified file. Very useful when mass adding files.||||--Exp=ed2k.txt<br />
|-<br />
|'''PrintEd2kLink'''||AniDB|| ||||--PrintEd2kLink<br />
|-<br />
|'''PrintAniDBLink'''||AniDB|| ||||--PrintAniDBLink<br />
|-<br />
|'''OpenAniDBLink'''||AniDB|| ||||--OpenAniDBLink<br />
|-<br />
|}<br />
<br />
====Windows Shortcut====<br />
#Extract Avdump to a folder of choice.<br />
#:Example: <tt>"C:\Program Files\AVDump2\"</tt><br />
#Right-click <tt>AVDump2CL.exe</tt>, select ''Create Shortcut''.<br />
#Right-click the shortcut, add options to the ''Shortcut - Target'' line.<br />
#:Example, normal usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" -p</tt><br />
#:Example, auto-creq usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" --Auth:''myName'':''udp_api_key''</tt><br />
#::You can also set other options from the list above if you wish to do so.<br />
#::A commandline option to export ED2K links to a file is by adding <tt>--Exp=''C:\Path\ed2k.txt''</tt>, etc.<br />
#::Note that you need to set an '''UDP API Key''' in your AniDB profile for auto-creqing.<br />
#:Optional: Change ''Run'' to ''Maximized''.<br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
====Send to====<br />
#Move the shortcut created above to the SendTo folder.<br />
#:Example, under XP: <tt>"C:\Documents and Settings\''Username''\SendTo"</tt><br />
#:Example, under Vista: <tt>"C:\Users\''Username''\AppData\Roaming\Microsoft\Windows\SendTo"</tt><br />
#::Where ''Username'' is your Windows Login-Name.<br />
#:Note that ''SendTo'' is a hidden folder.<br />
#Right-click any media-file, go to "Send To", choose <tt>AVDump2CL.exe</tt><br />
#Get [[Creq|CReqing]]<br />
<br />
====MS-DOS Batch File====<br />
#Extract Avdump to a folder of choice.<br />
#Create a MS-DOS batch file with the 2 lines below, and save it as ''filename.bat''.<br />
#<tt>@ECHO OFF</tt><br />
#<tt>C:\Program Files\AVDump\AVDump2CL.exe %1 --Exp:''C:\Path\ed2k.txt'' --Auth:''myName'':''udp_api_key''</tt><br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
==Changes From Avdump Classic==<br />
<br />
* AVD2 now runs on the managed .net platform. This will not affect most, as .net comes pre-installed with current versions of windows. XP or older may have to install the platform manually. While it has been tested on mono, such testing has not been exhaustive. We would be very interested in hearing how it behaves in such an environment.<br />
* While most command line parameters remain the same, there are some exceptions. <br />
** The "-o" parameter is no longer available in avd2.<br />
** The "-n" parameter is no longer available in avd2.<br />
** The meaning of the numeric parameters has changed.<br />
* In the event of an internal error, AVD2 ''will'' submit an error report back to AniDB. The error report contains no user-details (see sample), but ''is'' attached to the user name supplied with the -ac parameter. While error reports are ''only'' submitted if -ac is specified, they can be disabled by the addition of the -noerr parameter. That said, for the purposes of initial testing, we respectfully request that error reports not be disabled, so bugs can be found and fixed.<br />
<br />
====Sample Exception Report====<br />
<FileExceptions><br />
<Information><br />
<AVDump2CLVersion>0.1.3734.0</AVDump2CLVersion><br />
<RunOnBitness>64</RunOnBitness><br />
<OS>Microsoft Windows NT 6.1.7601 Service Pack 1</OS><br />
</Information><br />
<Exceptions><br />
<AVDump2CL.Exceptions.AVD2Exception thrownOn="20110303 05.27.26.9254"><br />
<Message>Error in DisplayBuffer</Message><br />
<System.ArgumentOutOfRangeException><br />
<Message><br />
Non-negative number required.<br />
Parameter name: totalWidth<br />
</Message><br />
<StackTrace><br />
<Frame><br />
at System.String.PadHelper(Int32 totalWidth, Char paddingChar, Boolean isRightPadded)<br />
</Frame><br />
<Frame>at l.a(f A_0, Progress A_1)</Frame><br />
<Frame>at l.a(f A_0, Dictionary`2& A_1)</Frame><br />
</StackTrace><br />
</System.ArgumentOutOfRangeException><br />
</AVDump2CL.Exceptions.AVD2Exception><br />
</Exceptions><br />
</FileExceptions><br />
<br />
===Avdump2 on Linux===<br />
Thanks to Mono, Avdump2 runs natively on Linux as well. However, as most development effort goes into the Windows version and due to the heterogenity of Linux distributions, running Avdump2 on Linux isn’t as straightforward as running it on Windows. All Linux-related usage notes can be found on the [[Avdump2 on Linux]] page.<br />
<br />
<br />
==Auto-creqing==<br />
[[Image:Autocreq.gif|thumb|Simple diagram of the way auto-creqing with Avdump2 works]]<br />
<br />
Avdump2 is the AniDB [[auto-creqing]] system. Some more or less important notes:<br />
* To be able to use this feature you’ll need an AniDB account '''and you have to define the ''UDP API Key'' in your [[profile]]'''. All data sent to the server will be logged with IP and uid.<br />
* It is possible to run more than one instance of Avdump2 at once, but not more than ten will work OK. At the moment ''only 10 sessions per ip are allowed by the server'', meaning the eleventh instance will terminate the first.<br />
* There is no direct connection between data sent to AniDB and creqs generated. The data received will just be stored for later processing. There is no way to check the current status for a dump. Usually, it should take ''at least 24 hours'' from the moment you dump a file till the data actually changes. If any irregularities occur, or when there is too much data pending, it will take more time.<br />
* The creqs generated will report the user who sent the data first (for a specific file) as the creqer.<br />
* You may dump files currently not in the database. The data is still stored and will be used later if/after the file has been registered.<br />
* Files creqed by the new system will be locked, meaning some fields will not be possible to change. Notify a moderator if you are '''sure''' that some of the data locked for a specific file is wrong.<br />
<br />
===Why didn't this file get dumped?===<br />
* The file in AniDB is registered with wrong size and/or ED2K hash.<br />
* The package never reached the server.<br />
* The decryption or decompression failed at server side (rare).<br />
* The dump is not valid XML (rare).<br />
<br />
===Why isn't this file verified?===<br />
Even if the file is dumped it doesn't mean it will get auto-creqed (and verified). Here are the reasons:<br />
* The file is corrupt/invalid ([http://anidb.net/perl-bin/animedb.pl?show=avmf&do=xml&avid=76226 example]).<br />
* The provided data is considered "incoherent". (Indicates a bug in Avdump.)<br />
* The dump was marked unfit for file verification by an AniDB Moderator.<br />
<br />
<br />
==Known issues==<br />
* In some cases MediaInfoLib (MIL) used by Avdump2 might report an audio stream to have 0 or 3 channels.<br />
* Anamorphic .asf/.wmv and .mpg/.mpeg files might not get detected correctly and will report the PAR instead of the DAR.<br />
* Some corrupted mkv files may throw a (Thread Aborted) exception, this will be fixed once the updated version of the mkv parser is introduced<br />
<br />
==Changelog==<br />
<div style="height: 280px; overflow: auto; padding: 3px; border:1px solid #AAAAAA; font-size: small"><br />
'''0.1.6248.0 : 2012.08.28'''<br />
* Shiny icon for the executable<br />
<br />
* New AniDB Communication, should be faster and more reliable.<br />
** Big file reports no longer fail to be ACReqed.<br />
** Wrong Version and Wrong UserName/Password errors are now separated<br />
** Update notification will be shown if a newer version is available<br />
<br />
* InfoProvider:<br />
** Trimming all value fields<br />
** Fixes serverside parsing errors<br />
<br />
* FileExtensionProvider:<br />
** Limit ReadLine length<br />
** Fixes errors which can happen when a binary file is parsed<br />
<br />
* <strike>Directory: Added workaround for "too long" filepaths</strike> <br/> FileAdding: On error, display the path of the causing file/directory<br />
<br />
* MatroskaParser:<br />
** Less strict with corrupted mkv files. <br/> (If enough data could be read, the ACReq will be sent despite errors)<br />
<br />
* FileSource: Fixed nullpointer excpetion<br />
<br />
* CL:<br />
** Shortcut for DoneLogFileNameOnly is now D instead of R (because it clashed with NoRecurse)<br />
** Added version check and notification of new version if present<br />
** Less jumping for the ETA display<br />
<br />
* Added extensive tracing (removed in public versions)<br />
<br />
* Lots of other small things<br />
<br />
'''0.1.5290.0 : 2012.05.12'''<br />
* Fixed FileExtensionParser (hopefully)<br />
* TXT Report should be fixed now<br />
* Fixed ACReq Send Thread crash<br />
* AVD2 no longer pauses when not on Windows<br />
* Fixed AVD2 not working when not started from same folder as the executable<br />
* Added switch --UseCWD<br />
* Other changes I haven't remembered yet<br />
<br />
'''0.1.5028.0 : 2011.09.11'''<br />
* Fixed shift of hashvalues (_Display_ only)<br />
* Fixed --Ext with "to remove" extensions<br />
* Fixed --Mon/--TOut to actually work<br />
* Fixed some bug in the old CLI converter<br />
* <no ponies><br />
<br />
'''0.1.5000.0 : 2011.09.11'''<br />
* all previous builds aside of 4991 have been disabled<br />
* <more ponies><br />
<br />
'''0.1.4964.0 : 2011.09.05'''<br />
* all previous builds have been disabled<br />
* Sending ACReqs asynchronous<br />
* <insert ponies riding down the rainbow and other stuff that has happened><br />
<br />
'''0.1.4334.0 : 2011.06.15'''<br />
* all previous builds have been disabled<br />
* should work under linux via mono now too<br />
<br />
'''0.1.4260.0 : 2011.05.25'''<br />
* all previous builds have been disabled<br />
* fix for rare case where all xml submitted would contain an incorrect hash<br />
<br />
'''0.1.4213.0 : 2011.05.14'''<br />
* all previous builds have been disabled<br />
* addition of support and detection of new video file type: .mk3d<br />
* addition of support and detection of new audio file type: .dtshd, .thd<br />
* addition of support and detection of new subtitle file type: .pjs, .rt, .tmp, .tts, .xss, new type of .sub files<br />
* addition of support and detection of new linker file type: .smil <br />
* addition of support and detection of .zip files starting with magic bytes "PK00PK"<br />
<br />
<br />
'''0.1.3958.0 : 2011.03.15''' - no need to redump everything<br />
* fixed the bug that caused avdump2 not to retry sending a dump when facing a timeout<br />
* video-only mp4 files got wrongly detected as m4v<br />
* automatic detection of 32/64bit and use of the correct mediainfolib<br />
* test if mediainfolib is accessible<br />
* check of mediainfolib version to prevent the usage of untested versions<br />
* updated to mediainfolib 0.7.42<br />
* added -crcerr parameter to log files where the calculated crc is not found in the filename<br />
* added -x parameter to create a "parameterless avdump1"-like output<br />
* new switch -H to test pure hashing speed<br />
* removed Tiger and MD4 checksums from dumps sent to the AniDB server<br />
<br />
'''0.1.3084.0 : 2011.03.12'''<br />
* initial release<br />
</div><br />
<br />
[[Category:Features]]<br />
[[Category:AniDB Clients]]<br />
[[Category:Avdump]]<br />
[[Category:Development]]</div>Omminahttps://wiki.anidb.net/index.php?title=Avdump2&diff=16997Avdump22012-10-23T09:16:34Z<p>Ommina: </p>
<hr />
<div>Welcome to the remarkably sparse avdump2 wiki page, lovingly hand created over many minutes + some more.<br />
<br />
We gleefully embrace build 6525, yet another public release of avd2. It represents a complete rewrite of the original avd1 code, runs against a new build of MediaInfoLibrary, contains a number of custom solutions for a number of formats, represents a significant investment of time and energy by Arokh, and is just generally nifty.<br />
<br />
There is no need to reprocess existing files with this build, but do keep an eye out for misbehaviour.<br />
<br />
==What is it==<br />
'''Avdump2''' is a video/audio codec identification utility - identifies which video codec and audio compression method is used on video files. Furthermore it hashes the file with a set of common hashalgorithms and calculates the used bit rates, the length, identifies the number of used audio channels and more.<br><br />
It, like its predecessor, is mainly based on [http://mediainfo.sourceforge.net/en mediainfo], but significantly enhanced and changed to fit AniDB's needs by [[User:Arokh|Arokh]].<br><br />
<br />
===Supported formats===<br />
Most major file formats are supported to some degree. While hashes are created for all file types, stream details remain shakey for others (notably 'swf'). Because of that for some filetypes (underlined) only the hashes get auto-creqed.<br />
<br />
* '''Video files:''' asf/wmv, avi, flv, m2ts, mk3d, mkv, mov, mp4, mpg/mpeg, ogm, ogv, qt, rm/rmvb, <u>swf</u>, ts, webm<br />
* '''Subtitle files:''' ass, idx, js, lrc, mks, pjs, rt, smi, srt, ssa, sub, sup, tmp, tts, txt, xss<br />
* '''Audio files:''' aac, ac3, dts, dtshd, flac, m4a, mka, mp3, ogg, ra, thd, wav, wma<br />
* '''Archive files:''' <u>7z</u>, <u>ace</u>, <u>rar</u>, <u>zip</u><br />
* '''Linker files:''' mkv, smil<br />
<br />
===Download===<br />
<br />
[http://static.anidb.net/client/avdump2/avdump2_6525.rar DOWNLOAD(RAR)] (Build 6525) MD5 = e83a8e5afedd1e34e766daeb6d64d2d2<br />
<br />
===Usage===<br />
'''Avdump2''' is a simple [[Wikipedia:Command line interface|command line]] client:<br />
:<tt>AVDump2CL.exe [--<Arg> -<OneLetterArg> ...] <media file/folder> [<media file/folder> ...]</tt><br />
<br />
While pre 4991 build arguments can still be used, it is recommended to use the new format shown below.<br />
The easiest way to convert them to the new format is to run the program with the old args which then displays a notice and the corresponding args in the new format.<br />
<br />
====Options====<br />
{|align="center" style="border: 1px solid #aaaaaa; border-collapse: collapse; background: #f9f9f9; line-height: 1.0; font-size: small; width: 95%"<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Switch<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Type<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Description<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Default<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Example<br />
|-<br />
|'''Auth'''=<username>:<udp_api_key>||Auto-Creqing||Enable automatic creqing. You should always use this option when dumping anime files! Also enables error reporting.||||--Auth=tard:monkey<br />
|-<br />
|'''Host'''=<hostname>:<port>||Auto-Creqing||Hostname of AniDB UDP API server||--Host=api.anidb.info:9002||<br />
|-<br />
|'''LPort'''=<port>||Auto-Creqing||Local UDP port used for autocreqing. Only needed when behind "strict" firewalls.||||--LPort=12345<br />
|-<br />
|'''TOut'''=<timeoutInSeconds>:<numOfRetries>||Auto-Creqing||Timeout for sending dumps||--TOut=10:3||--TOut=25:6<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''ACErr'''=<file path/name>||Logging||Write file paths of failed dumps to file.||||--ACErr=acerr.txt<br />
|-<br />
|'''CRCErr'''=<file path/name>||Logging||Checks if filename contains calculated crc||||--CRCErr=crcerr.txt<br />
|-<br />
|'''ExtDiff'''=<file path/name>||Logging||Write mismatched extensions and file paths to file.||||--ExtDiff=extdiff.txt<br />
|-<br />
|'''FixExt'''=<file path/name>||Logging||Changes the fileextension to the dectected extension and logs the action.||||--FixExt=fixext.txt<br />
|-<br />
|'''Done'''=<file path/name>||Logging||Skip paths present in log and append paths to newly processed files.||||--Done=done.txt<br />
|-<br />
|'''HLog'''=<file path/name>||Logging||Export hashes to file.||||--HLog="$CRC$ $ED2K$":hlog.txt<br />
|-<br />
|'''Log'''=<file path/name>||Logging||Write output to file.||||--Log=log.txt<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''M'''||Output||MediaInfo dump||||-M<br />
|-<br />
|'''m'''||Output||MediaInfo XML dump||||-m<br />
|-<br />
|'''t'''||Output||Simple text format||||-t<br />
|-<br />
|'''C'''||Output||XML creq format||||-C<br />
|-<br />
|'''c'''||Output||AVD2 creq dump||||-c<br />
|-<br />
|'''h'''||Output||Hash Dump||||-h<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''BSize'''=<KB_per_block>:<number_of_blocks>||Control||Buffer size for hashing.||||--BSize=512:16<br />
|-<br />
|'''Ext'''=<comma separated list>||Control||Comma separated extension list.||Process all supported extensions||--Ext=avi,mkv or --Ext=-zip,-sub or --Ext=*<br />
|-<br />
|'''Mon'''=<seconds>||Control||Monitor sleep duration in seconds.||--Mon=60||--Mon=120<br />
|-<br />
|'''NoErr'''||Control||Disable error reporting. You should not disable this as it helps finding and fixing bugs.||||--NoErr<br />
|-<br />
|'''R'''||Control||Do '''not''' recurse into subfolders.||||-R<br />
|-<br />
|'''p'''||Control||Pause when done (hold cmd window).||||-p<br />
|-<br />
|'''P'''||Control||Pause after each file.||||-P<br />
|-<br />
|'''r'''||Control||Random file order.||||-r<br />
|-<br />
|'''q'''||Control||Suppress progress (silent).||||-q<br />
|-<br />
|'''B'''||Control||Test pure hashingspeed without io limitations||||-B<br />
|-<br />
|'''U'''||Control||Use UTF8 as console output stream||||-U<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''0'''||Hashing||For CRC (because the CRC of a 0 byte file is 00000000).||||-0<br />
|-<br />
|'''1'''||Hashing||For SHA1 (because of the 1).||||-1<br />
|-<br />
|'''2'''||Hashing||For ED2K (because of the 2).||||-2<br />
|-<br />
|'''3'''||Hashing||For Tiger (because a tiger in the house minimizes the Three Great Risks -- thieves, fire, and evil spirits).||||-3<br />
|-<br />
|'''4'''||Hashing||For MD4 (because of the 4).||||-4<br />
|-<br />
|'''5'''||Hashing||For MD5 (because of the 5).||||-5<br />
|-<br />
|'''6'''||Hashing||For TTH ... because that's what's left :p||||-6<br />
|-<br />
|'''a'''||Hashing||All (available) hash algorithms.||||-a<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''Exp'''=<file path/name>||AniDB||Export ed2k-links to the specified file. Very useful when mass adding files.||||--Exp=ed2k.txt<br />
|-<br />
|'''PrintEd2kLink'''||AniDB|| ||||--PrintEd2kLink<br />
|-<br />
|'''PrintAniDBLink'''||AniDB|| ||||--PrintAniDBLink<br />
|-<br />
|'''OpenAniDBLink'''||AniDB|| ||||--OpenAniDBLink<br />
|-<br />
|}<br />
<br />
====Windows Shortcut====<br />
#Extract Avdump to a folder of choice.<br />
#:Example: <tt>"C:\Program Files\AVDump2\"</tt><br />
#Right-click <tt>AVDump2CL.exe</tt>, select ''Create Shortcut''.<br />
#Right-click the shortcut, add options to the ''Shortcut - Target'' line.<br />
#:Example, normal usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" -p</tt><br />
#:Example, auto-creq usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" --Auth:''myName'':''udp_api_key''</tt><br />
#::You can also set other options from the list above if you wish to do so.<br />
#::A commandline option to export ED2K links to a file is by adding <tt>--Exp=''C:\Path\ed2k.txt''</tt>, etc.<br />
#::Note that you need to set an '''UDP API Key''' in your AniDB profile for auto-creqing.<br />
#:Optional: Change ''Run'' to ''Maximized''.<br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
====Send to====<br />
#Move the shortcut created above to the SendTo folder.<br />
#:Example, under XP: <tt>"C:\Documents and Settings\''Username''\SendTo"</tt><br />
#:Example, under Vista: <tt>"C:\Users\''Username''\AppData\Roaming\Microsoft\Windows\SendTo"</tt><br />
#::Where ''Username'' is your Windows Login-Name.<br />
#:Note that ''SendTo'' is a hidden folder.<br />
#Right-click any media-file, go to "Send To", choose <tt>AVDump2CL.exe</tt><br />
#Get [[Creq|CReqing]]<br />
<br />
====MS-DOS Batch File====<br />
#Extract Avdump to a folder of choice.<br />
#Create a MS-DOS batch file with the 2 lines below, and save it as ''filename.bat''.<br />
#<tt>@ECHO OFF</tt><br />
#<tt>C:\Program Files\AVDump\AVDump2CL.exe %1 --Exp:''C:\Path\ed2k.txt'' --Auth:''myName'':''udp_api_key''</tt><br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
==Changes From Avdump Classic==<br />
<br />
* AVD2 now runs on the managed .net platform. This will not affect most, as .net comes pre-installed with current versions of windows. XP or older may have to install the platform manually. While it has been tested on mono, such testing has not been exhaustive. We would be very interested in hearing how it behaves in such an environment.<br />
* While most command line parameters remain the same, there are some exceptions. <br />
** The "-o" parameter is no longer available in avd2.<br />
** The "-n" parameter is no longer available in avd2.<br />
** The meaning of the numeric parameters has changed.<br />
* In the event of an internal error, AVD2 ''will'' submit an error report back to AniDB. The error report contains no user-details (see sample), but ''is'' attached to the user name supplied with the -ac parameter. While error reports are ''only'' submitted if -ac is specified, they can be disabled by the addition of the -noerr parameter. That said, for the purposes of initial testing, we respectfully request that error reports not be disabled, so bugs can be found and fixed.<br />
<br />
====Sample Exception Report====<br />
<FileExceptions><br />
<Information><br />
<AVDump2CLVersion>0.1.3734.0</AVDump2CLVersion><br />
<RunOnBitness>64</RunOnBitness><br />
<OS>Microsoft Windows NT 6.1.7601 Service Pack 1</OS><br />
</Information><br />
<Exceptions><br />
<AVDump2CL.Exceptions.AVD2Exception thrownOn="20110303 05.27.26.9254"><br />
<Message>Error in DisplayBuffer</Message><br />
<System.ArgumentOutOfRangeException><br />
<Message><br />
Non-negative number required.<br />
Parameter name: totalWidth<br />
</Message><br />
<StackTrace><br />
<Frame><br />
at System.String.PadHelper(Int32 totalWidth, Char paddingChar, Boolean isRightPadded)<br />
</Frame><br />
<Frame>at l.a(f A_0, Progress A_1)</Frame><br />
<Frame>at l.a(f A_0, Dictionary`2& A_1)</Frame><br />
</StackTrace><br />
</System.ArgumentOutOfRangeException><br />
</AVDump2CL.Exceptions.AVD2Exception><br />
</Exceptions><br />
</FileExceptions><br />
<br />
===Avdump2 on Linux===<br />
Thanks to Mono, Avdump2 runs natively on Linux as well. However, as most development effort goes into the Windows version and due to the heterogenity of Linux distributions, running Avdump2 on Linux isn’t as straightforward as running it on Windows. All Linux-related usage notes can be found on the [[Avdump2 on Linux]] page.<br />
<br />
<br />
==Auto-creqing==<br />
[[Image:Autocreq.gif|thumb|Simple diagram of the way auto-creqing with Avdump2 works]]<br />
<br />
Avdump2 is the AniDB [[auto-creqing]] system. Some more or less important notes:<br />
* To be able to use this feature you’ll need an AniDB account '''and you have to define the ''UDP API Key'' in your [[profile]]'''. All data sent to the server will be logged with IP and uid.<br />
* It is possible to run more than one instance of Avdump2 at once, but not more than ten will work OK. At the moment ''only 10 sessions per ip are allowed by the server'', meaning the eleventh instance will terminate the first.<br />
* There is no direct connection between data sent to AniDB and creqs generated. The data received will just be stored for later processing. There is no way to check the current status for a dump. Usually, it should take ''at least 24 hours'' from the moment you dump a file till the data actually changes. If any irregularities occur, or when there is too much data pending, it will take more time.<br />
* The creqs generated will report the user who sent the data first (for a specific file) as the creqer.<br />
* You may dump files currently not in the database. The data is still stored and will be used later if/after the file has been registered.<br />
* Files creqed by the new system will be locked, meaning some fields will not be possible to change. Notify a moderator if you are '''sure''' that some of the data locked for a specific file is wrong.<br />
<br />
===Why didn't this file get dumped?===<br />
* The file in AniDB is registered with wrong size and/or ED2K hash.<br />
* The package never reached the server.<br />
* The decryption or decompression failed at server side (rare).<br />
* The dump is not valid XML (rare).<br />
<br />
===Why isn't this file verified?===<br />
Even if the file is dumped it doesn't mean it will get auto-creqed (and verified). Here are the reasons:<br />
* The file is corrupt/invalid ([http://anidb.net/perl-bin/animedb.pl?show=avmf&do=xml&avid=76226 example]).<br />
* The provided data is considered "incoherent". (Indicates a bug in Avdump.)<br />
* The dump was marked unfit for file verification by an AniDB Moderator.<br />
<br />
<br />
==Known issues==<br />
* In some cases MediaInfoLib (MIL) used by Avdump2 might report an audio stream to have 0 or 3 channels.<br />
* Anamorphic .asf/.wmv and .mpg/.mpeg files might not get detected correctly and will report the PAR instead of the DAR.<br />
* Some corrupted mkv files may throw a (Thread Aborted) exception, this will be fixed once the updated version of the mkv parser is introduced<br />
* [6248] Avdump2 may freeze if autocreqs are enabled and there are no creqs to send<br />
<br />
==Changelog==<br />
<div style="height: 280px; overflow: auto; padding: 3px; border:1px solid #AAAAAA; font-size: small"><br />
'''0.1.6248.0 : 2012.08.28'''<br />
* Shiny icon for the executable<br />
<br />
* New AniDB Communication, should be faster and more reliable.<br />
** Big file reports no longer fail to be ACReqed.<br />
** Wrong Version and Wrong UserName/Password errors are now separated<br />
** Update notification will be shown if a newer version is available<br />
<br />
* InfoProvider:<br />
** Trimming all value fields<br />
** Fixes serverside parsing errors<br />
<br />
* FileExtensionProvider:<br />
** Limit ReadLine length<br />
** Fixes errors which can happen when a binary file is parsed<br />
<br />
* <strike>Directory: Added workaround for "too long" filepaths</strike> <br/> FileAdding: On error, display the path of the causing file/directory<br />
<br />
* MatroskaParser:<br />
** Less strict with corrupted mkv files. <br/> (If enough data could be read, the ACReq will be sent despite errors)<br />
<br />
* FileSource: Fixed nullpointer excpetion<br />
<br />
* CL:<br />
** Shortcut for DoneLogFileNameOnly is now D instead of R (because it clashed with NoRecurse)<br />
** Added version check and notification of new version if present<br />
** Less jumping for the ETA display<br />
<br />
* Added extensive tracing (removed in public versions)<br />
<br />
* Lots of other small things<br />
<br />
'''0.1.5290.0 : 2012.05.12'''<br />
* Fixed FileExtensionParser (hopefully)<br />
* TXT Report should be fixed now<br />
* Fixed ACReq Send Thread crash<br />
* AVD2 no longer pauses when not on Windows<br />
* Fixed AVD2 not working when not started from same folder as the executable<br />
* Added switch --UseCWD<br />
* Other changes I haven't remembered yet<br />
<br />
'''0.1.5028.0 : 2011.09.11'''<br />
* Fixed shift of hashvalues (_Display_ only)<br />
* Fixed --Ext with "to remove" extensions<br />
* Fixed --Mon/--TOut to actually work<br />
* Fixed some bug in the old CLI converter<br />
* <no ponies><br />
<br />
'''0.1.5000.0 : 2011.09.11'''<br />
* all previous builds aside of 4991 have been disabled<br />
* <more ponies><br />
<br />
'''0.1.4964.0 : 2011.09.05'''<br />
* all previous builds have been disabled<br />
* Sending ACReqs asynchronous<br />
* <insert ponies riding down the rainbow and other stuff that has happened><br />
<br />
'''0.1.4334.0 : 2011.06.15'''<br />
* all previous builds have been disabled<br />
* should work under linux via mono now too<br />
<br />
'''0.1.4260.0 : 2011.05.25'''<br />
* all previous builds have been disabled<br />
* fix for rare case where all xml submitted would contain an incorrect hash<br />
<br />
'''0.1.4213.0 : 2011.05.14'''<br />
* all previous builds have been disabled<br />
* addition of support and detection of new video file type: .mk3d<br />
* addition of support and detection of new audio file type: .dtshd, .thd<br />
* addition of support and detection of new subtitle file type: .pjs, .rt, .tmp, .tts, .xss, new type of .sub files<br />
* addition of support and detection of new linker file type: .smil <br />
* addition of support and detection of .zip files starting with magic bytes "PK00PK"<br />
<br />
<br />
'''0.1.3958.0 : 2011.03.15''' - no need to redump everything<br />
* fixed the bug that caused avdump2 not to retry sending a dump when facing a timeout<br />
* video-only mp4 files got wrongly detected as m4v<br />
* automatic detection of 32/64bit and use of the correct mediainfolib<br />
* test if mediainfolib is accessible<br />
* check of mediainfolib version to prevent the usage of untested versions<br />
* updated to mediainfolib 0.7.42<br />
* added -crcerr parameter to log files where the calculated crc is not found in the filename<br />
* added -x parameter to create a "parameterless avdump1"-like output<br />
* new switch -H to test pure hashing speed<br />
* removed Tiger and MD4 checksums from dumps sent to the AniDB server<br />
<br />
'''0.1.3084.0 : 2011.03.12'''<br />
* initial release<br />
</div><br />
<br />
[[Category:Features]]<br />
[[Category:AniDB Clients]]<br />
[[Category:Avdump]]<br />
[[Category:Development]]</div>Omminahttps://wiki.anidb.net/index.php?title=User:Ommina&diff=16995User:Ommina2012-10-22T11:46:47Z<p>Ommina: /* SIMILAR: Approve or Disapprove of a Similar Pairing */</p>
<hr />
<div>{{TOCright}}<br />
<br />
--> Edit FILE docs to include MyList data block <--<br />
<br />
=== CATEGORY: Retrieve Category Data ===<br />
<br />
=== SIMILAR: Approve or Disapprove of a Similar Pairing ===<br />
<br />
'''Command String:'''<br />
* SIMILAR entity=1&id1={int4 id}&id2={int4 id}[&approve={str [y|n|r]}]<br />
<br />
'''Possible Replies:'''<br />
* 275 SIMILAR APPROVAL<br />
{int entity}|{int sid}|{int id1}|{int id2}|{int total}|{int approved}|{str [y|n]}<br />
* 276 SIMILAR APPROVAL FOUND<br />
{int entity}|{int sid}|{int id1}|{int id2}|{int total}|{int approved}|{str [y|n]}<br />
* 277 SIMILAR APPROVAL UPDATED<br />
{int entity}|{int sid}|{int id1}|{int id2}|{int total}|{int approved}|{str [y|n]}<br />
* 278 SIMILAR APPROVAL REVOKED<br />
{int entity}|{int sid}|{int id1}|{int id2}|{int total}|{int approved}|{str r}<br />
<br />
* 375 NO SUCH SIMILAR PAIRING<br />
{int entity}|{int id1}|{int id2}<br />
* 376 NO SUCH SIMILAR PAIRING APPROVAL<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1.<br />
* ''id1'' and ''id2'' represent an ''existing'' pair of ids. There are no provisions for ''adding'' new similar pairs<br />
* Which id is assigned to ''id1'' and which id is assigned to ''id2'' is irrelevant<br />
* Use ''approval=y'' to approve the pair, ''approve=n'' to disapprove, and ''approve=r'' to revoke (delete) an existing approval/disapproval.<br />
* If an approval vote is already assigned, submitting a new ''y''/''n'' value will replace the old vote.<br />
<br />
=== UPDATED: Get List of Updated Anime IDs ===<br />
Returns a list of AniDB anime ids of anime that have been updated in in a given time frame, ordered by descending date.<br />
<br />
'''Command String:'''<br />
* UPDATED entity=1&[age={int4 id}|time={int4 date}]<br />
<br />
'''Possible Replies:'''<br />
* 243 UPDATED<br />
{int entity}|{int total count}|{int last update date}|{list aid}<br />
<br />
* 343 NO UPDATES<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1<br />
* Either ''age'' OR ''time'' can be specified, but not both<br />
* ''age'' is specified in days.<br />
** eg: age=30 requests a list of aid values of anime that have changed in the past 30 days<br />
* ''time'' is specified in unix time.<br />
** eg: time=1264982400 requests a list of aid values of anime that have changed since 2010-02-01<br />
* A maximum of 200 values will be returned<br />
* ''count'' specifies the total number of items found for the given time period. In short, if this value is great than 200, you have not retrieved all applicable ids.<br />
* ''last update date'' will contain the AniDB update time of the ''last'' aid to appear on the list<br />
<br />
'''An anime will be considered updated if:'''<br />
* A change is made to the anime record itself<br />
* An ''main'' or ''official'' anime title is added, edited, or deleted (not ''short'' or ''synonym'')<br />
* An episode for the anime is added, or delete (but NOT edited!) ( --> But perhaps airdate changes should <-- )<br />
* An episode title is added, edited, or delete<br />
* An anime category is added, or deleted (but NOT edited: eg, weight change)<br />
* An anime relation is added, or deleted<br />
<br />
=== REVIEW: Get Anime Review ===<br />
Retrieves the review scores and text for an anime review. Like ANIMEDESC, it will likely take multiple calls to this comment to retrieve a complete review - almost all reviews will overflow the size limits of a UDP packet.<br />
<br />
'''Command String:'''<br />
* REVIEW rid={int4 id}<br />
<br />
'''Possible Replies:'''<br />
* 234 REVIEW<br />
: {int4 current part}|{int4 max parts}|{int4 review id}|{int4 author uid}|{int4 score_animation}|{int4 score_sound}|{int4 score_story}|{int4 score_character}|{int4 score_value}|{int4 score_enjoyment}|{str review_text}<br />
* 234 REVIEW<br />
: {int4 current part}|{int4 max parts}|{str review_text}<br />
<br />
* 334 NO SUCH REVIEW<br />
<br />
'''Info:'''<br />
* IDs and scores are returned with part zero only. Parts one through max exclude the scores and return the text block only.<br />
<br />
<br />
<br />
<br />
<br />
[Maybe exchange author uid for author name. Or a uid->name lookup via USER?]<br />
<br />
=== WISHLIST: Retrieve Wishlist Data ===<br />
<br />
Retrieve wishlist data.<br />
<br />
'''Command String:'''<br><br />
full list:<br />
* WISHLIST<br />
by aid:<br />
* WISHLIST aid={int4 aid}<br />
by wishlist id:<br />
* WISHLIST lid={int4 lid}<br />
by priority:<br />
* WISHLIST priority={int4 priority}<br />
<br><br />
'''Possible Replies:'''<br><br />
<br><br />
by aid, lid:<br />
*223 WISHLIST<br />
: {int4 lid}|{int4 aid}|{int2 type}|{int2 priority}|{int4 fromuid}|{str comment}|{int4 adddate}<br />
<br><br />
full list, by priority:<br />
<br />
*229 MULTIPLE WISHLIST ITEMS<br />
: {int4 aid}|{int4 type}|{int4 priority}/n<br />
: {int4 aid}|{int4 type}|{int4 priority}/n<br />
..repeated n times<br />
<br><br><br />
*323 NO SUCH WISHLIST ITEM<br />
<br><br />
'''Info:'''<br />
* ''Priority'' values are 0: low, 1: medium, 2: high<br />
* ''Type'' values are 1: to watch, 2: to get<br />
* Multiple items are returned in descending priority (high priority first)<br />
* The ''fromuid'' field represents the uid of the user that created the wishlist entry. Typically this is the actual user, but could be a buddy.<br />
<br />
=== WISHLISTADD: Add Anime to Wishlist ===<br />
<br />
'''Command String:'''<br><br />
<br />
* WISHLISTADD aid={int4 aid}&type={int2 type}&priority={int2 priority}[&comment={str comment}]<br />
<br />
<br />
* 226 WISHLIST ITEM ADDED<br />
: {int4 wishlist id}<br />
* 228 WISHLIST ITEM UPDATED<br />
: {int4 wishlist id}<br />
<br />
=== WISHLISTDEL: Remove Anime from Wishlist ===<br />
<br />
=== NOTIFICATION: Retrieve Notification Date ===<br />
<br />
=== NOTIFICATIONADD: Add Anime or Group to Notify List ===<br />
<br />
'''Command String:'''<br><br />
<br />
by anime id:<br />
* NOTIFICATIONADD aid={int4 aid}&type={int2 type}&priority={int2 priority}<br />
by group id:<br />
* NOTIFICATIONADD gid={int4 gid}&type={int2 type}&priority={int2 priority}<br />
<br><br />
'''Possible Replies:'''<br />
<br />
* 246 NOTIFICATION ITEM ADDED<br />
: {int4 notification id}<br />
* 248 NOTIFICATION ITEM UPDATED<br />
: {int4 notification id}<br />
* 399 NO CHANGES<br />
<br><br />
'''Info:'''<br />
* ''Priority'' values are 0: low, 1: medium, 2: high<br />
* ''Type'' values are 0: all, 1: new, 2: group, 3: complete<br />
<br />
=== NOTIFICATIONDEL: Remove Anime or Group from Notify List ===<br />
<br />
<br />
=== Empty Table === <br />
<br />
<table><br />
<tr><br />
<td colspan="3" align="center">Byte 1</td><br />
</tr><br />
<tr><br />
<td>Bit</td><br />
<td>Decimal</td><br />
<td>Data Field</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>String</td><br />
</tr><br />
</table><br />
<br />
=== Permissions (badges) ===<br />
<br />
<pre>[22 Jan 12 16:57] * Ommina: baka gives good advice. Let's get the permission thing fully figured out. If I'm going to stop playing minecraft, I don't want to have to redo stuff. (and now gone for food.)<br />
[22 Jan 12 17:04] * worf: well ... what do we have<br />
[22 Jan 12 17:04] * worf: we have a set of personal settings that only affect you<br />
[22 Jan 12 17:05] * worf: hiding thumbnails, hiding all images, hiding porn images, hiding all porn<br />
[22 Jan 12 17:06] * worf: but those dont need to be considered in the xml<br />
[22 Jan 12 17:07] * worf: and then we have the permissions <br />
[22 Jan 12 17:07] * worf: see me in user list, see my anime list, see storage info, see source info, see viewed info, see ep info, see file info, see state info, see my votes, see my wishlist, see my userpage, see my porn<br />
[22 Jan 12 17:08] * worf: see my porn - obviously would apply to the hentai badge<br />
[22 Jan 12 17:09] * worf: see my anime list - should apply to all anime and creator badges<br />
[22 Jan 12 17:09] * DerIdiot: see my anime list/see viewed info/see ep info/see my votes are the ones that matter<br />
[22 Jan 12 17:11] * worf: see my votes shouldnt matter<br />
[22 Jan 12 17:11] * DerIdiot: wasn't sure if you have some badge with them<br />
[22 Jan 12 17:11] * DerIdiot: if not then yes it doesn't<br />
[22 Jan 12 17:11] * worf: there is a counter badge<br />
[22 Jan 12 17:11] * worf: but we are already displaying the number of votes on the userpage anyway<br />
[22 Jan 12 17:12] * worf: i dont think that permission hides the counter either<br />
[22 Jan 12 17:12] * DerIdiot: i'm not 100% sure, but if not then yes you cna ignore it<br />
[22 Jan 12 17:14] * worf: the only usage of PERM_SEEVOTES on the userpage appears to be for hiding the latest votes<br />
[22 Jan 12 17:17] * worf: so ... <br />
[22 Jan 12 17:17] * worf: PERM_SEEMYPORN for the hentai badge<br />
[22 Jan 12 17:18] * worf: PERM_SHOWMYLIST for all anime and creator based badges including the hentai badge<br />
[22 Jan 12 17:18] * worf: PERM_VIEWEDINFO same as the above i guess<br />
[22 Jan 12 17:20] * worf: PERM_EPINFO shouldnt apply since we arent displaying which episodes have been watched. just how many<br />
[22 Jan 12 17:22] * DerIdiot: PERM_EPINFO says that somethign is in mylist; PERM_VIEWEDINFO does the same + says that it's watched<br />
[22 Jan 12 17:25] * worf: if you have PERM_SHOWMYLIST on "everyone" and PERM_EPINFO on "no one" then you can only see which anime a person has but not which episodes<br />
[22 Jan 12 17:25] * DerIdiot: yes<br />
[22 Jan 12 17:25] * worf: hm, ok<br />
[22 Jan 12 17:25] * worf: it hides the counts too<br />
[22 Jan 12 17:26] * worf: k<br />
[22 Jan 12 17:26] * DerIdiot: but you only got watched badges not collecting ones right?<br />
[22 Jan 12 17:26] * worf: yes<br />
[22 Jan 12 17:26] * DerIdiot: then PERM_VIEWEDINFO is enough<br />
[22 Jan 12 17:26] * DerIdiot: should prolly have PERM_SHOWMYLIST and PERM_VIEWEDINFO<br />
[22 Jan 12 17:27] * worf: hmm<br />
</pre></div>Omminahttps://wiki.anidb.net/index.php?title=User:Ommina&diff=16994User:Ommina2012-10-22T09:10:28Z<p>Ommina: /* SIMILAR: Approve or Disapprove of a Similar Pairing */</p>
<hr />
<div>{{TOCright}}<br />
<br />
--> Edit FILE docs to include MyList data block <--<br />
<br />
=== CATEGORY: Retrieve Category Data ===<br />
<br />
=== SIMILAR: Approve or Disapprove of a Similar Pairing ===<br />
<br />
'''Command String:'''<br />
* SIMILAR entity=1&id1={int4 id}&id2={int4 id}[&approve={str [y|n|r]}]<br />
<br />
'''Possible Replies:'''<br />
* 275 SIMILAR APPROVAL<br />
{int sid}|{int id1}|{int id2}|{int total}|{int approved}|{str [y|n]}<br />
* 276 SIMILAR APPROVAL FOUND<br />
{int sid}|{int id1}|{int id2}|{int total}|{int approved}|{str [y|n]}<br />
* 277 SIMILAR APPROVAL UPDATED<br />
{int sid}|{int id1}|{int id2}|{int total}|{int approved}|{str [y|n]}<br />
* 278 SIMILAR APPROVAL REVOKED<br />
{int sid}|{int id1}|{int id2}|{int total}|{int approved}|{str r}<br />
<br />
* 375 NO SUCH SIMILAR PAIRING<br />
* 376 NO SUCH SIMILAR PAIRING APPROVAL<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1.<br />
* ''id1'' and ''id2'' represent an ''existing'' pair of ids. There are no provisions for ''adding'' new similar pairs<br />
* Which id is assigned to ''id1'' and which id is assigned to ''id2'' is irrelevant<br />
* Use ''approval=y'' to approve the pair, ''approve=n'' to disapprove, and ''approve=r'' to revoke (delete) an existing approval/disapproval.<br />
* If an approval vote is already assigned, submitting a new ''y''/''n'' value will replace the old vote.<br />
<br />
=== UPDATED: Get List of Updated Anime IDs ===<br />
Returns a list of AniDB anime ids of anime that have been updated in in a given time frame, ordered by descending date.<br />
<br />
'''Command String:'''<br />
* UPDATED entity=1&[age={int4 id}|time={int4 date}]<br />
<br />
'''Possible Replies:'''<br />
* 243 UPDATED<br />
{int entity}|{int total count}|{int last update date}|{list aid}<br />
<br />
* 343 NO UPDATES<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1<br />
* Either ''age'' OR ''time'' can be specified, but not both<br />
* ''age'' is specified in days.<br />
** eg: age=30 requests a list of aid values of anime that have changed in the past 30 days<br />
* ''time'' is specified in unix time.<br />
** eg: time=1264982400 requests a list of aid values of anime that have changed since 2010-02-01<br />
* A maximum of 200 values will be returned<br />
* ''count'' specifies the total number of items found for the given time period. In short, if this value is great than 200, you have not retrieved all applicable ids.<br />
* ''last update date'' will contain the AniDB update time of the ''last'' aid to appear on the list<br />
<br />
'''An anime will be considered updated if:'''<br />
* A change is made to the anime record itself<br />
* An ''main'' or ''official'' anime title is added, edited, or deleted (not ''short'' or ''synonym'')<br />
* An episode for the anime is added, or delete (but NOT edited!) ( --> But perhaps airdate changes should <-- )<br />
* An episode title is added, edited, or delete<br />
* An anime category is added, or deleted (but NOT edited: eg, weight change)<br />
* An anime relation is added, or deleted<br />
<br />
=== REVIEW: Get Anime Review ===<br />
Retrieves the review scores and text for an anime review. Like ANIMEDESC, it will likely take multiple calls to this comment to retrieve a complete review - almost all reviews will overflow the size limits of a UDP packet.<br />
<br />
'''Command String:'''<br />
* REVIEW rid={int4 id}<br />
<br />
'''Possible Replies:'''<br />
* 234 REVIEW<br />
: {int4 current part}|{int4 max parts}|{int4 review id}|{int4 author uid}|{int4 score_animation}|{int4 score_sound}|{int4 score_story}|{int4 score_character}|{int4 score_value}|{int4 score_enjoyment}|{str review_text}<br />
* 234 REVIEW<br />
: {int4 current part}|{int4 max parts}|{str review_text}<br />
<br />
* 334 NO SUCH REVIEW<br />
<br />
'''Info:'''<br />
* IDs and scores are returned with part zero only. Parts one through max exclude the scores and return the text block only.<br />
<br />
<br />
<br />
<br />
<br />
[Maybe exchange author uid for author name. Or a uid->name lookup via USER?]<br />
<br />
=== WISHLIST: Retrieve Wishlist Data ===<br />
<br />
Retrieve wishlist data.<br />
<br />
'''Command String:'''<br><br />
full list:<br />
* WISHLIST<br />
by aid:<br />
* WISHLIST aid={int4 aid}<br />
by wishlist id:<br />
* WISHLIST lid={int4 lid}<br />
by priority:<br />
* WISHLIST priority={int4 priority}<br />
<br><br />
'''Possible Replies:'''<br><br />
<br><br />
by aid, lid:<br />
*223 WISHLIST<br />
: {int4 lid}|{int4 aid}|{int2 type}|{int2 priority}|{int4 fromuid}|{str comment}|{int4 adddate}<br />
<br><br />
full list, by priority:<br />
<br />
*229 MULTIPLE WISHLIST ITEMS<br />
: {int4 aid}|{int4 type}|{int4 priority}/n<br />
: {int4 aid}|{int4 type}|{int4 priority}/n<br />
..repeated n times<br />
<br><br><br />
*323 NO SUCH WISHLIST ITEM<br />
<br><br />
'''Info:'''<br />
* ''Priority'' values are 0: low, 1: medium, 2: high<br />
* ''Type'' values are 1: to watch, 2: to get<br />
* Multiple items are returned in descending priority (high priority first)<br />
* The ''fromuid'' field represents the uid of the user that created the wishlist entry. Typically this is the actual user, but could be a buddy.<br />
<br />
=== WISHLISTADD: Add Anime to Wishlist ===<br />
<br />
'''Command String:'''<br><br />
<br />
* WISHLISTADD aid={int4 aid}&type={int2 type}&priority={int2 priority}[&comment={str comment}]<br />
<br />
<br />
* 226 WISHLIST ITEM ADDED<br />
: {int4 wishlist id}<br />
* 228 WISHLIST ITEM UPDATED<br />
: {int4 wishlist id}<br />
<br />
=== WISHLISTDEL: Remove Anime from Wishlist ===<br />
<br />
=== NOTIFICATION: Retrieve Notification Date ===<br />
<br />
=== NOTIFICATIONADD: Add Anime or Group to Notify List ===<br />
<br />
'''Command String:'''<br><br />
<br />
by anime id:<br />
* NOTIFICATIONADD aid={int4 aid}&type={int2 type}&priority={int2 priority}<br />
by group id:<br />
* NOTIFICATIONADD gid={int4 gid}&type={int2 type}&priority={int2 priority}<br />
<br><br />
'''Possible Replies:'''<br />
<br />
* 246 NOTIFICATION ITEM ADDED<br />
: {int4 notification id}<br />
* 248 NOTIFICATION ITEM UPDATED<br />
: {int4 notification id}<br />
* 399 NO CHANGES<br />
<br><br />
'''Info:'''<br />
* ''Priority'' values are 0: low, 1: medium, 2: high<br />
* ''Type'' values are 0: all, 1: new, 2: group, 3: complete<br />
<br />
=== NOTIFICATIONDEL: Remove Anime or Group from Notify List ===<br />
<br />
<br />
=== Empty Table === <br />
<br />
<table><br />
<tr><br />
<td colspan="3" align="center">Byte 1</td><br />
</tr><br />
<tr><br />
<td>Bit</td><br />
<td>Decimal</td><br />
<td>Data Field</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>String</td><br />
</tr><br />
</table><br />
<br />
=== Permissions (badges) ===<br />
<br />
<pre>[22 Jan 12 16:57] * Ommina: baka gives good advice. Let's get the permission thing fully figured out. If I'm going to stop playing minecraft, I don't want to have to redo stuff. (and now gone for food.)<br />
[22 Jan 12 17:04] * worf: well ... what do we have<br />
[22 Jan 12 17:04] * worf: we have a set of personal settings that only affect you<br />
[22 Jan 12 17:05] * worf: hiding thumbnails, hiding all images, hiding porn images, hiding all porn<br />
[22 Jan 12 17:06] * worf: but those dont need to be considered in the xml<br />
[22 Jan 12 17:07] * worf: and then we have the permissions <br />
[22 Jan 12 17:07] * worf: see me in user list, see my anime list, see storage info, see source info, see viewed info, see ep info, see file info, see state info, see my votes, see my wishlist, see my userpage, see my porn<br />
[22 Jan 12 17:08] * worf: see my porn - obviously would apply to the hentai badge<br />
[22 Jan 12 17:09] * worf: see my anime list - should apply to all anime and creator badges<br />
[22 Jan 12 17:09] * DerIdiot: see my anime list/see viewed info/see ep info/see my votes are the ones that matter<br />
[22 Jan 12 17:11] * worf: see my votes shouldnt matter<br />
[22 Jan 12 17:11] * DerIdiot: wasn't sure if you have some badge with them<br />
[22 Jan 12 17:11] * DerIdiot: if not then yes it doesn't<br />
[22 Jan 12 17:11] * worf: there is a counter badge<br />
[22 Jan 12 17:11] * worf: but we are already displaying the number of votes on the userpage anyway<br />
[22 Jan 12 17:12] * worf: i dont think that permission hides the counter either<br />
[22 Jan 12 17:12] * DerIdiot: i'm not 100% sure, but if not then yes you cna ignore it<br />
[22 Jan 12 17:14] * worf: the only usage of PERM_SEEVOTES on the userpage appears to be for hiding the latest votes<br />
[22 Jan 12 17:17] * worf: so ... <br />
[22 Jan 12 17:17] * worf: PERM_SEEMYPORN for the hentai badge<br />
[22 Jan 12 17:18] * worf: PERM_SHOWMYLIST for all anime and creator based badges including the hentai badge<br />
[22 Jan 12 17:18] * worf: PERM_VIEWEDINFO same as the above i guess<br />
[22 Jan 12 17:20] * worf: PERM_EPINFO shouldnt apply since we arent displaying which episodes have been watched. just how many<br />
[22 Jan 12 17:22] * DerIdiot: PERM_EPINFO says that somethign is in mylist; PERM_VIEWEDINFO does the same + says that it's watched<br />
[22 Jan 12 17:25] * worf: if you have PERM_SHOWMYLIST on "everyone" and PERM_EPINFO on "no one" then you can only see which anime a person has but not which episodes<br />
[22 Jan 12 17:25] * DerIdiot: yes<br />
[22 Jan 12 17:25] * worf: hm, ok<br />
[22 Jan 12 17:25] * worf: it hides the counts too<br />
[22 Jan 12 17:26] * worf: k<br />
[22 Jan 12 17:26] * DerIdiot: but you only got watched badges not collecting ones right?<br />
[22 Jan 12 17:26] * worf: yes<br />
[22 Jan 12 17:26] * DerIdiot: then PERM_VIEWEDINFO is enough<br />
[22 Jan 12 17:26] * DerIdiot: should prolly have PERM_SHOWMYLIST and PERM_VIEWEDINFO<br />
[22 Jan 12 17:27] * worf: hmm<br />
</pre></div>Omminahttps://wiki.anidb.net/index.php?title=User:Ommina&diff=16993User:Ommina2012-10-22T08:58:11Z<p>Ommina: /* SIMILAR: Approve or Disapprove of a Similar Pairing */</p>
<hr />
<div>{{TOCright}}<br />
<br />
--> Edit FILE docs to include MyList data block <--<br />
<br />
=== CATEGORY: Retrieve Category Data ===<br />
<br />
=== SIMILAR: Approve or Disapprove of a Similar Pairing ===<br />
<br />
'''Command String:'''<br />
* SIMILAR entity=1&id1={int4 id}&id2={int4 id}[&approve={str [y|n|r]}]<br />
<br />
'''Possible Replies:'''<br />
* 275 SIMILAR APPROVAL<br />
* 276 SIMILAR APPROVAL FOUND<br />
* 277 SIMILAR APPROVAL UPDATED<br />
* 278 SIMILAR APPROVAL REVOKED<br />
{int sid}|{int id1}|{int id2}|{str [y|n|r]}<br />
<br />
* 375 NO SUCH SIMILAR PAIRING<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1.<br />
* ''id1'' and ''id2'' represent an ''existing'' pair of ids. There are no provisions for ''adding'' new similar pairs<br />
* Which id is assigned to ''id1'' and which id is assigned to ''id2'' is irrelevant<br />
* Use ''approval=y'' to approve the pair, ''approve=n'' to disapprove, and ''approve=r'' to revoke (delete) an existing approval/disapproval.<br />
* If an approval vote is already assigned, submitting a new ''y''/''n'' value will replace the old vote.<br />
<br />
=== UPDATED: Get List of Updated Anime IDs ===<br />
Returns a list of AniDB anime ids of anime that have been updated in in a given time frame, ordered by descending date.<br />
<br />
'''Command String:'''<br />
* UPDATED entity=1&[age={int4 id}|time={int4 date}]<br />
<br />
'''Possible Replies:'''<br />
* 243 UPDATED<br />
{int entity}|{int total count}|{int last update date}|{list aid}<br />
<br />
* 343 NO UPDATES<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1<br />
* Either ''age'' OR ''time'' can be specified, but not both<br />
* ''age'' is specified in days.<br />
** eg: age=30 requests a list of aid values of anime that have changed in the past 30 days<br />
* ''time'' is specified in unix time.<br />
** eg: time=1264982400 requests a list of aid values of anime that have changed since 2010-02-01<br />
* A maximum of 200 values will be returned<br />
* ''count'' specifies the total number of items found for the given time period. In short, if this value is great than 200, you have not retrieved all applicable ids.<br />
* ''last update date'' will contain the AniDB update time of the ''last'' aid to appear on the list<br />
<br />
'''An anime will be considered updated if:'''<br />
* A change is made to the anime record itself<br />
* An ''main'' or ''official'' anime title is added, edited, or deleted (not ''short'' or ''synonym'')<br />
* An episode for the anime is added, or delete (but NOT edited!) ( --> But perhaps airdate changes should <-- )<br />
* An episode title is added, edited, or delete<br />
* An anime category is added, or deleted (but NOT edited: eg, weight change)<br />
* An anime relation is added, or deleted<br />
<br />
=== REVIEW: Get Anime Review ===<br />
Retrieves the review scores and text for an anime review. Like ANIMEDESC, it will likely take multiple calls to this comment to retrieve a complete review - almost all reviews will overflow the size limits of a UDP packet.<br />
<br />
'''Command String:'''<br />
* REVIEW rid={int4 id}<br />
<br />
'''Possible Replies:'''<br />
* 234 REVIEW<br />
: {int4 current part}|{int4 max parts}|{int4 review id}|{int4 author uid}|{int4 score_animation}|{int4 score_sound}|{int4 score_story}|{int4 score_character}|{int4 score_value}|{int4 score_enjoyment}|{str review_text}<br />
* 234 REVIEW<br />
: {int4 current part}|{int4 max parts}|{str review_text}<br />
<br />
* 334 NO SUCH REVIEW<br />
<br />
'''Info:'''<br />
* IDs and scores are returned with part zero only. Parts one through max exclude the scores and return the text block only.<br />
<br />
<br />
<br />
<br />
<br />
[Maybe exchange author uid for author name. Or a uid->name lookup via USER?]<br />
<br />
=== WISHLIST: Retrieve Wishlist Data ===<br />
<br />
Retrieve wishlist data.<br />
<br />
'''Command String:'''<br><br />
full list:<br />
* WISHLIST<br />
by aid:<br />
* WISHLIST aid={int4 aid}<br />
by wishlist id:<br />
* WISHLIST lid={int4 lid}<br />
by priority:<br />
* WISHLIST priority={int4 priority}<br />
<br><br />
'''Possible Replies:'''<br><br />
<br><br />
by aid, lid:<br />
*223 WISHLIST<br />
: {int4 lid}|{int4 aid}|{int2 type}|{int2 priority}|{int4 fromuid}|{str comment}|{int4 adddate}<br />
<br><br />
full list, by priority:<br />
<br />
*229 MULTIPLE WISHLIST ITEMS<br />
: {int4 aid}|{int4 type}|{int4 priority}/n<br />
: {int4 aid}|{int4 type}|{int4 priority}/n<br />
..repeated n times<br />
<br><br><br />
*323 NO SUCH WISHLIST ITEM<br />
<br><br />
'''Info:'''<br />
* ''Priority'' values are 0: low, 1: medium, 2: high<br />
* ''Type'' values are 1: to watch, 2: to get<br />
* Multiple items are returned in descending priority (high priority first)<br />
* The ''fromuid'' field represents the uid of the user that created the wishlist entry. Typically this is the actual user, but could be a buddy.<br />
<br />
=== WISHLISTADD: Add Anime to Wishlist ===<br />
<br />
'''Command String:'''<br><br />
<br />
* WISHLISTADD aid={int4 aid}&type={int2 type}&priority={int2 priority}[&comment={str comment}]<br />
<br />
<br />
* 226 WISHLIST ITEM ADDED<br />
: {int4 wishlist id}<br />
* 228 WISHLIST ITEM UPDATED<br />
: {int4 wishlist id}<br />
<br />
=== WISHLISTDEL: Remove Anime from Wishlist ===<br />
<br />
=== NOTIFICATION: Retrieve Notification Date ===<br />
<br />
=== NOTIFICATIONADD: Add Anime or Group to Notify List ===<br />
<br />
'''Command String:'''<br><br />
<br />
by anime id:<br />
* NOTIFICATIONADD aid={int4 aid}&type={int2 type}&priority={int2 priority}<br />
by group id:<br />
* NOTIFICATIONADD gid={int4 gid}&type={int2 type}&priority={int2 priority}<br />
<br><br />
'''Possible Replies:'''<br />
<br />
* 246 NOTIFICATION ITEM ADDED<br />
: {int4 notification id}<br />
* 248 NOTIFICATION ITEM UPDATED<br />
: {int4 notification id}<br />
* 399 NO CHANGES<br />
<br><br />
'''Info:'''<br />
* ''Priority'' values are 0: low, 1: medium, 2: high<br />
* ''Type'' values are 0: all, 1: new, 2: group, 3: complete<br />
<br />
=== NOTIFICATIONDEL: Remove Anime or Group from Notify List ===<br />
<br />
<br />
=== Empty Table === <br />
<br />
<table><br />
<tr><br />
<td colspan="3" align="center">Byte 1</td><br />
</tr><br />
<tr><br />
<td>Bit</td><br />
<td>Decimal</td><br />
<td>Data Field</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>String</td><br />
</tr><br />
</table><br />
<br />
=== Permissions (badges) ===<br />
<br />
<pre>[22 Jan 12 16:57] * Ommina: baka gives good advice. Let's get the permission thing fully figured out. If I'm going to stop playing minecraft, I don't want to have to redo stuff. (and now gone for food.)<br />
[22 Jan 12 17:04] * worf: well ... what do we have<br />
[22 Jan 12 17:04] * worf: we have a set of personal settings that only affect you<br />
[22 Jan 12 17:05] * worf: hiding thumbnails, hiding all images, hiding porn images, hiding all porn<br />
[22 Jan 12 17:06] * worf: but those dont need to be considered in the xml<br />
[22 Jan 12 17:07] * worf: and then we have the permissions <br />
[22 Jan 12 17:07] * worf: see me in user list, see my anime list, see storage info, see source info, see viewed info, see ep info, see file info, see state info, see my votes, see my wishlist, see my userpage, see my porn<br />
[22 Jan 12 17:08] * worf: see my porn - obviously would apply to the hentai badge<br />
[22 Jan 12 17:09] * worf: see my anime list - should apply to all anime and creator badges<br />
[22 Jan 12 17:09] * DerIdiot: see my anime list/see viewed info/see ep info/see my votes are the ones that matter<br />
[22 Jan 12 17:11] * worf: see my votes shouldnt matter<br />
[22 Jan 12 17:11] * DerIdiot: wasn't sure if you have some badge with them<br />
[22 Jan 12 17:11] * DerIdiot: if not then yes it doesn't<br />
[22 Jan 12 17:11] * worf: there is a counter badge<br />
[22 Jan 12 17:11] * worf: but we are already displaying the number of votes on the userpage anyway<br />
[22 Jan 12 17:12] * worf: i dont think that permission hides the counter either<br />
[22 Jan 12 17:12] * DerIdiot: i'm not 100% sure, but if not then yes you cna ignore it<br />
[22 Jan 12 17:14] * worf: the only usage of PERM_SEEVOTES on the userpage appears to be for hiding the latest votes<br />
[22 Jan 12 17:17] * worf: so ... <br />
[22 Jan 12 17:17] * worf: PERM_SEEMYPORN for the hentai badge<br />
[22 Jan 12 17:18] * worf: PERM_SHOWMYLIST for all anime and creator based badges including the hentai badge<br />
[22 Jan 12 17:18] * worf: PERM_VIEWEDINFO same as the above i guess<br />
[22 Jan 12 17:20] * worf: PERM_EPINFO shouldnt apply since we arent displaying which episodes have been watched. just how many<br />
[22 Jan 12 17:22] * DerIdiot: PERM_EPINFO says that somethign is in mylist; PERM_VIEWEDINFO does the same + says that it's watched<br />
[22 Jan 12 17:25] * worf: if you have PERM_SHOWMYLIST on "everyone" and PERM_EPINFO on "no one" then you can only see which anime a person has but not which episodes<br />
[22 Jan 12 17:25] * DerIdiot: yes<br />
[22 Jan 12 17:25] * worf: hm, ok<br />
[22 Jan 12 17:25] * worf: it hides the counts too<br />
[22 Jan 12 17:26] * worf: k<br />
[22 Jan 12 17:26] * DerIdiot: but you only got watched badges not collecting ones right?<br />
[22 Jan 12 17:26] * worf: yes<br />
[22 Jan 12 17:26] * DerIdiot: then PERM_VIEWEDINFO is enough<br />
[22 Jan 12 17:26] * DerIdiot: should prolly have PERM_SHOWMYLIST and PERM_VIEWEDINFO<br />
[22 Jan 12 17:27] * worf: hmm<br />
</pre></div>Omminahttps://wiki.anidb.net/index.php?title=User:Ommina&diff=16992User:Ommina2012-10-22T08:40:24Z<p>Ommina: /* SIMILAR: Approve or Disapprove of a Similar Pairing */</p>
<hr />
<div>{{TOCright}}<br />
<br />
--> Edit FILE docs to include MyList data block <--<br />
<br />
=== CATEGORY: Retrieve Category Data ===<br />
<br />
=== SIMILAR: Approve or Disapprove of a Similar Pairing ===<br />
<br />
'''Command String:'''<br />
* SIMILAR entity=1&id1={int4 id}&id2={int4 id}&approve={str [y|n|r]}<br />
<br />
'''Possible Replies:'''<br />
* 2nn SIMILAR<br />
{int sid}|{int aid1}|{int aid2}|{str [y|n|r]}<br />
<br />
* 3nn NO SUCH SIMILAR PAIR<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1.<br />
* ''id1'' and ''id2'' represent an ''existing'' pair of ids. There are no provisions for ''adding'' new similar pairs<br />
* Which id is assigned to ''id1'' and which id is assigned to ''id2'' is irrelevant<br />
* Use ''approval=y'' to approve the pair, ''approve=n'' to disapprove, and ''approve=r'' to revoke (delete) an existing approval/disapproval.<br />
* If an approval vote is already assigned, submitting a new ''y''/''n'' value will replace the old vote.<br />
<br />
=== UPDATED: Get List of Updated Anime IDs ===<br />
Returns a list of AniDB anime ids of anime that have been updated in in a given time frame, ordered by descending date.<br />
<br />
'''Command String:'''<br />
* UPDATED entity=1&[age={int4 id}|time={int4 date}]<br />
<br />
'''Possible Replies:'''<br />
* 243 UPDATED<br />
{int entity}|{int total count}|{int last update date}|{list aid}<br />
<br />
* 343 NO UPDATES<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1<br />
* Either ''age'' OR ''time'' can be specified, but not both<br />
* ''age'' is specified in days.<br />
** eg: age=30 requests a list of aid values of anime that have changed in the past 30 days<br />
* ''time'' is specified in unix time.<br />
** eg: time=1264982400 requests a list of aid values of anime that have changed since 2010-02-01<br />
* A maximum of 200 values will be returned<br />
* ''count'' specifies the total number of items found for the given time period. In short, if this value is great than 200, you have not retrieved all applicable ids.<br />
* ''last update date'' will contain the AniDB update time of the ''last'' aid to appear on the list<br />
<br />
'''An anime will be considered updated if:'''<br />
* A change is made to the anime record itself<br />
* An ''main'' or ''official'' anime title is added, edited, or deleted (not ''short'' or ''synonym'')<br />
* An episode for the anime is added, or delete (but NOT edited!) ( --> But perhaps airdate changes should <-- )<br />
* An episode title is added, edited, or delete<br />
* An anime category is added, or deleted (but NOT edited: eg, weight change)<br />
* An anime relation is added, or deleted<br />
<br />
=== REVIEW: Get Anime Review ===<br />
Retrieves the review scores and text for an anime review. Like ANIMEDESC, it will likely take multiple calls to this comment to retrieve a complete review - almost all reviews will overflow the size limits of a UDP packet.<br />
<br />
'''Command String:'''<br />
* REVIEW rid={int4 id}<br />
<br />
'''Possible Replies:'''<br />
* 234 REVIEW<br />
: {int4 current part}|{int4 max parts}|{int4 review id}|{int4 author uid}|{int4 score_animation}|{int4 score_sound}|{int4 score_story}|{int4 score_character}|{int4 score_value}|{int4 score_enjoyment}|{str review_text}<br />
* 234 REVIEW<br />
: {int4 current part}|{int4 max parts}|{str review_text}<br />
<br />
* 334 NO SUCH REVIEW<br />
<br />
'''Info:'''<br />
* IDs and scores are returned with part zero only. Parts one through max exclude the scores and return the text block only.<br />
<br />
<br />
<br />
<br />
<br />
[Maybe exchange author uid for author name. Or a uid->name lookup via USER?]<br />
<br />
=== WISHLIST: Retrieve Wishlist Data ===<br />
<br />
Retrieve wishlist data.<br />
<br />
'''Command String:'''<br><br />
full list:<br />
* WISHLIST<br />
by aid:<br />
* WISHLIST aid={int4 aid}<br />
by wishlist id:<br />
* WISHLIST lid={int4 lid}<br />
by priority:<br />
* WISHLIST priority={int4 priority}<br />
<br><br />
'''Possible Replies:'''<br><br />
<br><br />
by aid, lid:<br />
*223 WISHLIST<br />
: {int4 lid}|{int4 aid}|{int2 type}|{int2 priority}|{int4 fromuid}|{str comment}|{int4 adddate}<br />
<br><br />
full list, by priority:<br />
<br />
*229 MULTIPLE WISHLIST ITEMS<br />
: {int4 aid}|{int4 type}|{int4 priority}/n<br />
: {int4 aid}|{int4 type}|{int4 priority}/n<br />
..repeated n times<br />
<br><br><br />
*323 NO SUCH WISHLIST ITEM<br />
<br><br />
'''Info:'''<br />
* ''Priority'' values are 0: low, 1: medium, 2: high<br />
* ''Type'' values are 1: to watch, 2: to get<br />
* Multiple items are returned in descending priority (high priority first)<br />
* The ''fromuid'' field represents the uid of the user that created the wishlist entry. Typically this is the actual user, but could be a buddy.<br />
<br />
=== WISHLISTADD: Add Anime to Wishlist ===<br />
<br />
'''Command String:'''<br><br />
<br />
* WISHLISTADD aid={int4 aid}&type={int2 type}&priority={int2 priority}[&comment={str comment}]<br />
<br />
<br />
* 226 WISHLIST ITEM ADDED<br />
: {int4 wishlist id}<br />
* 228 WISHLIST ITEM UPDATED<br />
: {int4 wishlist id}<br />
<br />
=== WISHLISTDEL: Remove Anime from Wishlist ===<br />
<br />
=== NOTIFICATION: Retrieve Notification Date ===<br />
<br />
=== NOTIFICATIONADD: Add Anime or Group to Notify List ===<br />
<br />
'''Command String:'''<br><br />
<br />
by anime id:<br />
* NOTIFICATIONADD aid={int4 aid}&type={int2 type}&priority={int2 priority}<br />
by group id:<br />
* NOTIFICATIONADD gid={int4 gid}&type={int2 type}&priority={int2 priority}<br />
<br><br />
'''Possible Replies:'''<br />
<br />
* 246 NOTIFICATION ITEM ADDED<br />
: {int4 notification id}<br />
* 248 NOTIFICATION ITEM UPDATED<br />
: {int4 notification id}<br />
* 399 NO CHANGES<br />
<br><br />
'''Info:'''<br />
* ''Priority'' values are 0: low, 1: medium, 2: high<br />
* ''Type'' values are 0: all, 1: new, 2: group, 3: complete<br />
<br />
=== NOTIFICATIONDEL: Remove Anime or Group from Notify List ===<br />
<br />
<br />
=== Empty Table === <br />
<br />
<table><br />
<tr><br />
<td colspan="3" align="center">Byte 1</td><br />
</tr><br />
<tr><br />
<td>Bit</td><br />
<td>Decimal</td><br />
<td>Data Field</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>String</td><br />
</tr><br />
</table><br />
<br />
=== Permissions (badges) ===<br />
<br />
<pre>[22 Jan 12 16:57] * Ommina: baka gives good advice. Let's get the permission thing fully figured out. If I'm going to stop playing minecraft, I don't want to have to redo stuff. (and now gone for food.)<br />
[22 Jan 12 17:04] * worf: well ... what do we have<br />
[22 Jan 12 17:04] * worf: we have a set of personal settings that only affect you<br />
[22 Jan 12 17:05] * worf: hiding thumbnails, hiding all images, hiding porn images, hiding all porn<br />
[22 Jan 12 17:06] * worf: but those dont need to be considered in the xml<br />
[22 Jan 12 17:07] * worf: and then we have the permissions <br />
[22 Jan 12 17:07] * worf: see me in user list, see my anime list, see storage info, see source info, see viewed info, see ep info, see file info, see state info, see my votes, see my wishlist, see my userpage, see my porn<br />
[22 Jan 12 17:08] * worf: see my porn - obviously would apply to the hentai badge<br />
[22 Jan 12 17:09] * worf: see my anime list - should apply to all anime and creator badges<br />
[22 Jan 12 17:09] * DerIdiot: see my anime list/see viewed info/see ep info/see my votes are the ones that matter<br />
[22 Jan 12 17:11] * worf: see my votes shouldnt matter<br />
[22 Jan 12 17:11] * DerIdiot: wasn't sure if you have some badge with them<br />
[22 Jan 12 17:11] * DerIdiot: if not then yes it doesn't<br />
[22 Jan 12 17:11] * worf: there is a counter badge<br />
[22 Jan 12 17:11] * worf: but we are already displaying the number of votes on the userpage anyway<br />
[22 Jan 12 17:12] * worf: i dont think that permission hides the counter either<br />
[22 Jan 12 17:12] * DerIdiot: i'm not 100% sure, but if not then yes you cna ignore it<br />
[22 Jan 12 17:14] * worf: the only usage of PERM_SEEVOTES on the userpage appears to be for hiding the latest votes<br />
[22 Jan 12 17:17] * worf: so ... <br />
[22 Jan 12 17:17] * worf: PERM_SEEMYPORN for the hentai badge<br />
[22 Jan 12 17:18] * worf: PERM_SHOWMYLIST for all anime and creator based badges including the hentai badge<br />
[22 Jan 12 17:18] * worf: PERM_VIEWEDINFO same as the above i guess<br />
[22 Jan 12 17:20] * worf: PERM_EPINFO shouldnt apply since we arent displaying which episodes have been watched. just how many<br />
[22 Jan 12 17:22] * DerIdiot: PERM_EPINFO says that somethign is in mylist; PERM_VIEWEDINFO does the same + says that it's watched<br />
[22 Jan 12 17:25] * worf: if you have PERM_SHOWMYLIST on "everyone" and PERM_EPINFO on "no one" then you can only see which anime a person has but not which episodes<br />
[22 Jan 12 17:25] * DerIdiot: yes<br />
[22 Jan 12 17:25] * worf: hm, ok<br />
[22 Jan 12 17:25] * worf: it hides the counts too<br />
[22 Jan 12 17:26] * worf: k<br />
[22 Jan 12 17:26] * DerIdiot: but you only got watched badges not collecting ones right?<br />
[22 Jan 12 17:26] * worf: yes<br />
[22 Jan 12 17:26] * DerIdiot: then PERM_VIEWEDINFO is enough<br />
[22 Jan 12 17:26] * DerIdiot: should prolly have PERM_SHOWMYLIST and PERM_VIEWEDINFO<br />
[22 Jan 12 17:27] * worf: hmm<br />
</pre></div>Omminahttps://wiki.anidb.net/index.php?title=HTTP_API_Definition&diff=16991HTTP API Definition2012-10-22T06:31:31Z<p>Ommina: /* Access */</p>
<hr />
<div>{{TOCright}}<br />
<br />
== General ==<br />
The HTTP XML API is only a small part of the AniDB API framework, please refer to [[API]] for an overview.<br />
<br />
=== Clients ===<br />
<br />
If you want to create a client you have to register it {{AniDBLink|client|here}} and [[HTTP / UDP Clients|here]].<br />
<br />
=== Encoding ===<br />
All content is UTF8 encoded and gzip compressed (you may have to handle the decompressing yourself, if your HTTP library doesn't support compression of HTTP data). Transfer is in chunks, which are part of HTTP 1.1. This is the case even when your client requested uncompressed HTTP 1.0.<br />
<br />
=== Flooding and Caching ===<br />
All users of this API should employ heavy local caching. Requesting the same dataset multiple times on a single day can get you banned. The same goes for request flooding. You should not request more than one page every two seconds on average.<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Parameters ===<br />
These parameters apply to all HTTP XML API pages and should always be added to the request URLs.<br />
<br />
All users of the HTTP XML API need to be registered and have to provide their registered client identifier and version number on each request.<br />
<br />
Parameters:<br />
* <tt>client={string}</tt> [required]<br />
** client identification string, needs to be a registered client identifier, see: <br />
<br />
* <tt>clientver={integer}</tt> [required]<br />
** client version number, needs to be valid client version number for the given client identification string.<br />
<br />
* <tt>protover={integer}</tt> [required]<br />
** protocol version in use. Possible values: 1<br />
<br />
* <tt>request={string}</tt> [required]<br />
** HTTP XML datapage requested. See following sections.<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1</nowiki></u><br />
<br />
== Data Commands ==<br />
<br />
=== Anime ===<br />
Allows retrieval of non-file or episode related information for a specific anime by AID (AniDB anime id).<br />
<br />
==== Search ====<br />
AniDB offers a daily updated dump of all anime titles which can be used to support client sided anime search features.<br />
<br />
This file can also be used for anime title to AID lookups.<br />
<br />
:[http://anidb.net/api/animetitles.dat.gz http://anidb.net/api/animetitles.dat.gz]<br />
:[http://anidb.net/api/animetitles.xml.gz http://anidb.net/api/animetitles.xml.gz]<br />
<br />
Alternatively there is a ready to use search using these dumps available by a third party: [http://anisearch.outrance.pl/] (thx to eloyard)<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=anime</tt><br />
* <tt>aid={integer}</tt> [required]<br />
** AniDB anime id of the anime you want to retrieve data for.<br />
<br />
<br />
{{eyecatch|Note|The tags node presently contains both 'spoiler' and 'localspoiler' attributes. Both represent the same value. Clients should use 'localspoiler'; in time, 'spoiler' will be removed.}}<br />
<br />
<br />
{{eyecatch|Important!|The meaning of the <temporary> vote node has changed since the HTTP API was put in place. To help keep clients compatible, the node will not be removed short term, but client consumers should be aware that this value now represents the mean of all votes (both permanent and temporary).}}<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime&client={str}&clientver={int}&protover=1&aid={int}</nowiki></u><br />
<br />
===== Data =====<br />
<code><pre><br />
<?xml version="1.0" encoding="UTF-8"?><br />
<anime id="1" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>1999-01-04</startdate><br />
<enddate>1999-03-29</enddate><br />
<titles><br />
<title xml:lang="x-jat" type="main">Seikai no Monshou</title><br />
<title xml:lang="zh-Hans" type="syn">星界之纹章</title><br />
<title xml:lang="en" type="short">CotS</title><br />
<title xml:lang="x-jat" type="short">SnM</title><br />
<title xml:lang="ja" type="official">星界の紋章</title><br />
<title xml:lang="en" type="official">Crest of the Stars</title><br />
<title xml:lang="fr" type="official">Crest of the Stars</title><br />
<title xml:lang="pl" type="official">Crest of the Stars</title><br />
</titles><br />
<relatedanime><br />
<anime id="4" type="Sequel">Seikai no Senki</anime><br />
<anime id="6" type="Prequel">Seikai no Danshou</anime><br />
<anime id="1623" type="Summary">Seikai no Monshou Tokubetsuhen</anime><br />
</relatedanime><br />
<url>http://www.sunrise-inc.co.jp/seikai/</url><br />
<creators><br />
<name id="4495" type="Original Work">Morioka Hiroyuki</name><br />
</creators><br />
<description>Jinto Lin`s life changes forever when the Humankind Empire Abh takes over his home planet of Martine without firing a single shot. He is soon sent off to study the Abh language and culture and to prepare himself for his future as a nobleman — a future he never dreamed of. Or wanted.Now, Jinto is entering the next phase of his training, and he is about to meet his first Abh, the lovely Lafiel. But Jinto is about to learn that she is more than she appears to be. And together they will have to fight for their very lives.</description><br />
<ratings><br />
<permanent count="2953">8.53</permanent><br />
<temporary count="96">7.58</temporary><br />
<review count="11">8.75</review><br />
</ratings><br />
<picture>440.jpg</picture><br />
<categories><br />
<category id="174" parentid="8" hentai="false" weight="500"><br />
<name>Space Travel</name><br />
<description>Space Travel usually refers going to space or travelling there with or without a spacecraft. There are different forms of space travel like Interplanetary travel, Interstellar travel or Intergalactic travel. Since it isn`t possible to travel faster than light, most anime series involve some sort "sub-space travel mechanism" as a way to travel faster than light.</description><br />
</category><br />
<category id="274" parentid="268" hentai="false" weight="400"><br />
<name>Novel</name><br />
<description>Note that novel means book with words in paper, so no comics and no "visual novels", which should go under manga and dating-sim - visual Novel/erotic game respectively.&#13;<br />
&#13;<br />
Note that it can be applied to novels as we know them but also the typical light novels for teens and young adults, which are common in Japan and aside from being short include a number of illustrations. </description><br />
</category><br />
</categories><br />
<tags><br />
<tag id="136" approval="20" spoiler="false" update="2009-05-23"><br />
<name>space opera</name><br />
<count>71</count><br />
</tag><br />
<tag id="175" approval="17" spoiler="false" update="2008-03-13"><br />
<name>space elves</name><br />
<count>12</count><br />
</tag><br />
<tag id="389" approval="15" spoiler="false" update="2008-06-03"><br />
<name>war setting</name><br />
<count>64</count><br />
</tag><br />
<tag id="393" approval="18" spoiler="false" update="2008-06-03"><br />
<name>space battles</name><br />
<count>43</count><br />
<description>There are space battles in this anime. Usually between Earth forces and some alien invader, but ship to ship skirmishes in deep space are just as common.</description><br />
</tag><br />
</tags><br />
<characters><br />
<character id="7493" type="appears in" update="2009-05-28"><br />
<name>Gosroth</name><br />
<description>The Resii Gothroth.The first Abh ship lost in the war.</description><br />
<episodes>1,1012</episodes><br />
<picture>26147.jpg</picture><br />
</character><br />
<character id="7501" type="appears in" update="2009-05-28"><br />
<name>Planet Martine</name><br />
<description>The homeworld of Jinto</description><br />
<episodes>1</episodes><br />
</character><br />
<character id="7503" type="appears in" update="2009-05-28"><br />
<name>Rock Lynn</name><br />
<description>The former president of Martine, later made count of the Hyde system, after striking a deal with the Abh (in episode 1)</description><br />
<episodes>1</episodes><br />
<picture>26165.jpg</picture><br />
</character><br />
</characters><br />
<episodes><br />
<episode id="1" update="2005-03-10"><br />
<epno>1</epno><br />
<length>24</length><br />
<airdate>1999-01-03</airdate><br />
<rating votes="17">5.66</rating><br />
<title xml:lang="ja">侵略</title><br />
<title xml:lang="en">Invasion</title><br />
<title xml:lang="fr">Invasion</title><br />
<title xml:lang="x-jat">shinryaku</title><br />
</episode><br />
<episode id="2" update="2005-03-11"><br />
<epno>2</epno><br />
<length>24</length><br />
<airdate>1999-01-10</airdate><br />
<rating votes="12">6.66</rating><br />
<title xml:lang="ja">星たちの眷族</title><br />
<title xml:lang="en">Kin of the Stars</title><br />
<title xml:lang="fr">Les parents des Étoiles</title><br />
<title xml:lang="x-jat">Hoshi-tachi no Kenzoku</title><br />
</episode><br />
</episodes><br />
</anime><br />
</pre></code><br />
<br />
==== Errors ====<br />
[http://anidb.net/perl-bin/animedb.pl?show=cmt&post=159118 According to ommina] the API does not use HTTP return code. Instead you will get XML consisting of one tag with a textual description.<br />
<code><pre><br />
<error>Banned</error><br />
</pre></code><br />
<br />
=== Category List ===<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=categorylist</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=categorylist</tt><br />
** The current AniDB category tree. This tree is fairly static, with only rare changes. Request a new list only if you have good reason to believe there has been changes.<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=categorylist</nowiki></u><br />
<br />
<code><pre><br />
<categorylist><br />
<category id="80" parentid="3"><br />
<name>18 Restricted</name><br />
<description>This isn`t really an "Audience".<br />
<br />
While some anime might feature sexual content they still might not be porn. Only use it when the content is clearly *not* intended for minors. <br />
</description><br />
</category><br />
<category id="4" parentid="313"><br />
<name>Action</name><br />
</category><br />
<br />
...<br />
<br />
<category id="37" parentid="30"><br />
<name>Yuri</name><br />
<description>Yuri refers to anime that portray lesbian (female/female) sex. Do not confuse this with the Shoujo Ai category under Romance, which only portrays girl/girl relationships, but generally not anything pornographic. This is real female/female porn.</description><br />
</category><br />
</categorylist><br />
</pre></code><br />
<br />
=== Random Recommendation ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random recommendations' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomrecommendation</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomrecommendation</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomrecommendation</nowiki></u><br />
<br />
<code><pre><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="7899" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>2010-10-04</startdate><br />
<enddate>2010-12-27</enddate><br />
<title xml:lang="x-jat" type="main">Arakawa Under the Bridge 2</title><br />
<picture>54734.jpg</picture><br />
<ratings><br />
<permanent count="781">623</permanent><br />
<recommendations>8</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
...<br />
<br />
<randomrecommendation><br />
</pre></code><br />
<br />
=== Random Similar ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random similar' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomsimilar</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomsimilar</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomsimilar</nowiki></u><br />
<br />
<code><pre><br />
<randomsimilar><br />
<similar><br />
<source aid="7056" restricted="false"><br />
<title xml:lang="x-jat" type="main">Aoi Bungaku Series</title><br />
<picture>37124.jpg</picture><br />
</source><br />
<target aid="3654" restricted="false"><br />
<title xml:lang="x-jat" type="main">Ayakashi: Japanese Classic Horror</title><br />
<picture>44085.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
</randomsimilar><br />
</pre></code><br />
<br />
=== Hot Anime ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Unlike the two random result commands, the results here will match the results as supplied by the main web page (with some possible variance of a few hours, depending on cache life.)<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=hotanime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=hotanime</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=hotanime</nowiki></u><br />
<br />
<code><pre><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
</pre></code><br />
<br />
=== Main ===<br />
<br />
A one-stop command returning the combined results of random recommendation, random similar, and hot anime. Use this command instead of scraping the HTML, and if you need more than one of the individual replies.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=main</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=main</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=main</nowiki></u><br />
<br />
<code><pre><br />
<main><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
<randomsimilar><br />
<similar><br />
<source aid="8107" restricted="false"><br />
<title xml:lang="x-jat" type="main">A Channel: The Animation</title><br />
<picture>59870.jpg</picture><br />
</source><br />
<target aid="4777" restricted="false"><br />
<title xml:lang="x-jat" type="main">Lucky Star</title><br />
<picture>65555.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
<randomsimilar><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="44" restricted="false"><br />
<type>OVA</type><br />
<episodecount>1</episodecount><br />
<startdate>2000-05-24</startdate><br />
<enddate>2000-05-24</enddate><br />
<title xml:lang="x-jat" type="main">Amon Devilman Mokushiroku</title><br />
<picture>14016.jpg</picture><br />
<ratings><br />
<permanent count="317">387</permanent><br />
<recommendations>1</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
....<br />
<br />
</randomrecommendation><br />
</main><br />
</pre></code><br />
<br />
== User Data Commands ==<br />
<br />
=== User Mylist Summary ===<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=mylistsummary&user={str anidb username}&pass={str anidb password}</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=mylistsummary</tt><br />
** Returns a list of the user's anime list in summary form, roughly matching the data in the "my list" page of the web interface.<br />
* <tt>user={str username}&pass={str password}</tt><br />
** The user name and password of the desired user. This is their main password, not the API password specified in the profile.<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=mylistsummary&user={str}&pass={str}</nowiki></u><br />
<br />
<code><pre><br />
<mylistsummary uid="40237"><br />
<mylistitem aid="5841" state="2"><br />
<episodecount>22</episodecount><br />
<seencount>22</seencount><br />
<specialcount>9</specialcount><br />
<seenspecialcount>4</seenspecialcount><br />
</mylistitem><br />
<mylistsummary><br />
</pre></code><br />
<br />
[[Category:Development]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=User:Ommina&diff=16989User:Ommina2012-10-20T11:14:38Z<p>Ommina: /* UPDATED: Get List of Updated Anime IDs */</p>
<hr />
<div>{{TOCright}}<br />
<br />
--> Edit FILE docs to include MyList data block <--<br />
<br />
=== CATEGORY: Retrieve Category Data ===<br />
<br />
=== SIMILAR: Approve or Disapprove of a Similar Pairing ===<br />
<br />
'''Command String:'''<br />
* SIMILAR aid1={int4 id}&aid2={int4 id}&approve={str [y|n|r]}<br />
<br />
'''Possible Replies:'''<br />
* 2nn SIMILAR<br />
{int sid}|{int aid1}|{int aid2}|{str [y|n|r]}<br />
<br />
* 3nn NO SUCH SIMILAR PAIR<br />
<br />
'''Info:'''<br />
* ''aid1'' and ''aid2'' represent an ''existing'' pair of ids. There are no provisions for ''adding'' new similar pairs<br />
* Which id is assigned to ''aid1'' and which id is assigned to ''aid2'' is irrelevant<br />
* Use ''approval=y'' to approve the pair, ''approve=n'' to disapprove, and ''approve=r'' to revoke (delete) an existing approval/disapproval.<br />
* If an approval vote is already assigned, submitting a new ''y''/''n'' value will replace the old vote.<br />
<br />
=== UPDATED: Get List of Updated Anime IDs ===<br />
Returns a list of AniDB anime ids of anime that have been updated in in a given time frame, ordered by descending date.<br />
<br />
'''Command String:'''<br />
* UPDATED entity=1&[age={int4 id}|time={int4 date}]<br />
<br />
'''Possible Replies:'''<br />
* 243 UPDATED<br />
{int entity}|{int total count}|{int last update date}|{list aid}<br />
<br />
* 343 NO UPDATES<br />
<br />
'''Info:'''<br />
* ''entity'' is always 1<br />
* Either ''age'' OR ''time'' can be specified, but not both<br />
* ''age'' is specified in days.<br />
** eg: age=30 requests a list of aid values of anime that have changed in the past 30 days<br />
* ''time'' is specified in unix time.<br />
** eg: time=1264982400 requests a list of aid values of anime that have changed since 2010-02-01<br />
* A maximum of 200 values will be returned<br />
* ''count'' specifies the total number of items found for the given time period. In short, if this value is great than 200, you have not retrieved all applicable ids.<br />
* ''last update date'' will contain the AniDB update time of the ''last'' aid to appear on the list<br />
<br />
'''An anime will be considered updated if:'''<br />
* A change is made to the anime record itself<br />
* An ''main'' or ''official'' anime title is added, edited, or deleted (not ''short'' or ''synonym'')<br />
* An episode for the anime is added, or delete (but NOT edited!) ( --> But perhaps airdate changes should <-- )<br />
* An episode title is added, edited, or delete<br />
* An anime category is added, or deleted (but NOT edited: eg, weight change)<br />
* An anime relation is added, or deleted<br />
<br />
=== REVIEW: Get Anime Review ===<br />
Retrieves the review scores and text for an anime review. Like ANIMEDESC, it will likely take multiple calls to this comment to retrieve a complete review - almost all reviews will overflow the size limits of a UDP packet.<br />
<br />
'''Command String:'''<br />
* REVIEW rid={int4 id}<br />
<br />
'''Possible Replies:'''<br />
* 234 REVIEW<br />
: {int4 current part}|{int4 max parts}|{int4 review id}|{int4 author uid}|{int4 score_animation}|{int4 score_sound}|{int4 score_story}|{int4 score_character}|{int4 score_value}|{int4 score_enjoyment}|{str review_text}<br />
* 234 REVIEW<br />
: {int4 current part}|{int4 max parts}|{str review_text}<br />
<br />
* 334 NO SUCH REVIEW<br />
<br />
'''Info:'''<br />
* IDs and scores are returned with part zero only. Parts one through max exclude the scores and return the text block only.<br />
<br />
<br />
<br />
<br />
<br />
[Maybe exchange author uid for author name. Or a uid->name lookup via USER?]<br />
<br />
=== WISHLIST: Retrieve Wishlist Data ===<br />
<br />
Retrieve wishlist data.<br />
<br />
'''Command String:'''<br><br />
full list:<br />
* WISHLIST<br />
by aid:<br />
* WISHLIST aid={int4 aid}<br />
by wishlist id:<br />
* WISHLIST lid={int4 lid}<br />
by priority:<br />
* WISHLIST priority={int4 priority}<br />
<br><br />
'''Possible Replies:'''<br><br />
<br><br />
by aid, lid:<br />
*223 WISHLIST<br />
: {int4 lid}|{int4 aid}|{int2 type}|{int2 priority}|{int4 fromuid}|{str comment}|{int4 adddate}<br />
<br><br />
full list, by priority:<br />
<br />
*229 MULTIPLE WISHLIST ITEMS<br />
: {int4 aid}|{int4 type}|{int4 priority}/n<br />
: {int4 aid}|{int4 type}|{int4 priority}/n<br />
..repeated n times<br />
<br><br><br />
*323 NO SUCH WISHLIST ITEM<br />
<br><br />
'''Info:'''<br />
* ''Priority'' values are 0: low, 1: medium, 2: high<br />
* ''Type'' values are 1: to watch, 2: to get<br />
* Multiple items are returned in descending priority (high priority first)<br />
* The ''fromuid'' field represents the uid of the user that created the wishlist entry. Typically this is the actual user, but could be a buddy.<br />
<br />
=== WISHLISTADD: Add Anime to Wishlist ===<br />
<br />
'''Command String:'''<br><br />
<br />
* WISHLISTADD aid={int4 aid}&type={int2 type}&priority={int2 priority}[&comment={str comment}]<br />
<br />
<br />
* 226 WISHLIST ITEM ADDED<br />
: {int4 wishlist id}<br />
* 228 WISHLIST ITEM UPDATED<br />
: {int4 wishlist id}<br />
<br />
=== WISHLISTDEL: Remove Anime from Wishlist ===<br />
<br />
=== NOTIFICATION: Retrieve Notification Date ===<br />
<br />
=== NOTIFICATIONADD: Add Anime or Group to Notify List ===<br />
<br />
'''Command String:'''<br><br />
<br />
by anime id:<br />
* NOTIFICATIONADD aid={int4 aid}&type={int2 type}&priority={int2 priority}<br />
by group id:<br />
* NOTIFICATIONADD gid={int4 gid}&type={int2 type}&priority={int2 priority}<br />
<br><br />
'''Possible Replies:'''<br />
<br />
* 246 NOTIFICATION ITEM ADDED<br />
: {int4 notification id}<br />
* 248 NOTIFICATION ITEM UPDATED<br />
: {int4 notification id}<br />
* 399 NO CHANGES<br />
<br><br />
'''Info:'''<br />
* ''Priority'' values are 0: low, 1: medium, 2: high<br />
* ''Type'' values are 0: all, 1: new, 2: group, 3: complete<br />
<br />
=== NOTIFICATIONDEL: Remove Anime or Group from Notify List ===<br />
<br />
<br />
=== Empty Table === <br />
<br />
<table><br />
<tr><br />
<td colspan="3" align="center">Byte 1</td><br />
</tr><br />
<tr><br />
<td>Bit</td><br />
<td>Decimal</td><br />
<td>Data Field</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>String</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>String</td><br />
</tr><br />
</table><br />
<br />
=== Permissions (badges) ===<br />
<br />
<pre>[22 Jan 12 16:57] * Ommina: baka gives good advice. Let's get the permission thing fully figured out. If I'm going to stop playing minecraft, I don't want to have to redo stuff. (and now gone for food.)<br />
[22 Jan 12 17:04] * worf: well ... what do we have<br />
[22 Jan 12 17:04] * worf: we have a set of personal settings that only affect you<br />
[22 Jan 12 17:05] * worf: hiding thumbnails, hiding all images, hiding porn images, hiding all porn<br />
[22 Jan 12 17:06] * worf: but those dont need to be considered in the xml<br />
[22 Jan 12 17:07] * worf: and then we have the permissions <br />
[22 Jan 12 17:07] * worf: see me in user list, see my anime list, see storage info, see source info, see viewed info, see ep info, see file info, see state info, see my votes, see my wishlist, see my userpage, see my porn<br />
[22 Jan 12 17:08] * worf: see my porn - obviously would apply to the hentai badge<br />
[22 Jan 12 17:09] * worf: see my anime list - should apply to all anime and creator badges<br />
[22 Jan 12 17:09] * DerIdiot: see my anime list/see viewed info/see ep info/see my votes are the ones that matter<br />
[22 Jan 12 17:11] * worf: see my votes shouldnt matter<br />
[22 Jan 12 17:11] * DerIdiot: wasn't sure if you have some badge with them<br />
[22 Jan 12 17:11] * DerIdiot: if not then yes it doesn't<br />
[22 Jan 12 17:11] * worf: there is a counter badge<br />
[22 Jan 12 17:11] * worf: but we are already displaying the number of votes on the userpage anyway<br />
[22 Jan 12 17:12] * worf: i dont think that permission hides the counter either<br />
[22 Jan 12 17:12] * DerIdiot: i'm not 100% sure, but if not then yes you cna ignore it<br />
[22 Jan 12 17:14] * worf: the only usage of PERM_SEEVOTES on the userpage appears to be for hiding the latest votes<br />
[22 Jan 12 17:17] * worf: so ... <br />
[22 Jan 12 17:17] * worf: PERM_SEEMYPORN for the hentai badge<br />
[22 Jan 12 17:18] * worf: PERM_SHOWMYLIST for all anime and creator based badges including the hentai badge<br />
[22 Jan 12 17:18] * worf: PERM_VIEWEDINFO same as the above i guess<br />
[22 Jan 12 17:20] * worf: PERM_EPINFO shouldnt apply since we arent displaying which episodes have been watched. just how many<br />
[22 Jan 12 17:22] * DerIdiot: PERM_EPINFO says that somethign is in mylist; PERM_VIEWEDINFO does the same + says that it's watched<br />
[22 Jan 12 17:25] * worf: if you have PERM_SHOWMYLIST on "everyone" and PERM_EPINFO on "no one" then you can only see which anime a person has but not which episodes<br />
[22 Jan 12 17:25] * DerIdiot: yes<br />
[22 Jan 12 17:25] * worf: hm, ok<br />
[22 Jan 12 17:25] * worf: it hides the counts too<br />
[22 Jan 12 17:26] * worf: k<br />
[22 Jan 12 17:26] * DerIdiot: but you only got watched badges not collecting ones right?<br />
[22 Jan 12 17:26] * worf: yes<br />
[22 Jan 12 17:26] * DerIdiot: then PERM_VIEWEDINFO is enough<br />
[22 Jan 12 17:26] * DerIdiot: should prolly have PERM_SHOWMYLIST and PERM_VIEWEDINFO<br />
[22 Jan 12 17:27] * worf: hmm<br />
</pre></div>Omminahttps://wiki.anidb.net/index.php?title=Avdump2&diff=16890Avdump22012-09-24T05:22:51Z<p>Ommina: </p>
<hr />
<div>Welcome to the remarkably sparse avdump2 wiki page, lovingly hand created over many minutes + some more.<br />
<br />
We gleefully embrace build 6489, yet another public release of avd2. It represents a complete rewrite of the original avd1 code, runs against a new build of MediaInfoLibrary, contains a number of custom solutions for a number of formats, represents a significant investment of time and energy by Arokh, and is just generally nifty.<br />
<br />
There is no need to reprocess existing files with this build, but do keep an eye out for misbehaviour.<br />
<br />
==What is it==<br />
'''Avdump2''' is a video/audio codec identification utility - identifies which video codec and audio compression method is used on video files. Furthermore it hashes the file with a set of common hashalgorithms and calculates the used bit rates, the length, identifies the number of used audio channels and more.<br><br />
It, like its predecessor, is mainly based on [http://mediainfo.sourceforge.net/en mediainfo], but significantly enhanced and changed to fit AniDB's needs by [[User:Arokh|Arokh]].<br><br />
<br />
===Supported formats===<br />
Most major file formats are supported to some degree. While hashes are created for all file types, stream details remain shakey for others (notably 'swf'). Because of that for some filetypes (underlined) only the hashes get auto-creqed.<br />
<br />
* '''Video files:''' asf/wmv, avi, flv, m2ts, mk3d, mkv, mov, mp4, mpg/mpeg, ogm, ogv, qt, rm/rmvb, <u>swf</u>, ts, webm<br />
* '''Subtitle files:''' ass, idx, js, lrc, mks, pjs, rt, smi, srt, ssa, sub, sup, tmp, tts, txt, xss<br />
* '''Audio files:''' aac, ac3, dts, dtshd, flac, m4a, mka, mp3, ogg, ra, thd, wav, wma<br />
* '''Archive files:''' <u>7z</u>, <u>ace</u>, <u>rar</u>, <u>zip</u><br />
* '''Linker files:''' mkv, smil<br />
<br />
===Download===<br />
<br />
[http://static.anidb.net/client/avdump2/avdump2_6489.rar DOWNLOAD(RAR)] (Build 6489) MD5 = f1b3e700a8b34e48ae9e51875863a202<br />
<br />
===Usage===<br />
'''Avdump2''' is a simple [[Wikipedia:Command line interface|command line]] client:<br />
:<tt>AVDump2CL.exe [--<Arg> -<OneLetterArg> ...] <media file/folder> [<media file/folder> ...]</tt><br />
<br />
While pre 4991 build arguments can still be used, it is recommended to use the new format shown below.<br />
The easiest way to convert them to the new format is to run the program with the old args which then displays a notice and the corresponding args in the new format.<br />
<br />
====Options====<br />
{|align="center" style="border: 1px solid #aaaaaa; border-collapse: collapse; background: #f9f9f9; line-height: 1.0; font-size: small; width: 95%"<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Switch<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Type<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Description<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Default<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Example<br />
|-<br />
|'''Auth'''=<username>:<udp_api_key>||Auto-Creqing||Enable automatic creqing. You should always use this option when dumping anime files! Also enables error reporting.||||--Auth=tard:monkey<br />
|-<br />
|'''Host'''=<hostname>:<port>||Auto-Creqing||Hostname of AniDB UDP API server||--Host=api.anidb.info:9002||<br />
|-<br />
|'''LPort'''=<port>||Auto-Creqing||Local UDP port used for autocreqing. Only needed when behind "strict" firewalls.||||--LPort=12345<br />
|-<br />
|'''TOut'''=<timeoutInSeconds>:<numOfRetries>||Auto-Creqing||Timeout for sending dumps||--TOut=10:3||--TOut=25:6<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''ACErr'''=<file path/name>||Logging||Write file paths of failed dumps to file.||||--ACErr=acerr.txt<br />
|-<br />
|'''CRCErr'''=<file path/name>||Logging||Checks if filename contains calculated crc||||--CRCErr=crcerr.txt<br />
|-<br />
|'''ExtDiff'''=<file path/name>||Logging||Write mismatched extensions and file paths to file.||||--ExtDiff=extdiff.txt<br />
|-<br />
|'''FixExt'''=<file path/name>||Logging||Changes the fileextension to the dectected extension and logs the action.||||--FixExt=fixext.txt<br />
|-<br />
|'''Done'''=<file path/name>||Logging||Skip paths present in log and append paths to newly processed files.||||--Done=done.txt<br />
|-<br />
|'''HLog'''=<file path/name>||Logging||Export hashes to file.||||--HLog="$CRC$ $ED2K$":hlog.txt<br />
|-<br />
|'''Log'''=<file path/name>||Logging||Write output to file.||||--Log=log.txt<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''M'''||Output||MediaInfo dump||||-M<br />
|-<br />
|'''m'''||Output||MediaInfo XML dump||||-m<br />
|-<br />
|'''t'''||Output||Simple text format||||-t<br />
|-<br />
|'''C'''||Output||XML creq format||||-C<br />
|-<br />
|'''c'''||Output||AVD2 creq dump||||-c<br />
|-<br />
|'''h'''||Output||Hash Dump||||-h<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''BSize'''=<KB_per_block>:<number_of_blocks>||Control||Buffer size for hashing.||||--BSize=512:16<br />
|-<br />
|'''Ext'''=<comma separated list>||Control||Comma separated extension list.||Process all supported extensions||--Ext=avi,mkv or --Ext=-zip,-sub or --Ext=*<br />
|-<br />
|'''Mon'''=<seconds>||Control||Monitor sleep duration in seconds.||--Mon=60||--Mon=120<br />
|-<br />
|'''NoErr'''||Control||Disable error reporting. You should not disable this as it helps finding and fixing bugs.||||--NoErr<br />
|-<br />
|'''R'''||Control||Do '''not''' recurse into subfolders.||||-R<br />
|-<br />
|'''p'''||Control||Pause when done (hold cmd window).||||-p<br />
|-<br />
|'''P'''||Control||Pause after each file.||||-P<br />
|-<br />
|'''r'''||Control||Random file order.||||-r<br />
|-<br />
|'''q'''||Control||Suppress progress (silent).||||-q<br />
|-<br />
|'''B'''||Control||Test pure hashingspeed without io limitations||||-B<br />
|-<br />
|'''U'''||Control||Use UTF8 as console output stream||||-U<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''0'''||Hashing||For CRC (because the CRC of a 0 byte file is 00000000).||||-0<br />
|-<br />
|'''1'''||Hashing||For SHA1 (because of the 1).||||-1<br />
|-<br />
|'''2'''||Hashing||For ED2K (because of the 2).||||-2<br />
|-<br />
|'''3'''||Hashing||For Tiger (because a tiger in the house minimizes the Three Great Risks -- thieves, fire, and evil spirits).||||-3<br />
|-<br />
|'''4'''||Hashing||For MD4 (because of the 4).||||-4<br />
|-<br />
|'''5'''||Hashing||For MD5 (because of the 5).||||-5<br />
|-<br />
|'''6'''||Hashing||For TTH ... because that's what's left :p||||-6<br />
|-<br />
|'''a'''||Hashing||All (available) hash algorithms.||||-a<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''Exp'''=<file path/name>||AniDB||Export ed2k-links to the specified file. Very useful when mass adding files.||||--Exp=ed2k.txt<br />
|-<br />
|'''PrintEd2kLink'''||AniDB|| ||||--PrintEd2kLink<br />
|-<br />
|'''PrintAniDBLink'''||AniDB|| ||||--PrintAniDBLink<br />
|-<br />
|'''OpenAniDBLink'''||AniDB|| ||||--OpenAniDBLink<br />
|-<br />
|}<br />
<br />
====Windows Shortcut====<br />
#Extract Avdump to a folder of choice.<br />
#:Example: <tt>"C:\Program Files\AVDump2\"</tt><br />
#Right-click <tt>AVDump2CL.exe</tt>, select ''Create Shortcut''.<br />
#Right-click the shortcut, add options to the ''Shortcut - Target'' line.<br />
#:Example, normal usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" -p</tt><br />
#:Example, auto-creq usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" --Auth:''myName'':''udp_api_key''</tt><br />
#::You can also set other options from the list above if you wish to do so.<br />
#::A commandline option to export ED2K links to a file is by adding <tt>--Exp=''C:\Path\ed2k.txt''</tt>, etc.<br />
#::Note that you need to set an '''UDP API Key''' in your AniDB profile for auto-creqing.<br />
#:Optional: Change ''Run'' to ''Maximized''.<br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
====Send to====<br />
#Move the shortcut created above to the SendTo folder.<br />
#:Example, under XP: <tt>"C:\Documents and Settings\''Username''\SendTo"</tt><br />
#:Example, under Vista: <tt>"C:\Users\''Username''\AppData\Roaming\Microsoft\Windows\SendTo"</tt><br />
#::Where ''Username'' is your Windows Login-Name.<br />
#:Note that ''SendTo'' is a hidden folder.<br />
#Right-click any media-file, go to "Send To", choose <tt>AVDump2CL.exe</tt><br />
#Get [[Creq|CReqing]]<br />
<br />
====MS-DOS Batch File====<br />
#Extract Avdump to a folder of choice.<br />
#Create a MS-DOS batch file with the 2 lines below, and save it as ''filename.bat''.<br />
#<tt>@ECHO OFF</tt><br />
#<tt>C:\Program Files\AVDump\AVDump2CL.exe %1 --Exp:''C:\Path\ed2k.txt'' --Auth:''myName'':''udp_api_key''</tt><br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
==Changes From Avdump Classic==<br />
<br />
* AVD2 now runs on the managed .net platform. This will not affect most, as .net comes pre-installed with current versions of windows. XP or older may have to install the platform manually. While it has been tested on mono, such testing has not been exhaustive. We would be very interested in hearing how it behaves in such an environment.<br />
* While most command line parameters remain the same, there are some exceptions. <br />
** The "-o" parameter is no longer available in avd2.<br />
** The "-n" parameter is no longer available in avd2.<br />
** The meaning of the numeric parameters has changed.<br />
* In the event of an internal error, AVD2 ''will'' submit an error report back to AniDB. The error report contains no user-details (see sample), but ''is'' attached to the user name supplied with the -ac parameter. While error reports are ''only'' submitted if -ac is specified, they can be disabled by the addition of the -noerr parameter. That said, for the purposes of initial testing, we respectfully request that error reports not be disabled, so bugs can be found and fixed.<br />
<br />
====Sample Exception Report====<br />
<FileExceptions><br />
<Information><br />
<AVDump2CLVersion>0.1.3734.0</AVDump2CLVersion><br />
<RunOnBitness>64</RunOnBitness><br />
<OS>Microsoft Windows NT 6.1.7601 Service Pack 1</OS><br />
</Information><br />
<Exceptions><br />
<AVDump2CL.Exceptions.AVD2Exception thrownOn="20110303 05.27.26.9254"><br />
<Message>Error in DisplayBuffer</Message><br />
<System.ArgumentOutOfRangeException><br />
<Message><br />
Non-negative number required.<br />
Parameter name: totalWidth<br />
</Message><br />
<StackTrace><br />
<Frame><br />
at System.String.PadHelper(Int32 totalWidth, Char paddingChar, Boolean isRightPadded)<br />
</Frame><br />
<Frame>at l.a(f A_0, Progress A_1)</Frame><br />
<Frame>at l.a(f A_0, Dictionary`2& A_1)</Frame><br />
</StackTrace><br />
</System.ArgumentOutOfRangeException><br />
</AVDump2CL.Exceptions.AVD2Exception><br />
</Exceptions><br />
</FileExceptions><br />
<br />
===Avdump2 on Linux===<br />
Thanks to Mono, Avdump2 runs natively on Linux as well. However, as most development effort goes into the Windows version and due to the heterogenity of Linux distributions, running Avdump2 on Linux isn’t as straightforward as running it on Windows. All Linux-related usage notes can be found on the [[Avdump2 on Linux]] page.<br />
<br />
<br />
==Auto-creqing==<br />
[[Image:Autocreq.gif|thumb|Simple diagram of the way auto-creqing with Avdump2 works]]<br />
<br />
Avdump2 is the AniDB [[auto-creqing]] system. Some more or less important notes:<br />
* To be able to use this feature you’ll need an AniDB account '''and you have to define the ''UDP API Key'' in your [[profile]]'''. All data sent to the server will be logged with IP and uid.<br />
* It is possible to run more than one instance of Avdump2 at once, but not more than ten will work OK. At the moment ''only 10 sessions per ip are allowed by the server'', meaning the eleventh instance will terminate the first.<br />
* There is no direct connection between data sent to AniDB and creqs generated. The data received will just be stored for later processing. There is no way to check the current status for a dump. Usually, it should take ''at least 24 hours'' from the moment you dump a file till the data actually changes. If any irregularities occur, or when there is too much data pending, it will take more time.<br />
* The creqs generated will report the user who sent the data first (for a specific file) as the creqer.<br />
* You may dump files currently not in the database. The data is still stored and will be used later if/after the file has been registered.<br />
* Files creqed by the new system will be locked, meaning some fields will not be possible to change. Notify a moderator if you are '''sure''' that some of the data locked for a specific file is wrong.<br />
<br />
===Why didn't this file get dumped?===<br />
* The file in AniDB is registered with wrong size and/or ED2K hash.<br />
* The package never reached the server.<br />
* The decryption or decompression failed at server side (rare).<br />
* The dump is not valid XML (rare).<br />
<br />
===Why isn't this file verified?===<br />
Even if the file is dumped it doesn't mean it will get auto-creqed (and verified). Here are the reasons:<br />
* The file is corrupt/invalid ([http://anidb.net/perl-bin/animedb.pl?show=avmf&do=xml&avid=76226 example]).<br />
* The provided data is considered "incoherent". (Indicates a bug in Avdump.)<br />
* The dump was marked unfit for file verification by an AniDB Moderator.<br />
<br />
<br />
==Known issues==<br />
* In some cases MediaInfoLib (MIL) used by Avdump2 might report an audio stream to have 0 or 3 channels.<br />
* Anamorphic .asf/.wmv and .mpg/.mpeg files might not get detected correctly and will report the PAR instead of the DAR.<br />
* Some corrupted mkv files may throw a (Thread Aborted) exception, this will be fixed once the updated version of the mkv parser is introduced<br />
* [6248] Avdump2 may freeze if autocreqs are enabled and there are no creqs to send<br />
<br />
==Changelog==<br />
<div style="height: 280px; overflow: auto; padding: 3px; border:1px solid #AAAAAA; font-size: small"><br />
'''0.1.6248.0 : 2012.08.28'''<br />
* Shiny icon for the executable<br />
<br />
* New AniDB Communication, should be faster and more reliable.<br />
** Big file reports no longer fail to be ACReqed.<br />
** Wrong Version and Wrong UserName/Password errors are now separated<br />
** Update notification will be shown if a newer version is available<br />
<br />
* InfoProvider:<br />
** Trimming all value fields<br />
** Fixes serverside parsing errors<br />
<br />
* FileExtensionProvider:<br />
** Limit ReadLine length<br />
** Fixes errors which can happen when a binary file is parsed<br />
<br />
* <strike>Directory: Added workaround for "too long" filepaths</strike> <br/> FileAdding: On error, display the path of the causing file/directory<br />
<br />
* MatroskaParser:<br />
** Less strict with corrupted mkv files. <br/> (If enough data could be read, the ACReq will be sent despite errors)<br />
<br />
* FileSource: Fixed nullpointer excpetion<br />
<br />
* CL:<br />
** Shortcut for DoneLogFileNameOnly is now D instead of R (because it clashed with NoRecurse)<br />
** Added version check and notification of new version if present<br />
** Less jumping for the ETA display<br />
<br />
* Added extensive tracing (removed in public versions)<br />
<br />
* Lots of other small things<br />
<br />
'''0.1.5290.0 : 2012.05.12'''<br />
* Fixed FileExtensionParser (hopefully)<br />
* TXT Report should be fixed now<br />
* Fixed ACReq Send Thread crash<br />
* AVD2 no longer pauses when not on Windows<br />
* Fixed AVD2 not working when not started from same folder as the executable<br />
* Added switch --UseCWD<br />
* Other changes I haven't remembered yet<br />
<br />
'''0.1.5028.0 : 2011.09.11'''<br />
* Fixed shift of hashvalues (_Display_ only)<br />
* Fixed --Ext with "to remove" extensions<br />
* Fixed --Mon/--TOut to actually work<br />
* Fixed some bug in the old CLI converter<br />
* <no ponies><br />
<br />
'''0.1.5000.0 : 2011.09.11'''<br />
* all previous builds aside of 4991 have been disabled<br />
* <more ponies><br />
<br />
'''0.1.4964.0 : 2011.09.05'''<br />
* all previous builds have been disabled<br />
* Sending ACReqs asynchronous<br />
* <insert ponies riding down the rainbow and other stuff that has happened><br />
<br />
'''0.1.4334.0 : 2011.06.15'''<br />
* all previous builds have been disabled<br />
* should work under linux via mono now too<br />
<br />
'''0.1.4260.0 : 2011.05.25'''<br />
* all previous builds have been disabled<br />
* fix for rare case where all xml submitted would contain an incorrect hash<br />
<br />
'''0.1.4213.0 : 2011.05.14'''<br />
* all previous builds have been disabled<br />
* addition of support and detection of new video file type: .mk3d<br />
* addition of support and detection of new audio file type: .dtshd, .thd<br />
* addition of support and detection of new subtitle file type: .pjs, .rt, .tmp, .tts, .xss, new type of .sub files<br />
* addition of support and detection of new linker file type: .smil <br />
* addition of support and detection of .zip files starting with magic bytes "PK00PK"<br />
<br />
<br />
'''0.1.3958.0 : 2011.03.15''' - no need to redump everything<br />
* fixed the bug that caused avdump2 not to retry sending a dump when facing a timeout<br />
* video-only mp4 files got wrongly detected as m4v<br />
* automatic detection of 32/64bit and use of the correct mediainfolib<br />
* test if mediainfolib is accessible<br />
* check of mediainfolib version to prevent the usage of untested versions<br />
* updated to mediainfolib 0.7.42<br />
* added -crcerr parameter to log files where the calculated crc is not found in the filename<br />
* added -x parameter to create a "parameterless avdump1"-like output<br />
* new switch -H to test pure hashing speed<br />
* removed Tiger and MD4 checksums from dumps sent to the AniDB server<br />
<br />
'''0.1.3084.0 : 2011.03.12'''<br />
* initial release<br />
</div><br />
<br />
[[Category:Features]]<br />
[[Category:AniDB Clients]]<br />
[[Category:Avdump]]<br />
[[Category:Development]]</div>Omminahttps://wiki.anidb.net/index.php?title=Avdump2&diff=16785Avdump22012-09-01T08:01:22Z<p>Ommina: Undo revision 16784 by Ommina (talk)</p>
<hr />
<div>Welcome to the remarkably sparse avdump2 wiki page, lovingly hand created over many minutes + some more.<br />
<br />
We gleefully embrace build 6248, yet another public release of avd2. It represents a complete rewrite of the original avd1 code, runs against a new build of MediaInfoLibrary, contains a number of custom solutions for a number of formats, represents a significant investment of time and energy by Arokh, and is just generally nifty.<br />
<br />
There is no need to reprocess existing files with this build, but do keep an eye out for misbehaviour.<br />
<br />
==What is it==<br />
'''Avdump2''' is a video/audio codec identification utility - identifies which video codec and audio compression method is used on video files. Furthermore it hashes the file with a set of common hashalgorithms and calculates the used bit rates, the length, identifies the number of used audio channels and more.<br><br />
It, like its predecessor, is mainly based on [http://mediainfo.sourceforge.net/en mediainfo], but significantly enhanced and changed to fit AniDB's needs by [[User:Arokh|Arokh]].<br><br />
<br />
===Supported formats===<br />
Most major file formats are supported to some degree. While hashes are created for all file types, stream details remain shakey for others (notably 'swf'). Because of that for some filetypes (underlined) only the hashes get auto-creqed.<br />
<br />
* '''Video files:''' asf/wmv, avi, flv, m2ts, mk3d, mkv, mov, mp4, mpg/mpeg, ogm, ogv, qt, rm/rmvb, <u>swf</u>, ts, webm<br />
* '''Subtitle files:''' ass, idx, js, lrc, mks, pjs, rt, smi, srt, ssa, sub, sup, tmp, tts, txt, xss<br />
* '''Audio files:''' aac, ac3, dts, dtshd, flac, m4a, mka, mp3, ogg, ra, thd, wav, wma<br />
* '''Archive files:''' <u>7z</u>, <u>ace</u>, <u>rar</u>, <u>zip</u><br />
* '''Linker files:''' mkv, smil<br />
<br />
===Download===<br />
<br />
[http://static.anidb.net/client/avdump2/avdump2_6248.rar DOWNLOAD(RAR)] (Build 6248) MD5 = 4017b2835055d1c54abc12ae72703389<br />
<br />
===Usage===<br />
'''Avdump2''' is a simple [[Wikipedia:Command line interface|command line]] client:<br />
:<tt>AVDump2CL.exe [--<Arg> -<OneLetterArg> ...] <media file/folder> [<media file/folder> ...]</tt><br />
<br />
While pre 4991 build arguments can still be used, it is recommended to use the new format shown below.<br />
The easiest way to convert them to the new format is to run the program with the old args which then displays a notice and the corresponding args in the new format.<br />
<br />
====Options====<br />
{|align="center" style="border: 1px solid #aaaaaa; border-collapse: collapse; background: #f9f9f9; line-height: 1.0; font-size: small; width: 95%"<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Switch<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Type<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Description<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Default<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Example<br />
|-<br />
|'''Auth'''=<username>:<udp_api_key>||Auto-Creqing||Enable automatic creqing. You should always use this option when dumping anime files! Also enables error reporting.||||--Auth=tard:monkey<br />
|-<br />
|'''Host'''=<hostname>:<port>||Auto-Creqing||Hostname of AniDB UDP API server||--Host=api.anidb.info:9002||<br />
|-<br />
|'''LPort'''=<port>||Auto-Creqing||Local UDP port used for autocreqing. Only needed when behind "strict" firewalls.||||--LPort=12345<br />
|-<br />
|'''TOut'''=<timeoutInSeconds>:<numOfRetries>||Auto-Creqing||Timeout for sending dumps||--TOut=10:3||--TOut=25:6<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''ACErr'''=<file path/name>||Logging||Write file paths of failed dumps to file.||||--ACErr=acerr.txt<br />
|-<br />
|'''CRCErr'''=<file path/name>||Logging||Checks if filename contains calculated crc||||--CRCErr=crcerr.txt<br />
|-<br />
|'''ExtDiff'''=<file path/name>||Logging||Write mismatched extensions and file paths to file.||||--ExtDiff=extdiff.txt<br />
|-<br />
|'''FixExt'''=<file path/name>||Logging||Changes the fileextension to the dectected extension and logs the action.||||--FixExt=fixext.txt<br />
|-<br />
|'''Done'''=<file path/name>||Logging||Skip paths present in log and append paths to newly processed files.||||--Done=done.txt<br />
|-<br />
|'''HLog'''=<file path/name>||Logging||Export hashes to file.||||--HLog="$CRC$ $ED2K$":hlog.txt<br />
|-<br />
|'''Log'''=<file path/name>||Logging||Write output to file.||||--Log=log.txt<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''M'''||Output||MediaInfo dump||||-M<br />
|-<br />
|'''m'''||Output||MediaInfo XML dump||||-m<br />
|-<br />
|'''t'''||Output||Simple text format||||-t<br />
|-<br />
|'''C'''||Output||XML creq format||||-C<br />
|-<br />
|'''c'''||Output||AVD2 creq dump||||-c<br />
|-<br />
|'''h'''||Output||Hash Dump||||-h<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''BSize'''=<KB_per_block>:<number_of_blocks>||Control||Buffer size for hashing.||||--BSize=512:16<br />
|-<br />
|'''Ext'''=<comma separated list>||Control||Comma separated extension list.||Process all supported extensions||--Ext=avi,mkv or --Ext=-zip,-sub or --Ext=*<br />
|-<br />
|'''Mon'''=<seconds>||Control||Monitor sleep duration in seconds.||--Mon=60||--Mon=120<br />
|-<br />
|'''NoErr'''||Control||Disable error reporting. You should not disable this as it helps finding and fixing bugs.||||--NoErr<br />
|-<br />
|'''R'''||Control||Do '''not''' recurse into subfolders.||||-R<br />
|-<br />
|'''p'''||Control||Pause when done (hold cmd window).||||-p<br />
|-<br />
|'''P'''||Control||Pause after each file.||||-P<br />
|-<br />
|'''r'''||Control||Random file order.||||-r<br />
|-<br />
|'''q'''||Control||Suppress progress (silent).||||-q<br />
|-<br />
|'''B'''||Control||Test pure hashingspeed without io limitations||||-B<br />
|-<br />
|'''U'''||Control||Use UTF8 as console output stream||||-U<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''0'''||Hashing||For CRC (because the CRC of a 0 byte file is 00000000).||||-0<br />
|-<br />
|'''1'''||Hashing||For SHA1 (because of the 1).||||-1<br />
|-<br />
|'''2'''||Hashing||For ED2K (because of the 2).||||-2<br />
|-<br />
|'''3'''||Hashing||For Tiger (because a tiger in the house minimizes the Three Great Risks -- thieves, fire, and evil spirits).||||-3<br />
|-<br />
|'''4'''||Hashing||For MD4 (because of the 4).||||-4<br />
|-<br />
|'''5'''||Hashing||For MD5 (because of the 5).||||-5<br />
|-<br />
|'''6'''||Hashing||For TTH ... because that's what's left :p||||-6<br />
|-<br />
|'''a'''||Hashing||All (available) hash algorithms.||||-a<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''Exp'''=<file path/name>||AniDB||Export ed2k-links to the specified file. Very useful when mass adding files.||||--Exp=ed2k.txt<br />
|-<br />
|'''PrintEd2kLink'''||AniDB|| ||||--PrintEd2kLink<br />
|-<br />
|'''PrintAniDBLink'''||AniDB|| ||||--PrintAniDBLink<br />
|-<br />
|'''OpenAniDBLink'''||AniDB|| ||||--OpenAniDBLink<br />
|-<br />
|}<br />
<br />
====Windows Shortcut====<br />
#Extract Avdump to a folder of choice.<br />
#:Example: <tt>"C:\Program Files\AVDump2\"</tt><br />
#Right-click <tt>AVDump2CL.exe</tt>, select ''Create Shortcut''.<br />
#Right-click the shortcut, add options to the ''Shortcut - Target'' line.<br />
#:Example, normal usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" -p</tt><br />
#:Example, auto-creq usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" --Auth:''myName'':''udp_api_key''</tt><br />
#::You can also set other options from the list above if you wish to do so.<br />
#::A commandline option to export ED2K links to a file is by adding <tt>--Exp=''C:\Path\ed2k.txt''</tt>, etc.<br />
#::Note that you need to set an '''UDP API Key''' in your AniDB profile for auto-creqing.<br />
#:Optional: Change ''Run'' to ''Maximized''.<br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
====Send to====<br />
#Move the shortcut created above to the SendTo folder.<br />
#:Example, under XP: <tt>"C:\Documents and Settings\''Username''\SendTo"</tt><br />
#:Example, under Vista: <tt>"C:\Users\''Username''\AppData\Roaming\Microsoft\Windows\SendTo"</tt><br />
#::Where ''Username'' is your Windows Login-Name.<br />
#:Note that ''SendTo'' is a hidden folder.<br />
#Right-click any media-file, go to "Send To", choose <tt>AVDump2CL.exe</tt><br />
#Get [[Creq|CReqing]]<br />
<br />
====MS-DOS Batch File====<br />
#Extract Avdump to a folder of choice.<br />
#Create a MS-DOS batch file with the 2 lines below, and save it as ''filename.bat''.<br />
#<tt>@ECHO OFF</tt><br />
#<tt>C:\Program Files\AVDump\AVDump2CL.exe %1 --Exp:''C:\Path\ed2k.txt'' --Auth:''myName'':''udp_api_key''</tt><br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
==Changes From Avdump Classic==<br />
<br />
* AVD2 now runs on the managed .net platform. This will not affect most, as .net comes pre-installed with current versions of windows. XP or older may have to install the platform manually. While it has been tested on mono, such testing has not been exhaustive. We would be very interested in hearing how it behaves in such an environment.<br />
* While most command line parameters remain the same, there are some exceptions. <br />
** The "-o" parameter is no longer available in avd2.<br />
** The "-n" parameter is no longer available in avd2.<br />
** The meaning of the numeric parameters has changed.<br />
* In the event of an internal error, AVD2 ''will'' submit an error report back to AniDB. The error report contains no user-details (see sample), but ''is'' attached to the user name supplied with the -ac parameter. While error reports are ''only'' submitted if -ac is specified, they can be disabled by the addition of the -noerr parameter. That said, for the purposes of initial testing, we respectfully request that error reports not be disabled, so bugs can be found and fixed.<br />
<br />
====Sample Exception Report====<br />
<FileExceptions><br />
<Information><br />
<AVDump2CLVersion>0.1.3734.0</AVDump2CLVersion><br />
<RunOnBitness>64</RunOnBitness><br />
<OS>Microsoft Windows NT 6.1.7601 Service Pack 1</OS><br />
</Information><br />
<Exceptions><br />
<AVDump2CL.Exceptions.AVD2Exception thrownOn="20110303 05.27.26.9254"><br />
<Message>Error in DisplayBuffer</Message><br />
<System.ArgumentOutOfRangeException><br />
<Message><br />
Non-negative number required.<br />
Parameter name: totalWidth<br />
</Message><br />
<StackTrace><br />
<Frame><br />
at System.String.PadHelper(Int32 totalWidth, Char paddingChar, Boolean isRightPadded)<br />
</Frame><br />
<Frame>at l.a(f A_0, Progress A_1)</Frame><br />
<Frame>at l.a(f A_0, Dictionary`2& A_1)</Frame><br />
</StackTrace><br />
</System.ArgumentOutOfRangeException><br />
</AVDump2CL.Exceptions.AVD2Exception><br />
</Exceptions><br />
</FileExceptions><br />
<br />
===Avdump2 on Linux===<br />
Thanks to Mono, Avdump2 runs natively on Linux as well. However, as most development effort goes into the Windows version and due to the heterogenity of Linux distributions, running Avdump2 on Linux isn’t as straightforward as running it on Windows. All Linux-related usage notes can be found on the [[Avdump2 on Linux]] page.<br />
<br />
<br />
==Auto-creqing==<br />
[[Image:Autocreq.gif|thumb|Simple diagram of the way auto-creqing with Avdump2 works]]<br />
<br />
Avdump2 is the AniDB [[auto-creqing]] system. Some more or less important notes:<br />
* To be able to use this feature you’ll need an AniDB account '''and you have to define the ''UDP API Key'' in your [[profile]]'''. All data sent to the server will be logged with IP and uid.<br />
* It is possible to run more than one instance of Avdump2 at once, but not more than ten will work OK. At the moment ''only 10 sessions per ip are allowed by the server'', meaning the eleventh instance will terminate the first.<br />
* There is no direct connection between data sent to AniDB and creqs generated. The data received will just be stored for later processing. There is no way to check the current status for a dump. Usually, it should take ''at least 24 hours'' from the moment you dump a file till the data actually changes. If any irregularities occur, or when there is too much data pending, it will take more time.<br />
* The creqs generated will report the user who sent the data first (for a specific file) as the creqer.<br />
* You may dump files currently not in the database. The data is still stored and will be used later if/after the file has been registered.<br />
* Files creqed by the new system will be locked, meaning some fields will not be possible to change. Notify a moderator if you are '''sure''' that some of the data locked for a specific file is wrong.<br />
<br />
===Why didn't this file get dumped?===<br />
* The file in AniDB is registered with wrong size and/or ED2K hash.<br />
* The package never reached the server.<br />
* The decryption or decompression failed at server side (rare).<br />
* The dump is not valid XML (rare).<br />
<br />
===Why isn't this file verified?===<br />
Even if the file is dumped it doesn't mean it will get auto-creqed (and verified). Here are the reasons:<br />
* The file is corrupt/invalid ([http://anidb.net/perl-bin/animedb.pl?show=avmf&do=xml&avid=76226 example]).<br />
* The provided data is considered "incoherent". (Indicates a bug in Avdump.)<br />
* The dump was marked unfit for file verification by an AniDB Moderator.<br />
<br />
<br />
==Known issues==<br />
* In some cases MediaInfoLib (MIL) used by Avdump2 might report an audio stream to have 0 or 3 channels.<br />
* Anamorphic .asf/.wmv and .mpg/.mpeg files might not get detected correctly and will report the PAR instead of the DAR.<br />
* Some corrupted mkv files may throw a (Thread Aborted) exception, this will be fixed once the updated version of the mkv parser is introduced<br />
* [6248] Avdump2 may freeze if autocreqs are enabled and there are no creqs to send<br />
<br />
==Changelog==<br />
<div style="height: 280px; overflow: auto; padding: 3px; border:1px solid #AAAAAA; font-size: small"><br />
'''0.1.6248.0 : 2012.08.28'''<br />
* Shiny icon for the executable<br />
<br />
* New AniDB Communication, should be faster and more reliable.<br />
** Big file reports no longer fail to be ACReqed.<br />
** Wrong Version and Wrong UserName/Password errors are now separated<br />
** Update notification will be shown if a newer version is available<br />
<br />
* InfoProvider:<br />
** Trimming all value fields<br />
** Fixes serverside parsing errors<br />
<br />
* FileExtensionProvider:<br />
** Limit ReadLine length<br />
** Fixes errors which can happen when a binary file is parsed<br />
<br />
* <strike>Directory: Added workaround for "too long" filepaths</strike> <br/> FileAdding: On error, display the path of the causing file/directory<br />
<br />
* MatroskaParser:<br />
** Less strict with corrupted mkv files. <br/> (If enough data could be read, the ACReq will be sent despite errors)<br />
<br />
* FileSource: Fixed nullpointer excpetion<br />
<br />
* CL:<br />
** Shortcut for DoneLogFileNameOnly is now D instead of R (because it clashed with NoRecurse)<br />
** Added version check and notification of new version if present<br />
** Less jumping for the ETA display<br />
<br />
* Added extensive tracing (removed in public versions)<br />
<br />
* Lots of other small things<br />
<br />
'''0.1.5290.0 : 2012.05.12'''<br />
* Fixed FileExtensionParser (hopefully)<br />
* TXT Report should be fixed now<br />
* Fixed ACReq Send Thread crash<br />
* AVD2 no longer pauses when not on Windows<br />
* Fixed AVD2 not working when not started from same folder as the executable<br />
* Added switch --UseCWD<br />
* Other changes I haven't remembered yet<br />
<br />
'''0.1.5028.0 : 2011.09.11'''<br />
* Fixed shift of hashvalues (_Display_ only)<br />
* Fixed --Ext with "to remove" extensions<br />
* Fixed --Mon/--TOut to actually work<br />
* Fixed some bug in the old CLI converter<br />
* <no ponies><br />
<br />
'''0.1.5000.0 : 2011.09.11'''<br />
* all previous builds aside of 4991 have been disabled<br />
* <more ponies><br />
<br />
'''0.1.4964.0 : 2011.09.05'''<br />
* all previous builds have been disabled<br />
* Sending ACReqs asynchronous<br />
* <insert ponies riding down the rainbow and other stuff that has happened><br />
<br />
'''0.1.4334.0 : 2011.06.15'''<br />
* all previous builds have been disabled<br />
* should work under linux via mono now too<br />
<br />
'''0.1.4260.0 : 2011.05.25'''<br />
* all previous builds have been disabled<br />
* fix for rare case where all xml submitted would contain an incorrect hash<br />
<br />
'''0.1.4213.0 : 2011.05.14'''<br />
* all previous builds have been disabled<br />
* addition of support and detection of new video file type: .mk3d<br />
* addition of support and detection of new audio file type: .dtshd, .thd<br />
* addition of support and detection of new subtitle file type: .pjs, .rt, .tmp, .tts, .xss, new type of .sub files<br />
* addition of support and detection of new linker file type: .smil <br />
* addition of support and detection of .zip files starting with magic bytes "PK00PK"<br />
<br />
<br />
'''0.1.3958.0 : 2011.03.15''' - no need to redump everything<br />
* fixed the bug that caused avdump2 not to retry sending a dump when facing a timeout<br />
* video-only mp4 files got wrongly detected as m4v<br />
* automatic detection of 32/64bit and use of the correct mediainfolib<br />
* test if mediainfolib is accessible<br />
* check of mediainfolib version to prevent the usage of untested versions<br />
* updated to mediainfolib 0.7.42<br />
* added -crcerr parameter to log files where the calculated crc is not found in the filename<br />
* added -x parameter to create a "parameterless avdump1"-like output<br />
* new switch -H to test pure hashing speed<br />
* removed Tiger and MD4 checksums from dumps sent to the AniDB server<br />
<br />
'''0.1.3084.0 : 2011.03.12'''<br />
* initial release<br />
</div><br />
<br />
[[Category:Features]]<br />
[[Category:AniDB Clients]]<br />
[[Category:Avdump]]<br />
[[Category:Development]]</div>Omminahttps://wiki.anidb.net/index.php?title=Avdump2&diff=16784Avdump22012-09-01T07:44:04Z<p>Ommina: </p>
<hr />
<div>Welcome to the remarkably sparse avdump2 wiki page, lovingly hand created over many minutes + some more.<br />
<br />
We gleefully embrace build 6312, yet another public release of avd2. It represents a complete rewrite of the original avd1 code, runs against a new build of MediaInfoLibrary, contains a number of custom solutions for a number of formats, represents a significant investment of time and energy by Arokh, and is just generally nifty.<br />
<br />
There is no need to reprocess existing files with this build, but do keep an eye out for misbehaviour.<br />
<br />
==What is it==<br />
'''Avdump2''' is a video/audio codec identification utility - identifies which video codec and audio compression method is used on video files. Furthermore it hashes the file with a set of common hashalgorithms and calculates the used bit rates, the length, identifies the number of used audio channels and more.<br><br />
It, like its predecessor, is mainly based on [http://mediainfo.sourceforge.net/en mediainfo], but significantly enhanced and changed to fit AniDB's needs by [[User:Arokh|Arokh]].<br><br />
<br />
===Supported formats===<br />
Most major file formats are supported to some degree. While hashes are created for all file types, stream details remain shakey for others (notably 'swf'). Because of that for some filetypes (underlined) only the hashes get auto-creqed.<br />
<br />
* '''Video files:''' asf/wmv, avi, flv, m2ts, mk3d, mkv, mov, mp4, mpg/mpeg, ogm, ogv, qt, rm/rmvb, <u>swf</u>, ts, webm<br />
* '''Subtitle files:''' ass, idx, js, lrc, mks, pjs, rt, smi, srt, ssa, sub, sup, tmp, tts, txt, xss<br />
* '''Audio files:''' aac, ac3, dts, dtshd, flac, m4a, mka, mp3, ogg, ra, thd, wav, wma<br />
* '''Archive files:''' <u>7z</u>, <u>ace</u>, <u>rar</u>, <u>zip</u><br />
* '''Linker files:''' mkv, smil<br />
<br />
===Download===<br />
<br />
[http://static.anidb.net/client/avdump2/avdump2_6312.rar DOWNLOAD(RAR)] (Build 6312) MD5 = d0b10c98481e794d1e93935381369c56<br />
<br />
===Usage===<br />
'''Avdump2''' is a simple [[Wikipedia:Command line interface|command line]] client:<br />
:<tt>AVDump2CL.exe [--<Arg> -<OneLetterArg> ...] <media file/folder> [<media file/folder> ...]</tt><br />
<br />
While pre 4991 build arguments can still be used, it is recommended to use the new format shown below.<br />
The easiest way to convert them to the new format is to run the program with the old args which then displays a notice and the corresponding args in the new format.<br />
<br />
====Options====<br />
{|align="center" style="border: 1px solid #aaaaaa; border-collapse: collapse; background: #f9f9f9; line-height: 1.0; font-size: small; width: 95%"<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Switch<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Type<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Description<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Default<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Example<br />
|-<br />
|'''Auth'''=<username>:<udp_api_key>||Auto-Creqing||Enable automatic creqing. You should always use this option when dumping anime files! Also enables error reporting.||||--Auth=tard:monkey<br />
|-<br />
|'''Host'''=<hostname>:<port>||Auto-Creqing||Hostname of AniDB UDP API server||--Host=api.anidb.info:9002||<br />
|-<br />
|'''LPort'''=<port>||Auto-Creqing||Local UDP port used for autocreqing. Only needed when behind "strict" firewalls.||||--LPort=12345<br />
|-<br />
|'''TOut'''=<timeoutInSeconds>:<numOfRetries>||Auto-Creqing||Timeout for sending dumps||--TOut=10:3||--TOut=25:6<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''ACErr'''=<file path/name>||Logging||Write file paths of failed dumps to file.||||--ACErr=acerr.txt<br />
|-<br />
|'''CRCErr'''=<file path/name>||Logging||Checks if filename contains calculated crc||||--CRCErr=crcerr.txt<br />
|-<br />
|'''ExtDiff'''=<file path/name>||Logging||Write mismatched extensions and file paths to file.||||--ExtDiff=extdiff.txt<br />
|-<br />
|'''FixExt'''=<file path/name>||Logging||Changes the fileextension to the dectected extension and logs the action.||||--FixExt=fixext.txt<br />
|-<br />
|'''Done'''=<file path/name>||Logging||Skip paths present in log and append paths to newly processed files.||||--Done=done.txt<br />
|-<br />
|'''HLog'''=<file path/name>||Logging||Export hashes to file.||||--HLog="$CRC$ $ED2K$":hlog.txt<br />
|-<br />
|'''Log'''=<file path/name>||Logging||Write output to file.||||--Log=log.txt<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''M'''||Output||MediaInfo dump||||-M<br />
|-<br />
|'''m'''||Output||MediaInfo XML dump||||-m<br />
|-<br />
|'''t'''||Output||Simple text format||||-t<br />
|-<br />
|'''C'''||Output||XML creq format||||-C<br />
|-<br />
|'''c'''||Output||AVD2 creq dump||||-c<br />
|-<br />
|'''h'''||Output||Hash Dump||||-h<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''BSize'''=<KB_per_block>:<number_of_blocks>||Control||Buffer size for hashing.||||--BSize=512:16<br />
|-<br />
|'''Ext'''=<comma separated list>||Control||Comma separated extension list.||Process all supported extensions||--Ext=avi,mkv or --Ext=-zip,-sub or --Ext=*<br />
|-<br />
|'''Mon'''=<seconds>||Control||Monitor sleep duration in seconds.||--Mon=60||--Mon=120<br />
|-<br />
|'''NoErr'''||Control||Disable error reporting. You should not disable this as it helps finding and fixing bugs.||||--NoErr<br />
|-<br />
|'''R'''||Control||Do '''not''' recurse into subfolders.||||-R<br />
|-<br />
|'''p'''||Control||Pause when done (hold cmd window).||||-p<br />
|-<br />
|'''P'''||Control||Pause after each file.||||-P<br />
|-<br />
|'''r'''||Control||Random file order.||||-r<br />
|-<br />
|'''q'''||Control||Suppress progress (silent).||||-q<br />
|-<br />
|'''B'''||Control||Test pure hashingspeed without io limitations||||-B<br />
|-<br />
|'''U'''||Control||Use UTF8 as console output stream||||-U<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''0'''||Hashing||For CRC (because the CRC of a 0 byte file is 00000000).||||-0<br />
|-<br />
|'''1'''||Hashing||For SHA1 (because of the 1).||||-1<br />
|-<br />
|'''2'''||Hashing||For ED2K (because of the 2).||||-2<br />
|-<br />
|'''3'''||Hashing||For Tiger (because a tiger in the house minimizes the Three Great Risks -- thieves, fire, and evil spirits).||||-3<br />
|-<br />
|'''4'''||Hashing||For MD4 (because of the 4).||||-4<br />
|-<br />
|'''5'''||Hashing||For MD5 (because of the 5).||||-5<br />
|-<br />
|'''6'''||Hashing||For TTH ... because that's what's left :p||||-6<br />
|-<br />
|'''a'''||Hashing||All (available) hash algorithms.||||-a<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''Exp'''=<file path/name>||AniDB||Export ed2k-links to the specified file. Very useful when mass adding files.||||--Exp=ed2k.txt<br />
|-<br />
|'''PrintEd2kLink'''||AniDB|| ||||--PrintEd2kLink<br />
|-<br />
|'''PrintAniDBLink'''||AniDB|| ||||--PrintAniDBLink<br />
|-<br />
|'''OpenAniDBLink'''||AniDB|| ||||--OpenAniDBLink<br />
|-<br />
|}<br />
<br />
====Windows Shortcut====<br />
#Extract Avdump to a folder of choice.<br />
#:Example: <tt>"C:\Program Files\AVDump2\"</tt><br />
#Right-click <tt>AVDump2CL.exe</tt>, select ''Create Shortcut''.<br />
#Right-click the shortcut, add options to the ''Shortcut - Target'' line.<br />
#:Example, normal usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" -p</tt><br />
#:Example, auto-creq usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" --Auth:''myName'':''udp_api_key''</tt><br />
#::You can also set other options from the list above if you wish to do so.<br />
#::A commandline option to export ED2K links to a file is by adding <tt>--Exp=''C:\Path\ed2k.txt''</tt>, etc.<br />
#::Note that you need to set an '''UDP API Key''' in your AniDB profile for auto-creqing.<br />
#:Optional: Change ''Run'' to ''Maximized''.<br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
====Send to====<br />
#Move the shortcut created above to the SendTo folder.<br />
#:Example, under XP: <tt>"C:\Documents and Settings\''Username''\SendTo"</tt><br />
#:Example, under Vista: <tt>"C:\Users\''Username''\AppData\Roaming\Microsoft\Windows\SendTo"</tt><br />
#::Where ''Username'' is your Windows Login-Name.<br />
#:Note that ''SendTo'' is a hidden folder.<br />
#Right-click any media-file, go to "Send To", choose <tt>AVDump2CL.exe</tt><br />
#Get [[Creq|CReqing]]<br />
<br />
====MS-DOS Batch File====<br />
#Extract Avdump to a folder of choice.<br />
#Create a MS-DOS batch file with the 2 lines below, and save it as ''filename.bat''.<br />
#<tt>@ECHO OFF</tt><br />
#<tt>C:\Program Files\AVDump\AVDump2CL.exe %1 --Exp:''C:\Path\ed2k.txt'' --Auth:''myName'':''udp_api_key''</tt><br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
==Changes From Avdump Classic==<br />
<br />
* AVD2 now runs on the managed .net platform. This will not affect most, as .net comes pre-installed with current versions of windows. XP or older may have to install the platform manually. While it has been tested on mono, such testing has not been exhaustive. We would be very interested in hearing how it behaves in such an environment.<br />
* While most command line parameters remain the same, there are some exceptions. <br />
** The "-o" parameter is no longer available in avd2.<br />
** The "-n" parameter is no longer available in avd2.<br />
** The meaning of the numeric parameters has changed.<br />
* In the event of an internal error, AVD2 ''will'' submit an error report back to AniDB. The error report contains no user-details (see sample), but ''is'' attached to the user name supplied with the -ac parameter. While error reports are ''only'' submitted if -ac is specified, they can be disabled by the addition of the -noerr parameter. That said, for the purposes of initial testing, we respectfully request that error reports not be disabled, so bugs can be found and fixed.<br />
<br />
====Sample Exception Report====<br />
<FileExceptions><br />
<Information><br />
<AVDump2CLVersion>0.1.3734.0</AVDump2CLVersion><br />
<RunOnBitness>64</RunOnBitness><br />
<OS>Microsoft Windows NT 6.1.7601 Service Pack 1</OS><br />
</Information><br />
<Exceptions><br />
<AVDump2CL.Exceptions.AVD2Exception thrownOn="20110303 05.27.26.9254"><br />
<Message>Error in DisplayBuffer</Message><br />
<System.ArgumentOutOfRangeException><br />
<Message><br />
Non-negative number required.<br />
Parameter name: totalWidth<br />
</Message><br />
<StackTrace><br />
<Frame><br />
at System.String.PadHelper(Int32 totalWidth, Char paddingChar, Boolean isRightPadded)<br />
</Frame><br />
<Frame>at l.a(f A_0, Progress A_1)</Frame><br />
<Frame>at l.a(f A_0, Dictionary`2& A_1)</Frame><br />
</StackTrace><br />
</System.ArgumentOutOfRangeException><br />
</AVDump2CL.Exceptions.AVD2Exception><br />
</Exceptions><br />
</FileExceptions><br />
<br />
===Avdump2 on Linux===<br />
Thanks to Mono, Avdump2 runs natively on Linux as well. However, as most development effort goes into the Windows version and due to the heterogenity of Linux distributions, running Avdump2 on Linux isn’t as straightforward as running it on Windows. All Linux-related usage notes can be found on the [[Avdump2 on Linux]] page.<br />
<br />
<br />
==Auto-creqing==<br />
[[Image:Autocreq.gif|thumb|Simple diagram of the way auto-creqing with Avdump2 works]]<br />
<br />
Avdump2 is the AniDB [[auto-creqing]] system. Some more or less important notes:<br />
* To be able to use this feature you’ll need an AniDB account '''and you have to define the ''UDP API Key'' in your [[profile]]'''. All data sent to the server will be logged with IP and uid.<br />
* It is possible to run more than one instance of Avdump2 at once, but not more than ten will work OK. At the moment ''only 10 sessions per ip are allowed by the server'', meaning the eleventh instance will terminate the first.<br />
* There is no direct connection between data sent to AniDB and creqs generated. The data received will just be stored for later processing. There is no way to check the current status for a dump. Usually, it should take ''at least 24 hours'' from the moment you dump a file till the data actually changes. If any irregularities occur, or when there is too much data pending, it will take more time.<br />
* The creqs generated will report the user who sent the data first (for a specific file) as the creqer.<br />
* You may dump files currently not in the database. The data is still stored and will be used later if/after the file has been registered.<br />
* Files creqed by the new system will be locked, meaning some fields will not be possible to change. Notify a moderator if you are '''sure''' that some of the data locked for a specific file is wrong.<br />
<br />
===Why didn't this file get dumped?===<br />
* The file in AniDB is registered with wrong size and/or ED2K hash.<br />
* The package never reached the server.<br />
* The decryption or decompression failed at server side (rare).<br />
* The dump is not valid XML (rare).<br />
<br />
===Why isn't this file verified?===<br />
Even if the file is dumped it doesn't mean it will get auto-creqed (and verified). Here are the reasons:<br />
* The file is corrupt/invalid ([http://anidb.net/perl-bin/animedb.pl?show=avmf&do=xml&avid=76226 example]).<br />
* The provided data is considered "incoherent". (Indicates a bug in Avdump.)<br />
* The dump was marked unfit for file verification by an AniDB Moderator.<br />
<br />
<br />
==Known issues==<br />
* In some cases MediaInfoLib (MIL) used by Avdump2 might report an audio stream to have 0 or 3 channels.<br />
* Anamorphic .asf/.wmv and .mpg/.mpeg files might not get detected correctly and will report the PAR instead of the DAR.<br />
* Some corrupted mkv files may throw a (Thread Aborted) exception, this will be fixed once the updated version of the mkv parser is introduced<br />
* [6248] Avdump2 may freeze if autocreqs are enabled and there are no creqs to send<br />
<br />
==Changelog==<br />
<div style="height: 280px; overflow: auto; padding: 3px; border:1px solid #AAAAAA; font-size: small"><br />
'''0.1.6248.0 : 2012.08.28'''<br />
* Shiny icon for the executable<br />
<br />
* New AniDB Communication, should be faster and more reliable.<br />
** Big file reports no longer fail to be ACReqed.<br />
** Wrong Version and Wrong UserName/Password errors are now separated<br />
** Update notification will be shown if a newer version is available<br />
<br />
* InfoProvider:<br />
** Trimming all value fields<br />
** Fixes serverside parsing errors<br />
<br />
* FileExtensionProvider:<br />
** Limit ReadLine length<br />
** Fixes errors which can happen when a binary file is parsed<br />
<br />
* <strike>Directory: Added workaround for "too long" filepaths</strike> <br/> FileAdding: On error, display the path of the causing file/directory<br />
<br />
* MatroskaParser:<br />
** Less strict with corrupted mkv files. <br/> (If enough data could be read, the ACReq will be sent despite errors)<br />
<br />
* FileSource: Fixed nullpointer excpetion<br />
<br />
* CL:<br />
** Shortcut for DoneLogFileNameOnly is now D instead of R (because it clashed with NoRecurse)<br />
** Added version check and notification of new version if present<br />
** Less jumping for the ETA display<br />
<br />
* Added extensive tracing (removed in public versions)<br />
<br />
* Lots of other small things<br />
<br />
'''0.1.5290.0 : 2012.05.12'''<br />
* Fixed FileExtensionParser (hopefully)<br />
* TXT Report should be fixed now<br />
* Fixed ACReq Send Thread crash<br />
* AVD2 no longer pauses when not on Windows<br />
* Fixed AVD2 not working when not started from same folder as the executable<br />
* Added switch --UseCWD<br />
* Other changes I haven't remembered yet<br />
<br />
'''0.1.5028.0 : 2011.09.11'''<br />
* Fixed shift of hashvalues (_Display_ only)<br />
* Fixed --Ext with "to remove" extensions<br />
* Fixed --Mon/--TOut to actually work<br />
* Fixed some bug in the old CLI converter<br />
* <no ponies><br />
<br />
'''0.1.5000.0 : 2011.09.11'''<br />
* all previous builds aside of 4991 have been disabled<br />
* <more ponies><br />
<br />
'''0.1.4964.0 : 2011.09.05'''<br />
* all previous builds have been disabled<br />
* Sending ACReqs asynchronous<br />
* <insert ponies riding down the rainbow and other stuff that has happened><br />
<br />
'''0.1.4334.0 : 2011.06.15'''<br />
* all previous builds have been disabled<br />
* should work under linux via mono now too<br />
<br />
'''0.1.4260.0 : 2011.05.25'''<br />
* all previous builds have been disabled<br />
* fix for rare case where all xml submitted would contain an incorrect hash<br />
<br />
'''0.1.4213.0 : 2011.05.14'''<br />
* all previous builds have been disabled<br />
* addition of support and detection of new video file type: .mk3d<br />
* addition of support and detection of new audio file type: .dtshd, .thd<br />
* addition of support and detection of new subtitle file type: .pjs, .rt, .tmp, .tts, .xss, new type of .sub files<br />
* addition of support and detection of new linker file type: .smil <br />
* addition of support and detection of .zip files starting with magic bytes "PK00PK"<br />
<br />
<br />
'''0.1.3958.0 : 2011.03.15''' - no need to redump everything<br />
* fixed the bug that caused avdump2 not to retry sending a dump when facing a timeout<br />
* video-only mp4 files got wrongly detected as m4v<br />
* automatic detection of 32/64bit and use of the correct mediainfolib<br />
* test if mediainfolib is accessible<br />
* check of mediainfolib version to prevent the usage of untested versions<br />
* updated to mediainfolib 0.7.42<br />
* added -crcerr parameter to log files where the calculated crc is not found in the filename<br />
* added -x parameter to create a "parameterless avdump1"-like output<br />
* new switch -H to test pure hashing speed<br />
* removed Tiger and MD4 checksums from dumps sent to the AniDB server<br />
<br />
'''0.1.3084.0 : 2011.03.12'''<br />
* initial release<br />
</div><br />
<br />
[[Category:Features]]<br />
[[Category:AniDB Clients]]<br />
[[Category:Avdump]]<br />
[[Category:Development]]</div>Omminahttps://wiki.anidb.net/index.php?title=Avdump2&diff=16782Avdump22012-08-31T09:08:12Z<p>Ommina: /* Known issues */</p>
<hr />
<div>Welcome to the remarkably sparse avdump2 wiki page, lovingly hand created over many minutes + some more.<br />
<br />
We gleefully embrace build 6248, yet another public release of avd2. It represents a complete rewrite of the original avd1 code, runs against a new build of MediaInfoLibrary, contains a number of custom solutions for a number of formats, represents a significant investment of time and energy by Arokh, and is just generally nifty.<br />
<br />
There is no need to reprocess existing files with this build, but do keep an eye out for misbehaviour.<br />
<br />
==What is it==<br />
'''Avdump2''' is a video/audio codec identification utility - identifies which video codec and audio compression method is used on video files. Furthermore it hashes the file with a set of common hashalgorithms and calculates the used bit rates, the length, identifies the number of used audio channels and more.<br><br />
It, like its predecessor, is mainly based on [http://mediainfo.sourceforge.net/en mediainfo], but significantly enhanced and changed to fit AniDB's needs by [[User:Arokh|Arokh]].<br><br />
<br />
===Supported formats===<br />
Most major file formats are supported to some degree. While hashes are created for all file types, stream details remain shakey for others (notably 'swf'). Because of that for some filetypes (underlined) only the hashes get auto-creqed.<br />
<br />
* '''Video files:''' asf/wmv, avi, flv, m2ts, mk3d, mkv, mov, mp4, mpg/mpeg, ogm, ogv, qt, rm/rmvb, <u>swf</u>, ts, webm<br />
* '''Subtitle files:''' ass, idx, js, lrc, mks, pjs, rt, smi, srt, ssa, sub, sup, tmp, tts, txt, xss<br />
* '''Audio files:''' aac, ac3, dts, dtshd, flac, m4a, mka, mp3, ogg, ra, thd, wav, wma<br />
* '''Archive files:''' <u>7z</u>, <u>ace</u>, <u>rar</u>, <u>zip</u><br />
* '''Linker files:''' mkv, smil<br />
<br />
===Download===<br />
<br />
[http://static.anidb.net/client/avdump2/avdump2_6248.rar DOWNLOAD(RAR)] (Build 6248) MD5 = 4017b2835055d1c54abc12ae72703389<br />
<br />
===Usage===<br />
'''Avdump2''' is a simple [[Wikipedia:Command line interface|command line]] client:<br />
:<tt>AVDump2CL.exe [--<Arg> -<OneLetterArg> ...] <media file/folder> [<media file/folder> ...]</tt><br />
<br />
While pre 4991 build arguments can still be used, it is recommended to use the new format shown below.<br />
The easiest way to convert them to the new format is to run the program with the old args which then displays a notice and the corresponding args in the new format.<br />
<br />
====Options====<br />
{|align="center" style="border: 1px solid #aaaaaa; border-collapse: collapse; background: #f9f9f9; line-height: 1.0; font-size: small; width: 95%"<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Switch<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Type<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Description<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Default<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Example<br />
|-<br />
|'''Auth'''=<username>:<udp_api_key>||Auto-Creqing||Enable automatic creqing. You should always use this option when dumping anime files! Also enables error reporting.||||--Auth=tard:monkey<br />
|-<br />
|'''Host'''=<hostname>:<port>||Auto-Creqing||Hostname of AniDB UDP API server||--Host=api.anidb.info:9002||<br />
|-<br />
|'''LPort'''=<port>||Auto-Creqing||Local UDP port used for autocreqing. Only needed when behind "strict" firewalls.||||--LPort=12345<br />
|-<br />
|'''TOut'''=<timeoutInSeconds>:<numOfRetries>||Auto-Creqing||Timeout for sending dumps||--TOut=10:3||--TOut=25:6<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''ACErr'''=<file path/name>||Logging||Write file paths of failed dumps to file.||||--ACErr=acerr.txt<br />
|-<br />
|'''CRCErr'''=<file path/name>||Logging||Checks if filename contains calculated crc||||--CRCErr=crcerr.txt<br />
|-<br />
|'''ExtDiff'''=<file path/name>||Logging||Write mismatched extensions and file paths to file.||||--ExtDiff=extdiff.txt<br />
|-<br />
|'''FixExt'''=<file path/name>||Logging||Changes the fileextension to the dectected extension and logs the action.||||--FixExt=fixext.txt<br />
|-<br />
|'''Done'''=<file path/name>||Logging||Skip paths present in log and append paths to newly processed files.||||--Done=done.txt<br />
|-<br />
|'''HLog'''=<file path/name>||Logging||Export hashes to file.||||--HLog="$CRC$ $ED2K$":hlog.txt<br />
|-<br />
|'''Log'''=<file path/name>||Logging||Write output to file.||||--Log=log.txt<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''M'''||Output||MediaInfo dump||||-M<br />
|-<br />
|'''m'''||Output||MediaInfo XML dump||||-m<br />
|-<br />
|'''t'''||Output||Simple text format||||-t<br />
|-<br />
|'''C'''||Output||XML creq format||||-C<br />
|-<br />
|'''c'''||Output||AVD2 creq dump||||-c<br />
|-<br />
|'''h'''||Output||Hash Dump||||-h<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''BSize'''=<KB_per_block>:<number_of_blocks>||Control||Buffer size for hashing.||||--BSize=512:16<br />
|-<br />
|'''Ext'''=<comma separated list>||Control||Comma separated extension list.||Process all supported extensions||--Ext=avi,mkv or --Ext=-zip,-sub or --Ext=*<br />
|-<br />
|'''Mon'''=<seconds>||Control||Monitor sleep duration in seconds.||--Mon=60||--Mon=120<br />
|-<br />
|'''NoErr'''||Control||Disable error reporting. You should not disable this as it helps finding and fixing bugs.||||--NoErr<br />
|-<br />
|'''R'''||Control||Do '''not''' recurse into subfolders.||||-R<br />
|-<br />
|'''p'''||Control||Pause when done (hold cmd window).||||-p<br />
|-<br />
|'''P'''||Control||Pause after each file.||||-P<br />
|-<br />
|'''r'''||Control||Random file order.||||-r<br />
|-<br />
|'''q'''||Control||Suppress progress (silent).||||-q<br />
|-<br />
|'''B'''||Control||Test pure hashingspeed without io limitations||||-B<br />
|-<br />
|'''U'''||Control||Use UTF8 as console output stream||||-U<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''0'''||Hashing||For CRC (because the CRC of a 0 byte file is 00000000).||||-0<br />
|-<br />
|'''1'''||Hashing||For SHA1 (because of the 1).||||-1<br />
|-<br />
|'''2'''||Hashing||For ED2K (because of the 2).||||-2<br />
|-<br />
|'''3'''||Hashing||For Tiger (because a tiger in the house minimizes the Three Great Risks -- thieves, fire, and evil spirits).||||-3<br />
|-<br />
|'''4'''||Hashing||For MD4 (because of the 4).||||-4<br />
|-<br />
|'''5'''||Hashing||For MD5 (because of the 5).||||-5<br />
|-<br />
|'''6'''||Hashing||For TTH ... because that's what's left :p||||-6<br />
|-<br />
|'''a'''||Hashing||All (available) hash algorithms.||||-a<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''Exp'''=<file path/name>||AniDB||Export ed2k-links to the specified file. Very useful when mass adding files.||||--Exp=ed2k.txt<br />
|-<br />
|'''PrintEd2kLink'''||AniDB|| ||||--PrintEd2kLink<br />
|-<br />
|'''PrintAniDBLink'''||AniDB|| ||||--PrintAniDBLink<br />
|-<br />
|'''OpenAniDBLink'''||AniDB|| ||||--OpenAniDBLink<br />
|-<br />
|}<br />
<br />
====Windows Shortcut====<br />
#Extract Avdump to a folder of choice.<br />
#:Example: <tt>"C:\Program Files\AVDump2\"</tt><br />
#Right-click <tt>AVDump2CL.exe</tt>, select ''Create Shortcut''.<br />
#Right-click the shortcut, add options to the ''Shortcut - Target'' line.<br />
#:Example, normal usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" -p</tt><br />
#:Example, auto-creq usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" --Auth:''myName'':''udp_api_key''</tt><br />
#::You can also set other options from the list above if you wish to do so.<br />
#::A commandline option to export ED2K links to a file is by adding <tt>--Exp=''C:\Path\ed2k.txt''</tt>, etc.<br />
#::Note that you need to set an '''UDP API Key''' in your AniDB profile for auto-creqing.<br />
#:Optional: Change ''Run'' to ''Maximized''.<br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
====Send to====<br />
#Move the shortcut created above to the SendTo folder.<br />
#:Example, under XP: <tt>"C:\Documents and Settings\''Username''\SendTo"</tt><br />
#:Example, under Vista: <tt>"C:\Users\''Username''\AppData\Roaming\Microsoft\Windows\SendTo"</tt><br />
#::Where ''Username'' is your Windows Login-Name.<br />
#:Note that ''SendTo'' is a hidden folder.<br />
#Right-click any media-file, go to "Send To", choose <tt>AVDump2CL.exe</tt><br />
#Get [[Creq|CReqing]]<br />
<br />
====MS-DOS Batch File====<br />
#Extract Avdump to a folder of choice.<br />
#Create a MS-DOS batch file with the 2 lines below, and save it as ''filename.bat''.<br />
#<tt>@ECHO OFF</tt><br />
#<tt>C:\Program Files\AVDump\AVDump2CL.exe %1 --Exp:''C:\Path\ed2k.txt'' --Auth:''myName'':''udp_api_key''</tt><br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
==Changes From Avdump Classic==<br />
<br />
* AVD2 now runs on the managed .net platform. This will not affect most, as .net comes pre-installed with current versions of windows. XP or older may have to install the platform manually. While it has been tested on mono, such testing has not been exhaustive. We would be very interested in hearing how it behaves in such an environment.<br />
* While most command line parameters remain the same, there are some exceptions. <br />
** The "-o" parameter is no longer available in avd2.<br />
** The "-n" parameter is no longer available in avd2.<br />
** The meaning of the numeric parameters has changed.<br />
* In the event of an internal error, AVD2 ''will'' submit an error report back to AniDB. The error report contains no user-details (see sample), but ''is'' attached to the user name supplied with the -ac parameter. While error reports are ''only'' submitted if -ac is specified, they can be disabled by the addition of the -noerr parameter. That said, for the purposes of initial testing, we respectfully request that error reports not be disabled, so bugs can be found and fixed.<br />
<br />
====Sample Exception Report====<br />
<FileExceptions><br />
<Information><br />
<AVDump2CLVersion>0.1.3734.0</AVDump2CLVersion><br />
<RunOnBitness>64</RunOnBitness><br />
<OS>Microsoft Windows NT 6.1.7601 Service Pack 1</OS><br />
</Information><br />
<Exceptions><br />
<AVDump2CL.Exceptions.AVD2Exception thrownOn="20110303 05.27.26.9254"><br />
<Message>Error in DisplayBuffer</Message><br />
<System.ArgumentOutOfRangeException><br />
<Message><br />
Non-negative number required.<br />
Parameter name: totalWidth<br />
</Message><br />
<StackTrace><br />
<Frame><br />
at System.String.PadHelper(Int32 totalWidth, Char paddingChar, Boolean isRightPadded)<br />
</Frame><br />
<Frame>at l.a(f A_0, Progress A_1)</Frame><br />
<Frame>at l.a(f A_0, Dictionary`2& A_1)</Frame><br />
</StackTrace><br />
</System.ArgumentOutOfRangeException><br />
</AVDump2CL.Exceptions.AVD2Exception><br />
</Exceptions><br />
</FileExceptions><br />
<br />
===Avdump2 on Linux===<br />
Thanks to Mono, Avdump2 runs natively on Linux as well. However, as most development effort goes into the Windows version and due to the heterogenity of Linux distributions, running Avdump2 on Linux isn’t as straightforward as running it on Windows. All Linux-related usage notes can be found on the [[Avdump2 on Linux]] page.<br />
<br />
<br />
==Auto-creqing==<br />
[[Image:Autocreq.gif|thumb|Simple diagram of the way auto-creqing with Avdump2 works]]<br />
<br />
Avdump2 is the AniDB [[auto-creqing]] system. Some more or less important notes:<br />
* To be able to use this feature you’ll need an AniDB account '''and you have to define the ''UDP API Key'' in your [[profile]]'''. All data sent to the server will be logged with IP and uid.<br />
* It is possible to run more than one instance of Avdump2 at once, but not more than ten will work OK. At the moment ''only 10 sessions per ip are allowed by the server'', meaning the eleventh instance will terminate the first.<br />
* There is no direct connection between data sent to AniDB and creqs generated. The data received will just be stored for later processing. There is no way to check the current status for a dump. Usually, it should take ''at least 24 hours'' from the moment you dump a file till the data actually changes. If any irregularities occur, or when there is too much data pending, it will take more time.<br />
* The creqs generated will report the user who sent the data first (for a specific file) as the creqer.<br />
* You may dump files currently not in the database. The data is still stored and will be used later if/after the file has been registered.<br />
* Files creqed by the new system will be locked, meaning some fields will not be possible to change. Notify a moderator if you are '''sure''' that some of the data locked for a specific file is wrong.<br />
<br />
===Why didn't this file get dumped?===<br />
* The file in AniDB is registered with wrong size and/or ED2K hash.<br />
* The package never reached the server.<br />
* The decryption or decompression failed at server side (rare).<br />
* The dump is not valid XML (rare).<br />
<br />
===Why isn't this file verified?===<br />
Even if the file is dumped it doesn't mean it will get auto-creqed (and verified). Here are the reasons:<br />
* The file is corrupt/invalid ([http://anidb.net/perl-bin/animedb.pl?show=avmf&do=xml&avid=76226 example]).<br />
* The provided data is considered "incoherent". (Indicates a bug in Avdump.)<br />
* The dump was marked unfit for file verification by an AniDB Moderator.<br />
<br />
<br />
==Known issues==<br />
* In some cases MediaInfoLib (MIL) used by Avdump2 might report an audio stream to have 0 or 3 channels.<br />
* Anamorphic .asf/.wmv and .mpg/.mpeg files might not get detected correctly and will report the PAR instead of the DAR.<br />
* Some corrupted mkv files may throw a (Thread Aborted) exception, this will be fixed once the updated version of the mkv parser is introduced<br />
* [6248] Avdump2 may freeze if autocreqs are enabled and there are no creqs to send<br />
<br />
==Changelog==<br />
<div style="height: 280px; overflow: auto; padding: 3px; border:1px solid #AAAAAA; font-size: small"><br />
'''0.1.6248.0 : 2012.08.28'''<br />
* Shiny icon for the executable<br />
<br />
* New AniDB Communication, should be faster and more reliable.<br />
** Big file reports no longer fail to be ACReqed.<br />
** Wrong Version and Wrong UserName/Password errors are now separated<br />
** Update notification will be shown if a newer version is available<br />
<br />
* InfoProvider:<br />
** Trimming all value fields<br />
** Fixes serverside parsing errors<br />
<br />
* FileExtensionProvider:<br />
** Limit ReadLine length<br />
** Fixes errors which can happen when a binary file is parsed<br />
<br />
* Directory: Added workaround for "too long" filepaths<br />
<br />
* MatroskaParser:<br />
** Less strict with corrupted mkv files. <br/> (If enough data could be read, the ACReq will be sent despite errors)<br />
<br />
* FileSource: Fixed nullpointer excpetion<br />
<br />
* CL:<br />
** Shortcut for DoneLogFileNameOnly is now D instead of R (because it clashed with NoRecurse)<br />
** Added version check and notification of new version if present<br />
** Less jumping for the ETA display<br />
<br />
* Added extensive tracing (removed in public versions)<br />
<br />
* Lots of other small things<br />
<br />
'''0.1.5290.0 : 2012.05.12'''<br />
* Fixed FileExtensionParser (hopefully)<br />
* TXT Report should be fixed now<br />
* Fixed ACReq Send Thread crash<br />
* AVD2 no longer pauses when not on Windows<br />
* Fixed AVD2 not working when not started from same folder as the executable<br />
* Added switch --UseCWD<br />
* Other changes I haven't remembered yet<br />
<br />
'''0.1.5028.0 : 2011.09.11'''<br />
* Fixed shift of hashvalues (_Display_ only)<br />
* Fixed --Ext with "to remove" extensions<br />
* Fixed --Mon/--TOut to actually work<br />
* Fixed some bug in the old CLI converter<br />
* <no ponies><br />
<br />
'''0.1.5000.0 : 2011.09.11'''<br />
* all previous builds aside of 4991 have been disabled<br />
* <more ponies><br />
<br />
'''0.1.4964.0 : 2011.09.05'''<br />
* all previous builds have been disabled<br />
* Sending ACReqs asynchronous<br />
* <insert ponies riding down the rainbow and other stuff that has happened><br />
<br />
'''0.1.4334.0 : 2011.06.15'''<br />
* all previous builds have been disabled<br />
* should work under linux via mono now too<br />
<br />
'''0.1.4260.0 : 2011.05.25'''<br />
* all previous builds have been disabled<br />
* fix for rare case where all xml submitted would contain an incorrect hash<br />
<br />
'''0.1.4213.0 : 2011.05.14'''<br />
* all previous builds have been disabled<br />
* addition of support and detection of new video file type: .mk3d<br />
* addition of support and detection of new audio file type: .dtshd, .thd<br />
* addition of support and detection of new subtitle file type: .pjs, .rt, .tmp, .tts, .xss, new type of .sub files<br />
* addition of support and detection of new linker file type: .smil <br />
* addition of support and detection of .zip files starting with magic bytes "PK00PK"<br />
<br />
<br />
'''0.1.3958.0 : 2011.03.15''' - no need to redump everything<br />
* fixed the bug that caused avdump2 not to retry sending a dump when facing a timeout<br />
* video-only mp4 files got wrongly detected as m4v<br />
* automatic detection of 32/64bit and use of the correct mediainfolib<br />
* test if mediainfolib is accessible<br />
* check of mediainfolib version to prevent the usage of untested versions<br />
* updated to mediainfolib 0.7.42<br />
* added -crcerr parameter to log files where the calculated crc is not found in the filename<br />
* added -x parameter to create a "parameterless avdump1"-like output<br />
* new switch -H to test pure hashing speed<br />
* removed Tiger and MD4 checksums from dumps sent to the AniDB server<br />
<br />
'''0.1.3084.0 : 2011.03.12'''<br />
* initial release<br />
</div><br />
<br />
[[Category:Features]]<br />
[[Category:AniDB Clients]]<br />
[[Category:Avdump]]<br />
[[Category:Development]]</div>Omminahttps://wiki.anidb.net/index.php?title=Avdump2&diff=16781Avdump22012-08-31T09:07:19Z<p>Ommina: Reverted edits by Ommina (talk) to last revision by Dvdkhl</p>
<hr />
<div>Welcome to the remarkably sparse avdump2 wiki page, lovingly hand created over many minutes + some more.<br />
<br />
We gleefully embrace build 6248, yet another public release of avd2. It represents a complete rewrite of the original avd1 code, runs against a new build of MediaInfoLibrary, contains a number of custom solutions for a number of formats, represents a significant investment of time and energy by Arokh, and is just generally nifty.<br />
<br />
There is no need to reprocess existing files with this build, but do keep an eye out for misbehaviour.<br />
<br />
==What is it==<br />
'''Avdump2''' is a video/audio codec identification utility - identifies which video codec and audio compression method is used on video files. Furthermore it hashes the file with a set of common hashalgorithms and calculates the used bit rates, the length, identifies the number of used audio channels and more.<br><br />
It, like its predecessor, is mainly based on [http://mediainfo.sourceforge.net/en mediainfo], but significantly enhanced and changed to fit AniDB's needs by [[User:Arokh|Arokh]].<br><br />
<br />
===Supported formats===<br />
Most major file formats are supported to some degree. While hashes are created for all file types, stream details remain shakey for others (notably 'swf'). Because of that for some filetypes (underlined) only the hashes get auto-creqed.<br />
<br />
* '''Video files:''' asf/wmv, avi, flv, m2ts, mk3d, mkv, mov, mp4, mpg/mpeg, ogm, ogv, qt, rm/rmvb, <u>swf</u>, ts, webm<br />
* '''Subtitle files:''' ass, idx, js, lrc, mks, pjs, rt, smi, srt, ssa, sub, sup, tmp, tts, txt, xss<br />
* '''Audio files:''' aac, ac3, dts, dtshd, flac, m4a, mka, mp3, ogg, ra, thd, wav, wma<br />
* '''Archive files:''' <u>7z</u>, <u>ace</u>, <u>rar</u>, <u>zip</u><br />
* '''Linker files:''' mkv, smil<br />
<br />
===Download===<br />
<br />
[http://static.anidb.net/client/avdump2/avdump2_6248.rar DOWNLOAD(RAR)] (Build 6248) MD5 = 4017b2835055d1c54abc12ae72703389<br />
<br />
===Usage===<br />
'''Avdump2''' is a simple [[Wikipedia:Command line interface|command line]] client:<br />
:<tt>AVDump2CL.exe [--<Arg> -<OneLetterArg> ...] <media file/folder> [<media file/folder> ...]</tt><br />
<br />
While pre 4991 build arguments can still be used, it is recommended to use the new format shown below.<br />
The easiest way to convert them to the new format is to run the program with the old args which then displays a notice and the corresponding args in the new format.<br />
<br />
====Options====<br />
{|align="center" style="border: 1px solid #aaaaaa; border-collapse: collapse; background: #f9f9f9; line-height: 1.0; font-size: small; width: 95%"<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Switch<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Type<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Description<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Default<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Example<br />
|-<br />
|'''Auth'''=<username>:<udp_api_key>||Auto-Creqing||Enable automatic creqing. You should always use this option when dumping anime files! Also enables error reporting.||||--Auth=tard:monkey<br />
|-<br />
|'''Host'''=<hostname>:<port>||Auto-Creqing||Hostname of AniDB UDP API server||--Host=api.anidb.info:9002||<br />
|-<br />
|'''LPort'''=<port>||Auto-Creqing||Local UDP port used for autocreqing. Only needed when behind "strict" firewalls.||||--LPort=12345<br />
|-<br />
|'''TOut'''=<timeoutInSeconds>:<numOfRetries>||Auto-Creqing||Timeout for sending dumps||--TOut=10:3||--TOut=25:6<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''ACErr'''=<file path/name>||Logging||Write file paths of failed dumps to file.||||--ACErr=acerr.txt<br />
|-<br />
|'''CRCErr'''=<file path/name>||Logging||Checks if filename contains calculated crc||||--CRCErr=crcerr.txt<br />
|-<br />
|'''ExtDiff'''=<file path/name>||Logging||Write mismatched extensions and file paths to file.||||--ExtDiff=extdiff.txt<br />
|-<br />
|'''FixExt'''=<file path/name>||Logging||Changes the fileextension to the dectected extension and logs the action.||||--FixExt=fixext.txt<br />
|-<br />
|'''Done'''=<file path/name>||Logging||Skip paths present in log and append paths to newly processed files.||||--Done=done.txt<br />
|-<br />
|'''HLog'''=<file path/name>||Logging||Export hashes to file.||||--HLog="$CRC$ $ED2K$":hlog.txt<br />
|-<br />
|'''Log'''=<file path/name>||Logging||Write output to file.||||--Log=log.txt<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''M'''||Output||MediaInfo dump||||-M<br />
|-<br />
|'''m'''||Output||MediaInfo XML dump||||-m<br />
|-<br />
|'''t'''||Output||Simple text format||||-t<br />
|-<br />
|'''C'''||Output||XML creq format||||-C<br />
|-<br />
|'''c'''||Output||AVD2 creq dump||||-c<br />
|-<br />
|'''h'''||Output||Hash Dump||||-h<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''BSize'''=<KB_per_block>:<number_of_blocks>||Control||Buffer size for hashing.||||--BSize=512:16<br />
|-<br />
|'''Ext'''=<comma separated list>||Control||Comma separated extension list.||Process all supported extensions||--Ext=avi,mkv or --Ext=-zip,-sub or --Ext=*<br />
|-<br />
|'''Mon'''=<seconds>||Control||Monitor sleep duration in seconds.||--Mon=60||--Mon=120<br />
|-<br />
|'''NoErr'''||Control||Disable error reporting. You should not disable this as it helps finding and fixing bugs.||||--NoErr<br />
|-<br />
|'''R'''||Control||Do '''not''' recurse into subfolders.||||-R<br />
|-<br />
|'''p'''||Control||Pause when done (hold cmd window).||||-p<br />
|-<br />
|'''P'''||Control||Pause after each file.||||-P<br />
|-<br />
|'''r'''||Control||Random file order.||||-r<br />
|-<br />
|'''q'''||Control||Suppress progress (silent).||||-q<br />
|-<br />
|'''B'''||Control||Test pure hashingspeed without io limitations||||-B<br />
|-<br />
|'''U'''||Control||Use UTF8 as console output stream||||-U<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''0'''||Hashing||For CRC (because the CRC of a 0 byte file is 00000000).||||-0<br />
|-<br />
|'''1'''||Hashing||For SHA1 (because of the 1).||||-1<br />
|-<br />
|'''2'''||Hashing||For ED2K (because of the 2).||||-2<br />
|-<br />
|'''3'''||Hashing||For Tiger (because a tiger in the house minimizes the Three Great Risks -- thieves, fire, and evil spirits).||||-3<br />
|-<br />
|'''4'''||Hashing||For MD4 (because of the 4).||||-4<br />
|-<br />
|'''5'''||Hashing||For MD5 (because of the 5).||||-5<br />
|-<br />
|'''6'''||Hashing||For TTH ... because that's what's left :p||||-6<br />
|-<br />
|'''a'''||Hashing||All (available) hash algorithms.||||-a<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''Exp'''=<file path/name>||AniDB||Export ed2k-links to the specified file. Very useful when mass adding files.||||--Exp=ed2k.txt<br />
|-<br />
|'''PrintEd2kLink'''||AniDB|| ||||--PrintEd2kLink<br />
|-<br />
|'''PrintAniDBLink'''||AniDB|| ||||--PrintAniDBLink<br />
|-<br />
|'''OpenAniDBLink'''||AniDB|| ||||--OpenAniDBLink<br />
|-<br />
|}<br />
<br />
====Windows Shortcut====<br />
#Extract Avdump to a folder of choice.<br />
#:Example: <tt>"C:\Program Files\AVDump2\"</tt><br />
#Right-click <tt>AVDump2CL.exe</tt>, select ''Create Shortcut''.<br />
#Right-click the shortcut, add options to the ''Shortcut - Target'' line.<br />
#:Example, normal usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" -p</tt><br />
#:Example, auto-creq usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" --Auth:''myName'':''udp_api_key''</tt><br />
#::You can also set other options from the list above if you wish to do so.<br />
#::A commandline option to export ED2K links to a file is by adding <tt>--Exp=''C:\Path\ed2k.txt''</tt>, etc.<br />
#::Note that you need to set an '''UDP API Key''' in your AniDB profile for auto-creqing.<br />
#:Optional: Change ''Run'' to ''Maximized''.<br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
====Send to====<br />
#Move the shortcut created above to the SendTo folder.<br />
#:Example, under XP: <tt>"C:\Documents and Settings\''Username''\SendTo"</tt><br />
#:Example, under Vista: <tt>"C:\Users\''Username''\AppData\Roaming\Microsoft\Windows\SendTo"</tt><br />
#::Where ''Username'' is your Windows Login-Name.<br />
#:Note that ''SendTo'' is a hidden folder.<br />
#Right-click any media-file, go to "Send To", choose <tt>AVDump2CL.exe</tt><br />
#Get [[Creq|CReqing]]<br />
<br />
====MS-DOS Batch File====<br />
#Extract Avdump to a folder of choice.<br />
#Create a MS-DOS batch file with the 2 lines below, and save it as ''filename.bat''.<br />
#<tt>@ECHO OFF</tt><br />
#<tt>C:\Program Files\AVDump\AVDump2CL.exe %1 --Exp:''C:\Path\ed2k.txt'' --Auth:''myName'':''udp_api_key''</tt><br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
==Changes From Avdump Classic==<br />
<br />
* AVD2 now runs on the managed .net platform. This will not affect most, as .net comes pre-installed with current versions of windows. XP or older may have to install the platform manually. While it has been tested on mono, such testing has not been exhaustive. We would be very interested in hearing how it behaves in such an environment.<br />
* While most command line parameters remain the same, there are some exceptions. <br />
** The "-o" parameter is no longer available in avd2.<br />
** The "-n" parameter is no longer available in avd2.<br />
** The meaning of the numeric parameters has changed.<br />
* In the event of an internal error, AVD2 ''will'' submit an error report back to AniDB. The error report contains no user-details (see sample), but ''is'' attached to the user name supplied with the -ac parameter. While error reports are ''only'' submitted if -ac is specified, they can be disabled by the addition of the -noerr parameter. That said, for the purposes of initial testing, we respectfully request that error reports not be disabled, so bugs can be found and fixed.<br />
<br />
====Sample Exception Report====<br />
<FileExceptions><br />
<Information><br />
<AVDump2CLVersion>0.1.3734.0</AVDump2CLVersion><br />
<RunOnBitness>64</RunOnBitness><br />
<OS>Microsoft Windows NT 6.1.7601 Service Pack 1</OS><br />
</Information><br />
<Exceptions><br />
<AVDump2CL.Exceptions.AVD2Exception thrownOn="20110303 05.27.26.9254"><br />
<Message>Error in DisplayBuffer</Message><br />
<System.ArgumentOutOfRangeException><br />
<Message><br />
Non-negative number required.<br />
Parameter name: totalWidth<br />
</Message><br />
<StackTrace><br />
<Frame><br />
at System.String.PadHelper(Int32 totalWidth, Char paddingChar, Boolean isRightPadded)<br />
</Frame><br />
<Frame>at l.a(f A_0, Progress A_1)</Frame><br />
<Frame>at l.a(f A_0, Dictionary`2& A_1)</Frame><br />
</StackTrace><br />
</System.ArgumentOutOfRangeException><br />
</AVDump2CL.Exceptions.AVD2Exception><br />
</Exceptions><br />
</FileExceptions><br />
<br />
===Avdump2 on Linux===<br />
Thanks to Mono, Avdump2 runs natively on Linux as well. However, as most development effort goes into the Windows version and due to the heterogenity of Linux distributions, running Avdump2 on Linux isn’t as straightforward as running it on Windows. All Linux-related usage notes can be found on the [[Avdump2 on Linux]] page.<br />
<br />
<br />
==Auto-creqing==<br />
[[Image:Autocreq.gif|thumb|Simple diagram of the way auto-creqing with Avdump2 works]]<br />
<br />
Avdump2 is the AniDB [[auto-creqing]] system. Some more or less important notes:<br />
* To be able to use this feature you’ll need an AniDB account '''and you have to define the ''UDP API Key'' in your [[profile]]'''. All data sent to the server will be logged with IP and uid.<br />
* It is possible to run more than one instance of Avdump2 at once, but not more than ten will work OK. At the moment ''only 10 sessions per ip are allowed by the server'', meaning the eleventh instance will terminate the first.<br />
* There is no direct connection between data sent to AniDB and creqs generated. The data received will just be stored for later processing. There is no way to check the current status for a dump. Usually, it should take ''at least 24 hours'' from the moment you dump a file till the data actually changes. If any irregularities occur, or when there is too much data pending, it will take more time.<br />
* The creqs generated will report the user who sent the data first (for a specific file) as the creqer.<br />
* You may dump files currently not in the database. The data is still stored and will be used later if/after the file has been registered.<br />
* Files creqed by the new system will be locked, meaning some fields will not be possible to change. Notify a moderator if you are '''sure''' that some of the data locked for a specific file is wrong.<br />
<br />
===Why didn't this file get dumped?===<br />
* The file in AniDB is registered with wrong size and/or ED2K hash.<br />
* The package never reached the server.<br />
* The decryption or decompression failed at server side (rare).<br />
* The dump is not valid XML (rare).<br />
<br />
===Why isn't this file verified?===<br />
Even if the file is dumped it doesn't mean it will get auto-creqed (and verified). Here are the reasons:<br />
* The file is corrupt/invalid ([http://anidb.net/perl-bin/animedb.pl?show=avmf&do=xml&avid=76226 example]).<br />
* The provided data is considered "incoherent". (Indicates a bug in Avdump.)<br />
* The dump was marked unfit for file verification by an AniDB Moderator.<br />
<br />
<br />
==Known issues==<br />
* In some cases MediaInfoLib (MIL) used by Avdump2 might report an audio stream to have 0 or 3 channels.<br />
* Anamorphic .asf/.wmv and .mpg/.mpeg files might not get detected correctly and will report the PAR instead of the DAR.<br />
* Some corrupted mkv files may throw a (Thread Aborted) exception, this will be fixed once the updated version of the mkv parser is introduced<br />
<br />
==Changelog==<br />
<div style="height: 280px; overflow: auto; padding: 3px; border:1px solid #AAAAAA; font-size: small"><br />
'''0.1.6248.0 : 2012.08.28'''<br />
* Shiny icon for the executable<br />
<br />
* New AniDB Communication, should be faster and more reliable.<br />
** Big file reports no longer fail to be ACReqed.<br />
** Wrong Version and Wrong UserName/Password errors are now separated<br />
** Update notification will be shown if a newer version is available<br />
<br />
* InfoProvider:<br />
** Trimming all value fields<br />
** Fixes serverside parsing errors<br />
<br />
* FileExtensionProvider:<br />
** Limit ReadLine length<br />
** Fixes errors which can happen when a binary file is parsed<br />
<br />
* Directory: Added workaround for "too long" filepaths<br />
<br />
* MatroskaParser:<br />
** Less strict with corrupted mkv files. <br/> (If enough data could be read, the ACReq will be sent despite errors)<br />
<br />
* FileSource: Fixed nullpointer excpetion<br />
<br />
* CL:<br />
** Shortcut for DoneLogFileNameOnly is now D instead of R (because it clashed with NoRecurse)<br />
** Added version check and notification of new version if present<br />
** Less jumping for the ETA display<br />
<br />
* Added extensive tracing (removed in public versions)<br />
<br />
* Lots of other small things<br />
<br />
'''0.1.5290.0 : 2012.05.12'''<br />
* Fixed FileExtensionParser (hopefully)<br />
* TXT Report should be fixed now<br />
* Fixed ACReq Send Thread crash<br />
* AVD2 no longer pauses when not on Windows<br />
* Fixed AVD2 not working when not started from same folder as the executable<br />
* Added switch --UseCWD<br />
* Other changes I haven't remembered yet<br />
<br />
'''0.1.5028.0 : 2011.09.11'''<br />
* Fixed shift of hashvalues (_Display_ only)<br />
* Fixed --Ext with "to remove" extensions<br />
* Fixed --Mon/--TOut to actually work<br />
* Fixed some bug in the old CLI converter<br />
* <no ponies><br />
<br />
'''0.1.5000.0 : 2011.09.11'''<br />
* all previous builds aside of 4991 have been disabled<br />
* <more ponies><br />
<br />
'''0.1.4964.0 : 2011.09.05'''<br />
* all previous builds have been disabled<br />
* Sending ACReqs asynchronous<br />
* <insert ponies riding down the rainbow and other stuff that has happened><br />
<br />
'''0.1.4334.0 : 2011.06.15'''<br />
* all previous builds have been disabled<br />
* should work under linux via mono now too<br />
<br />
'''0.1.4260.0 : 2011.05.25'''<br />
* all previous builds have been disabled<br />
* fix for rare case where all xml submitted would contain an incorrect hash<br />
<br />
'''0.1.4213.0 : 2011.05.14'''<br />
* all previous builds have been disabled<br />
* addition of support and detection of new video file type: .mk3d<br />
* addition of support and detection of new audio file type: .dtshd, .thd<br />
* addition of support and detection of new subtitle file type: .pjs, .rt, .tmp, .tts, .xss, new type of .sub files<br />
* addition of support and detection of new linker file type: .smil <br />
* addition of support and detection of .zip files starting with magic bytes "PK00PK"<br />
<br />
<br />
'''0.1.3958.0 : 2011.03.15''' - no need to redump everything<br />
* fixed the bug that caused avdump2 not to retry sending a dump when facing a timeout<br />
* video-only mp4 files got wrongly detected as m4v<br />
* automatic detection of 32/64bit and use of the correct mediainfolib<br />
* test if mediainfolib is accessible<br />
* check of mediainfolib version to prevent the usage of untested versions<br />
* updated to mediainfolib 0.7.42<br />
* added -crcerr parameter to log files where the calculated crc is not found in the filename<br />
* added -x parameter to create a "parameterless avdump1"-like output<br />
* new switch -H to test pure hashing speed<br />
* removed Tiger and MD4 checksums from dumps sent to the AniDB server<br />
<br />
'''0.1.3084.0 : 2011.03.12'''<br />
* initial release<br />
</div><br />
<br />
[[Category:Features]]<br />
[[Category:AniDB Clients]]<br />
[[Category:Avdump]]<br />
[[Category:Development]]</div>Omminahttps://wiki.anidb.net/index.php?title=Avdump2&diff=16780Avdump22012-08-31T07:07:15Z<p>Ommina: </p>
<hr />
<div>Welcome to the remarkably sparse avdump2 wiki page, lovingly hand created over many minutes + some more.<br />
<br />
We gleefully embrace build 6271, yet another public release of avd2. It represents a complete rewrite of the original avd1 code, runs against a new build of MediaInfoLibrary, contains a number of custom solutions for a number of formats, represents a significant investment of time and energy by Arokh, and is just generally nifty.<br />
<br />
There is no need to reprocess existing files with this build, but do keep an eye out for misbehaviour.<br />
<br />
==What is it==<br />
'''Avdump2''' is a video/audio codec identification utility - identifies which video codec and audio compression method is used on video files. Furthermore it hashes the file with a set of common hashalgorithms and calculates the used bit rates, the length, identifies the number of used audio channels and more.<br><br />
It, like its predecessor, is mainly based on [http://mediainfo.sourceforge.net/en mediainfo], but significantly enhanced and changed to fit AniDB's needs by [[User:Arokh|Arokh]].<br><br />
<br />
===Supported formats===<br />
Most major file formats are supported to some degree. While hashes are created for all file types, stream details remain shakey for others (notably 'swf'). Because of that for some filetypes (underlined) only the hashes get auto-creqed.<br />
<br />
* '''Video files:''' asf/wmv, avi, flv, m2ts, mk3d, mkv, mov, mp4, mpg/mpeg, ogm, ogv, qt, rm/rmvb, <u>swf</u>, ts, webm<br />
* '''Subtitle files:''' ass, idx, js, lrc, mks, pjs, rt, smi, srt, ssa, sub, sup, tmp, tts, txt, xss<br />
* '''Audio files:''' aac, ac3, dts, dtshd, flac, m4a, mka, mp3, ogg, ra, thd, wav, wma<br />
* '''Archive files:''' <u>7z</u>, <u>ace</u>, <u>rar</u>, <u>zip</u><br />
* '''Linker files:''' mkv, smil<br />
<br />
===Download===<br />
<br />
[http://static.anidb.net/client/avdump2/avdump2_6271.rar DOWNLOAD(RAR)] (Build 6271) MD5 = 599edec036bdaa773550e0d67dee6aa4<br />
<br />
===Usage===<br />
'''Avdump2''' is a simple [[Wikipedia:Command line interface|command line]] client:<br />
:<tt>AVDump2CL.exe [--<Arg> -<OneLetterArg> ...] <media file/folder> [<media file/folder> ...]</tt><br />
<br />
While pre 4991 build arguments can still be used, it is recommended to use the new format shown below.<br />
The easiest way to convert them to the new format is to run the program with the old args which then displays a notice and the corresponding args in the new format.<br />
<br />
====Options====<br />
{|align="center" style="border: 1px solid #aaaaaa; border-collapse: collapse; background: #f9f9f9; line-height: 1.0; font-size: small; width: 95%"<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Switch<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Type<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Description<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Default<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Example<br />
|-<br />
|'''Auth'''=<username>:<udp_api_key>||Auto-Creqing||Enable automatic creqing. You should always use this option when dumping anime files! Also enables error reporting.||||--Auth=tard:monkey<br />
|-<br />
|'''Host'''=<hostname>:<port>||Auto-Creqing||Hostname of AniDB UDP API server||--Host=api.anidb.info:9002||<br />
|-<br />
|'''LPort'''=<port>||Auto-Creqing||Local UDP port used for autocreqing. Only needed when behind "strict" firewalls.||||--LPort=12345<br />
|-<br />
|'''TOut'''=<timeoutInSeconds>:<numOfRetries>||Auto-Creqing||Timeout for sending dumps||--TOut=10:3||--TOut=25:6<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''ACErr'''=<file path/name>||Logging||Write file paths of failed dumps to file.||||--ACErr=acerr.txt<br />
|-<br />
|'''CRCErr'''=<file path/name>||Logging||Checks if filename contains calculated crc||||--CRCErr=crcerr.txt<br />
|-<br />
|'''ExtDiff'''=<file path/name>||Logging||Write mismatched extensions and file paths to file.||||--ExtDiff=extdiff.txt<br />
|-<br />
|'''FixExt'''=<file path/name>||Logging||Changes the fileextension to the dectected extension and logs the action.||||--FixExt=fixext.txt<br />
|-<br />
|'''Done'''=<file path/name>||Logging||Skip paths present in log and append paths to newly processed files.||||--Done=done.txt<br />
|-<br />
|'''HLog'''=<file path/name>||Logging||Export hashes to file.||||--HLog="$CRC$ $ED2K$":hlog.txt<br />
|-<br />
|'''Log'''=<file path/name>||Logging||Write output to file.||||--Log=log.txt<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''M'''||Output||MediaInfo dump||||-M<br />
|-<br />
|'''m'''||Output||MediaInfo XML dump||||-m<br />
|-<br />
|'''t'''||Output||Simple text format||||-t<br />
|-<br />
|'''C'''||Output||XML creq format||||-C<br />
|-<br />
|'''c'''||Output||AVD2 creq dump||||-c<br />
|-<br />
|'''h'''||Output||Hash Dump||||-h<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''BSize'''=<KB_per_block>:<number_of_blocks>||Control||Buffer size for hashing.||||--BSize=512:16<br />
|-<br />
|'''Ext'''=<comma separated list>||Control||Comma separated extension list.||Process all supported extensions||--Ext=avi,mkv or --Ext=-zip,-sub or --Ext=*<br />
|-<br />
|'''Mon'''=<seconds>||Control||Monitor sleep duration in seconds.||--Mon=60||--Mon=120<br />
|-<br />
|'''NoErr'''||Control||Disable error reporting. You should not disable this as it helps finding and fixing bugs.||||--NoErr<br />
|-<br />
|'''R'''||Control||Do '''not''' recurse into subfolders.||||-R<br />
|-<br />
|'''p'''||Control||Pause when done (hold cmd window).||||-p<br />
|-<br />
|'''P'''||Control||Pause after each file.||||-P<br />
|-<br />
|'''r'''||Control||Random file order.||||-r<br />
|-<br />
|'''q'''||Control||Suppress progress (silent).||||-q<br />
|-<br />
|'''B'''||Control||Test pure hashingspeed without io limitations||||-B<br />
|-<br />
|'''U'''||Control||Use UTF8 as console output stream||||-U<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''0'''||Hashing||For CRC (because the CRC of a 0 byte file is 00000000).||||-0<br />
|-<br />
|'''1'''||Hashing||For SHA1 (because of the 1).||||-1<br />
|-<br />
|'''2'''||Hashing||For ED2K (because of the 2).||||-2<br />
|-<br />
|'''3'''||Hashing||For Tiger (because a tiger in the house minimizes the Three Great Risks -- thieves, fire, and evil spirits).||||-3<br />
|-<br />
|'''4'''||Hashing||For MD4 (because of the 4).||||-4<br />
|-<br />
|'''5'''||Hashing||For MD5 (because of the 5).||||-5<br />
|-<br />
|'''6'''||Hashing||For TTH ... because that's what's left :p||||-6<br />
|-<br />
|'''a'''||Hashing||All (available) hash algorithms.||||-a<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''Exp'''=<file path/name>||AniDB||Export ed2k-links to the specified file. Very useful when mass adding files.||||--Exp=ed2k.txt<br />
|-<br />
|'''PrintEd2kLink'''||AniDB|| ||||--PrintEd2kLink<br />
|-<br />
|'''PrintAniDBLink'''||AniDB|| ||||--PrintAniDBLink<br />
|-<br />
|'''OpenAniDBLink'''||AniDB|| ||||--OpenAniDBLink<br />
|-<br />
|}<br />
<br />
====Windows Shortcut====<br />
#Extract Avdump to a folder of choice.<br />
#:Example: <tt>"C:\Program Files\AVDump2\"</tt><br />
#Right-click <tt>AVDump2CL.exe</tt>, select ''Create Shortcut''.<br />
#Right-click the shortcut, add options to the ''Shortcut - Target'' line.<br />
#:Example, normal usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" -p</tt><br />
#:Example, auto-creq usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" --Auth:''myName'':''udp_api_key''</tt><br />
#::You can also set other options from the list above if you wish to do so.<br />
#::A commandline option to export ED2K links to a file is by adding <tt>--Exp=''C:\Path\ed2k.txt''</tt>, etc.<br />
#::Note that you need to set an '''UDP API Key''' in your AniDB profile for auto-creqing.<br />
#:Optional: Change ''Run'' to ''Maximized''.<br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
====Send to====<br />
#Move the shortcut created above to the SendTo folder.<br />
#:Example, under XP: <tt>"C:\Documents and Settings\''Username''\SendTo"</tt><br />
#:Example, under Vista: <tt>"C:\Users\''Username''\AppData\Roaming\Microsoft\Windows\SendTo"</tt><br />
#::Where ''Username'' is your Windows Login-Name.<br />
#:Note that ''SendTo'' is a hidden folder.<br />
#Right-click any media-file, go to "Send To", choose <tt>AVDump2CL.exe</tt><br />
#Get [[Creq|CReqing]]<br />
<br />
====MS-DOS Batch File====<br />
#Extract Avdump to a folder of choice.<br />
#Create a MS-DOS batch file with the 2 lines below, and save it as ''filename.bat''.<br />
#<tt>@ECHO OFF</tt><br />
#<tt>C:\Program Files\AVDump\AVDump2CL.exe %1 --Exp:''C:\Path\ed2k.txt'' --Auth:''myName'':''udp_api_key''</tt><br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
==Changes From Avdump Classic==<br />
<br />
* AVD2 now runs on the managed .net platform. This will not affect most, as .net comes pre-installed with current versions of windows. XP or older may have to install the platform manually. While it has been tested on mono, such testing has not been exhaustive. We would be very interested in hearing how it behaves in such an environment.<br />
* While most command line parameters remain the same, there are some exceptions. <br />
** The "-o" parameter is no longer available in avd2.<br />
** The "-n" parameter is no longer available in avd2.<br />
** The meaning of the numeric parameters has changed.<br />
* In the event of an internal error, AVD2 ''will'' submit an error report back to AniDB. The error report contains no user-details (see sample), but ''is'' attached to the user name supplied with the -ac parameter. While error reports are ''only'' submitted if -ac is specified, they can be disabled by the addition of the -noerr parameter. That said, for the purposes of initial testing, we respectfully request that error reports not be disabled, so bugs can be found and fixed.<br />
<br />
====Sample Exception Report====<br />
<FileExceptions><br />
<Information><br />
<AVDump2CLVersion>0.1.3734.0</AVDump2CLVersion><br />
<RunOnBitness>64</RunOnBitness><br />
<OS>Microsoft Windows NT 6.1.7601 Service Pack 1</OS><br />
</Information><br />
<Exceptions><br />
<AVDump2CL.Exceptions.AVD2Exception thrownOn="20110303 05.27.26.9254"><br />
<Message>Error in DisplayBuffer</Message><br />
<System.ArgumentOutOfRangeException><br />
<Message><br />
Non-negative number required.<br />
Parameter name: totalWidth<br />
</Message><br />
<StackTrace><br />
<Frame><br />
at System.String.PadHelper(Int32 totalWidth, Char paddingChar, Boolean isRightPadded)<br />
</Frame><br />
<Frame>at l.a(f A_0, Progress A_1)</Frame><br />
<Frame>at l.a(f A_0, Dictionary`2& A_1)</Frame><br />
</StackTrace><br />
</System.ArgumentOutOfRangeException><br />
</AVDump2CL.Exceptions.AVD2Exception><br />
</Exceptions><br />
</FileExceptions><br />
<br />
===Avdump2 on Linux===<br />
Thanks to Mono, Avdump2 runs natively on Linux as well. However, as most development effort goes into the Windows version and due to the heterogenity of Linux distributions, running Avdump2 on Linux isn’t as straightforward as running it on Windows. All Linux-related usage notes can be found on the [[Avdump2 on Linux]] page.<br />
<br />
<br />
==Auto-creqing==<br />
[[Image:Autocreq.gif|thumb|Simple diagram of the way auto-creqing with Avdump2 works]]<br />
<br />
Avdump2 is the AniDB [[auto-creqing]] system. Some more or less important notes:<br />
* To be able to use this feature you’ll need an AniDB account '''and you have to define the ''UDP API Key'' in your [[profile]]'''. All data sent to the server will be logged with IP and uid.<br />
* It is possible to run more than one instance of Avdump2 at once, but not more than ten will work OK. At the moment ''only 10 sessions per ip are allowed by the server'', meaning the eleventh instance will terminate the first.<br />
* There is no direct connection between data sent to AniDB and creqs generated. The data received will just be stored for later processing. There is no way to check the current status for a dump. Usually, it should take ''at least 24 hours'' from the moment you dump a file till the data actually changes. If any irregularities occur, or when there is too much data pending, it will take more time.<br />
* The creqs generated will report the user who sent the data first (for a specific file) as the creqer.<br />
* You may dump files currently not in the database. The data is still stored and will be used later if/after the file has been registered.<br />
* Files creqed by the new system will be locked, meaning some fields will not be possible to change. Notify a moderator if you are '''sure''' that some of the data locked for a specific file is wrong.<br />
<br />
===Why didn't this file get dumped?===<br />
* The file in AniDB is registered with wrong size and/or ED2K hash.<br />
* The package never reached the server.<br />
* The decryption or decompression failed at server side (rare).<br />
* The dump is not valid XML (rare).<br />
<br />
===Why isn't this file verified?===<br />
Even if the file is dumped it doesn't mean it will get auto-creqed (and verified). Here are the reasons:<br />
* The file is corrupt/invalid ([http://anidb.net/perl-bin/animedb.pl?show=avmf&do=xml&avid=76226 example]).<br />
* The provided data is considered "incoherent". (Indicates a bug in Avdump.)<br />
* The dump was marked unfit for file verification by an AniDB Moderator.<br />
<br />
<br />
==Known issues==<br />
* In some cases MediaInfoLib (MIL) used by Avdump2 might report an audio stream to have 0 or 3 channels.<br />
* Anamorphic .asf/.wmv and .mpg/.mpeg files might not get detected correctly and will report the PAR instead of the DAR.<br />
* Some corrupted mkv files may throw a (Thread Aborted) exception, this will be fixed once the updated version of the mkv parser is introduced<br />
* [6248] Avdump2 may freeze if autocreqs are enabled and there are no creqs to send<br />
<br />
==Changelog==<br />
<div style="height: 280px; overflow: auto; padding: 3px; border:1px solid #AAAAAA; font-size: small"><br />
'''0.1.6248.0 : 2012.08.28'''<br />
* Shiny icon for the executable<br />
<br />
* New AniDB Communication, should be faster and more reliable.<br />
** Big file reports no longer fail to be ACReqed.<br />
** Wrong Version and Wrong UserName/Password errors are now separated<br />
** Update notification will be shown if a newer version is available<br />
<br />
* InfoProvider:<br />
** Trimming all value fields<br />
** Fixes serverside parsing errors<br />
<br />
* FileExtensionProvider:<br />
** Limit ReadLine length<br />
** Fixes errors which can happen when a binary file is parsed<br />
<br />
* Directory: Added workaround for "too long" filepaths<br />
<br />
* MatroskaParser:<br />
** Less strict with corrupted mkv files. <br/> (If enough data could be read, the ACReq will be sent despite errors)<br />
<br />
* FileSource: Fixed nullpointer excpetion<br />
<br />
* CL:<br />
** Shortcut for DoneLogFileNameOnly is now D instead of R (because it clashed with NoRecurse)<br />
** Added version check and notification of new version if present<br />
** Less jumping for the ETA display<br />
<br />
* Added extensive tracing (removed in public versions)<br />
<br />
* Lots of other small things<br />
<br />
'''0.1.5290.0 : 2012.05.12'''<br />
* Fixed FileExtensionParser (hopefully)<br />
* TXT Report should be fixed now<br />
* Fixed ACReq Send Thread crash<br />
* AVD2 no longer pauses when not on Windows<br />
* Fixed AVD2 not working when not started from same folder as the executable<br />
* Added switch --UseCWD<br />
* Other changes I haven't remembered yet<br />
<br />
'''0.1.5028.0 : 2011.09.11'''<br />
* Fixed shift of hashvalues (_Display_ only)<br />
* Fixed --Ext with "to remove" extensions<br />
* Fixed --Mon/--TOut to actually work<br />
* Fixed some bug in the old CLI converter<br />
* <no ponies><br />
<br />
'''0.1.5000.0 : 2011.09.11'''<br />
* all previous builds aside of 4991 have been disabled<br />
* <more ponies><br />
<br />
'''0.1.4964.0 : 2011.09.05'''<br />
* all previous builds have been disabled<br />
* Sending ACReqs asynchronous<br />
* <insert ponies riding down the rainbow and other stuff that has happened><br />
<br />
'''0.1.4334.0 : 2011.06.15'''<br />
* all previous builds have been disabled<br />
* should work under linux via mono now too<br />
<br />
'''0.1.4260.0 : 2011.05.25'''<br />
* all previous builds have been disabled<br />
* fix for rare case where all xml submitted would contain an incorrect hash<br />
<br />
'''0.1.4213.0 : 2011.05.14'''<br />
* all previous builds have been disabled<br />
* addition of support and detection of new video file type: .mk3d<br />
* addition of support and detection of new audio file type: .dtshd, .thd<br />
* addition of support and detection of new subtitle file type: .pjs, .rt, .tmp, .tts, .xss, new type of .sub files<br />
* addition of support and detection of new linker file type: .smil <br />
* addition of support and detection of .zip files starting with magic bytes "PK00PK"<br />
<br />
<br />
'''0.1.3958.0 : 2011.03.15''' - no need to redump everything<br />
* fixed the bug that caused avdump2 not to retry sending a dump when facing a timeout<br />
* video-only mp4 files got wrongly detected as m4v<br />
* automatic detection of 32/64bit and use of the correct mediainfolib<br />
* test if mediainfolib is accessible<br />
* check of mediainfolib version to prevent the usage of untested versions<br />
* updated to mediainfolib 0.7.42<br />
* added -crcerr parameter to log files where the calculated crc is not found in the filename<br />
* added -x parameter to create a "parameterless avdump1"-like output<br />
* new switch -H to test pure hashing speed<br />
* removed Tiger and MD4 checksums from dumps sent to the AniDB server<br />
<br />
'''0.1.3084.0 : 2011.03.12'''<br />
* initial release<br />
</div><br />
<br />
[[Category:Features]]<br />
[[Category:AniDB Clients]]<br />
[[Category:Avdump]]<br />
[[Category:Development]]</div>Omminahttps://wiki.anidb.net/index.php?title=Avdump2&diff=16779Avdump22012-08-31T07:06:43Z<p>Ommina: /* Download */</p>
<hr />
<div>Welcome to the remarkably sparse avdump2 wiki page, lovingly hand created over many minutes + some more.<br />
<br />
We gleefully embrace build 6248, yet another public release of avd2. It represents a complete rewrite of the original avd1 code, runs against a new build of MediaInfoLibrary, contains a number of custom solutions for a number of formats, represents a significant investment of time and energy by Arokh, and is just generally nifty.<br />
<br />
There is no need to reprocess existing files with this build, but do keep an eye out for misbehaviour.<br />
<br />
==What is it==<br />
'''Avdump2''' is a video/audio codec identification utility - identifies which video codec and audio compression method is used on video files. Furthermore it hashes the file with a set of common hashalgorithms and calculates the used bit rates, the length, identifies the number of used audio channels and more.<br><br />
It, like its predecessor, is mainly based on [http://mediainfo.sourceforge.net/en mediainfo], but significantly enhanced and changed to fit AniDB's needs by [[User:Arokh|Arokh]].<br><br />
<br />
===Supported formats===<br />
Most major file formats are supported to some degree. While hashes are created for all file types, stream details remain shakey for others (notably 'swf'). Because of that for some filetypes (underlined) only the hashes get auto-creqed.<br />
<br />
* '''Video files:''' asf/wmv, avi, flv, m2ts, mk3d, mkv, mov, mp4, mpg/mpeg, ogm, ogv, qt, rm/rmvb, <u>swf</u>, ts, webm<br />
* '''Subtitle files:''' ass, idx, js, lrc, mks, pjs, rt, smi, srt, ssa, sub, sup, tmp, tts, txt, xss<br />
* '''Audio files:''' aac, ac3, dts, dtshd, flac, m4a, mka, mp3, ogg, ra, thd, wav, wma<br />
* '''Archive files:''' <u>7z</u>, <u>ace</u>, <u>rar</u>, <u>zip</u><br />
* '''Linker files:''' mkv, smil<br />
<br />
===Download===<br />
<br />
[http://static.anidb.net/client/avdump2/avdump2_6271.rar DOWNLOAD(RAR)] (Build 6271) MD5 = 599edec036bdaa773550e0d67dee6aa4<br />
<br />
===Usage===<br />
'''Avdump2''' is a simple [[Wikipedia:Command line interface|command line]] client:<br />
:<tt>AVDump2CL.exe [--<Arg> -<OneLetterArg> ...] <media file/folder> [<media file/folder> ...]</tt><br />
<br />
While pre 4991 build arguments can still be used, it is recommended to use the new format shown below.<br />
The easiest way to convert them to the new format is to run the program with the old args which then displays a notice and the corresponding args in the new format.<br />
<br />
====Options====<br />
{|align="center" style="border: 1px solid #aaaaaa; border-collapse: collapse; background: #f9f9f9; line-height: 1.0; font-size: small; width: 95%"<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Switch<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Type<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Description<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Default<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Example<br />
|-<br />
|'''Auth'''=<username>:<udp_api_key>||Auto-Creqing||Enable automatic creqing. You should always use this option when dumping anime files! Also enables error reporting.||||--Auth=tard:monkey<br />
|-<br />
|'''Host'''=<hostname>:<port>||Auto-Creqing||Hostname of AniDB UDP API server||--Host=api.anidb.info:9002||<br />
|-<br />
|'''LPort'''=<port>||Auto-Creqing||Local UDP port used for autocreqing. Only needed when behind "strict" firewalls.||||--LPort=12345<br />
|-<br />
|'''TOut'''=<timeoutInSeconds>:<numOfRetries>||Auto-Creqing||Timeout for sending dumps||--TOut=10:3||--TOut=25:6<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''ACErr'''=<file path/name>||Logging||Write file paths of failed dumps to file.||||--ACErr=acerr.txt<br />
|-<br />
|'''CRCErr'''=<file path/name>||Logging||Checks if filename contains calculated crc||||--CRCErr=crcerr.txt<br />
|-<br />
|'''ExtDiff'''=<file path/name>||Logging||Write mismatched extensions and file paths to file.||||--ExtDiff=extdiff.txt<br />
|-<br />
|'''FixExt'''=<file path/name>||Logging||Changes the fileextension to the dectected extension and logs the action.||||--FixExt=fixext.txt<br />
|-<br />
|'''Done'''=<file path/name>||Logging||Skip paths present in log and append paths to newly processed files.||||--Done=done.txt<br />
|-<br />
|'''HLog'''=<file path/name>||Logging||Export hashes to file.||||--HLog="$CRC$ $ED2K$":hlog.txt<br />
|-<br />
|'''Log'''=<file path/name>||Logging||Write output to file.||||--Log=log.txt<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''M'''||Output||MediaInfo dump||||-M<br />
|-<br />
|'''m'''||Output||MediaInfo XML dump||||-m<br />
|-<br />
|'''t'''||Output||Simple text format||||-t<br />
|-<br />
|'''C'''||Output||XML creq format||||-C<br />
|-<br />
|'''c'''||Output||AVD2 creq dump||||-c<br />
|-<br />
|'''h'''||Output||Hash Dump||||-h<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''BSize'''=<KB_per_block>:<number_of_blocks>||Control||Buffer size for hashing.||||--BSize=512:16<br />
|-<br />
|'''Ext'''=<comma separated list>||Control||Comma separated extension list.||Process all supported extensions||--Ext=avi,mkv or --Ext=-zip,-sub or --Ext=*<br />
|-<br />
|'''Mon'''=<seconds>||Control||Monitor sleep duration in seconds.||--Mon=60||--Mon=120<br />
|-<br />
|'''NoErr'''||Control||Disable error reporting. You should not disable this as it helps finding and fixing bugs.||||--NoErr<br />
|-<br />
|'''R'''||Control||Do '''not''' recurse into subfolders.||||-R<br />
|-<br />
|'''p'''||Control||Pause when done (hold cmd window).||||-p<br />
|-<br />
|'''P'''||Control||Pause after each file.||||-P<br />
|-<br />
|'''r'''||Control||Random file order.||||-r<br />
|-<br />
|'''q'''||Control||Suppress progress (silent).||||-q<br />
|-<br />
|'''B'''||Control||Test pure hashingspeed without io limitations||||-B<br />
|-<br />
|'''U'''||Control||Use UTF8 as console output stream||||-U<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''0'''||Hashing||For CRC (because the CRC of a 0 byte file is 00000000).||||-0<br />
|-<br />
|'''1'''||Hashing||For SHA1 (because of the 1).||||-1<br />
|-<br />
|'''2'''||Hashing||For ED2K (because of the 2).||||-2<br />
|-<br />
|'''3'''||Hashing||For Tiger (because a tiger in the house minimizes the Three Great Risks -- thieves, fire, and evil spirits).||||-3<br />
|-<br />
|'''4'''||Hashing||For MD4 (because of the 4).||||-4<br />
|-<br />
|'''5'''||Hashing||For MD5 (because of the 5).||||-5<br />
|-<br />
|'''6'''||Hashing||For TTH ... because that's what's left :p||||-6<br />
|-<br />
|'''a'''||Hashing||All (available) hash algorithms.||||-a<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''Exp'''=<file path/name>||AniDB||Export ed2k-links to the specified file. Very useful when mass adding files.||||--Exp=ed2k.txt<br />
|-<br />
|'''PrintEd2kLink'''||AniDB|| ||||--PrintEd2kLink<br />
|-<br />
|'''PrintAniDBLink'''||AniDB|| ||||--PrintAniDBLink<br />
|-<br />
|'''OpenAniDBLink'''||AniDB|| ||||--OpenAniDBLink<br />
|-<br />
|}<br />
<br />
====Windows Shortcut====<br />
#Extract Avdump to a folder of choice.<br />
#:Example: <tt>"C:\Program Files\AVDump2\"</tt><br />
#Right-click <tt>AVDump2CL.exe</tt>, select ''Create Shortcut''.<br />
#Right-click the shortcut, add options to the ''Shortcut - Target'' line.<br />
#:Example, normal usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" -p</tt><br />
#:Example, auto-creq usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" --Auth:''myName'':''udp_api_key''</tt><br />
#::You can also set other options from the list above if you wish to do so.<br />
#::A commandline option to export ED2K links to a file is by adding <tt>--Exp=''C:\Path\ed2k.txt''</tt>, etc.<br />
#::Note that you need to set an '''UDP API Key''' in your AniDB profile for auto-creqing.<br />
#:Optional: Change ''Run'' to ''Maximized''.<br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
====Send to====<br />
#Move the shortcut created above to the SendTo folder.<br />
#:Example, under XP: <tt>"C:\Documents and Settings\''Username''\SendTo"</tt><br />
#:Example, under Vista: <tt>"C:\Users\''Username''\AppData\Roaming\Microsoft\Windows\SendTo"</tt><br />
#::Where ''Username'' is your Windows Login-Name.<br />
#:Note that ''SendTo'' is a hidden folder.<br />
#Right-click any media-file, go to "Send To", choose <tt>AVDump2CL.exe</tt><br />
#Get [[Creq|CReqing]]<br />
<br />
====MS-DOS Batch File====<br />
#Extract Avdump to a folder of choice.<br />
#Create a MS-DOS batch file with the 2 lines below, and save it as ''filename.bat''.<br />
#<tt>@ECHO OFF</tt><br />
#<tt>C:\Program Files\AVDump\AVDump2CL.exe %1 --Exp:''C:\Path\ed2k.txt'' --Auth:''myName'':''udp_api_key''</tt><br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
==Changes From Avdump Classic==<br />
<br />
* AVD2 now runs on the managed .net platform. This will not affect most, as .net comes pre-installed with current versions of windows. XP or older may have to install the platform manually. While it has been tested on mono, such testing has not been exhaustive. We would be very interested in hearing how it behaves in such an environment.<br />
* While most command line parameters remain the same, there are some exceptions. <br />
** The "-o" parameter is no longer available in avd2.<br />
** The "-n" parameter is no longer available in avd2.<br />
** The meaning of the numeric parameters has changed.<br />
* In the event of an internal error, AVD2 ''will'' submit an error report back to AniDB. The error report contains no user-details (see sample), but ''is'' attached to the user name supplied with the -ac parameter. While error reports are ''only'' submitted if -ac is specified, they can be disabled by the addition of the -noerr parameter. That said, for the purposes of initial testing, we respectfully request that error reports not be disabled, so bugs can be found and fixed.<br />
<br />
====Sample Exception Report====<br />
<FileExceptions><br />
<Information><br />
<AVDump2CLVersion>0.1.3734.0</AVDump2CLVersion><br />
<RunOnBitness>64</RunOnBitness><br />
<OS>Microsoft Windows NT 6.1.7601 Service Pack 1</OS><br />
</Information><br />
<Exceptions><br />
<AVDump2CL.Exceptions.AVD2Exception thrownOn="20110303 05.27.26.9254"><br />
<Message>Error in DisplayBuffer</Message><br />
<System.ArgumentOutOfRangeException><br />
<Message><br />
Non-negative number required.<br />
Parameter name: totalWidth<br />
</Message><br />
<StackTrace><br />
<Frame><br />
at System.String.PadHelper(Int32 totalWidth, Char paddingChar, Boolean isRightPadded)<br />
</Frame><br />
<Frame>at l.a(f A_0, Progress A_1)</Frame><br />
<Frame>at l.a(f A_0, Dictionary`2& A_1)</Frame><br />
</StackTrace><br />
</System.ArgumentOutOfRangeException><br />
</AVDump2CL.Exceptions.AVD2Exception><br />
</Exceptions><br />
</FileExceptions><br />
<br />
===Avdump2 on Linux===<br />
Thanks to Mono, Avdump2 runs natively on Linux as well. However, as most development effort goes into the Windows version and due to the heterogenity of Linux distributions, running Avdump2 on Linux isn’t as straightforward as running it on Windows. All Linux-related usage notes can be found on the [[Avdump2 on Linux]] page.<br />
<br />
<br />
==Auto-creqing==<br />
[[Image:Autocreq.gif|thumb|Simple diagram of the way auto-creqing with Avdump2 works]]<br />
<br />
Avdump2 is the AniDB [[auto-creqing]] system. Some more or less important notes:<br />
* To be able to use this feature you’ll need an AniDB account '''and you have to define the ''UDP API Key'' in your [[profile]]'''. All data sent to the server will be logged with IP and uid.<br />
* It is possible to run more than one instance of Avdump2 at once, but not more than ten will work OK. At the moment ''only 10 sessions per ip are allowed by the server'', meaning the eleventh instance will terminate the first.<br />
* There is no direct connection between data sent to AniDB and creqs generated. The data received will just be stored for later processing. There is no way to check the current status for a dump. Usually, it should take ''at least 24 hours'' from the moment you dump a file till the data actually changes. If any irregularities occur, or when there is too much data pending, it will take more time.<br />
* The creqs generated will report the user who sent the data first (for a specific file) as the creqer.<br />
* You may dump files currently not in the database. The data is still stored and will be used later if/after the file has been registered.<br />
* Files creqed by the new system will be locked, meaning some fields will not be possible to change. Notify a moderator if you are '''sure''' that some of the data locked for a specific file is wrong.<br />
<br />
===Why didn't this file get dumped?===<br />
* The file in AniDB is registered with wrong size and/or ED2K hash.<br />
* The package never reached the server.<br />
* The decryption or decompression failed at server side (rare).<br />
* The dump is not valid XML (rare).<br />
<br />
===Why isn't this file verified?===<br />
Even if the file is dumped it doesn't mean it will get auto-creqed (and verified). Here are the reasons:<br />
* The file is corrupt/invalid ([http://anidb.net/perl-bin/animedb.pl?show=avmf&do=xml&avid=76226 example]).<br />
* The provided data is considered "incoherent". (Indicates a bug in Avdump.)<br />
* The dump was marked unfit for file verification by an AniDB Moderator.<br />
<br />
<br />
==Known issues==<br />
* In some cases MediaInfoLib (MIL) used by Avdump2 might report an audio stream to have 0 or 3 channels.<br />
* Anamorphic .asf/.wmv and .mpg/.mpeg files might not get detected correctly and will report the PAR instead of the DAR.<br />
* Some corrupted mkv files may throw a (Thread Aborted) exception, this will be fixed once the updated version of the mkv parser is introduced<br />
* [6248] Avdump2 may freeze if autocreqs are enabled and there are no creqs to send<br />
<br />
==Changelog==<br />
<div style="height: 280px; overflow: auto; padding: 3px; border:1px solid #AAAAAA; font-size: small"><br />
'''0.1.6248.0 : 2012.08.28'''<br />
* Shiny icon for the executable<br />
<br />
* New AniDB Communication, should be faster and more reliable.<br />
** Big file reports no longer fail to be ACReqed.<br />
** Wrong Version and Wrong UserName/Password errors are now separated<br />
** Update notification will be shown if a newer version is available<br />
<br />
* InfoProvider:<br />
** Trimming all value fields<br />
** Fixes serverside parsing errors<br />
<br />
* FileExtensionProvider:<br />
** Limit ReadLine length<br />
** Fixes errors which can happen when a binary file is parsed<br />
<br />
* Directory: Added workaround for "too long" filepaths<br />
<br />
* MatroskaParser:<br />
** Less strict with corrupted mkv files. <br/> (If enough data could be read, the ACReq will be sent despite errors)<br />
<br />
* FileSource: Fixed nullpointer excpetion<br />
<br />
* CL:<br />
** Shortcut for DoneLogFileNameOnly is now D instead of R (because it clashed with NoRecurse)<br />
** Added version check and notification of new version if present<br />
** Less jumping for the ETA display<br />
<br />
* Added extensive tracing (removed in public versions)<br />
<br />
* Lots of other small things<br />
<br />
'''0.1.5290.0 : 2012.05.12'''<br />
* Fixed FileExtensionParser (hopefully)<br />
* TXT Report should be fixed now<br />
* Fixed ACReq Send Thread crash<br />
* AVD2 no longer pauses when not on Windows<br />
* Fixed AVD2 not working when not started from same folder as the executable<br />
* Added switch --UseCWD<br />
* Other changes I haven't remembered yet<br />
<br />
'''0.1.5028.0 : 2011.09.11'''<br />
* Fixed shift of hashvalues (_Display_ only)<br />
* Fixed --Ext with "to remove" extensions<br />
* Fixed --Mon/--TOut to actually work<br />
* Fixed some bug in the old CLI converter<br />
* <no ponies><br />
<br />
'''0.1.5000.0 : 2011.09.11'''<br />
* all previous builds aside of 4991 have been disabled<br />
* <more ponies><br />
<br />
'''0.1.4964.0 : 2011.09.05'''<br />
* all previous builds have been disabled<br />
* Sending ACReqs asynchronous<br />
* <insert ponies riding down the rainbow and other stuff that has happened><br />
<br />
'''0.1.4334.0 : 2011.06.15'''<br />
* all previous builds have been disabled<br />
* should work under linux via mono now too<br />
<br />
'''0.1.4260.0 : 2011.05.25'''<br />
* all previous builds have been disabled<br />
* fix for rare case where all xml submitted would contain an incorrect hash<br />
<br />
'''0.1.4213.0 : 2011.05.14'''<br />
* all previous builds have been disabled<br />
* addition of support and detection of new video file type: .mk3d<br />
* addition of support and detection of new audio file type: .dtshd, .thd<br />
* addition of support and detection of new subtitle file type: .pjs, .rt, .tmp, .tts, .xss, new type of .sub files<br />
* addition of support and detection of new linker file type: .smil <br />
* addition of support and detection of .zip files starting with magic bytes "PK00PK"<br />
<br />
<br />
'''0.1.3958.0 : 2011.03.15''' - no need to redump everything<br />
* fixed the bug that caused avdump2 not to retry sending a dump when facing a timeout<br />
* video-only mp4 files got wrongly detected as m4v<br />
* automatic detection of 32/64bit and use of the correct mediainfolib<br />
* test if mediainfolib is accessible<br />
* check of mediainfolib version to prevent the usage of untested versions<br />
* updated to mediainfolib 0.7.42<br />
* added -crcerr parameter to log files where the calculated crc is not found in the filename<br />
* added -x parameter to create a "parameterless avdump1"-like output<br />
* new switch -H to test pure hashing speed<br />
* removed Tiger and MD4 checksums from dumps sent to the AniDB server<br />
<br />
'''0.1.3084.0 : 2011.03.12'''<br />
* initial release<br />
</div><br />
<br />
[[Category:Features]]<br />
[[Category:AniDB Clients]]<br />
[[Category:Avdump]]<br />
[[Category:Development]]</div>Omminahttps://wiki.anidb.net/index.php?title=Avdump2&diff=16777Avdump22012-08-28T10:41:32Z<p>Ommina: /* Known issues */</p>
<hr />
<div>Welcome to the remarkably sparse avdump2 wiki page, lovingly hand created over many minutes + some more.<br />
<br />
We gleefully embrace build 6248, yet another public release of avd2. It represents a complete rewrite of the original avd1 code, runs against a new build of MediaInfoLibrary, contains a number of custom solutions for a number of formats, represents a significant investment of time and energy by Arokh, and is just generally nifty.<br />
<br />
There is no need to reprocess existing files with this build, but do keep an eye out for misbehaviour.<br />
<br />
==What is it==<br />
'''Avdump2''' is a video/audio codec identification utility - identifies which video codec and audio compression method is used on video files. Furthermore it hashes the file with a set of common hashalgorithms and calculates the used bit rates, the length, identifies the number of used audio channels and more.<br><br />
It, like its predecessor, is mainly based on [http://mediainfo.sourceforge.net/en mediainfo], but significantly enhanced and changed to fit AniDB's needs by [[User:Arokh|Arokh]].<br><br />
<br />
===Supported formats===<br />
Most major file formats are supported to some degree. While hashes are created for all file types, stream details remain shakey for others (notably 'swf'). Because of that for some filetypes (underlined) only the hashes get auto-creqed.<br />
<br />
* '''Video files:''' asf/wmv, avi, flv, m2ts, mk3d, mkv, mov, mp4, mpg/mpeg, ogm, ogv, qt, rm/rmvb, <u>swf</u>, ts, webm<br />
* '''Subtitle files:''' ass, idx, js, lrc, mks, pjs, rt, smi, srt, ssa, sub, sup, tmp, tts, txt, xss<br />
* '''Audio files:''' aac, ac3, dts, dtshd, flac, m4a, mka, mp3, ogg, ra, thd, wav, wma<br />
* '''Archive files:''' <u>7z</u>, <u>ace</u>, <u>rar</u>, <u>zip</u><br />
* '''Linker files:''' mkv, smil<br />
<br />
===Download===<br />
<br />
[http://static.anidb.net/client/avdump2/avdump2_6248.rar DOWNLOAD(RAR)] (Build 6248) MD5 = 4017b2835055d1c54abc12ae72703389<br />
<br />
===Usage===<br />
'''Avdump2''' is a simple [[Wikipedia:Command line interface|command line]] client:<br />
:<tt>AVDump2CL.exe [--<Arg> -<OneLetterArg> ...] <media file/folder> [<media file/folder> ...]</tt><br />
<br />
While pre 4991 build arguments can still be used, it is recommended to use the new format shown below.<br />
The easiest way to convert them to the new format is to run the program with the old args which then displays a notice and the corresponding args in the new format.<br />
<br />
====Options====<br />
{|align="center" style="border: 1px solid #aaaaaa; border-collapse: collapse; background: #f9f9f9; line-height: 1.0; font-size: small; width: 95%"<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Switch<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Type<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Description<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Default<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Example<br />
|-<br />
|'''Auth'''=<username>:<udp_api_key>||Auto-Creqing||Enable automatic creqing. You should always use this option when dumping anime files! Also enables error reporting.||||--Auth=tard:monkey<br />
|-<br />
|'''Host'''=<hostname>:<port>||Auto-Creqing||Hostname of AniDB UDP API server||--Host=api.anidb.info:9002||<br />
|-<br />
|'''LPort'''=<port>||Auto-Creqing||Local UDP port used for autocreqing. Only needed when behind "strict" firewalls.||||--LPort=12345<br />
|-<br />
|'''TOut'''=<timeoutInSeconds>:<numOfRetries>||Auto-Creqing||Timeout for sending dumps||--TOut=10:3||--TOut=25:6<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''ACErr'''=<file path/name>||Logging||Write file paths of failed dumps to file.||||--ACErr=acerr.txt<br />
|-<br />
|'''CRCErr'''=<file path/name>||Logging||Checks if filename contains calculated crc||||--CRCErr=crcerr.txt<br />
|-<br />
|'''ExtDiff'''=<file path/name>||Logging||Write mismatched extensions and file paths to file.||||--ExtDiff=extdiff.txt<br />
|-<br />
|'''FixExt'''=<file path/name>||Logging||Changes the fileextension to the dectected extension and logs the action.||||--FixExt=fixext.txt<br />
|-<br />
|'''Done'''=<file path/name>||Logging||Skip paths present in log and append paths to newly processed files.||||--Done=done.txt<br />
|-<br />
|'''HLog'''=<file path/name>||Logging||Export hashes to file.||||--HLog="$CRC$ $ED2K$":hlog.txt<br />
|-<br />
|'''Log'''=<file path/name>||Logging||Write output to file.||||--Log=log.txt<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''M'''||Output||MediaInfo dump||||-M<br />
|-<br />
|'''m'''||Output||MediaInfo XML dump||||-m<br />
|-<br />
|'''t'''||Output||Simple text format||||-t<br />
|-<br />
|'''C'''||Output||XML creq format||||-C<br />
|-<br />
|'''c'''||Output||AVD2 creq dump||||-c<br />
|-<br />
|'''h'''||Output||Hash Dump||||-h<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''BSize'''=<KB_per_block>:<number_of_blocks>||Control||Buffer size for hashing.||||--BSize=512:16<br />
|-<br />
|'''Ext'''=<comma separated list>||Control||Comma separated extension list.||Process all supported extensions||--Ext=avi,mkv or --Ext=-zip,-sub or --Ext=*<br />
|-<br />
|'''Mon'''=<seconds>||Control||Monitor sleep duration in seconds.||--Mon=60||--Mon=120<br />
|-<br />
|'''NoErr'''||Control||Disable error reporting. You should not disable this as it helps finding and fixing bugs.||||--NoErr<br />
|-<br />
|'''R'''||Control||Do '''not''' recurse into subfolders.||||-R<br />
|-<br />
|'''p'''||Control||Pause when done (hold cmd window).||||-p<br />
|-<br />
|'''P'''||Control||Pause after each file.||||-P<br />
|-<br />
|'''r'''||Control||Random file order.||||-r<br />
|-<br />
|'''q'''||Control||Suppress progress (silent).||||-q<br />
|-<br />
|'''B'''||Control||Test pure hashingspeed without io limitations||||-B<br />
|-<br />
|'''U'''||Control||Use UTF8 as console output stream||||-U<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''0'''||Hashing||For CRC (because the CRC of a 0 byte file is 00000000).||||-0<br />
|-<br />
|'''1'''||Hashing||For SHA1 (because of the 1).||||-1<br />
|-<br />
|'''2'''||Hashing||For ED2K (because of the 2).||||-2<br />
|-<br />
|'''3'''||Hashing||For Tiger (because a tiger in the house minimizes the Three Great Risks -- thieves, fire, and evil spirits).||||-3<br />
|-<br />
|'''4'''||Hashing||For MD4 (because of the 4).||||-4<br />
|-<br />
|'''5'''||Hashing||For MD5 (because of the 5).||||-5<br />
|-<br />
|'''6'''||Hashing||For TTH ... because that's what's left :p||||-6<br />
|-<br />
|'''a'''||Hashing||All (available) hash algorithms.||||-a<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''Exp'''=<file path/name>||AniDB||Export ed2k-links to the specified file. Very useful when mass adding files.||||--Exp=ed2k.txt<br />
|-<br />
|'''PrintEd2kLink'''||AniDB|| ||||--PrintEd2kLink<br />
|-<br />
|'''PrintAniDBLink'''||AniDB|| ||||--PrintAniDBLink<br />
|-<br />
|'''OpenAniDBLink'''||AniDB|| ||||--OpenAniDBLink<br />
|-<br />
|}<br />
<br />
====Windows Shortcut====<br />
#Extract Avdump to a folder of choice.<br />
#:Example: <tt>"C:\Program Files\AVDump2\"</tt><br />
#Right-click <tt>AVDump2CL.exe</tt>, select ''Create Shortcut''.<br />
#Right-click the shortcut, add options to the ''Shortcut - Target'' line.<br />
#:Example, normal usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" -p</tt><br />
#:Example, auto-creq usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" --Auth:''myName'':''udp_api_key''</tt><br />
#::You can also set other options from the list above if you wish to do so.<br />
#::A commandline option to export ED2K links to a file is by adding <tt>--Exp=''C:\Path\ed2k.txt''</tt>, etc.<br />
#::Note that you need to set an '''UDP API Key''' in your AniDB profile for auto-creqing.<br />
#:Optional: Change ''Run'' to ''Maximized''.<br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
====Send to====<br />
#Move the shortcut created above to the SendTo folder.<br />
#:Example, under XP: <tt>"C:\Documents and Settings\''Username''\SendTo"</tt><br />
#:Example, under Vista: <tt>"C:\Users\''Username''\AppData\Roaming\Microsoft\Windows\SendTo"</tt><br />
#::Where ''Username'' is your Windows Login-Name.<br />
#:Note that ''SendTo'' is a hidden folder.<br />
#Right-click any media-file, go to "Send To", choose <tt>AVDump2CL.exe</tt><br />
#Get [[Creq|CReqing]]<br />
<br />
====MS-DOS Batch File====<br />
#Extract Avdump to a folder of choice.<br />
#Create a MS-DOS batch file with the 2 lines below, and save it as ''filename.bat''.<br />
#<tt>@ECHO OFF</tt><br />
#<tt>C:\Program Files\AVDump\AVDump2CL.exe %1 --Exp:''C:\Path\ed2k.txt'' --Auth:''myName'':''udp_api_key''</tt><br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
==Changes From Avdump Classic==<br />
<br />
* AVD2 now runs on the managed .net platform. This will not affect most, as .net comes pre-installed with current versions of windows. XP or older may have to install the platform manually. While it has been tested on mono, such testing has not been exhaustive. We would be very interested in hearing how it behaves in such an environment.<br />
* While most command line parameters remain the same, there are some exceptions. <br />
** The "-o" parameter is no longer available in avd2.<br />
** The "-n" parameter is no longer available in avd2.<br />
** The meaning of the numeric parameters has changed.<br />
* In the event of an internal error, AVD2 ''will'' submit an error report back to AniDB. The error report contains no user-details (see sample), but ''is'' attached to the user name supplied with the -ac parameter. While error reports are ''only'' submitted if -ac is specified, they can be disabled by the addition of the -noerr parameter. That said, for the purposes of initial testing, we respectfully request that error reports not be disabled, so bugs can be found and fixed.<br />
<br />
====Sample Exception Report====<br />
<FileExceptions><br />
<Information><br />
<AVDump2CLVersion>0.1.3734.0</AVDump2CLVersion><br />
<RunOnBitness>64</RunOnBitness><br />
<OS>Microsoft Windows NT 6.1.7601 Service Pack 1</OS><br />
</Information><br />
<Exceptions><br />
<AVDump2CL.Exceptions.AVD2Exception thrownOn="20110303 05.27.26.9254"><br />
<Message>Error in DisplayBuffer</Message><br />
<System.ArgumentOutOfRangeException><br />
<Message><br />
Non-negative number required.<br />
Parameter name: totalWidth<br />
</Message><br />
<StackTrace><br />
<Frame><br />
at System.String.PadHelper(Int32 totalWidth, Char paddingChar, Boolean isRightPadded)<br />
</Frame><br />
<Frame>at l.a(f A_0, Progress A_1)</Frame><br />
<Frame>at l.a(f A_0, Dictionary`2& A_1)</Frame><br />
</StackTrace><br />
</System.ArgumentOutOfRangeException><br />
</AVDump2CL.Exceptions.AVD2Exception><br />
</Exceptions><br />
</FileExceptions><br />
<br />
===Avdump2 on Linux===<br />
Thanks to Mono, Avdump2 runs natively on Linux as well. However, as most development effort goes into the Windows version and due to the heterogenity of Linux distributions, running Avdump2 on Linux isn’t as straightforward as running it on Windows. All Linux-related usage notes can be found on the [[Avdump2 on Linux]] page.<br />
<br />
<br />
==Auto-creqing==<br />
[[Image:Autocreq.gif|thumb|Simple diagram of the way auto-creqing with Avdump2 works]]<br />
<br />
Avdump2 is the AniDB [[auto-creqing]] system. Some more or less important notes:<br />
* To be able to use this feature you’ll need an AniDB account '''and you have to define the ''UDP API Key'' in your [[profile]]'''. All data sent to the server will be logged with IP and uid.<br />
* It is possible to run more than one instance of Avdump2 at once, but not more than ten will work OK. At the moment ''only 10 sessions per ip are allowed by the server'', meaning the eleventh instance will terminate the first.<br />
* There is no direct connection between data sent to AniDB and creqs generated. The data received will just be stored for later processing. There is no way to check the current status for a dump. Usually, it should take ''at least 24 hours'' from the moment you dump a file till the data actually changes. If any irregularities occur, or when there is too much data pending, it will take more time.<br />
* The creqs generated will report the user who sent the data first (for a specific file) as the creqer.<br />
* You may dump files currently not in the database. The data is still stored and will be used later if/after the file has been registered.<br />
* Files creqed by the new system will be locked, meaning some fields will not be possible to change. Notify a moderator if you are '''sure''' that some of the data locked for a specific file is wrong.<br />
<br />
===Why didn't this file get dumped?===<br />
* The file in AniDB is registered with wrong size and/or ED2K hash.<br />
* The package never reached the server.<br />
* The decryption or decompression failed at server side (rare).<br />
* The dump is not valid XML (rare).<br />
<br />
===Why isn't this file verified?===<br />
Even if the file is dumped it doesn't mean it will get auto-creqed (and verified). Here are the reasons:<br />
* The file is corrupt/invalid ([http://anidb.net/perl-bin/animedb.pl?show=avmf&do=xml&avid=76226 example]).<br />
* The provided data is considered "incoherent". (Indicates a bug in Avdump.)<br />
* The dump was marked unfit for file verification by an AniDB Moderator.<br />
<br />
<br />
==Known issues==<br />
* In some cases MediaInfoLib (MIL) used by Avdump2 might report an audio stream to have 0 or 3 channels.<br />
* Anamorphic .asf/.wmv and .mpg/.mpeg files might not get detected correctly and will report the PAR instead of the DAR.<br />
* Some corrupted mkv files may throw a (Thread Aborted) exception, this will be fixed once the updated version of the mkv parser is introduced<br />
* [6248] Avdump2 may freeze if autocreqs are enabled and there are no creqs to send<br />
<br />
==Changelog==<br />
<div style="height: 280px; overflow: auto; padding: 3px; border:1px solid #AAAAAA; font-size: small"><br />
'''0.1.6248.0 : 2012.08.28'''<br />
* Shiny icon for the executable<br />
<br />
* New AniDB Communication, should be faster and more reliable.<br />
** Big file reports no longer fail to be ACReqed.<br />
** Wrong Version and Wrong UserName/Password errors are now separated<br />
** Update notification will be shown if a newer version is available<br />
<br />
* InfoProvider:<br />
** Trimming all value fields<br />
** Fixes serverside parsing errors<br />
<br />
* FileExtensionProvider:<br />
** Limit ReadLine length<br />
** Fixes errors which can happen when a binary file is parsed<br />
<br />
* Directory: Added workaround for "too long" filepaths<br />
<br />
* MatroskaParser:<br />
** Less strict with corrupted mkv files. <br/> (If enough data could be read, the ACReq will be sent despite errors)<br />
<br />
* FileSource: Fixed nullpointer excpetion<br />
<br />
* CL:<br />
** Shortcut for DoneLogFileNameOnly is now D instead of R (because it clashed with NoRecurse)<br />
** Added version check and notification of new version if present<br />
** Less jumping for the ETA display<br />
<br />
* Added extensive tracing (removed in public versions)<br />
<br />
* Lots of other small things<br />
<br />
'''0.1.5290.0 : 2012.05.12'''<br />
* Fixed FileExtensionParser (hopefully)<br />
* TXT Report should be fixed now<br />
* Fixed ACReq Send Thread crash<br />
* AVD2 no longer pauses when not on Windows<br />
* Fixed AVD2 not working when not started from same folder as the executable<br />
* Added switch --UseCWD<br />
* Other changes I haven't remembered yet<br />
<br />
'''0.1.5028.0 : 2011.09.11'''<br />
* Fixed shift of hashvalues (_Display_ only)<br />
* Fixed --Ext with "to remove" extensions<br />
* Fixed --Mon/--TOut to actually work<br />
* Fixed some bug in the old CLI converter<br />
* <no ponies><br />
<br />
'''0.1.5000.0 : 2011.09.11'''<br />
* all previous builds aside of 4991 have been disabled<br />
* <more ponies><br />
<br />
'''0.1.4964.0 : 2011.09.05'''<br />
* all previous builds have been disabled<br />
* Sending ACReqs asynchronous<br />
* <insert ponies riding down the rainbow and other stuff that has happened><br />
<br />
'''0.1.4334.0 : 2011.06.15'''<br />
* all previous builds have been disabled<br />
* should work under linux via mono now too<br />
<br />
'''0.1.4260.0 : 2011.05.25'''<br />
* all previous builds have been disabled<br />
* fix for rare case where all xml submitted would contain an incorrect hash<br />
<br />
'''0.1.4213.0 : 2011.05.14'''<br />
* all previous builds have been disabled<br />
* addition of support and detection of new video file type: .mk3d<br />
* addition of support and detection of new audio file type: .dtshd, .thd<br />
* addition of support and detection of new subtitle file type: .pjs, .rt, .tmp, .tts, .xss, new type of .sub files<br />
* addition of support and detection of new linker file type: .smil <br />
* addition of support and detection of .zip files starting with magic bytes "PK00PK"<br />
<br />
<br />
'''0.1.3958.0 : 2011.03.15''' - no need to redump everything<br />
* fixed the bug that caused avdump2 not to retry sending a dump when facing a timeout<br />
* video-only mp4 files got wrongly detected as m4v<br />
* automatic detection of 32/64bit and use of the correct mediainfolib<br />
* test if mediainfolib is accessible<br />
* check of mediainfolib version to prevent the usage of untested versions<br />
* updated to mediainfolib 0.7.42<br />
* added -crcerr parameter to log files where the calculated crc is not found in the filename<br />
* added -x parameter to create a "parameterless avdump1"-like output<br />
* new switch -H to test pure hashing speed<br />
* removed Tiger and MD4 checksums from dumps sent to the AniDB server<br />
<br />
'''0.1.3084.0 : 2011.03.12'''<br />
* initial release<br />
</div><br />
<br />
[[Category:Features]]<br />
[[Category:AniDB Clients]]<br />
[[Category:Avdump]]<br />
[[Category:Development]]</div>Omminahttps://wiki.anidb.net/index.php?title=Avdump2&diff=16775Avdump22012-08-28T09:25:14Z<p>Ommina: </p>
<hr />
<div>Welcome to the remarkably sparse avdump2 wiki page, lovingly hand created over many minutes + some more.<br />
<br />
We gleefully embrace build 6248, yet another public release of avd2. It represents a complete rewrite of the original avd1 code, runs against a new build of MediaInfoLibrary, contains a number of custom solutions for a number of formats, represents a significant investment of time and energy by Arokh, and is just generally nifty.<br />
<br />
There is no need to reprocess existing files with this build, but do keep an eye out for misbehaviour.<br />
<br />
==What is it==<br />
'''Avdump2''' is a video/audio codec identification utility - identifies which video codec and audio compression method is used on video files. Furthermore it hashes the file with a set of common hashalgorithms and calculates the used bit rates, the length, identifies the number of used audio channels and more.<br><br />
It, like its predecessor, is mainly based on [http://mediainfo.sourceforge.net/en mediainfo], but significantly enhanced and changed to fit AniDB's needs by [[User:Arokh|Arokh]].<br><br />
<br />
===Supported formats===<br />
Most major file formats are supported to some degree. While hashes are created for all file types, stream details remain shakey for others (notably 'swf'). Because of that for some filetypes (underlined) only the hashes get auto-creqed.<br />
<br />
* '''Video files:''' asf/wmv, avi, flv, m2ts, mk3d, mkv, mov, mp4, mpg/mpeg, ogm, ogv, qt, rm/rmvb, <u>swf</u>, ts, webm<br />
* '''Subtitle files:''' ass, idx, js, lrc, mks, pjs, rt, smi, srt, ssa, sub, sup, tmp, tts, txt, xss<br />
* '''Audio files:''' aac, ac3, dts, dtshd, flac, m4a, mka, mp3, ogg, ra, thd, wav, wma<br />
* '''Archive files:''' <u>7z</u>, <u>ace</u>, <u>rar</u>, <u>zip</u><br />
* '''Linker files:''' mkv, smil<br />
<br />
===Download===<br />
<br />
[http://static.anidb.net/client/avdump2/avdump2_6248.rar DOWNLOAD(RAR)] (Build 6248) MD5 = 4017b2835055d1c54abc12ae72703389<br />
<br />
===Usage===<br />
'''Avdump2''' is a simple [[Wikipedia:Command line interface|command line]] client:<br />
:<tt>AVDump2CL.exe [--<Arg> -<OneLetterArg> ...] <media file/folder> [<media file/folder> ...]</tt><br />
<br />
While pre 4991 build arguments can still be used, it is recommended to use the new format shown below.<br />
The easiest way to convert them to the new format is to run the program with the old args which then displays a notice and the corresponding args in the new format.<br />
<br />
====Options====<br />
{|align="center" style="border: 1px solid #aaaaaa; border-collapse: collapse; background: #f9f9f9; line-height: 1.0; font-size: small; width: 95%"<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Switch<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Type<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Description<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Default<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Example<br />
|-<br />
|'''Auth'''=<username>:<udp_api_key>||Auto-Creqing||Enable automatic creqing. You should always use this option when dumping anime files! Also enables error reporting.||||--Auth=tard:monkey<br />
|-<br />
|'''Host'''=<hostname>:<port>||Auto-Creqing||Hostname of AniDB UDP API server||--Host=api.anidb.info:9002||<br />
|-<br />
|'''LPort'''=<port>||Auto-Creqing||Local UDP port used for autocreqing. Only needed when behind "strict" firewalls.||||--LPort=12345<br />
|-<br />
|'''TOut'''=<timeoutInSeconds>:<numOfRetries>||Auto-Creqing||Timeout for sending dumps||--TOut=10:3||--TOut=25:6<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''ACErr'''=<file path/name>||Logging||Write file paths of failed dumps to file.||||--ACErr=acerr.txt<br />
|-<br />
|'''CRCErr'''=<file path/name>||Logging||Checks if filename contains calculated crc||||--CRCErr=crcerr.txt<br />
|-<br />
|'''ExtDiff'''=<file path/name>||Logging||Write mismatched extensions and file paths to file.||||--ExtDiff=extdiff.txt<br />
|-<br />
|'''FixExt'''=<file path/name>||Logging||Changes the fileextension to the dectected extension and logs the action.||||--FixExt=fixext.txt<br />
|-<br />
|'''Done'''=<file path/name>||Logging||Skip paths present in log and append paths to newly processed files.||||--Done=done.txt<br />
|-<br />
|'''HLog'''=<file path/name>||Logging||Export hashes to file.||||--HLog="$CRC$ $ED2K$":hlog.txt<br />
|-<br />
|'''Log'''=<file path/name>||Logging||Write output to file.||||--Log=log.txt<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''M'''||Output||MediaInfo dump||||-M<br />
|-<br />
|'''m'''||Output||MediaInfo XML dump||||-m<br />
|-<br />
|'''t'''||Output||Simple text format||||-t<br />
|-<br />
|'''C'''||Output||XML creq format||||-C<br />
|-<br />
|'''c'''||Output||AVD2 creq dump||||-c<br />
|-<br />
|'''h'''||Output||Hash Dump||||-h<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''BSize'''=<KB_per_block>:<number_of_blocks>||Control||Buffer size for hashing.||||--BSize=512:16<br />
|-<br />
|'''Ext'''=<comma separated list>||Control||Comma separated extension list.||Process all supported extensions||--Ext=avi,mkv or --Ext=-zip,-sub or --Ext=*<br />
|-<br />
|'''Mon'''=<seconds>||Control||Monitor sleep duration in seconds.||--Mon=60||--Mon=120<br />
|-<br />
|'''NoErr'''||Control||Disable error reporting. You should not disable this as it helps finding and fixing bugs.||||--NoErr<br />
|-<br />
|'''R'''||Control||Do '''not''' recurse into subfolders.||||-R<br />
|-<br />
|'''p'''||Control||Pause when done (hold cmd window).||||-p<br />
|-<br />
|'''P'''||Control||Pause after each file.||||-P<br />
|-<br />
|'''r'''||Control||Random file order.||||-r<br />
|-<br />
|'''q'''||Control||Suppress progress (silent).||||-q<br />
|-<br />
|'''B'''||Control||Test pure hashingspeed without io limitations||||-B<br />
|-<br />
|'''U'''||Control||Use UTF8 as console output stream||||-U<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''0'''||Hashing||For CRC (because the CRC of a 0 byte file is 00000000).||||-0<br />
|-<br />
|'''1'''||Hashing||For SHA1 (because of the 1).||||-1<br />
|-<br />
|'''2'''||Hashing||For ED2K (because of the 2).||||-2<br />
|-<br />
|'''3'''||Hashing||For Tiger (because a tiger in the house minimizes the Three Great Risks -- thieves, fire, and evil spirits).||||-3<br />
|-<br />
|'''4'''||Hashing||For MD4 (because of the 4).||||-4<br />
|-<br />
|'''5'''||Hashing||For MD5 (because of the 5).||||-5<br />
|-<br />
|'''6'''||Hashing||For TTH ... because that's what's left :p||||-6<br />
|-<br />
|'''a'''||Hashing||All (available) hash algorithms.||||-a<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''Exp'''=<file path/name>||AniDB||Export ed2k-links to the specified file. Very useful when mass adding files.||||--Exp=ed2k.txt<br />
|-<br />
|'''PrintEd2kLink'''||AniDB|| ||||--PrintEd2kLink<br />
|-<br />
|'''PrintAniDBLink'''||AniDB|| ||||--PrintAniDBLink<br />
|-<br />
|'''OpenAniDBLink'''||AniDB|| ||||--OpenAniDBLink<br />
|-<br />
|}<br />
<br />
====Windows Shortcut====<br />
#Extract Avdump to a folder of choice.<br />
#:Example: <tt>"C:\Program Files\AVDump2\"</tt><br />
#Right-click <tt>AVDump2CL.exe</tt>, select ''Create Shortcut''.<br />
#Right-click the shortcut, add options to the ''Shortcut - Target'' line.<br />
#:Example, normal usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" -p</tt><br />
#:Example, auto-creq usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" --Auth:''myName'':''udp_api_key''</tt><br />
#::You can also set other options from the list above if you wish to do so.<br />
#::A commandline option to export ED2K links to a file is by adding <tt>--Exp=''C:\Path\ed2k.txt''</tt>, etc.<br />
#::Note that you need to set an '''UDP API Key''' in your AniDB profile for auto-creqing.<br />
#:Optional: Change ''Run'' to ''Maximized''.<br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
====Send to====<br />
#Move the shortcut created above to the SendTo folder.<br />
#:Example, under XP: <tt>"C:\Documents and Settings\''Username''\SendTo"</tt><br />
#:Example, under Vista: <tt>"C:\Users\''Username''\AppData\Roaming\Microsoft\Windows\SendTo"</tt><br />
#::Where ''Username'' is your Windows Login-Name.<br />
#:Note that ''SendTo'' is a hidden folder.<br />
#Right-click any media-file, go to "Send To", choose <tt>AVDump2CL.exe</tt><br />
#Get [[Creq|CReqing]]<br />
<br />
====MS-DOS Batch File====<br />
#Extract Avdump to a folder of choice.<br />
#Create a MS-DOS batch file with the 2 lines below, and save it as ''filename.bat''.<br />
#<tt>@ECHO OFF</tt><br />
#<tt>C:\Program Files\AVDump\AVDump2CL.exe %1 --Exp:''C:\Path\ed2k.txt'' --Auth:''myName'':''udp_api_key''</tt><br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
==Changes From Avdump Classic==<br />
<br />
* AVD2 now runs on the managed .net platform. This will not affect most, as .net comes pre-installed with current versions of windows. XP or older may have to install the platform manually. While it has been tested on mono, such testing has not been exhaustive. We would be very interested in hearing how it behaves in such an environment.<br />
* While most command line parameters remain the same, there are some exceptions. <br />
** The "-o" parameter is no longer available in avd2.<br />
** The "-n" parameter is no longer available in avd2.<br />
** The meaning of the numeric parameters has changed.<br />
* In the event of an internal error, AVD2 ''will'' submit an error report back to AniDB. The error report contains no user-details (see sample), but ''is'' attached to the user name supplied with the -ac parameter. While error reports are ''only'' submitted if -ac is specified, they can be disabled by the addition of the -noerr parameter. That said, for the purposes of initial testing, we respectfully request that error reports not be disabled, so bugs can be found and fixed.<br />
<br />
====Sample Exception Report====<br />
<FileExceptions><br />
<Information><br />
<AVDump2CLVersion>0.1.3734.0</AVDump2CLVersion><br />
<RunOnBitness>64</RunOnBitness><br />
<OS>Microsoft Windows NT 6.1.7601 Service Pack 1</OS><br />
</Information><br />
<Exceptions><br />
<AVDump2CL.Exceptions.AVD2Exception thrownOn="20110303 05.27.26.9254"><br />
<Message>Error in DisplayBuffer</Message><br />
<System.ArgumentOutOfRangeException><br />
<Message><br />
Non-negative number required.<br />
Parameter name: totalWidth<br />
</Message><br />
<StackTrace><br />
<Frame><br />
at System.String.PadHelper(Int32 totalWidth, Char paddingChar, Boolean isRightPadded)<br />
</Frame><br />
<Frame>at l.a(f A_0, Progress A_1)</Frame><br />
<Frame>at l.a(f A_0, Dictionary`2& A_1)</Frame><br />
</StackTrace><br />
</System.ArgumentOutOfRangeException><br />
</AVDump2CL.Exceptions.AVD2Exception><br />
</Exceptions><br />
</FileExceptions><br />
<br />
===Avdump2 on Linux===<br />
Thanks to Mono, Avdump2 runs natively on Linux as well. However, as most development effort goes into the Windows version and due to the heterogenity of Linux distributions, running Avdump2 on Linux isn’t as straightforward as running it on Windows. All Linux-related usage notes can be found on the [[Avdump2 on Linux]] page.<br />
<br />
<br />
==Auto-creqing==<br />
[[Image:Autocreq.gif|thumb|Simple diagram of the way auto-creqing with Avdump2 works]]<br />
<br />
Avdump2 is the AniDB [[auto-creqing]] system. Some more or less important notes:<br />
* To be able to use this feature you’ll need an AniDB account '''and you have to define the ''UDP API Key'' in your [[profile]]'''. All data sent to the server will be logged with IP and uid.<br />
* It is possible to run more than one instance of Avdump2 at once, but not more than ten will work OK. At the moment ''only 10 sessions per ip are allowed by the server'', meaning the eleventh instance will terminate the first.<br />
* There is no direct connection between data sent to AniDB and creqs generated. The data received will just be stored for later processing. There is no way to check the current status for a dump. Usually, it should take ''at least 24 hours'' from the moment you dump a file till the data actually changes. If any irregularities occur, or when there is too much data pending, it will take more time.<br />
* The creqs generated will report the user who sent the data first (for a specific file) as the creqer.<br />
* You may dump files currently not in the database. The data is still stored and will be used later if/after the file has been registered.<br />
* Files creqed by the new system will be locked, meaning some fields will not be possible to change. Notify a moderator if you are '''sure''' that some of the data locked for a specific file is wrong.<br />
<br />
===Why didn't this file get dumped?===<br />
* The file in AniDB is registered with wrong size and/or ED2K hash.<br />
* The package never reached the server.<br />
* The decryption or decompression failed at server side (rare).<br />
* The dump is not valid XML (rare).<br />
<br />
===Why isn't this file verified?===<br />
Even if the file is dumped it doesn't mean it will get auto-creqed (and verified). Here are the reasons:<br />
* The file is corrupt/invalid ([http://anidb.net/perl-bin/animedb.pl?show=avmf&do=xml&avid=76226 example]).<br />
* The provided data is considered "incoherent". (Indicates a bug in Avdump.)<br />
* The dump was marked unfit for file verification by an AniDB Moderator.<br />
<br />
<br />
==Known issues==<br />
* In some cases MediaInfoLib (MIL) used by Avdump2 might report an audio stream to have 0 or 3 channels.<br />
* Anamorphic .asf/.wmv and .mpg/.mpeg files might not get detected correctly and will report the PAR instead of the DAR.<br />
* Some corrupted mkv files may throw a (Thread Aborted) exception, this will be fixed once the updated version of the mkv parser is introduced<br />
<br />
==Changelog==<br />
<div style="height: 280px; overflow: auto; padding: 3px; border:1px solid #AAAAAA; font-size: small"><br />
'''0.1.6248.0 : 2012.08.28'''<br />
* New AniDB Communication, should be faster and more reliable.<br />
** Big file reports no longer fail to be ACReqed.<br />
** Wrong Version and Wrong UserName/Password errors are now separated<br />
** Update notification will be shown if a newer version is available<br />
<br />
* InfoProvider:<br />
** Trimming all value fields<br />
** Fixes serverside parsing errors<br />
<br />
* FileExtensionProvider:<br />
** Limit ReadLine length<br />
** Fixes errors which can happen when a binary file is parsed<br />
<br />
* Directory: Added workaround for "too long" filepaths<br />
<br />
* MatroskaParser:<br />
** Less strict with corrupted mkv files. <br/> (If enough data could be read, the ACReq will be sent despite errors)<br />
<br />
* FileSource: Fixed nullpointer excpetion<br />
<br />
* CL:<br />
** Shortcut for DoneLogFileNameOnly is now D instead of R (because it clashed with NoRecurse)<br />
** Added version check and notification of new version if present<br />
** Less jumping for the ETA display<br />
<br />
* Added extensive tracing (removed in public versions)<br />
<br />
* Lots of other small things<br />
<br />
'''0.1.5290.0 : 2012.05.12'''<br />
* Fixed FileExtensionParser (hopefully)<br />
* TXT Report should be fixed now<br />
* Fixed ACReq Send Thread crash<br />
* AVD2 no longer pauses when not on Windows<br />
* Fixed AVD2 not working when not started from same folder as the executable<br />
* Added switch --UseCWD<br />
* Other changes I haven't remembered yet<br />
<br />
'''0.1.5028.0 : 2011.09.11'''<br />
* Fixed shift of hashvalues (_Display_ only)<br />
* Fixed --Ext with "to remove" extensions<br />
* Fixed --Mon/--TOut to actually work<br />
* Fixed some bug in the old CLI converter<br />
* <no ponies><br />
<br />
'''0.1.5000.0 : 2011.09.11'''<br />
* all previous builds aside of 4991 have been disabled<br />
* <more ponies><br />
<br />
'''0.1.4964.0 : 2011.09.05'''<br />
* all previous builds have been disabled<br />
* Sending ACReqs asynchronous<br />
* <insert ponies riding down the rainbow and other stuff that has happened><br />
<br />
'''0.1.4334.0 : 2011.06.15'''<br />
* all previous builds have been disabled<br />
* should work under linux via mono now too<br />
<br />
'''0.1.4260.0 : 2011.05.25'''<br />
* all previous builds have been disabled<br />
* fix for rare case where all xml submitted would contain an incorrect hash<br />
<br />
'''0.1.4213.0 : 2011.05.14'''<br />
* all previous builds have been disabled<br />
* addition of support and detection of new video file type: .mk3d<br />
* addition of support and detection of new audio file type: .dtshd, .thd<br />
* addition of support and detection of new subtitle file type: .pjs, .rt, .tmp, .tts, .xss, new type of .sub files<br />
* addition of support and detection of new linker file type: .smil <br />
* addition of support and detection of .zip files starting with magic bytes "PK00PK"<br />
<br />
<br />
'''0.1.3958.0 : 2011.03.15''' - no need to redump everything<br />
* fixed the bug that caused avdump2 not to retry sending a dump when facing a timeout<br />
* video-only mp4 files got wrongly detected as m4v<br />
* automatic detection of 32/64bit and use of the correct mediainfolib<br />
* test if mediainfolib is accessible<br />
* check of mediainfolib version to prevent the usage of untested versions<br />
* updated to mediainfolib 0.7.42<br />
* added -crcerr parameter to log files where the calculated crc is not found in the filename<br />
* added -x parameter to create a "parameterless avdump1"-like output<br />
* new switch -H to test pure hashing speed<br />
* removed Tiger and MD4 checksums from dumps sent to the AniDB server<br />
<br />
'''0.1.3084.0 : 2011.03.12'''<br />
* initial release<br />
</div><br />
<br />
[[Category:Features]]<br />
[[Category:AniDB Clients]]<br />
[[Category:Avdump]]<br />
[[Category:Development]]</div>Omminahttps://wiki.anidb.net/index.php?title=Avdump2&diff=16774Avdump22012-08-28T09:19:38Z<p>Ommina: /* Download */</p>
<hr />
<div>Welcome to the remarkably sparse avdump2 wiki page, lovingly hand created over many minutes + some more.<br />
<br />
We gleefully embrace build 5290, yet another public release of avd2. It represents a complete rewrite of the original avd1 code, runs against a new build of MediaInfoLibrary, contains a number of custom solutions for a number of formats, represents a significant investment of time and energy by Arokh, and is just generally nifty.<br />
<br />
This release contains a minor collection of fixes from previous releases, and, barring discovery of world-ending bugs in the interim, will be the first version to be formally announced on the web site proper. As before, there is no need to reprocess existing files with this build, but do keep an eye out for misbehaviour.<br />
<br />
==What is it==<br />
'''Avdump2''' is a video/audio codec identification utility - identifies which video codec and audio compression method is used on video files. Furthermore it hashes the file with a set of common hashalgorithms and calculates the used bit rates, the length, identifies the number of used audio channels and more.<br><br />
It, like its predecessor, is mainly based on [http://mediainfo.sourceforge.net/en mediainfo], but significantly enhanced and changed to fit AniDB's needs by [[User:Arokh|Arokh]].<br><br />
<br />
===Supported formats===<br />
Most major file formats are supported to some degree. While hashes are created for all file types, stream details remain shakey for others (notably 'swf'). Because of that for some filetypes (underlined) only the hashes get auto-creqed.<br />
<br />
* '''Video files:''' asf/wmv, avi, flv, m2ts, mk3d, mkv, mov, mp4, mpg/mpeg, ogm, ogv, qt, rm/rmvb, <u>swf</u>, ts, webm<br />
* '''Subtitle files:''' ass, idx, js, lrc, mks, pjs, rt, smi, srt, ssa, sub, sup, tmp, tts, txt, xss<br />
* '''Audio files:''' aac, ac3, dts, dtshd, flac, m4a, mka, mp3, ogg, ra, thd, wav, wma<br />
* '''Archive files:''' <u>7z</u>, <u>ace</u>, <u>rar</u>, <u>zip</u><br />
* '''Linker files:''' mkv, smil<br />
<br />
===Download===<br />
<br />
[http://static.anidb.net/client/avdump2/avdump2_6248.rar DOWNLOAD(RAR)] (Build 6248) MD5 = 4017b2835055d1c54abc12ae72703389<br />
<br />
===Usage===<br />
'''Avdump2''' is a simple [[Wikipedia:Command line interface|command line]] client:<br />
:<tt>AVDump2CL.exe [--<Arg> -<OneLetterArg> ...] <media file/folder> [<media file/folder> ...]</tt><br />
<br />
While pre 4991 build arguments can still be used, it is recommended to use the new format shown below.<br />
The easiest way to convert them to the new format is to run the program with the old args which then displays a notice and the corresponding args in the new format.<br />
<br />
====Options====<br />
{|align="center" style="border: 1px solid #aaaaaa; border-collapse: collapse; background: #f9f9f9; line-height: 1.0; font-size: small; width: 95%"<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Switch<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Type<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Description<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Default<br />
! style="border: 1px solid #aaaaaa; background: #f2f2f2;" | Example<br />
|-<br />
|'''Auth'''=<username>:<udp_api_key>||Auto-Creqing||Enable automatic creqing. You should always use this option when dumping anime files! Also enables error reporting.||||--Auth=tard:monkey<br />
|-<br />
|'''Host'''=<hostname>:<port>||Auto-Creqing||Hostname of AniDB UDP API server||--Host=api.anidb.info:9002||<br />
|-<br />
|'''LPort'''=<port>||Auto-Creqing||Local UDP port used for autocreqing. Only needed when behind "strict" firewalls.||||--LPort=12345<br />
|-<br />
|'''TOut'''=<timeoutInSeconds>:<numOfRetries>||Auto-Creqing||Timeout for sending dumps||--TOut=10:3||--TOut=25:6<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''ACErr'''=<file path/name>||Logging||Write file paths of failed dumps to file.||||--ACErr=acerr.txt<br />
|-<br />
|'''CRCErr'''=<file path/name>||Logging||Checks if filename contains calculated crc||||--CRCErr=crcerr.txt<br />
|-<br />
|'''ExtDiff'''=<file path/name>||Logging||Write mismatched extensions and file paths to file.||||--ExtDiff=extdiff.txt<br />
|-<br />
|'''FixExt'''=<file path/name>||Logging||Changes the fileextension to the dectected extension and logs the action.||||--FixExt=fixext.txt<br />
|-<br />
|'''Done'''=<file path/name>||Logging||Skip paths present in log and append paths to newly processed files.||||--Done=done.txt<br />
|-<br />
|'''HLog'''=<file path/name>||Logging||Export hashes to file.||||--HLog="$CRC$ $ED2K$":hlog.txt<br />
|-<br />
|'''Log'''=<file path/name>||Logging||Write output to file.||||--Log=log.txt<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''M'''||Output||MediaInfo dump||||-M<br />
|-<br />
|'''m'''||Output||MediaInfo XML dump||||-m<br />
|-<br />
|'''t'''||Output||Simple text format||||-t<br />
|-<br />
|'''C'''||Output||XML creq format||||-C<br />
|-<br />
|'''c'''||Output||AVD2 creq dump||||-c<br />
|-<br />
|'''h'''||Output||Hash Dump||||-h<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''BSize'''=<KB_per_block>:<number_of_blocks>||Control||Buffer size for hashing.||||--BSize=512:16<br />
|-<br />
|'''Ext'''=<comma separated list>||Control||Comma separated extension list.||Process all supported extensions||--Ext=avi,mkv or --Ext=-zip,-sub or --Ext=*<br />
|-<br />
|'''Mon'''=<seconds>||Control||Monitor sleep duration in seconds.||--Mon=60||--Mon=120<br />
|-<br />
|'''NoErr'''||Control||Disable error reporting. You should not disable this as it helps finding and fixing bugs.||||--NoErr<br />
|-<br />
|'''R'''||Control||Do '''not''' recurse into subfolders.||||-R<br />
|-<br />
|'''p'''||Control||Pause when done (hold cmd window).||||-p<br />
|-<br />
|'''P'''||Control||Pause after each file.||||-P<br />
|-<br />
|'''r'''||Control||Random file order.||||-r<br />
|-<br />
|'''q'''||Control||Suppress progress (silent).||||-q<br />
|-<br />
|'''B'''||Control||Test pure hashingspeed without io limitations||||-B<br />
|-<br />
|'''U'''||Control||Use UTF8 as console output stream||||-U<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''0'''||Hashing||For CRC (because the CRC of a 0 byte file is 00000000).||||-0<br />
|-<br />
|'''1'''||Hashing||For SHA1 (because of the 1).||||-1<br />
|-<br />
|'''2'''||Hashing||For ED2K (because of the 2).||||-2<br />
|-<br />
|'''3'''||Hashing||For Tiger (because a tiger in the house minimizes the Three Great Risks -- thieves, fire, and evil spirits).||||-3<br />
|-<br />
|'''4'''||Hashing||For MD4 (because of the 4).||||-4<br />
|-<br />
|'''5'''||Hashing||For MD5 (because of the 5).||||-5<br />
|-<br />
|'''6'''||Hashing||For TTH ... because that's what's left :p||||-6<br />
|-<br />
|'''a'''||Hashing||All (available) hash algorithms.||||-a<br />
|-<br />
| &nbsp;<br />
|-<br />
|'''Exp'''=<file path/name>||AniDB||Export ed2k-links to the specified file. Very useful when mass adding files.||||--Exp=ed2k.txt<br />
|-<br />
|'''PrintEd2kLink'''||AniDB|| ||||--PrintEd2kLink<br />
|-<br />
|'''PrintAniDBLink'''||AniDB|| ||||--PrintAniDBLink<br />
|-<br />
|'''OpenAniDBLink'''||AniDB|| ||||--OpenAniDBLink<br />
|-<br />
|}<br />
<br />
====Windows Shortcut====<br />
#Extract Avdump to a folder of choice.<br />
#:Example: <tt>"C:\Program Files\AVDump2\"</tt><br />
#Right-click <tt>AVDump2CL.exe</tt>, select ''Create Shortcut''.<br />
#Right-click the shortcut, add options to the ''Shortcut - Target'' line.<br />
#:Example, normal usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" -p</tt><br />
#:Example, auto-creq usage: <tt>"C:\Program Files\AVDump2\AVDump2CL.exe" --Auth:''myName'':''udp_api_key''</tt><br />
#::You can also set other options from the list above if you wish to do so.<br />
#::A commandline option to export ED2K links to a file is by adding <tt>--Exp=''C:\Path\ed2k.txt''</tt>, etc.<br />
#::Note that you need to set an '''UDP API Key''' in your AniDB profile for auto-creqing.<br />
#:Optional: Change ''Run'' to ''Maximized''.<br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
====Send to====<br />
#Move the shortcut created above to the SendTo folder.<br />
#:Example, under XP: <tt>"C:\Documents and Settings\''Username''\SendTo"</tt><br />
#:Example, under Vista: <tt>"C:\Users\''Username''\AppData\Roaming\Microsoft\Windows\SendTo"</tt><br />
#::Where ''Username'' is your Windows Login-Name.<br />
#:Note that ''SendTo'' is a hidden folder.<br />
#Right-click any media-file, go to "Send To", choose <tt>AVDump2CL.exe</tt><br />
#Get [[Creq|CReqing]]<br />
<br />
====MS-DOS Batch File====<br />
#Extract Avdump to a folder of choice.<br />
#Create a MS-DOS batch file with the 2 lines below, and save it as ''filename.bat''.<br />
#<tt>@ECHO OFF</tt><br />
#<tt>C:\Program Files\AVDump\AVDump2CL.exe %1 --Exp:''C:\Path\ed2k.txt'' --Auth:''myName'':''udp_api_key''</tt><br />
#Drag and drop any media-file onto the shortcut.<br />
<br />
{{eyecatch|Note|'''The ''udp_api_key'' is not your user password!!! see [[Avdump#Auto-creqing|Auto-creqing]] .}}<br />
<br />
==Changes From Avdump Classic==<br />
<br />
* AVD2 now runs on the managed .net platform. This will not affect most, as .net comes pre-installed with current versions of windows. XP or older may have to install the platform manually. While it has been tested on mono, such testing has not been exhaustive. We would be very interested in hearing how it behaves in such an environment.<br />
* While most command line parameters remain the same, there are some exceptions. <br />
** The "-o" parameter is no longer available in avd2.<br />
** The "-n" parameter is no longer available in avd2.<br />
** The meaning of the numeric parameters has changed.<br />
* In the event of an internal error, AVD2 ''will'' submit an error report back to AniDB. The error report contains no user-details (see sample), but ''is'' attached to the user name supplied with the -ac parameter. While error reports are ''only'' submitted if -ac is specified, they can be disabled by the addition of the -noerr parameter. That said, for the purposes of initial testing, we respectfully request that error reports not be disabled, so bugs can be found and fixed.<br />
<br />
====Sample Exception Report====<br />
<FileExceptions><br />
<Information><br />
<AVDump2CLVersion>0.1.3734.0</AVDump2CLVersion><br />
<RunOnBitness>64</RunOnBitness><br />
<OS>Microsoft Windows NT 6.1.7601 Service Pack 1</OS><br />
</Information><br />
<Exceptions><br />
<AVDump2CL.Exceptions.AVD2Exception thrownOn="20110303 05.27.26.9254"><br />
<Message>Error in DisplayBuffer</Message><br />
<System.ArgumentOutOfRangeException><br />
<Message><br />
Non-negative number required.<br />
Parameter name: totalWidth<br />
</Message><br />
<StackTrace><br />
<Frame><br />
at System.String.PadHelper(Int32 totalWidth, Char paddingChar, Boolean isRightPadded)<br />
</Frame><br />
<Frame>at l.a(f A_0, Progress A_1)</Frame><br />
<Frame>at l.a(f A_0, Dictionary`2& A_1)</Frame><br />
</StackTrace><br />
</System.ArgumentOutOfRangeException><br />
</AVDump2CL.Exceptions.AVD2Exception><br />
</Exceptions><br />
</FileExceptions><br />
<br />
===Avdump2 on Linux===<br />
Thanks to Mono, Avdump2 runs natively on Linux as well. However, as most development effort goes into the Windows version and due to the heterogenity of Linux distributions, running Avdump2 on Linux isn’t as straightforward as running it on Windows. All Linux-related usage notes can be found on the [[Avdump2 on Linux]] page.<br />
<br />
<br />
==Auto-creqing==<br />
[[Image:Autocreq.gif|thumb|Simple diagram of the way auto-creqing with Avdump2 works]]<br />
<br />
Avdump2 is the AniDB [[auto-creqing]] system. Some more or less important notes:<br />
* To be able to use this feature you’ll need an AniDB account '''and you have to define the ''UDP API Key'' in your [[profile]]'''. All data sent to the server will be logged with IP and uid.<br />
* It is possible to run more than one instance of Avdump2 at once, but not more than ten will work OK. At the moment ''only 10 sessions per ip are allowed by the server'', meaning the eleventh instance will terminate the first.<br />
* There is no direct connection between data sent to AniDB and creqs generated. The data received will just be stored for later processing. There is no way to check the current status for a dump. Usually, it should take ''at least 24 hours'' from the moment you dump a file till the data actually changes. If any irregularities occur, or when there is too much data pending, it will take more time.<br />
* The creqs generated will report the user who sent the data first (for a specific file) as the creqer.<br />
* You may dump files currently not in the database. The data is still stored and will be used later if/after the file has been registered.<br />
* Files creqed by the new system will be locked, meaning some fields will not be possible to change. Notify a moderator if you are '''sure''' that some of the data locked for a specific file is wrong.<br />
<br />
===Why didn't this file get dumped?===<br />
* The file in AniDB is registered with wrong size and/or ED2K hash.<br />
* The package never reached the server.<br />
* The decryption or decompression failed at server side (rare).<br />
* The dump is not valid XML (rare).<br />
<br />
===Why isn't this file verified?===<br />
Even if the file is dumped it doesn't mean it will get auto-creqed (and verified). Here are the reasons:<br />
* The file is corrupt/invalid ([http://anidb.net/perl-bin/animedb.pl?show=avmf&do=xml&avid=76226 example]).<br />
* The provided data is considered "incoherent". (Indicates a bug in Avdump.)<br />
* The dump was marked unfit for file verification by an AniDB Moderator.<br />
<br />
<br />
==Known issues==<br />
* In some cases MediaInfoLib (MIL) used by Avdump2 might report an audio stream to have 0 or 3 channels.<br />
* Anamorphic .asf/.wmv and .mpg/.mpeg files might not get detected correctly and will report the PAR instead of the DAR.<br />
* Some corrupted mkv files may throw a (Thread Aborted) exception, this will be fixed once the updated version of the mkv parser is introduced<br />
<br />
==Changelog==<br />
<div style="height: 280px; overflow: auto; padding: 3px; border:1px solid #AAAAAA; font-size: small"><br />
'''0.1.6248.0 : 2012.08.28'''<br />
* New AniDB Communication, should be faster and more reliable.<br />
** Big file reports no longer fail to be ACReqed.<br />
** Wrong Version and Wrong UserName/Password errors are now separated<br />
** Update notification will be shown if a newer version is available<br />
<br />
* InfoProvider:<br />
** Trimming all value fields<br />
** Fixes serverside parsing errors<br />
<br />
* FileExtensionProvider:<br />
** Limit ReadLine length<br />
** Fixes errors which can happen when a binary file is parsed<br />
<br />
* Directory: Added workaround for "too long" filepaths<br />
<br />
* MatroskaParser:<br />
** Less strict with corrupted mkv files. <br/> (If enough data could be read, the ACReq will be sent despite errors)<br />
<br />
* FileSource: Fixed nullpointer excpetion<br />
<br />
* CL:<br />
** Shortcut for DoneLogFileNameOnly is now D instead of R (because it clashed with NoRecurse)<br />
** Added version check and notification of new version if present<br />
** Less jumping for the ETA display<br />
<br />
* Added extensive tracing (removed in public versions)<br />
<br />
* Lots of other small things<br />
<br />
'''0.1.5290.0 : 2012.05.12'''<br />
* Fixed FileExtensionParser (hopefully)<br />
* TXT Report should be fixed now<br />
* Fixed ACReq Send Thread crash<br />
* AVD2 no longer pauses when not on Windows<br />
* Fixed AVD2 not working when not started from same folder as the executable<br />
* Added switch --UseCWD<br />
* Other changes I haven't remembered yet<br />
<br />
'''0.1.5028.0 : 2011.09.11'''<br />
* Fixed shift of hashvalues (_Display_ only)<br />
* Fixed --Ext with "to remove" extensions<br />
* Fixed --Mon/--TOut to actually work<br />
* Fixed some bug in the old CLI converter<br />
* <no ponies><br />
<br />
'''0.1.5000.0 : 2011.09.11'''<br />
* all previous builds aside of 4991 have been disabled<br />
* <more ponies><br />
<br />
'''0.1.4964.0 : 2011.09.05'''<br />
* all previous builds have been disabled<br />
* Sending ACReqs asynchronous<br />
* <insert ponies riding down the rainbow and other stuff that has happened><br />
<br />
'''0.1.4334.0 : 2011.06.15'''<br />
* all previous builds have been disabled<br />
* should work under linux via mono now too<br />
<br />
'''0.1.4260.0 : 2011.05.25'''<br />
* all previous builds have been disabled<br />
* fix for rare case where all xml submitted would contain an incorrect hash<br />
<br />
'''0.1.4213.0 : 2011.05.14'''<br />
* all previous builds have been disabled<br />
* addition of support and detection of new video file type: .mk3d<br />
* addition of support and detection of new audio file type: .dtshd, .thd<br />
* addition of support and detection of new subtitle file type: .pjs, .rt, .tmp, .tts, .xss, new type of .sub files<br />
* addition of support and detection of new linker file type: .smil <br />
* addition of support and detection of .zip files starting with magic bytes "PK00PK"<br />
<br />
<br />
'''0.1.3958.0 : 2011.03.15''' - no need to redump everything<br />
* fixed the bug that caused avdump2 not to retry sending a dump when facing a timeout<br />
* video-only mp4 files got wrongly detected as m4v<br />
* automatic detection of 32/64bit and use of the correct mediainfolib<br />
* test if mediainfolib is accessible<br />
* check of mediainfolib version to prevent the usage of untested versions<br />
* updated to mediainfolib 0.7.42<br />
* added -crcerr parameter to log files where the calculated crc is not found in the filename<br />
* added -x parameter to create a "parameterless avdump1"-like output<br />
* new switch -H to test pure hashing speed<br />
* removed Tiger and MD4 checksums from dumps sent to the AniDB server<br />
<br />
'''0.1.3084.0 : 2011.03.12'''<br />
* initial release<br />
</div><br />
<br />
[[Category:Features]]<br />
[[Category:AniDB Clients]]<br />
[[Category:Avdump]]<br />
[[Category:Development]]</div>Omminahttps://wiki.anidb.net/index.php?title=HTTP_API_Definition&diff=16745HTTP API Definition2012-06-02T23:22:15Z<p>Ommina: /* Flooding and Caching */</p>
<hr />
<div>{{TOCright}}<br />
<br />
== General ==<br />
The HTTP XML API is only a small part of the AniDB API framework, please refer to [[API]] for an overview.<br />
<br />
=== Clients ===<br />
<br />
If you want to create a client you have to register it {{AniDBLink|client|here}} and [[HTTP / UDP Clients|here]].<br />
<br />
=== Encoding ===<br />
All content is UTF8 encoded and gzip compressed (you may have to handle the decompressing yourself, if your HTTP library doesn't support compression of HTTP data). Transfer is in chunks, which are part of HTTP 1.1. This is the case even when your client requested uncompressed HTTP 1.0.<br />
<br />
=== Flooding and Caching ===<br />
All users of this API should employ heavy local caching. Requesting the same dataset multiple times on a single day can get you banned. The same goes for request flooding. You should not request more than one page every two seconds on average.<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Parameters ===<br />
These parameters apply to all HTTP XML API pages and should always be added to the request URLs.<br />
<br />
All users of the HTTP XML API need to be registered and have to provide their registered client identifier and version number on each request.<br />
<br />
Parameters:<br />
* <tt>client={string}</tt> [required]<br />
** client identification string, needs to be a registered client identifier, see: <br />
<br />
* <tt>clientver={integer}</tt> [required]<br />
** client version number, needs to be valid client version number for the given client identification string.<br />
<br />
* <tt>protover={integer}</tt> [required]<br />
** protocol version in use. Possible values: 1<br />
<br />
* <tt>request={string}</tt> [required]<br />
** HTTP XML datapage requested. See following sections.<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1</nowiki></u><br />
<br />
== Data Commands ==<br />
<br />
=== Anime ===<br />
Allows retrieval of non-file or episode related information for a specific anime by AID (AniDB anime id).<br />
<br />
==== Search ====<br />
AniDB offers a daily updated dump of all anime titles which can be used to support client sided anime search features.<br />
<br />
This file can also be used for anime title to AID lookups.<br />
<br />
:[http://anidb.net/api/animetitles.dat.gz http://anidb.net/api/animetitles.dat.gz]<br />
:[http://anidb.net/api/animetitles.xml.gz http://anidb.net/api/animetitles.xml.gz]<br />
<br />
Alternatively there is a ready to use search using these dumps available by a third party: [http://anisearch.outrance.pl/] (thx to eloyard)<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=anime</tt><br />
* <tt>aid={integer}</tt> [required]<br />
** AniDB anime id of the anime you want to retrieve data for.<br />
<br />
<br />
{{eyecatch|Note|The tags node presently contains both 'spoiler' and 'localspoiler' attributes. Both represent the same value. Clients should use 'localspoiler'; in time, 'spoiler' will be removed.}}<br />
<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=anime&client={str}&clientver={int}&protover=1&aid={int}</nowiki></u><br />
<br />
===== Data =====<br />
<code><pre><br />
<?xml version="1.0" encoding="UTF-8"?><br />
<anime id="1" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>1999-01-04</startdate><br />
<enddate>1999-03-29</enddate><br />
<titles><br />
<title xml:lang="x-jat" type="main">Seikai no Monshou</title><br />
<title xml:lang="zh-Hans" type="syn">星界之纹章</title><br />
<title xml:lang="en" type="short">CotS</title><br />
<title xml:lang="x-jat" type="short">SnM</title><br />
<title xml:lang="ja" type="official">星界の紋章</title><br />
<title xml:lang="en" type="official">Crest of the Stars</title><br />
<title xml:lang="fr" type="official">Crest of the Stars</title><br />
<title xml:lang="pl" type="official">Crest of the Stars</title><br />
</titles><br />
<relatedanime><br />
<anime id="4" type="Sequel">Seikai no Senki</anime><br />
<anime id="6" type="Prequel">Seikai no Danshou</anime><br />
<anime id="1623" type="Summary">Seikai no Monshou Tokubetsuhen</anime><br />
</relatedanime><br />
<url>http://www.sunrise-inc.co.jp/seikai/</url><br />
<creators><br />
<name id="4495" type="Original Work">Morioka Hiroyuki</name><br />
</creators><br />
<description>Jinto Lin`s life changes forever when the Humankind Empire Abh takes over his home planet of Martine without firing a single shot. He is soon sent off to study the Abh language and culture and to prepare himself for his future as a nobleman — a future he never dreamed of. Or wanted.Now, Jinto is entering the next phase of his training, and he is about to meet his first Abh, the lovely Lafiel. But Jinto is about to learn that she is more than she appears to be. And together they will have to fight for their very lives.</description><br />
<ratings><br />
<permanent count="2953">8.53</permanent><br />
<temporary count="96">7.58</temporary><br />
<review count="11">8.75</review><br />
</ratings><br />
<picture>440.jpg</picture><br />
<categories><br />
<category id="174" parentid="8" hentai="false" weight="500"><br />
<name>Space Travel</name><br />
<description>Space Travel usually refers going to space or travelling there with or without a spacecraft. There are different forms of space travel like Interplanetary travel, Interstellar travel or Intergalactic travel. Since it isn`t possible to travel faster than light, most anime series involve some sort "sub-space travel mechanism" as a way to travel faster than light.</description><br />
</category><br />
<category id="274" parentid="268" hentai="false" weight="400"><br />
<name>Novel</name><br />
<description>Note that novel means book with words in paper, so no comics and no "visual novels", which should go under manga and dating-sim - visual Novel/erotic game respectively.&#13;<br />
&#13;<br />
Note that it can be applied to novels as we know them but also the typical light novels for teens and young adults, which are common in Japan and aside from being short include a number of illustrations. </description><br />
</category><br />
</categories><br />
<tags><br />
<tag id="136" approval="20" spoiler="false" update="2009-05-23"><br />
<name>space opera</name><br />
<count>71</count><br />
</tag><br />
<tag id="175" approval="17" spoiler="false" update="2008-03-13"><br />
<name>space elves</name><br />
<count>12</count><br />
</tag><br />
<tag id="389" approval="15" spoiler="false" update="2008-06-03"><br />
<name>war setting</name><br />
<count>64</count><br />
</tag><br />
<tag id="393" approval="18" spoiler="false" update="2008-06-03"><br />
<name>space battles</name><br />
<count>43</count><br />
<description>There are space battles in this anime. Usually between Earth forces and some alien invader, but ship to ship skirmishes in deep space are just as common.</description><br />
</tag><br />
</tags><br />
<characters><br />
<character id="7493" type="appears in" update="2009-05-28"><br />
<name>Gosroth</name><br />
<description>The Resii Gothroth.The first Abh ship lost in the war.</description><br />
<episodes>1,1012</episodes><br />
<picture>26147.jpg</picture><br />
</character><br />
<character id="7501" type="appears in" update="2009-05-28"><br />
<name>Planet Martine</name><br />
<description>The homeworld of Jinto</description><br />
<episodes>1</episodes><br />
</character><br />
<character id="7503" type="appears in" update="2009-05-28"><br />
<name>Rock Lynn</name><br />
<description>The former president of Martine, later made count of the Hyde system, after striking a deal with the Abh (in episode 1)</description><br />
<episodes>1</episodes><br />
<picture>26165.jpg</picture><br />
</character><br />
</characters><br />
<episodes><br />
<episode id="1" update="2005-03-10"><br />
<epno>1</epno><br />
<length>24</length><br />
<airdate>1999-01-03</airdate><br />
<rating votes="17">5.66</rating><br />
<title xml:lang="ja">侵略</title><br />
<title xml:lang="en">Invasion</title><br />
<title xml:lang="fr">Invasion</title><br />
<title xml:lang="x-jat">shinryaku</title><br />
</episode><br />
<episode id="2" update="2005-03-11"><br />
<epno>2</epno><br />
<length>24</length><br />
<airdate>1999-01-10</airdate><br />
<rating votes="12">6.66</rating><br />
<title xml:lang="ja">星たちの眷族</title><br />
<title xml:lang="en">Kin of the Stars</title><br />
<title xml:lang="fr">Les parents des Étoiles</title><br />
<title xml:lang="x-jat">Hoshi-tachi no Kenzoku</title><br />
</episode><br />
</episodes><br />
</anime><br />
</pre></code><br />
==== Errors ====<br />
[http://anidb.net/perl-bin/animedb.pl?show=cmt&post=159118 According to ommina] the API does not use HTTP return code. Instead you will get XML consisting of one tag with a textual description.<br />
<code><pre><br />
<error>Banned</error><br />
</pre></code><br />
<br />
=== Category List ===<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=categorylist</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=categorylist</tt><br />
** The current AniDB category tree. This tree is fairly static, with only rare changes. Request a new list only if you have good reason to believe there has been changes.<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=categorylist</nowiki></u><br />
<br />
<code><pre><br />
<categorylist><br />
<category id="80" parentid="3"><br />
<name>18 Restricted</name><br />
<description>This isn`t really an "Audience".<br />
<br />
While some anime might feature sexual content they still might not be porn. Only use it when the content is clearly *not* intended for minors. <br />
</description><br />
</category><br />
<category id="4" parentid="313"><br />
<name>Action</name><br />
</category><br />
<br />
...<br />
<br />
<category id="37" parentid="30"><br />
<name>Yuri</name><br />
<description>Yuri refers to anime that portray lesbian (female/female) sex. Do not confuse this with the Shoujo Ai category under Romance, which only portrays girl/girl relationships, but generally not anything pornographic. This is real female/female porn.</description><br />
</category><br />
</categorylist><br />
</pre></code><br />
<br />
=== Random Recommendation ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random recommendations' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomrecommendation</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomrecommendation</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomrecommendation</nowiki></u><br />
<br />
<code><pre><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="7899" restricted="false"><br />
<type>TV Series</type><br />
<episodecount>13</episodecount><br />
<startdate>2010-10-04</startdate><br />
<enddate>2010-12-27</enddate><br />
<title xml:lang="x-jat" type="main">Arakawa Under the Bridge 2</title><br />
<picture>54734.jpg</picture><br />
<ratings><br />
<permanent count="781">623</permanent><br />
<recommendations>8</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
...<br />
<br />
<randomrecommendation><br />
</pre></code><br />
<br />
=== Random Similar ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Please note, however, that the 'random similar' are, in fact, random. Please do not expect random results here to match random results there.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=randomsimilar</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=randomsimilar</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=randomsimilar</nowiki></u><br />
<br />
<code><pre><br />
<randomsimilar><br />
<similar><br />
<source aid="7056" restricted="false"><br />
<title xml:lang="x-jat" type="main">Aoi Bungaku Series</title><br />
<picture>37124.jpg</picture><br />
</source><br />
<target aid="3654" restricted="false"><br />
<title xml:lang="x-jat" type="main">Ayakashi: Japanese Classic Horror</title><br />
<picture>44085.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
</randomsimilar><br />
</pre></code><br />
<br />
=== Hot Anime ===<br />
<br />
This command mirrors the type of data provided on the main web page. Use this instead of scraping the HTML. Unlike the two random result commands, the results here will match the results as supplied by the main web page (with some possible variance of a few hours, depending on cache life.)<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=hotanime</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=hotanime</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=hotanime</nowiki></u><br />
<br />
<code><pre><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
</pre></code><br />
<br />
=== Main ===<br />
<br />
A one-stop command returning the combined results of random recommendation, random similar, and hot anime. Use this command instead of scraping the HTML, and if you need more than one of the individual replies.<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=main</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=main</tt><br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=main</nowiki></u><br />
<br />
<code><pre><br />
<main><br />
<hotanime><br />
<anime id="8556" restricted="false"><br />
<episodecount>12</episodecount><br />
<startdate>2012-01-10</startdate><br />
<title xml:lang="x-jat" type="main">Another</title><br />
<ratings><br />
<permanent count="248">6.61</permanent><br />
<temporary count="261">7.88</temporary><br />
<review count="1">4.33</review><br />
</ratings><br />
<picture>79963.jpg</picture><br />
</anime><br />
<br />
...<br />
<br />
</hotanime><br />
<randomsimilar><br />
<similar><br />
<source aid="8107" restricted="false"><br />
<title xml:lang="x-jat" type="main">A Channel: The Animation</title><br />
<picture>59870.jpg</picture><br />
</source><br />
<target aid="4777" restricted="false"><br />
<title xml:lang="x-jat" type="main">Lucky Star</title><br />
<picture>65555.jpg</picture><br />
</target><br />
</similar><br />
<br />
...<br />
<br />
<randomsimilar><br />
<randomrecommendation><br />
<recommendation><br />
<anime id="44" restricted="false"><br />
<type>OVA</type><br />
<episodecount>1</episodecount><br />
<startdate>2000-05-24</startdate><br />
<enddate>2000-05-24</enddate><br />
<title xml:lang="x-jat" type="main">Amon Devilman Mokushiroku</title><br />
<picture>14016.jpg</picture><br />
<ratings><br />
<permanent count="317">387</permanent><br />
<recommendations>1</recommendations><br />
</ratings><br />
</anime><br />
</recommendation><br />
<br />
....<br />
<br />
</randomrecommendation><br />
</main><br />
</pre></code><br />
<br />
== User Data Commands ==<br />
<br />
=== User Mylist Summary ===<br />
<br />
==== Access ====<br />
Base URL: <u><nowiki>http://api.anidb.net:9001/httpapi?request=mylistsummary&user={str anidb username}&pass={str anidb password}</nowiki></u><br />
<br />
Parameters:<br />
* <tt>request=mylistsummary</tt><br />
** Returns a list of the user's anime list in summary form, roughly matching the data in the "my list" page of the web interface.<br />
* <tt>user={str username}&pass={str password}</tt><br />
** The user name and password of the desired user. This is their main password, not the API password specified in the profile.<br />
<br />
Example:<br />
URL: <u><nowiki>http://api.anidb.net:9001/httpapi?client={str}&clientver={int}&protover=1&request=mylistsummary&user={str}&pass={str}</nowiki></u><br />
<br />
<code><pre><br />
<mylistsummary uid="40237"><br />
<mylistitem aid="5841" state="2"><br />
<episodecount>22</episodecount><br />
<seencount>22</seencount><br />
<specialcount>9</specialcount><br />
<seenspecialcount>4</seenspecialcount><br />
</mylistitem><br />
<mylistsummary><br />
</pre></code><br />
<br />
[[Category:Development]]<br />
[[Category:API]]</div>Omminahttps://wiki.anidb.net/index.php?title=UDP_API_Definition&diff=16731UDP API Definition2012-04-15T22:19:17Z<p>Ommina: /* FILE: Retrieve File Data */</p>
<hr />
<div>{{TOCright}}<br />
<br />
== General Information ==<br />
'''Author:''' [[User:Exp|Exp]] & [[User:Epoximator|Epoximator]] & [[User:Ommina|Ommina]]<br><br />
'''Version:''' 0.03.610 (2010-05-01)<br><br />
'''Version number used for protover parameter:''' "3"<br />
<br />
'''IMPORTANT INFORMATION FOR ALL INTERESTED:'''<br />
* If you are mainly interested in notifications and private messaging, check out our [[Jabber]] and [[RSSRDF]] support first.<br />
* The UDP API is not an appropriate choice if you desire to download a local copy of the AniDB database.<br />
* If you want to create a client you have to register it {{AniDBLink|client|here}} and [[UDP Clients|here]].<br />
** Check out the clients that are being developed. There exists usable code in many different languages already.<br />
* If you have suggestions for improvements or new features use the [[UDP API DEV|development]] page.<br />
* Please also take a look at the [[API]] page.<br />
<br />
== Formats used in this Spec ==<br />
* {vartype varname} - Specifies what shall be inserted at this point and its type.<br />
* [...] - Everything between [ and ] is optional.<br />
<br />
=== Used types ===<br />
* ''int2'' - 2 byte Integer (in string representation)<br />
* ''int4'' - 4 byte Integer (in string representation)<br />
* ''boolean'' - true or false - use '1' for ''true'', '0' for ''false''<br />
* ''str'' - String (UDP packet length restricts string size to 1400 bytes)<br />
* ''hexstr'' -- a hex representation of a decimal value, two characters per byte. If multiple bytes are represented, byte one is the first two characters of the string, byte two the next two, and so on.<br />
<br />
=== Content Encoding ===<br />
* Default character encoding: ''ASCII''<br />
* Escape scheme for option values (to server): ''html form encoding'' + ''newline''<br />
** This means you have to encode at least <tt>&</tt> in your option values in html form encoding style (<tt>&amp;amp;</tt>) before sending them to the api server. All other html form encodings are optional.<br />
** All newlines should be replaced by &lt;br /&gt;<br />
* Escape scheme for returned data fields (from server): ', | and newline<br />
** Content newlines are encoded as &lt;br /&gt;, ' is encoded as ` and | is not allowed in data fields.<br />
** Dates are returned in unix time (number of seconds elapsed since January 1, 1970 00:00:00 UTC)<br />
<br />
== Basics ==<br />
=== General ===<br />
The network communication is ''packet'' and ''line'' based. Each AniDB API command is exactly one UDP packet containing one line. Results are sent as one packet but may consist out of multiple lines. A return value always starts with a 3 byte result code followed by a human readable version of the result code. Be aware that important data fields may be returned directly after the return code (see: 200,201,271,272,504).<br />
The meaning for all result codes can be found in this document. If there is more than one entry returned, it's one entry per line. Lines are terminated by a <tt>\n</tt> (no dos linefeed <tt>\r</tt>). The elements of a format string are separated by a "|" character.<br />
<br />
<tt>{three digit return code} {str return string}\n</tt><br><br />
<tt>{data field 0}|{data field 1}|...|{data field n}</tt><br />
<br />
'''IMPORTANT:'''<br />
* All commands except PING, ENCRYPT, ENCODING, AUTH and VERSION '''requires''' login, meaning that the ''session tag'' must be set (<tt>s=xxxxx</tt>).<br />
* A client should ignore any additional trailing data fields it doesn't expect. Additional fields are going to be added to the output of some commands from time to time. Those additional fields will simply be appended to the end of the existing output. A client should be written in a way so that it is not affected by such new fields.<br />
* Due to the length constraints of an UDP package (over PPPoE) the replies from the server will never exceed 1400 bytes. String fields will be truncated if necessary to ensure this. No warnings are given when this happens.<br />
* A client should handle all possible return codes for each command.<br />
** Possible return codes for '''all commands''':<br />
*** 505 ILLEGAL INPUT OR ACCESS DENIED<br />
*** 555 BANNED<br />
***: {str reason}<br />
*** 598 UNKNOWN COMMAND<br />
*** 600 INTERNAL SERVER ERROR<br />
*** 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
*** 602 SERVER BUSY - TRY AGAIN LATER<br />
*** 604 TIMEOUT - DELAY AND RESUBMIT<br />
** Additional return codes for all commands that '''require login''':<br />
*** 501 LOGIN FIRST<br />
*** 502 ACCESS DENIED<br />
*** 506 INVALID SESSION<br />
<br />
{{eyecatch|Note|The '555 BANNED' message should not be expected by the client. This message is only enabled temporary to help developers understand what they are doing wrong.}}<br><br />
<br />
{{eyecatch|Note|<br />
While in daily maintenance the AniDB API will reply with<br />
<br />
601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
<br />
to all commands. If a client receives such a return value it should wait at least 30 minutes before trying again.}}<br />
<br />
=== Server / UDP Connection ===<br />
The Client has to send data packets to:<br />
* '''Server:''' api.anidb.net<br />
* '''Port:''' 9000/UDP<br />
The servername and port should not be hardcoded into a frontend but should be read from a configuration file.<br />
<br />
=== Server Errors ===<br />
* At any time the API might return a fatal error of the form:<br />
: <tt>6xx ERROR DESCRIPTION</tt><br />
* Possible codes are 600-699.<br />
* Occurrences of these errors (except 601 and 602) should be reported to [[User:Ommina|Ommina]].<br />
{{eyecatch|Note|6XX messages do not always return the tags given with the command which caused the error!}}<br />
<br />
=== Connection Problems ===<br />
There are many ways for a client to end up banned or the API might currently be handling too many concurrent connections.<br />
If a client does not get any reply to an AUTH command it should start to increase the retry delay exponentially with every failed login attempt. (i.e. try again after 30 seconds if the first login attempt failed, if the second fails too retry after 2 minutes, then 5 minutes, then 10 minutes, then 30 minutes, ... until you reach a retry delay of ~2-4h.)<br />
<br />
=== Local Port ===<br />
A client should select a fixed local port >1024 at install time and reuse it for local UDP Sockets. If the API sees too many different UDP Ports from one IP within ~1 hour it will ban the IP. (So make sure you're reusing your UDP ports also for testing/debugging!)<br />
<br />
The local port may be hardcoded, however, an option to manually specify another port should be offered.<br />
<br />
'''Note when behind a [[Wikipedia:Network address translation|NAT]]/masquerading router:'''<br><br />
A session between the server and a client is identified by the ''IP and port'' used by the client. So when the port (or IP) changes within a session the client has to authenticate again. If a client is behind a NAT router it can’t actually control the local port used for the connection. The router will normally ''translate'' the port to support several computers on a LAN to share the Internet connection. The public port (as determined by the router and seen by the server) which has been assigned to the connection will only be reserved for as long as it is in use. This means that the router will usually ''deallocate the port after a fixed timeout period'' (eg. five, ten or 15 minutes). Once that happens the client will no longer be able to receive UDP messages from the server (the messages will be discarded as undeliverable by the router) and a new port will be selected once the client tries to send a message to the server (which will result in a new connection session - '''Note:''' This could get you banned!, see above). So in order to keep a session over a NAT router alive, the client has to ping the server within the router's deallocation period to prevent a timeout.<br />
<br />
The client can decide whether it is behind a NAT router or not by adding <tt>nat=1</tt> to the AUTH command. This will cause the response to include the IP and port as seen by the server. If the port differs from the port reported by the local socket, the connection subject to NAT and the client should issue PING commands in regular intervals. Please do not send pings more often than is necessary to keep NAT connections alive.<br />
<br />
=== Flood Protection ===<br />
To prevent high server load the UDP API server enforces a strict flood protection policy.<br />
* Short Term:<br />
** A Client MUST NOT send more than 0.5 packets per second (that's one packet every two seconds, not two packets a second!)<br />
** The server will start to enforce the limit after the first 5 packets have been received.<br />
* Long Term:<br />
** A Client MUST NOT send more than one packet every four seconds over an extended amount of time.<br />
** ''An extended amount of time'' is not defined. Use common sense.<br />
<br />
Once a client exceeds a rate limit all further UDP packets from that client will be dropped without feedback until the client's packet rate is back down to acceptable levels.<br />
<br />
{{eyecatch|Note|Dropped packets are still taken into account for the packet rate. Meaning if you continuously send packets your client will be banned forever.}}<br />
<br />
Generally clients should be written in a way to minimize server and network load. You should always keep that in mind.<br />
<br />
Abusive clients may be banned completely.<br />
<br />
{{eyecatch|Note|<br />
If you suddenly stop getting replies from the AniDB API or you normally don't have a notable packetloss and from one point on you suddenly note a high packetloss percentage you have most likely entered a critical flood ratio.<br />
If the AniDB API isn't answering at all it might either be down or you have been banned, this is normally caused by violating the API specs (i.e. too many connections using different ports from one IP, too many auth failures, ...) (usually lasts 30 minutes).<br />
If you're experiencing packet loss you have probably reached the rate limit and the API starts to randomly drop incoming packets from your IP. (can be solved by enforcing a delay between multiple commands when you're sending a batch)}}<br />
<br />
=== Anti Leech Protection ===<br />
The API should not be used to "download" AniDB. If such attempts are detected you will get banned.<br />
<br />
=== Caching ===<br />
To minimize server and network load a client should use local caching in order to prevent repeated API requests for the same data.<br />
<br />
A client should locally cache FILE/EP/ANIME/GROUP/... info wherever possible for extended amounts of time.<br />
(I.e. if a client is used to scan a local folder with anime files and add them via API to a users MyList then it shall only ask for all files in the first run and cache the info for all files known to AniDB. If run again over the same folder it shall only check those files which were unknown to AniDB at the time of the last check.)<br />
<br />
Later versions of the API might enforce this by banning clients which ask for the same information more than once every week/month.<br />
<br />
=== Tag option ===<br />
The API will add a user defined string at the beginning of each reply line separated with a space, if desired.<br />
* To enable add the <tt>tag={str usertag}</tt> option to a command.<br />
* A tag is only valid for the command it was send with, meaning it is not persistent. If you want to have tags in front of all reply lines you will have to append the tag option to each command you send to the server.<br />
* Tags are meant to enable a client to handle more than one request/reply at a time.<br />
<br />
Usage example:<br />
AUTH user=baka&pass=baka&protover=25&client=someclient&clientver=1&tag=abc123<br />
abc123 200 Jxqxb LOGIN ACCEPTED<br />
or<br />
LOGOUT s=Jxqxb&tag=byebye<br />
byebye 203 LOGGED OUT<br />
<br />
{{eyecatch|Note|The tag option is valid for all api commands and is thus not explicitly listed in the description of each command.}}<br />
<br />
=== Data Indexes (fid,aid,eid,gid,lid) ===<br />
* All indexes start at 1 (not 0).<br />
* It is possible for table entries to have id fields with a value of 0 (i.e. gid). Those are to be interpreted as "NONE" or "NULL".<br />
* An ID is '''never''' reused. That means after an entry is deleted no new entry will ever have that ID again.<br />
* Mylist IDs (lid) are globally unique, not per-user unique.<br />
<br />
== Authing Commands ==<br />
{{eyecatch|Note|'''ANY''' command which requires parameters may return: 505 ILLEGAL INPUT OR ACCESS DENIED}}<br />
<br />
----<br />
=== AUTH: Authing to the AnimeDB ===<br />
'''Command String:'''<br />
* AUTH user={str username}&pass={str password}&protover={int4 apiversion}&client={str clientname}&clientver={int4 clientversion}[&nat=1&comp=1&enc={str encoding}&mtu{int4 mtu value}&imgserver=1]<br />
<br />
'''Possible Replies:'''<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
* 500 LOGIN FAILED<br />
* 503 CLIENT VERSION OUTDATED<br />
* 504 CLIENT BANNED - {str reason}<br />
* 505 ILLEGAL INPUT OR ACCESS DENIED<br />
* 601 ANIDB OUT OF SERVICE - TRY AGAIN LATER<br />
when nat=1<br />
* 200 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED<br />
* 201 {str session_key} {str ip}:{int2 port} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
when imgserver=1<br />
* 200 {str session_key} LOGIN ACCEPTED<br />
{str image server name}<br />
* 201 {str session_key} LOGIN ACCEPTED - NEW VERSION AVAILABLE<br />
{str image server name}<br />
<br />
'''Info:'''<br />
{{eyecatch|Note|The password is the normal AniDB website password! The password listed in the profile as API Password in only used for the optional encryption feature.}}<br />
* The ''session_key'' is a String containing only ''a-z,A-Z,0-9'' chars of a length of ''4-8'' characters.<br />
: It has to be stored by the client and needs to be sent as parameter with every command which requires the user to logged in.<br />
* The ''session_key'' String is appended as parameter "s", i.e. "PUSH notify=1&msg=1&s={str session_key}".<br />
* On a '''500 LOGIN FAILED''' message the client should request the user to enter username and password again.<br />
* In case of a '''501 LOGIN FIRST''' message the client should silently resend an auth command and send the failed command again.<br />
* A '''502 ACCESS DENIED''' message should abort the current action on the client side and display a message to the user.<br />
* A '''503 CLIENT VERSION OUTDATED''' message states that the udp server has been updated and does not support your client any longer. (protover is too low). A 201 message refers to a new version of the client software.<br />
* A '''506 INVALID SESSION''' means that either the session key parameter "s" was not provided with a command that requires it or the session key is no longer valid. The client should reissue an AUTH command.<br />
{{eyecatch|Note|A frontend shall expect 501 and 502 messages to be returned on ANY command.}}<br><br />
{{eyecatch|Note|AniDB usernames may only contain characters (a-z,A-Z), numbers (0-9), underscores (_) and hyphens (-).}}<br />
* The client should send the apiversion of the AnimeDB API version it supports as value of the protover parameter.<br />
* The client MAY NOT send anything but the version of the API Specs the author used to write the client! (as it is stated at the top of this file @ "Version number used for protover parameter")<br />
: The API will compare that value to it's own version of the API and if the version of the client is older the API will decide whether the changes were significant enough to deny the old client access to the DB.<br />
* The clientname shall be a lower-case string containing only the chars ''a-z'' of ''4-16 chars'' length which identifies the client. (i.e. mykickassclient)<br />
* The clientversion shall be a number starting with 1, increased on every change in the client.<br />
: clientname and clientversion might be used by the API to distinguish between different clients and client versions if that should ever become necessary.<br />
{{eyecatch|Important|<br />
* DO NOT use the clientname of an existing client. If you modify an existing client's code to meet your own needs, create a new client name for yourself.<br />
* ALWAYS increase the clientversion number if you release a new client version.}}<br />
* A Login and its assigned ''session_key'' is valid until the virtual UDP connection times out or until a LOGOUT command is issued.<br />
* The virtual UDP connection times out if no data was received from the client for '''35 minutes'''.<br />
* A client should issue a UPTIME command once every 30 minutes to keep the connection alive should that be required.<br />
* If the client does not use any of the notification/push features of the API it should NOT keep the connection alive, furthermore it should explicitly terminate the connection by issuing a LOGOUT command once it finished it's work.<br />
* If it is very likely that another command will be issued shortly (within the next 20 minutes) a client SHOULD keep the current connection open, by not sending a LOGOUT command.<br />
{{eyecatch|Important|<br />
* A client should NOT perform a full AUTH / command / LOGOUT cycle for each command it wants to send. Again, if another command is likely within 20 minutes, remain logged in.}}<br />
* The client shall notify the user if it received a 201 message at login.<br />
: This means a new version of the client is available, however the old version is still supported otherwise a client banned message would have been returned.<br />
* The user should get a pop-up message on 503 and 504 messages telling him to update his client software.<br />
: ('''Note:''' 504 means that this version of the client is banned, not the user!)<br />
* The 'nat' option makes the client able to detect whether it is behind a nat router or not. When the client is behind a nat router it should keep the "connection" alive with the PING command.<br />
{{eyecatch|Important|Make sure your client handles ALL possible AUTH return codes before giving out any versions!}}<br />
* When ''enc=x'' is defined the server will change the encoding used to x.<br />
**If the encoding is supported it will change right away (including the response) and be reset on logout/timeout.<br />
**If not supported then the argument will be silently ignored. Use ENCODING to test what works.<br />
**Supported encodings are [http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html these].<br />
* ''comp=1'' means that the client supports compression ([http://java.sun.com/j2se/1.5.0/docs/api/java/util/zip/Deflater.html DEFLATE]).<br />
**The server will compress (instead of truncating) the datagrams when needed if this option is enabled.<br />
**The first two bytes of compressed datagrams will always be set to zero. (So tags should never start with that.)<br />
* Default [[Wikipedia:MTU (networking)|''MTU'']] is 1400. Minimum allowed is 400, maximum 1400, due [[Wikipedia:Point-to-Point Protocol over Ethernet|PPPoE]].<br />
<br />
----<br />
<br />
=== LOGOUT: Logout ===<br />
'''Command String:'''<br />
* LOGOUT<br />
<br />
'''Possible Replies:'''<br />
* 203 LOGGED OUT<br />
* 403 NOT LOGGED IN<br />
<br />
'''Info:'''<br />
* This command only works if you are already logged in.<br />
* A logout should ALWAYS be issued if the client is currently logged in and is either exiting or not expecting to send/receive any AniDB API packets for the next >= 30 minutes.<br />
<br />
----<br />
=== ENCRYPT: Start Encrypted Session ===<br />
Will cause all future messages from the server, except the first (the reply to the ENCRYPT command itself), to be encrypted (128 bit [[Wikipedia:Advanced Encryption Standard|AES]]). The client will also have to encrypt all future requests sent to the server. All non-encrypted messages will be discarded by the server. The encryption key is the [[Wikipedia:MD5|MD5]] hash of a special ''UDP API Key'' (defined in the users profile) concatenated with the salt string as given in the reply to the ENCRYPT message. A normal AUTH message is still necessary to authenticate and should follow the ENCRYPT command once the API has acknowledged the encryption.<br />
<br />
'''Command String:'''<br />
* ENCRYPT user={str name}&type={int2 type}<br />
<br />
'''Possible Replies:'''<br />
* 209 {str salt} ENCRYPTION ENABLED<br />
* 309 API PASSWORD NOT DEFINED<br />
* 509 NO SUCH ENCRYPTION TYPE<br />
* 394 NO SUCH USER<br />
<br />
'''Info:'''<br />
* ''user'' is the user name.<br />
* ''type'' is the type of encryption; 1 => 128 bit AES (only one defined).<br />
* ''API Key'' is the one defined in the {{AniDBLink|profile|profile settings page}}.<br />
* It is not possible to disable the encryption once enabled while staying logged in.<br />
** A logout (the logout message needs to be correctly encrypted) or timeout will disable the encryption.<br />
* In order to minimize server load, encryption should be disabled by default and should have to be enabled manually by the user in the configuration options.<br />
* The encryption key is md5(api_key_of_user+''salt'').<br />
* Padding of the message needs to be done according to the PKCS5Padding scheme.<br />
<br />
== Notify Commands ==<br />
=== Introduction ===<br />
Broadly speaking, notifications provide an indication to the client that some event has occurred within the AniDB database.<br />
<br />
There are three types:<br />
* New file [[Notifications|notification]]. (Only anime type supported.)<br />
* New private message notification.<br />
* New buddy event notification.<br />
<br />
Note that, while a user can subscribe to multiple 'new file' events (see [[Notifications|notifications]]), at present, the UDP API only supports notifications of new files by anime. New files by group, or new files by producer, are NOT presently supported. Just the same, keeping in mind that the API is designed to potentially support such notifications in the future will help in understanding why some of the commands are structured the way they are.<br />
<br />
The word "notification" is also used a bit inconsistently in this document. An AniDB notification is originally a "new file [[Notifications|notification]]". It might be more correct to use the term "event" for the original "happening" and then "notification" as the means to notify the user (client). New-file, new-message, buddy-* and going-down are all events that results in notifications. Only the first two type of events are persistent, though, meaning they exist and remain in the same state until some user action affects them.<br />
<br />
=== Getting Notifications ===<br />
Clients that wish to receive notifications have two routes available to them. They are by no means mutually exclusive and selecting one does not imply a client is unable to use commands from another.<br />
<br />
'''Method One: Polling'''<br />
<br />
With this method, the client contacts the server at some interval (no more than once every 20 minutes) to see if there are new file notifications waiting. If there are, the client can the get further details of the files in question. This is analogous to checking an email server every half hour to see if new email has arrived.<br />
<br />
Its principal advantage is that it is easy to design and code. Blocking sockets are sufficient as the client can expect the reply received to correspond with the command sent.<br />
<br />
The disadvantage of this approach is that it introduces a delay and some uncertainty in receiving notifications. If, for example, the user clears the notification on the website before the client collects it, the client will not learn of the new file. Similarly, if the user does not dismiss notifications via the site, the client will have an increasing amount of stale data to work though. Finally, notifications cleared by the client also clears them from the website, so users will need to be made aware of what is going on.<br />
<br />
A polling HOWTO:<br />
<br />
* Use NOTIFY (no more than once every 20 minutes) to get the number of pending notifications<br />
* IF there are new notifications pending, use NOTIFYLIST to get a list of notification types and associated IDs.<br />
* Use NOTIFYGET to receive a notification, supplying the ID provided by NOTIFYLIST<br />
* Use NOTIFYACK to acknowledge a notification, supplying the ID provided by NOTIFYLIST (if desired)<br />
<br />
{{eyecatch|Note|The ID supplied by NOTIFYLIST will be the ID of the affected notification type. Since, at present, only the anime type is supported, this value is always an aid. In the future, it may represent a group or producer ID. In these cases, the str '''type''' value will indicate what entity the ID represents.}}<br />
<br />
'''Method Two: Server PUSH'''<br />
<br />
With this method, the server takes the active role in advising the client that a new file has arrived. The client must register with the server to receive further advice information, and will be responsible for keeping the login session from timing out, and any NAT router ports open. The UDP packet is sent to the ip and port from which the AUTH command was received.<br />
<br />
This method compensates for the disadvantages of the polling method, but is more difficult to code. Blocking sockets are no longer an option, nor can a client make any assumptions that an incoming packet will necessarily be a reply to the last command sent. The tag option may be helpful here.<br />
<br />
A PUSH HOWTO:<br />
<br />
* PUSH to register your client session.<br />
* Listen for 720-799 NOTIFICATIONs ('''not 290''').<br />
* Use PUSHACK to to acknowledge the notification using the nid supplied with NOTIFICATION<br />
* Use NOTIFYGET to receive a notification, suppling the relid provided by NOTIFICATION (NOT the packet ID)<br />
* Use NOTIFYACK to acknowledge a notification, suppling the relid provided by NOTIFICATION (if desired)<br />
* Use UPTIME (with an interval between 30 and 35 minutes) to keep login session valid<br />
<br />
It is probably a good idea to use tags to separate NOTIFICATIONs from the other communication. NOTIFICATIONs will '''never''' have tags.<br />
<br />
=== PUSH: UDP Notification Registration ===<br />
Register your client as an observer for AniDB notification events for the current user. If you are registered for one or more event types the AniDB server will send an UDP packet (format see below) on each change which affects the current user.<br />
<br />
'''Command String:'''<br />
* PUSH notify={boolean on_new_file}&msg={boolean on_new_private_message}[&buddy={boolean on_buddy_event}]<br />
<br />
'''Possible Replies:'''<br />
* 270 NOTIFICATION ENABLED<br />
OR (if both values are 0)<br />
* 370 NOTIFICATION DISABLED<br />
<br />
'''Info:'''<br />
* A client which has registered to receive UDP notification packets must:<br />
** Issue a PUSHACK command for each notification received with ''notify_packet_id'' provided in the notification packet.<br />
** Use PING to keep the connection alive (< 30 min).<br />
** Use UPTIME to ensure that the session is OK (>= 30 min).<br />
* Every notification generated is resent 3 times unless acknowledged. After that the client is logged out.<br />
<br />
=== NOTIFY: Notifications ===<br />
Get number of pending notifications (and number of online buddies).<br />
<br />
'''Command String:'''<br />
* NOTIFY [buddy=1]<br />
<br />
'''Possible Replies:'''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}<br />
when ''buddy=1''<br />
* 290 NOTIFICATION<br />
: {int4 pending_file_notifications}|{int4 number_of_unread_messages}|{int4 number_of_online_buddies}<br />
<br />
'''Info:'''<br />
* If the client did send a NOTIFY within the last 35 minutes and it was confirmed by AniDB then receiving a 501 LOGIN FIRST message for the next NOTIFY command shows that AniDB logged the client out because it did not respond to a PUSH Notification packet.<br />
* There is no command to retrieve missed PUSH Notifications.<br />
{{eyecatch|Note|This command MUST NOT be issued more than once every 20 minutes.}}<br />
<br />
----<br />
=== NOTIFYLIST: List Notification/Message IDs ===<br />
List id of all pending (not acknowledged) ''new private message'' and ''new file'' notifications. Buddy events cannot be acknowledged.<br />
<br />
'''Command String:'''<br />
* NOTIFYLIST<br />
<br />
'''Possible Replies:'''<br />
*291 NOTIFYLIST<br />
: {str type}|{int4 id}<br />
: {str type}|{int4 id}<br />
: ...<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as required by NOTIFYGET. For messages it is the actual message id, for notifications it is the id of the related type; anime, group or producer. Since only file notifications related to anime is implemented atm, it is the anime id (aid).<br />
* NOTIFYLIST returns one line per entry, if no entries are available only the first line of the reply is returned.<br />
{{eyecatch|Note|This command MUST NOT be issued regularly but should only be triggered by either a push message received by the client or a reply to a NOTIFY command which tells you that there are messages/notifications waiting.}}<br />
<br />
----<br />
=== NOTIFYGET: Get Notification/Message ===<br />
Receive private message or file notification.<br />
<br />
'''Command String:'''<br />
* NOTIFYGET type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 292 NOTIFYGET<br />
: {int4 id}|{int4 from_user_id}|{str from_user_name}|{int4 date}|{int4 type}|{str title}|{str body}<br />
* 392 NO SUCH ENTRY<br />
when type = N<br />
* 293 NOTIFYGET<br />
: {int4 relid}|{int4 type}|{int2 count}|{int4 date}|{str relidname}|{str fids}<br />
* 393 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
* id is the identifier for the notification/message as given by NOTIFYLIST (or ''relid'' from 271 NOTIFICATION and mid from 272 NOTIFICATION)<br />
* for message entries (M):<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: type is the type of the message (0=normal msg, 1=annonymous, 2=system msg, 3=mod msg)<br />
* for notification entries (N):<br />
: relid is the id of the related type (anime)<br />
: relname is the name of the related type (anime)<br />
: type is the notification type (0=all, 1=new, 2=group, 3=complete)<br />
: count is the number of events pending for this subscription<br />
: date is the time of the event (in seconds since 1.1.1970)<br />
: fids is a comma separated list with the affected file ids<br />
<br />
----<br />
=== NOTIFYACK: Acknowledge Notification/Message ===<br />
This command will mark a message read or clear a ''new file'' notification. Buddy events are not acknowledgeable.<br />
<br />
'''Command String:'''<br />
* NOTIFYACK type={str type}&id={int4 id}<br />
<br />
'''Possible Replies:'''<br><br />
when type = M<br />
* 281 NOTIFYACK SUCCESSFUL<br />
* 381 NO SUCH ENTRY<br />
when type = N<br />
* 282 NOTIFYACK SUCCESSFUL<br />
* 382 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* type is:<br />
: M for message entries<br />
: N for notification entries<br />
<br />
====Notification Packet Format====<br />
'''New File Notify:'''<br />
<br />
720 {int4 notify_packet_id} NOTIFICATION - NEW FILE<br />
{int4 fidlist}|{int2 reltype}|{int2 priority}<br />
<br />
* fidlist is a comma separated list of file ids<br />
* reltype is: 1 = anime, 2 = group, 3 = producer<br />
* priority is: 0 = low, 1 = medium, 2 = high<br />
* new file notifications are created as a batch, so it is not unusual to get several new files for a particular anime at once. It is in this case that a comma separated list of fids will be returned<br />
<br />
{{eyecatch|Note|Group (and producer) related file notifications are not implemented yet.}}<br />
<br />
<br />
'''New Private Message Notify:'''<br />
<br />
794 {int4 notify_packet_id} NOTIFICATION - NEW MESSAGE<br />
{int2 type}|{int4 date}|{int4 sent_by_uid}|{str sent_by_name}|{str subject}|{str body}|{int mid}<br />
<br />
* type is the type of the message (0=normal msg, 1=anonymous, 2=system msg, 3=mod msg)<br />
* date is the time the message was sent (in seconds since 1.1.1970)<br />
* sender uid/sender name are the user id and user name of the sender<br />
* subject is the message subject<br />
* body is message body (can be truncated)<br />
* mid is message id and can be used with NOTIFYACK<br />
<br />
'''Buddy Event Notify:'''<br />
753 {int4 notify_packet_id} NOTIFICATION - BUDDY<br />
{int4 buddy uid}|{int2 event type}<br />
* Possible event types:<br />
** 0 => LOGIN<br />
** 1 => LOGOUT<br />
** 2 => ACCEPTED<br />
** 3 => ADDED<br />
<br />
<br />
'''Going Down Event Notify:'''<br />
799 {int4 notify_packet_id} NOTIFICATION - SHUTTING DOWN<br />
{int4 time offline}|{int4 comment}<br />
<br />
* Clients with any notification on will receive the SHUTTING DOWN message before the API goes offline.<br />
* Time offline is the time in minutes the API will be down, 0 if indefinite (client can direct user to the AniDB site for status updates).<br />
* The comment is a short explanation for the downtime.<br />
* Only one datagram will be sent, and the server will not listen for replies.<br />
<br />
<br />
=== PUSHACK: UDP Notification Acknowledge ===<br />
Used to acknowledge notification packets (720-799). A client must be prepared to issue this command before using '''PUSH'''.<br />
<br />
'''Command String:'''<br />
* PUSHACK nid={int4 notify_packet_id}<br />
<br />
'''Possible Replies:'''<br />
* 701 PUSHACK CONFIRMED<br />
* 702 NO SUCH PACKET PENDING<br />
<br />
'''Info:'''<br />
* See: '''PUSH'''<br />
<br />
== Buddy Commands ==<br />
Group of commands used to administrate your buddylist.<br />
<br />
=== BUDDYADD: Add a user to Buddy List ===<br />
'''Command String:'''<br />
* BUDDYADD uid={int4 buddy uid}<br />
* BUDDYADD uname={int4 buddy name}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 255 BUDDY ADDED<br />
* 355 BUDDY ALREADY ADDED<br />
<br />
----<br />
=== BUDDYDEL: Remove a user from Buddy List ===<br />
'''Command String:'''<br />
* BUDDYDEL uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 256 BUDDY DELETED<br />
<br />
----<br />
=== BUDDYACCEPT: Accept user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYACCEPT uid={int4 user uid}<br />
'''Possible Replies:'''<br />
* 356 NO SUCH BUDDY<br />
* 257 BUDDY ACCEPTED<br />
* 357 BUDDY ALREADY ACCEPTED<br />
<br />
----<br />
=== BUDDYDENY: Deny user as Buddy ===<br />
'''Command String:'''<br />
* BUDDYDENY uid={int4 buddy uid}<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 258 BUDDY DENIED<br />
* 358 BUDDY ALREADY DENIED<br />
<br />
----<br />
=== BUDDYLIST: Retrieve Buddy List ===<br />
'''Command String:'''<br />
* BUDDYLIST startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 253 {int2 start} {int2 end} {int2 total} BUDDY LIST<br />
: {int4 uid}|{str username}|{int2 state}<br />
: ...<br />
'''Info:'''<br />
* state is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = this user is in your buddylist<br />
* bit 2 = this user has accepted you<br />
* bit 3 = this user is waiting for your approval<br />
<br />
----<br />
=== BUDDYSTATE: Retrieve Buddy States===<br />
'''Command String:'''<br />
* BUDDYSTATE startat={int2 start at #}<br />
'''Possible Replies:'''<br />
* 254 {int2 start} {int2 end} {int2 total} BUDDY STATE<br />
: {int4 uid}|{int2 onlinestate}<br />
: ...<br />
<br />
'''Info:'''<br />
* onlinestate is a 16bit bit field in integer notation (lowest bit first):<br />
* bit 1 = http online (user has issued a HTTP request within the last 10 minutes)<br />
* bit 2 = udp api online (user is currently connected to the udp api server)<br />
* example: 0=offline, 1=http online, 2=udp api online, 3=http&udp api online<br />
<br />
== Data Commands ==<br />
=== ANIME: Retrieve Anime Data ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIME aid={int4 id}[&amask={hexstr}]<br />
by name<br />
* ANIME aname={str anime name}[&amask={hexstr}]<br />
<br />
'''Possible Replies:'''<br />
<br />
If no ''amask'' is provided:<br />
* 230 ANIME<br />
: {int4 aid}|{int4 eps}|{int4 ep count}|{int4 special cnt}|{int4 rating}|{int4 votes}|{int4 tmprating}|{int4 tmpvotes}|{int4 review rating average}|{int4 reviews}|{str year}|{str type}|{str romaji}|{str kanji}|{str english}|{str other}|{str short names}|{str synonyms}|{str category list}<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* Fields are returned in the same order they appear in the ''amask'' field list: byte 1, bit 7 first<br />
* Synonyms and short names are separated with '<br />
* Category fields are separated with ',' and ordered by weight (desc).<br />
* By name: must be perfect match of romaji/kanji/english/other/synonym/short name.<br />
* 'Producer id list' and 'producer name list' match the data returned by the former producer bits (but using the revised creator ids)<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
* '''Note:''' The character id list is the first data to be truncated if needed. And then: category list, synonym list, short name list. This applies to the FILE command too.<br />
* Selecting an 'unused' or 'reserved' bit will return an "illegal input" (505) response.<br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="5" align="center"><b>amask</b></td></tr><br />
<tr><br />
<td align="center"><b>Byte 1</b></td><br />
<td align="center"><b>Byte 2</b></td><br />
<td align="center"><b>Byte 3</b></td><br />
<td align="center"><b>Byte 4</b></td><br />
<td align="center"><b>Byte 5</b></td><br />
<td align="center"><b>Byte 6</b></td><br />
<td align="center"><b>Byte 7</b></td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int aid</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int dateflags</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str category list</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str category weight list</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 special ep count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int air date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int end date</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str url</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str picname</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str category id list</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int vote count</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 temp rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int temp vote count</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 average review rating</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int review count</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str award list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>bool is 18+ restricted</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int anime planet id</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int ANN id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int allcinema id</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str AnimeNfo id</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int date record updated</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int character id list</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int creator id list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int main creator id list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str main creator name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td><b>Bit</b></td><br />
<td align="right"><b>Dec</b></td><br />
<td><b>Data Field</b></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 specials count</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 credits count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 other count</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 trailer count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 parody count</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<br />
'''Related aid type (Byte 1, Bit 2):'''<br />
<pre><br />
value meaning<br />
<br />
1 sequel<br />
2 prequel<br />
11 same setting<br />
21 alternative setting<br />
32 alternative version<br />
41 music video<br />
42 character<br />
51 side story<br />
52 parent story<br />
61 summary<br />
62 full story<br />
100 other<br />
</pre><br />
<br />
'''Examples:''' (note that the given amask gives the same result as the default request)<br />
> ANIME aid=1&amask=b2f0e0fc000000&s=xxxxx<br />
< 230 ANIME<br />
1|1999-1999|TV Series|Space,Future,Plot Continuity,SciFi,Space Travel,Shipboard,Other Planet,Novel,Genetic Modification,Action,Romance,Military,Large Breasts,Gunfights,Adventure,Human Enhancement,Nudity|Seikai no Monshou|星界の紋章|Crest of the Stars||13|13|3|853|3225|756|110|875|11<br />
<br />
<br />
----<br />
<br />
=== ANIMEDESC: Retrieve Anime Description ===<br />
'''Command String:'''<br><br />
by aid<br />
* ANIMEDESC aid={int4 id}&part={int4 partno}<br />
<br />
'''Possible Replies:'''<br />
* 233 ANIMEDESC<br />
: {int4 current part}|{int4 max parts}|{str description}<br />
* 330 NO SUCH ANIME<br />
* 333 NO SUCH DESCRIPTION<br />
<br />
'''Info:'''<br />
* The maximum length of the anime description is roughly 5000 characters, but the maximum length of a UDP packet is 1400 bytes<br />
* Multiple calls to ANIMEDESC may be necessary to retrieve the complete text, retrieving separate 1400 byte parts with each call<br />
* ''part'' is zero-based<br />
* '''Note:''' No support, at present, for retrieving descriptions by title. ''aid'' only<br />
<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> ANIMEDESC aid=3169&part=0&s=xxxxx<br />
< 233 ANIMEDESC<br />
0|1|As summer break arrives for the students, Jun Sakurada is busily studying on his own in the library, making up for time lost <cut><br />
<br />
----<br />
=== CALENDAR: Get Upcoming Titles ===<br />
Returns the anime ids of the 25 most recently aired / released anime, directly followed by the next 25 anime due to be aired / released, ordered by start date.<br />
<br />
'''Command String:'''<br />
* CALENDAR<br />
<br />
'''Possible Replies:'''<br />
* 297 CALENDAR<br />
{int aid}|{int startdate}|{int dateflags}/n<br />
<br />
..repeated n times<br />
<br />
* 397 CALENDAR EMPTY<br />
<br />
'''Info:'''<br />
* Takes no parameters (other than the session string)<br />
* Titles returned are filtered by the 'show adult' preference of the logged in user. That is, users who have elected to hide adult content will have it hidden here as well.<br />
* Do not depend on the command always returning exactly 50 titles; there may not always be 25 future titles pending, depending on the user's 'adult' preferences, and the date in relation to the relation to the current anime season.<br />
* Date flags are used to indicated an unknown value (unknown month, day, year)<br />
* ''dateflags'' values:<br />
** bit0 set == Startdate, Unknown Day<br />
** bit1 set == Startdate, Unknown Month, Day<br />
** bit2 set == Enddate, Unknown Day<br />
** bit3 set == Enddate, Unknown Month, Day<br />
** bit4 set == AirDate in the Past/Anime has ended<br />
** bit5 set == Startdate, Unknown Year<br />
** bit6 set == Enddate, Unknown Year<br />
<br />
=== CHARACTER: Get Character Information ===<br />
Returns character details associated with a given character ID, including associated anime ids, episode ids, and seiyuu.<br />
<br />
'''Command String:'''<br />
* CHARACTER charid={int characterid}<br />
<br />
'''Possible Replies:'''<br />
* 235 CHARACTER<br />
: {int charid}|{str character name kanji}|{str character name transcription}|{str pic}|{anime blocks}|{int episode list}|{int last update date}|{int2 type}|{str gender}<br />
<br />
: An 'anime block' is {int anime id},{int appearance},{int creatorid},{boolean is_main_seiyuu} repeated as many times as necessary, separated by a single quote ( ' ). <br />
<br />
* 335 NO SUCH CHARACTER<br />
<br />
'''Info:'''<br />
* If no seiyuu is associated with the character for a given aid, the 'creatorid' and 'is_main_seiyuu' fields will be empty, but the commas will remain.<br />
* An empty episode list is "undefined": no episode values have been added.<br />
* ''appearance'' values: 0='appears in', 1='cameo appearance in', 2='main character in', 3='secondary cast in'<br />
* ''type'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** 1 => 'Character'<br />
** 2 => 'Mecha'<br />
** 3 => 'Organisation'<br />
** 4 => 'Vessel' <br />
* ''gender'' can be one of: (Note: this is subject to changes so don't rely on this mapping)<br />
** "M" => 'Male'<br />
** "F" => 'Female'<br />
** "I" => 'Intersexual'<br />
** "D" => 'Dimorphic'<br />
** "-" => 'none/does not apply'<br />
** "?" => 'unknown'<br />
<br />
'''Example:'''<br />
<br />
CHARACTER charid=488&s=DChan<br />
235 CHARACTER<br />
488|ニコ・ロビン|Nico Robin|14789.jpg|4097,2,1900,1'69,2,1901,0'6199,0,1900,1'5691,0,1900,1'2644,0,,'4851,0,1900,1||1236938094<br />
<br />
=== CREATOR: Get Creator Information ===<br />
<br />
'''Command String:'''<br />
* CREATOR creatorid={int creatorid}<br />
<br />
'''Possible Replies:'''<br />
* 245 CREATOR<br />
: {int creatorid}|{str creator name kanji}|{str creator name transcription}|{int type}|{str pic_name}|{str url_english}|{str url_japanese}|{str wiki_url_english}|{str wiki_url_japanese}|{int last update date}<br />
<br />
* 345 NO SUCH CREATOR<br />
<br />
'''Info:'''<br />
* ANIME AMASK byte6, bit5<br />
* ''type'' values: 1='person', 2='company', 3='collaboration'<br />
<br />
Example:<br />
<br />
245 CREATOR<br />
718|GAINAX|Gainax|2|10092.png||http://www.gainax.co.jp/|Gainax|Gainax|1237048093<br />
<br />
=== EPISODE: Retrieve Episode Data ===<br />
'''Command String:'''<br><br />
by eid<br />
* EPISODE eid={int eid}<br />
by anime and episode number<br />
* EPISODE aname={str anime name}&epno={int4 episode number}<br />
* EPISODE aid={int anime id}&epno={int4 episode number}<br />
<br />
'''Possible Replies:'''<br />
* 240 EPISODE<br />
: {int eid}|{int aid}|{int4 length}|{int4 rating}|{int votes}|{str epno}|{str eng}|{str romaji}|{str kanji}|{int aired}<br />
* 340 NO SUCH EPISODE<br />
<br />
'''Info:'''<br />
* length is in minutes<br />
* Returned 'epno' includes special character (only if special) and padding (only if normal). Special characters are S(special), C(credits), T(trailer), P(parody), O(other).<br />
<br />
'''Examples:''' (html escaped code intended)<br />
> EPISODE eid=1&s=xxxxx<br />
< 240 EPISODE<br />
1|1|24|400|4|01|Invasion|shinryaku|??<br />
<br />
> EPISODE aname=Seikai no Monshou&epno=2&s=xxxxx<br />
< 240 EPISODE<br />
2|1|24|750|2|02|Kin of the Stars|Hoshi-tachi no Kenzoku|??????|1295059229<br />
<br />
----<br />
<br />
=== FILE: Retrieve File Data ===<br />
'''Command String:'''<br><br />
by fid:<br />
* FILE fid={int4 id}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by size+ed2k hash:<br />
* FILE size={int8 size}&ed2k={str ed2khash}&fmask={hexstr fmask}&amask={hexstr amask}<br />
by anime, group and epno<br />
* FILE aname={str anime name}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aname={str anime name}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gname={str group name}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
* FILE aid={int4 anime id}&gid={int4 group id}&epno={int4 episode number}&fmask={hexstr fmask}&amask={hexstr amask}<br />
<br />
'''Possible Replies:'''<br />
* 220 FILE<br />
: {int4 fid}|{int4 aid}|{int4 eid}|{int4 gid}|{int4 state}|{int8 size}|{str ed2k}|{str anidbfilename}<br />
* 220 FILE<br />
: {int4 fid}|...(data list)<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 0}|{int4 fid 1}|...|{int4 fid n}<br />
* 320 NO SUCH FILE<br />
<br />
'''Info:'''<br />
* fid, aid, eid, gid are the unique ids for the file, anime, ep, group entries at AniDB.<br />
: You can use those to create links to the corresponding pages at AniDB.<br />
* anidbfilename is the AniDB filename for the file.<br />
: However this name does not contain all the extra information of the filenames on AniDB and might be composed slightly different.<br />
* fmask and amask are hexidecimal strings where each bit corresponds to a data field related to the specified file (see below). The data list received is sorted and returned in the same order as the tables: top to bottom, left to right, with fmask preceding amask. There is '''no''' provision to retrieve all fields. Further, requesting a 'unusued' or 'reserved' bit will return an "illegal input" error.<br />
* fid is always returned as the first value, regardless of what masks are provided.<br />
* Only the first matching file is returned when aname, gname and epno is used.<br />
* "audio codec" and "audio bitrate" will return multiple values if there are multiple audio streams present in the file. Values will be separated by a single quote. <br />
* For byte 1, bit 2 (other episodes): episode IDs will be followed by an integer '''percentage''' that indicate the percentage of the related episode this file covers. Typically 100%, there are cases where it will be 50, 30, or other values. This value provides no indication where, within an episode, the file represents. That is, 50% could mean the file covers the first half of the episode, the second half, or some 50% range in between.<br />
'''State:'''<br />
<pre><br />
bit / int value meaning<br />
1 / 1 FILE_CRCOK: file matched official CRC (displayed with green background in AniDB)<br />
2 / 2 FILE_CRCERR: file DID NOT match official CRC (displayed with red background in AniDB)<br />
3 / 4 FILE_ISV2: file is version 2<br />
4 / 8 FILE_ISV3: file is version 3<br />
5 / 16 FILE_ISV4: file is version 4<br />
6 / 32 FILE_ISV5: file is version 5<br />
7 / 64 FILE_UNC: file is uncensored<br />
8 / 128 FILE_CEN: file is censored<br />
<br />
examples:<br />
state ==== 9 ==> FILE_CRCOK+FILE_ISV3 ==> file matched official CRC and is version 3<br />
state ==== 0 ==> - ==> file was not crc checked and is version 1<br />
state ==== 34 ==> FILE_CRCERR+FILE_ISV5 ==> file DID NOT match official CRC and is version 5<br />
state ==== 1 ==> FILE_CRCOK ==> file matched official CRC and is version 1<br />
state ==== 8 ==> FILE_ISV3 ==> file was not CRC checked and is version 3<br />
</pre><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''fmask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
<td align="center">'''Byte 5'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 aid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 eid</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 gid</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 mylist id</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>list other episodes</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>int2 IsDeprecated</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int2 state</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int8 size</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ed2k</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str md5</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str sha1</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str crc32</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>video colour depth</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str quality</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str audio codec list</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 audio bitrate list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str video codec</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 video bitrate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str video resolution</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str file type (extension)</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str dub language</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str sub language</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 length in seconds</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str description</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 aired date</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>str anidb file name</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 mylist state</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 mylist filestate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>int4 mylist viewed</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>int4 mylist viewdate</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str mylist storage</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str mylist source</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str mylist other</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
<table border="0" cellpadding="0" cellspacing="2"><br />
<tr><td colspan="4" align="center">'''amask:'''</td></tr><br />
<tr><br />
<td align="center">'''Byte 1'''</td><br />
<td align="center">'''Byte 2'''</td><br />
<td align="center">'''Byte 3'''</td><br />
<td align="center">'''Byte 4'''</td><br />
</tr><br />
<tr><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>int4 anime total episodes</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>int4 highest episode number</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str year</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str related aid list</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str related aid type</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>str category list</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>reserved</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str romaji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str kanji name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str english name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str other name</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>str short name list</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>str synonym list</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td><i>retired</i></td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td><i>retired</i></td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str epno</td><br />
</tr><br />
<tr><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str ep name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>str ep romaji name</td><br />
</tr><br />
<tr><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>str ep kanji name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>int4 episode rating</td><br />
</tr><br />
<tr><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>int4 episode vote count</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>unused</td><br />
</tr><br />
</table><br />
</td><br />
<td><br />
<table><br />
<tr><br />
<td>'''Bit'''</td><br />
<td align="right">'''Dec'''</td><br />
<td>'''Data Field'''</td><br />
</tr><br />
<tr><br />
<td>7</td><br />
<td align="right">128</td><br />
<td>str group name</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>6</td><br />
<td align="right">64</td><br />
<td>str group short name</td><br />
</tr><br />
<tr><br />
<td>5</td><br />
<td align="right">32</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>4</td><br />
<td align="right">16</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>3</td><br />
<td align="right">8</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>2</td><br />
<td align="right">4</td><br />
<td>unused</td><br />
</tr><br />
<tr><br />
<td>1</td><br />
<td align="right">2</td><br />
<td>unused</td><br />
</tr><br />
<tr bgcolor="#eeeeee"><br />
<td>0</td><br />
<td align="right">1</td><br />
<td>int4 date aid record updated</td><br />
</tr><br />
</table><br />
</td><br />
</tr><br />
</table><br />
<br />
'''Examples:''' (html escaped code intended)<br />
> FILE size=177747474&ed2k=70cd93fd3981cc80a8ea6a646ff805c9&fmask=7FF8FEF8&amask=C000F0C0&s=xxxxx<br />
< 220 FILE<br />
312498|4688|69260|4243|0||0|1|177747474|70cd93fd3981cc80a8ea6a646ff805c9|b2a7c7d591333e20495de3571b235c28|7af9b962c17ff729baeee67533e5219526cd5095|a200fe73|high|DTV|Vorbis (Ogg Vorbis)|104|H264/AVC|800|704x400|japanese|english'english'english|1560||1175472000|26|26|01|The Wings to the Sky|Sora he no Tsubasa|????|#nanoha-DamagedGoodz|Nanoha-DGz<br />
<br />
----<br />
<br />
=== GROUP: Retrieve Group Data ===<br />
'''Command String:'''<br><br />
by gid<br />
* GROUP gid={int gid}<br />
by name/shortname<br />
* GROUP gname={str group name}<br />
<br />
'''Possible Replies:'''<br />
* 250 GROUP<br />
: {int gid}|{int4 rating}|{int votes}|{int4 acount}|{int fcount}|{str name}|{str short}|{str irc channel}|{str irc server}|{str url}|{str picname}|{int4 foundeddate}|{int4 disbandeddate}|{int2 dateflags}|{int4 lastreleasedate}|{int4 lastactivitydate}|{list grouprelations}<br />
* 350 NO SUCH GROUP<br />
<br />
'''Info:'''<br />
* Requires login<br />
* ''gname'' is an exact match of either a group name or short name<br />
* As either name and short names are unique if there is a result from GROUP request by name that will be the only match<br />
* ''dateflags'' values:<br />
** bit0 set == Foundeddate, Unknown Day<br />
** bit1 set == Foundeddate, Unknown Month, Day<br />
** bit2 set == Disbandeddate, Unknown Day<br />
** bit3 set == Disbandeddate, Unknown Month, Day<br />
** bit5 set == Foundeddate, Unknown Year<br />
** bit6 set == Disbandeddate, Unknown Year<br />
* ''releasedate'' and ''activitydate'' are distinct. ''releasedate'' is the date a file was actually released by the group, where ''activitydate'' is the date of a file being added to AniDB. As such, lastrelease may very well be much older than lastactivity.<br />
* ''groupreleations'' is a list of apostrophe-separated pairs, where each pair consists of {int4 othergroupid},{int2 relationtype}<br />
** relationtype:<br />
*** 1 => "Participant in"<br />
*** 2 => "Parent of"<br />
*** 4 => "Merged from"<br />
*** 5 => "Now known as"<br />
*** 6 => "Other"<br />
<br />
'''Example:'''<br />
> GROUP gid=7091&s=bunny<br />
< 250 GROUP<br />
7091|832|1445|43|566|Frostii|Frostii|#frostii|irc.rizon.net|http://frostii.com|15844.jpg|1228089600|0|1|1301875200|1304222640|7255,1'3097,4'748,4'8106,1'8159,2'8402,1'8696,1'9022,1<br />
<br />
----<br />
<br />
=== GROUPSTATUS: Get Completed Episode ===<br />
Returns a list of group names and ranges of episodes released by the group for a given anime.<br />
<br />
'''Command String:'''<br />
* GROUPSTATUS aid={int animeid}[&state={int completion_state}]<br />
<br />
'''Possible Replies:'''<br />
* 225 GROUPSTATUS<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: {int group id}|{str group name}|{int completion state}|{int last episode number}|{int rating}|{int votes}|{str episode range}\n<br />
: ... (repeated)<br />
<br />
* 325 NO GROUPS FOUND<br />
* 330 NO SUCH ANIME<br />
<br />
'''Info:'''<br />
* The seven fields will be repeated as necessary, one for each group, separated by a new line character<br />
* Groups will be filtered by the languages selected in the user's profile<br />
* If ''state'' is not supplied, groups with a completion state of <i>'ongoing'</i>, <i>'finished'</i>, or <i>'complete'</i> are returned<br />
* Groups are returned in order of descending episode count<br />
* If there are more groups to return than can be stored in a UDP packet, additional groups will be silently discarded<br />
* ''state'' values: <br />
#ongoing<br />
#stalled<br />
#complete<br />
#dropped<br />
#finished<br />
#specials only<br />
<br />
== MyList Commands ==<br />
=== MYLIST: Retrieve MyList Data ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLIST lid={int4 lid}<br />
by fid:<br />
* MYLIST fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLIST size={int4 size}&ed2k={str ed2khash}<br />
by anime + group + epno<br />
* MYLIST aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLIST aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 221 MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 312 MULTIPLE MYLIST ENTRIES<br />
: {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}<br />
* 321 NO SUCH ENTRY<br />
<br />
'''Info:'''<br />
* The state field provides information about the location and sharing state of a file in MyList.<br />
* 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).<br />
* eps is a list of episodes, e.g. "1-12,14-16,T1"<br />
<br />
'''States:'''<br />
0 - unknown - state is unknown or the user doesn't want to provide this information<br />
1 - on hdd - the file is stored on hdd (but is not shared)<br />
2 - on cd - the file is stored on cd<br />
3 - deleted - the file has been deleted or is not available for other reasons (i.e. reencoded)<br />
<br />
'''Filestates:''' (for normal files, i.e. not generic)<br />
0 => normal/original<br />
1 => corrupted version/invalid crc<br />
2 => self edited<br />
10 => self ripped<br />
11 => on dvd<br />
12 => on vhs<br />
13 => on tv<br />
14 => in theaters<br />
15 => streamed<br />
100 => other<br />
<br />
'''Example:'''<br />
> MYLIST aname=gits sac&s=xxxxx<br />
< 322 MULTIPLE FILES FOUND<br />
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<br />
<br />
----<br />
=== MYLISTADD: Add file to MyList ===<br />
The command string for MYLISTADD is made of up two blocks: a 'fileinfo' block, which limits the command to a specific file, or an 'animeinfo'/'groupinfo'/'episodeinfo' block, which can be used to specify a range of files, including generics. Additionally, a number of optional parameters can be included with either set.<br />
<br />
'''Adding a single file to the MyList with the 'fileinfo' block'''<br />
<br />
* MYLISTADD fid={int4 fid}<br />
'''or'''<br />
* MYLISTADD size={int4 size}&ed2k={str ed2khash}<br />
'''or'''<br />
* MYLISTADD lid={int4 lid}&edit=1 (valid for edit only)<br />
<br />
'''Adding one or more files to the MyList with the 'animeinfo'/'groupinfo'/'episodeinfo' block'''<br />
<br />
Here, you have a number of options, depending on what data you have available. In brief, 'animeinfo' represents a choice between anime id and anime name. 'groupinfo' represents a choice between group id, group name, and generic=1. 'episodeinfo' represents a range of one or more episodes.<br />
<br />
* MYLISTADD aid={int4 aid}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aid={int4 aid}&generic=1&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gid={int gid}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&gname={str group_name}&epno={int4 episode number}<br />
'''or'''<br />
* MYLISTADD aname={str anime_name}&generic=1&epno={int4 episode number}<br />
<br />
Each command listed can have, in addition, a number of optional components to provide further MyList details. Append these as desired.<br />
<br />
* &state={int2 state}<br />
* &viewed={boolean viewed}<br />
* &viewdate={int4 viewdate}<br />
* &source={str source}<br />
* &storage={str storage}<br />
* &other={str other}<br />
<br />
Finally, edit=1 can be included to edit a MyList entry instead of creating a new one. When editing, optional values that are not supplied retain their original value. That is, they are ''not'' replaced with default or empty values. Only values supplied are updated.<br />
<br />
'''Possible Replies:'''<br />
* 320 NO SUCH FILE<br />
* 330 NO SUCH ANIME<br />
* 350 NO SUCH GROUP<br />
when edit=0 and adding by fid, size/ed2k<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 mylist id of new entry}<br />
when edit=0 and adding by aname, aid<br />
* 210 MYLIST ENTRY ADDED<br />
: {int4 number of entries added}<br />
* 310 FILE ALREADY IN MYLIST<br />
: {int4 lid}|{int4 fid}|{int4 eid}|{int4 aid}|{int4 gid}|{int4 date}|{int2 state}|{int4 viewdate}|{str storage}|{str source}|{str other}|{int2 filestate}<br />
* 322 MULTIPLE FILES FOUND<br />
: {int4 fid 1}|{int4 fid 2}|...|{int4 fid n}<br />
when edit=1<br />
* 311 MYLIST ENTRY EDITED<br />
* 311 MYLIST ENTRY EDITED<br />
: {int4 number of entries edited}<br />
* 411 NO SUCH MYLIST ENTRY<br />
<br />
'''Info:'''<br />
* All data except lid/fid/size+hash/generic is optional.<br />
* Viewed should be 0 for unwatched files and 1 for watched files.<br />
* If viewdate is not specified, the current time will be used. The field will be disregarded if viewed=0.<br />
* Other is the only field which may contain newlines, but they have to be stored as &lt;br /&gt;<br />
* For state values refer to: '''MYLIST'''<br />
* If you want to change an existing entry and already know its MyList id (lid) please use the lid-version of this command. It put less load on the server.<br />
* epno=0 means all eps (default), negative numbers means upto. (-12 -> upto 12)<br />
* group is optional only when edit=1, meaning you can't add every file for an anime<br />
* If the file already exists (response code 310), the ''current'' record will be returned, in the same format as the MYLIST response.<br />
----<br />
<br />
=== MYLISTDEL: Remove file from MyList ===<br />
'''Command String:'''<br><br />
by lid: (mylist id)<br />
* MYLISTDEL lid={int4 lid}<br />
by fid:<br />
* MYLISTDEL fid={int4 fid}<br />
by size+ed2k hash:<br />
* MYLISTDEL size={int4 size}&ed2k={str ed2k hash}<br />
by anime + group + epno<br />
* MYLISTDEL aname={str anime name}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aname={str anime name}[&gid={int4 group id}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gname={str group name}&epno={int4 episode number}]<br />
* MYLISTDEL aid={int4 anime id}[&gid={int4 group id}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 211 MYLIST ENTRY DELETED<br />
: {int4 number of entries}<br />
* 411 NO SUCH MYLIST ENTRY<br />
'''Info:'''<br />
* group is optional<br />
* command will delete all enties found<br />
<br />
----<br />
=== MYLISTSTATS : Retrieve MyList stats ===<br />
'''Command String:'''<br />
* MYLISTSTATS<br />
'''Possible Replies:'''<br />
* 222 MYLIST STATS<br />
{animes}|{eps}|{files}|{size of files}|{added animes}|{added eps}|{added files}|{added groups}|{leech %}|{glory %}|{viewed % of db}|{mylist % of db}|{viewed % of mylist}|{number of viewed eps}|{votes}|{reviews}|{viewed length in minutes}<br />
<br />
'''Info:'''<br />
* All fields are int<br />
<br />
----<br />
<br />
=== VOTE: Vote for specified anime/episode/group ===<br />
'''Command String:'''<br><br />
by id<br />
* VOTE type={int2 type}&id={int4 id}[&value={int4 vote value}&epno={int4 episode number}]<br />
by name<br />
* VOTE type={int2 type}&name={string name}[&value={int4 vote value}&epno={int4 episode number}]<br />
<br />
'''Possible Replies:'''<br />
* 260 VOTED<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 261 VOTE FOUND<br />
: {str entity name}|{vote value}|{vote type}|{entity id}<br />
* 262 VOTE UPDATED<br />
: {str entity name}|{old vote value}|{vote type}|{entity id}<br />
* 263 VOTE REVOKED<br />
: {str entity name}|{revoked vote value}|{vote type}|{entity id}<br />
* 360 NO SUCH VOTE<br />
: {str entity name}|0|{vote type}|{entity id}<br />
* 361 INVALID VOTE TYPE<br />
* 362 INVALID VOTE VALUE<br />
* 363 PERMVOTE NOT ALLOWED<br />
: {str aname}|{vote value}|{type}|{entity id}<br />
* 364 ALREADY PERMVOTED<br />
: {str entity name}|{existing vote value}|{vote type}|{entity id}<br />
<br />
'''Info:'''<br />
* type: 1=anime, 2=anime tmpvote, 3=group<br />
* entity: anime, episode, or group<br />
* for episode voting add epno on type=1<br />
* value: negative number means revoke, 0 means retrieve (default), 100-1000 are valid vote values, rest is illegal<br />
* votes will be updated automatically (no questions asked)<br />
* tmpvoting when there exist a perm vote is not possible<br />
<br />
----<br />
<br />
=== RANDOM: Get a random anime ===<br />
'''Command String:'''<br />
* RANDOMANIME type={int4 type}<br />
<br />
'''Possible Replies:'''<br />
* 230 ANIME ... (see ANIME)<br />
<br />
'''Info:'''<br />
* type: 0=from db, 1=watched, 2=unwatched, 3=all mylist<br />
<br />
== Misc Commands ==<br />
=== MYLISTEXPORT: Schedule a MyList Export ===<br />
Queues a {{AniDBLink|export|MyList Export}} by the AniDB Servers. As with a manual export request, exports are only done during periods when server load is low. As a result, exports may take up to 24 hours. The client submitting the request will receive an AniDB message when the export is ready to be collected.<br />
<br />
Only one export can be in the queue at a time.<br />
<br />
'''Command String:'''<br />
* MYLISTEXPORT [template={str template_name}|cancel=1]<br />
<br />
'''Possible Replies:'''<br />
* 217 Export Queued<br />
* 218 Export Cancelled<br />
* 317 No Such Template<br />
* 318 Export Already In Queue<br />
* 319 No Export In Queue or Export In Progress<br />
<br />
'''Info:'''<br />
* ''template_name'' must match an available export template on the {{AniDBLink|export|MyList Export}} page.<br />
* ''cancel'' will cancel any pending export request, queued either through UDP or the web server.<br />
* Clients can subscribe the message notifications if they wish to be notified when an export is complete.<br />
<br />
----<br />
<br />
=== PING: Ping Command ===<br />
'''Command String:'''<br />
* PING [nat=1]<br />
<br />
'''Possible Replies:'''<br />
* 300 PONG<br />
: {int4 port} ''(when nat=1)''<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* May be used by a frontend to determine if the API is still available.<br />
* May be executed even if not yet logged in.<br />
* The option <tt>nat=1</tt> provides an easy way to determine if the router has changed the outgoing port. ({{t|587}})<br />
<br />
----<br />
<br />
=== VERSION: Retrieve Server Version ===<br />
'''Command String:'''<br />
* VERSION<br />
<br />
'''Possible Replies:'''<br />
* 998 VERSION<br />
: {str server version}<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
<br />
----<br />
=== UPTIME: Retrieve Server Uptime ===<br />
'''Command String:'''<br />
* UPTIME<br />
<br />
'''Possible Replies:'''<br />
* 208 UPTIME<br />
: {int4 udpserver uptime in milliseconds}<br />
<br />
'''Info:'''<br />
* This command is the preferred way to check that the session is OK.<br />
<br />
----<br />
=== ENCODING: Change Encoding for Session ===<br />
Sets preferred [[Wikipedia:Character encoding|encoding]] per session. The preferred way to do this is to use the '''enc''' argument for AUTH. This command is mostly for testing.<br />
<br />
'''Command String:'''<br />
* ENCODING name={str encoding name}<br />
<br />
'''Possible Replies:'''<br />
* 219 ENCODING CHANGED<br />
* 519 ENCODING NOT SUPPORTED<br />
<br />
'''Info:'''<br />
* This command does not require a session.<br />
* Supported encodings: http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html<br />
* Default: ASCII.<br />
* Resets to default on logout.<br />
<br />
----<br />
<br />
=== SENDMSG: Send Message ===<br />
'''Command String:'''<br />
* SENDMSG to={str username}&title={str title}&body={str body}<br />
<br />
'''Possible Replies:'''<br />
* 294 SENDMSG SUCCESSFUL<br />
* 394 NO SUCH USER<br />
* 501 LOGIN FIRST<br />
<br />
'''Note:'''<br />
* This command allows you to send an AniDB message.<br />
{{eyecatch|Important|<br />
title must not be longer than 50 chars.<br><br />
body must not be longer than 900 chars.<br />
}}<br />
<br />
----<br />
=== USER: Retrieve User UID ===<br />
'''Command String:'''<br />
* USER [user={str user name}|uid={int user id}]<br />
<br />
'''Possible Replies:'''<br />
* 394 NO SUCH USER<br />
* 295 USER<br />
: {int4 uid}|{str username}<br />
<br />
----<br />
<br />
=== STATS [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* STATS<br />
<br />
'''Possible Replies:'''<br />
* 206 STATS<br />
: {int4 animes)|{int4 eps}|{int4 files}|{int4 groups}|{int4 users}|{int8 total file size in bytes}|{int4 open [[creq|creqs]]}<br />
<br />
----<br />
=== TOP [{{colour|red|disabled}}] ===<br />
'''Command String:'''<br />
* TOP<br />
<br />
'''Possible Replies:'''<br />
* 207 TOP<br />
: {str longest mylist}|{int count}<br />
: {str largest mylist}|{int count}<br />
: {str most lame files}|{int count}<br />
: {str most indep. user}|{int count}<br />
: {str biggest leecher}|{int count}<br />
: {str most anime added}|{int count}<br />
: {str most eps added}|{int count}<br />
: {str most files added}|{int count}<br />
: {str most groups added}|{int count}<br />
: {str most votes}|{int count}<br />
: {str most reviews}|{int count}<br />
<br />
'''Info:'''<br />
* All strings are user names.<br />
* 'Hide myself in IRC stats' applies for this too.<br />
<br />
== Fatal Errors ==<br />
At anypoint int the retrieval process you have to expect the following output:<br />
* 6xx INTERNAL SERVER ERROR<br />
: ERROR: {str errormessage}<br />
OR<br />
*6xx INTERNAL SERVER ERROR - {str errormessage}<br />
<br />
Such errors should be reported back to [[User:Ommina|Ommina]].<br />
(xx is a number between 00 and 99)<br />
<br />
If you supply an unknown or unimplemented command you will get an error:<br />
* 598 UNKNOWN COMMAND<br />
<br />
== Return Codes ==<br />
{{eyecatch|Note|While the names below '''are''' the actual code strings returned by the server, clients are nonetheless encouraged to work with the numeric codes instead. }}<br />
<pre><br />
LOGIN_ACCEPTED = 200<br />
LOGIN_ACCEPTED_NEW_VERSION = 201<br />
LOGGED_OUT = 203<br />
RESOURCE = 205<br />
STATS = 206<br />
TOP = 207<br />
UPTIME = 208<br />
ENCRYPTION_ENABLED = 209<br />
MYLIST_ENTRY_ADDED = 210<br />
MYLIST_ENTRY_DELETED = 211<br />
ADDED_FILE = 214<br />
ADDED_STREAM = 215<br />
EXPORT_QUEUED = 217<br />
EXPORT_CANCELLED = 218<br />
ENCODING_CHANGED = 219<br />
FILE = 220<br />
MYLIST = 221<br />
MYLIST_STATS = 222<br />
WISHLIST = 223<br />
NOTIFICATION = 224<br />
GROUP_STATUS = 225<br />
WISHLIST_ENTRY_ADDED = 226<br />
WISHLIST_ENTRY_DELETED = 227<br />
WISHLIST_ENTRY_UPDATED = 228<br />
MULTIPLE_WISHLIST = 229<br />
ANIME = 230<br />
ANIME_BEST_MATCH = 231<br />
RANDOM_ANIME = 232<br />
ANIME_DESCRIPTION = 233<br />
REVIEW = 234<br />
CHARACTER = 235<br />
SONG = 236<br />
ANIMETAG = 237<br />
CHARACTERTAG = 238<br />
EPISODE = 240<br />
UPDATED = 243<br />
TITLE = 244<br />
CREATOR = 245<br />
NOTIFICATION_ENTRY_ADDED = 246<br />
NOTIFICATION_ENTRY_DELETED = 247<br />
NOTIFICATION_ENTRY_UPDATE = 248<br />
MULTIPLE_NOTIFICATION = 249<br />
GROUP = 250<br />
CATEGORY = 251<br />
BUDDY_LIST = 253<br />
BUDDY_STATE = 254<br />
BUDDY_ADDED = 255<br />
BUDDY_DELETED = 256<br />
BUDDY_ACCEPTED = 257<br />
BUDDY_DENIED = 258<br />
VOTED = 260<br />
VOTE_FOUND = 261<br />
VOTE_UPDATED = 262<br />
VOTE_REVOKED = 263<br />
HOT_ANIME = 265<br />
RANDOM_RECOMMENDATION = 266<br />
RANDOM_SIMILAR = 267<br />
NOTIFICATION_ENABLED = 270<br />
NOTIFYACK_SUCCESSFUL_MESSAGE = 281<br />
NOTIFYACK_SUCCESSFUL_NOTIFIATION = 282<br />
NOTIFICATION_STATE = 290<br />
NOTIFYLIST = 291<br />
NOTIFYGET_MESSAGE = 292<br />
NOTIFYGET_NOTIFY = 293<br />
SENDMESSAGE_SUCCESSFUL = 294<br />
USER_ID = 295<br />
CALENDAR = 297<br />
<br />
PONG = 300<br />
AUTHPONG = 301<br />
NO_SUCH_RESOURCE = 305<br />
API_PASSWORD_NOT_DEFINED = 309<br />
FILE_ALREADY_IN_MYLIST = 310<br />
MYLIST_ENTRY_EDITED = 311<br />
MULTIPLE_MYLIST_ENTRIES = 312<br />
WATCHED = 313<br />
SIZE_HASH_EXISTS = 314<br />
INVALID_DATA = 315<br />
STREAMNOID_USED = 316<br />
EXPORT_NO_SUCH_TEMPLATE = 317<br />
EXPORT_ALREADY_IN_QUEUE = 318<br />
EXPORT_NO_EXPORT_QUEUED_OR_IS_PROCESSING = 319<br />
NO_SUCH_FILE = 320<br />
NO_SUCH_ENTRY = 321<br />
MULTIPLE_FILES_FOUND = 322<br />
NO_SUCH_WISHLIST = 323<br />
NO_SUCH_NOTIFICATION = 324<br />
NO_GROUPS_FOUND = 325<br />
NO_SUCH_ANIME = 330<br />
NO_SUCH_DESCRIPTION = 333<br />
NO_SUCH_REVIEW = 334<br />
NO_SUCH_CHARACTER = 335<br />
NO_SUCH_SONG = 336<br />
NO_SUCH_ANIMETAG = 337<br />
NO_SUCH_CHARACTERTAG = 338<br />
NO_SUCH_EPISODE = 340<br />
NO_SUCH_UPDATES = 343<br />
NO_SUCH_TITLES = 344<br />
NO_SUCH_CREATOR = 345<br />
NO_SUCH_GROUP = 350<br />
NO_SUCH_CATEGORY = 351<br />
BUDDY_ALREADY_ADDED = 355<br />
NO_SUCH_BUDDY = 356<br />
BUDDY_ALREADY_ACCEPTED = 357<br />
BUDDY_ALREADY_DENIED = 358<br />
NO_SUCH_VOTE = 360<br />
INVALID_VOTE_TYPE = 361<br />
INVALID_VOTE_VALUE = 362<br />
PERMVOTE_NOT_ALLOWED = 363<br />
ALREADY_PERMVOTED = 364<br />
HOT_ANIME_EMPTY = 365<br />
RANDOM_RECOMMENDATION_EMPTY = 366<br />
RANDOM_SIMILAR_EMPTY = 367<br />
NOTIFICATION_DISABLED = 370<br />
NO_SUCH_ENTRY_MESSAGE = 381<br />
NO_SUCH_ENTRY_NOTIFICATION = 382<br />
NO_SUCH_MESSAGE = 392<br />
NO_SUCH_NOTIFY = 393<br />
NO_SUCH_USER = 394<br />
CALENDAR_EMPTY = 397<br />
NO_CHANGES = 399<br />
<br />
NOT_LOGGED_IN = 403<br />
NO_SUCH_MYLIST_FILE = 410<br />
NO_SUCH_MYLIST_ENTRY = 411<br />
MYLIST_UNAVAILABLE = 412<br />
<br />
LOGIN_FAILED = 500<br />
LOGIN_FIRST = 501<br />
ACCESS_DENIED = 502<br />
CLIENT_VERSION_OUTDATED = 503<br />
CLIENT_BANNED = 504<br />
ILLEGAL_INPUT_OR_ACCESS_DENIED = 505<br />
INVALID_SESSION = 506<br />
NO_SUCH_ENCRYPTION_TYPE = 509<br />
ENCODING_NOT_SUPPORTED = 519<br />
BANNED = 555<br />
UNKNOWN_COMMAND = 598<br />
<br />
INTERNAL_SERVER_ERROR = 600<br />
ANIDB_OUT_OF_SERVICE = 601<br />
SERVER_BUSY = 602<br />
NO_DATA = 603<br />
TIMEOUT - DELAY AND RESUBMIT = 604<br />
API_VIOLATION = 666<br />
<br />
PUSHACK_CONFIRMED = 701<br />
NO_SUCH_PACKET_PENDING = 702</pre><br />
<br />
[[Category:Development]]<br />
[[Category:UDP]]<br />
[[Category:API]]</div>Ommina