Menu

#290 Getting an error when using XML-RPC interface

Undecided
closed
nobody
1
2012-10-15
2012-10-12
No

I am currently working on a Qt aria2c gui using XML-RPC API. I use xmlrpc-c++ library to connect to a local aria2c instance. I want to download a torrent file and get "a torrent file does not contain a root dictionary" error from API. Here is my code:

QFile t_file(torrent_path);
t_file.open(QIODevice::ReadOnly);
QByteArray array = t_file.readAll();
array = array.toBase64();
std::vector<unsigned char=""> data;
data.resize(array.size());
qCopy(array.begin(), array.end(), data.begin());
xmlrpc_c::value result;
xmlrpc_c::paramList settings;
settings.add( xmlrpc_c::value_bytestring(data) );
mClient.call(listenAddress.toStdString(), "aria2.addTorrent", settings, &result);

Discussion

  • tujikawa

    tujikawa - 2012-10-13

    Old aria2 has an issue to read base64 encoded torrent data which contains CR or LF, This issue was fixed in aria2 1.15.2. Which version are you using?

     
  • Nazar Mishturak

    Nazar Mishturak - 2012-10-13

    1.14.2. I will update to 1.15.2 now.

     
  • Nazar Mishturak

    Nazar Mishturak - 2012-10-13

    Updated to 1.15.2. It was crashing with Bencode decoding failed, but removing array = array.toBase64(); line solved it. Also, can you tell me how not to save sha-1 named .torrent files in aria2c working directory?

     
  • tujikawa

    tujikawa - 2012-10-13

    OK, so xmlrpc library seems to encode binary strings in base64 automatically.

    There is no option to disable saving torrent file at the moment. I'll add it in the future release.

     
  • tujikawa

    tujikawa - 2012-10-15

    Added --rpc-save-upload-metadata option to enable/disable to save sha-1 named file.

    • status: open --> closed
     

Log in to post a comment.