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);
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?
1.14.2. I will update to 1.15.2 now.
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?
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.
Added --rpc-save-upload-metadata option to enable/disable to save sha-1 named file.