jobermark Posted August 1, 2011 Report Share Posted August 1, 2011 I just started using this interface. My husband tends to start downloads of large multi-file torrents of video clips and then pick out files as the complete. I was automating this, and used getfiles with multiple hash keys (the keys for all of these half-completed leviathan torrents).It is cool that you accept multiple values of the hash function, for folks that want all of that info, but don't want to spend the time on round trips.But many json parsing tools misinterpret the result, because there are multiple copies of the same key in the dictionary. Obviously, for my little experiment, I can write crap code. What is there is easy to fix, I just find the key "files": in the string before parsing, and wedge in just enough packing to make the result legal.But on general principals, if you claim to return JSON, the result should be valid, and a straight eval in JavaScript or Python should net the intended result. So, on whatever wish list you keep, can we have a copy that is a list, instead of a dictionary with multiple copies of the same key? Maybe only populated when there are multiple hash values?This seems like the kind of thing that is there almost by accident, and that may not warrant full support. But then other folks should note the bug before they get confused by it. Link to comment Share on other sites More sharing options...
jknoll Posted August 2, 2011 Report Share Posted August 2, 2011 Thanks for the report/request. You're correct, the current behavior is a bit crazy. It would make more sense to return a JSON response containing dict of infohash => [dict of file metadata] keys, with the number of entries corresponding to the number of passed-in infohashes. That's a consistent response format no matter how many infohashes are supplied, and it solves the keys-overwriting-each-other issue.We have a long list of improvements we'd like to make to the WebAPI, and are working on making improvements and releasing them back to the community without breaking compatibility. Link to comment Share on other sites More sharing options...
Firon Posted August 2, 2011 Report Share Posted August 2, 2011 Honestly? The API sucks enough that breaking compatibility would be a huge improvement for everyone. Link to comment Share on other sites More sharing options...
AdamK Posted August 2, 2011 Report Share Posted August 2, 2011 +1 Let's just break with the old, broken stuff. I'm sure Ultima agrees. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.