rdnetto Posted July 24, 2008 Report Share Posted July 24, 2008 Hi,I've been writing a program designed to interface with uTorrent via its WebUI interface, and I have a found that several values returned by "?action=getsettings" do not have the correct type. webui.username, webui.password, webui.guest, & webui.cookie are all marked as type 0, which is supposed to mean integer, according to http://forum.utorrent.com/viewtopic.php?id=25661#p258859. However, these values are strings (corresponding typecode is 2). This problem occurs on uTorrent 1.7.7 build 8179.Also, I have found that several settings which are marked as integers return an empty set of quotes ("") - does this imply a value of 0? (This includes all the fields which are supposed to return the build number).I would appreciate it if the program (or the WebUI API Reference at the previous link) could be updated to reflect this. Link to comment Share on other sites More sharing options...
Ryan Norton Posted July 24, 2008 Report Share Posted July 24, 2008 These should be fixed in the 1.8 RCs, please check Link to comment Share on other sites More sharing options...
Ultima Posted July 24, 2008 Report Share Posted July 24, 2008 Frankly, the type/value elements of the array aren't really necessary. If a value is supposed to be an integer, µTorrent should actually be returning an actual integer, not a stringified integer. If it's supposed to be a boolean, just send a boolean. This is among the various suggestions that Directrix and I have made regarding µTorrent's JSON output, but it'll probably come another time. Link to comment Share on other sites More sharing options...
rdnetto Posted July 25, 2008 Author Report Share Posted July 25, 2008 Sorry, it is fixed in the 1.8 RC. However, field reserved for the build number is still blank ({"" : "");And Ultima, I believe that the type element is relevant if there is no reference for the settings. Also, if you use a strongly typed language to interface with uTorrent, you'll end up writing some sort of script to generate the type definition for settings, etc. which will rely on the type elements. Becase there are aprox 170 different settings, entering the types manually would be unreasonable - if you're going to remove the type element, make sure that you setup a reference for the settings somewhere.EDIT:The build field isn't blank in the RC - I guess I must have been using a different build or something. Link to comment Share on other sites More sharing options...
Ultima Posted July 26, 2008 Report Share Posted July 26, 2008 Well, a JSON parser should ideally take care of the types for you in a strongly-typed language (maybe with a wrapper/variant class of some sort). Figuring the type out would perhaps then be just a question of looking at some flag in the object. µTorrent already uses numbers and strings in its JSON output, so if your JSON parser doesn't already handle types, it'll have trouble elsewhere besides the settings array. Link to comment Share on other sites More sharing options...
Ryan Norton Posted July 26, 2008 Report Share Posted July 26, 2008 No problem about the RC - the string/integer type bug shouldn't have been in 1.7 in the first place .I can't reproduce the blank build number field problem though - here it displays{"build":11564as expected. Any information that can help reproduce it? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.