WhatCD / Gazelle

http://whatcd.github.io/Gazelle/
1.84k stars 363 forks source link

Adding action=user_torrents #99

Open kbuffington opened 8 years ago

kbuffington commented 8 years ago

Adding new AJAX end point: user_torrents. This allows the retrieval of the torrents and primary artists for the torrents a user is seeding from one of the four types: seeding, leeching, uploaded, snatched. Results are ordered starting with most-recent first. This replicates the data available from torrents.php with a type and userid specified.

The end point properly handles paranoia settings for non-logged in users.

Required variables: userid: the user to retrieve torrent information for type: seeding, leeching, uploaded, snatched

Optional limit, offset

An example request and response:

// https://what.cd/ajax.php?action=user_torrents&userid=2&type=seeding&limit=3&offset=1

{
  "status": "success",
  "response": {
    "seeding": [
      {
        "groupId": "4",
        "name": "If You Have Ghost",
        "torrentId": "4",
        "artistName": "Ghost B.C.",
        "artistId": "4"
      },
      {
        "groupId": "3",
        "name": "Absolute Dissent",
        "torrentId": "3",
        "artistName": "Killing Joke",
        "artistId": "3"
      }
    ]
  }
}