[Solved] Adding .torrent data via a metainfo RPC

Discussion of the Web Interface for Transmission, formerly known as Clutch. This applies to all version of Transmission
Post Reply
elmotheelk
Posts: 14
Joined: Sat Apr 11, 2009 12:40 am

[Solved] Adding .torrent data via a metainfo RPC

Post by elmotheelk »

For my Transmission Android client (called Transdroid), I am using the RPC JSON-API. I am trying to add a new feature, allowing to upload the contents of a local .torrent file to the server daemon. (This is used for example on website that have password-protected .torrent files. When you send such URL's to transmission, it doesn't know how to retrieve them from the internet since it has no username/password to authenticate with.)

The problem is that Transmission keeps giving me an error response:

Code: Select all

{"method":"Add","arguments":{},"tag":0,"result":"invalid or corrupt torrent file"}
What I am sending is the contents of a .torrent file that is base64-encoded. The full request as a text file can be downlaoded here (the base64-encoded string is quite big and I can't upload .txt files here). Basically, it looks like:

Code: Select all

{"method":"torrent-add","arguments":{"metainfo":"<the encoded string>"},"tag":0}
This .torrent file I have encoded is an Ubuntu torrent.

Any ideas on why this torrent is rejected? Here is the Java base64-encoder that I use (but I have the same issue with several other encoders). Hope you can help me!
Last edited by elmotheelk on Tue Jun 16, 2009 12:31 pm, edited 1 time in total.
elmotheelk
Posts: 14
Joined: Sat Apr 11, 2009 12:40 am

Re: Adding .torrent data via a metainfo RPC

Post by elmotheelk »

Well, I should have known: the moment I decide to post a support request, I just fix it. Oh well: the problem WAS with the base64 encoding algorithm I used. I change now use this Java class instead, which works fine. Sorry to bother you.

On the bright side: transmission will be the first torrent daemon in my Android app to support the uploading of .torrent files. :-) Thanks again for making this great torrent app and a very nice RPC JSON-API.
Post Reply