WhatCD/Gazelle

Documentation of `Requests Search` from JSON API Documentation is broken

popham opened this issue · 1 comments

The current JSON API Documentation (a wiki page on GitHub) claims that filter_cat[], releases[], bitrates[], formats[], and media[] usage follows from that on requests.php.

Monkeying with queries on requests.php, I see that filter_cat specs a bitmask as an array of 0's and 1's, where any trailing zeros may be ignored. The others (releases, bitrates, formats, and media), however, spec bitmasks by indices to the 1's. The results page from a requests.php query aligns with the documented JSON API equivalent:

request = {
  'action': 'requests',
  'search': '2015',
  'page': 1,
  'sort': 'desc', # This is not documented, but works (extrapolated from `requests.php`)
  'order': 'votes', # This is not documented, but works (extrapolated from `requests.php`)
  'filter_cat': [0,1],
  'releases': [1,5,6,9],
  'formats': [0,1],
  'bitrates': [2,6,7,8,9],
  'media': [0,2,7]
}

Parametrizing a JSON query with the above does not yield the same results as the HTTP request. If I map releases, bitrates, formats, and media to filter_cat-analogous bitmaps, then I get results that parallel the HTTP request (I only verified the first three entries):

request = {
  'action': 'requests',
  'search': '2015',
  'page': 1,
  'sort': 'desc',
  'order': 'votes',
  'filter_cat': [0,1,0,0,0,0,0],
  'releases': [1,0,0,0,0,1,1,0,0,1],
  'formats': [1,1],
  'bitrates': [0,0,1,0,0,0,1,1,1,1],
  'media': [1,0,1,0,0,0,0,1]
}

This was me screwing up my HTTP library.