Tag Archives: torrent

How can I parse a .torrent file with PHP? [solved]

There are some similar questions, but most of them want to download a torrent using PHP or something like that. What I’d like to do is parse a .torrent file, add trackers to it, and then re-save it as a .torrent file. I saw Snark which looks to be for Java only. Can I do this with PHP? If so, how? Solution To parse a .torrent file with PHP you can use a standalone function, as demonstrated here or you can use a library, like the one included with php-bittorrent

Posted in Tech Tips, Web Development | Tagged , , , | Leave a comment

ValueError: No JSON object could be decoded – cuTorrent

cuTorrent is a simple command-line tool that interacts with remote uTorrent instances through thier webui. To use cuTorrent you must have uTorrent running with the webUI on. However, what I wanted was a command-line interface to interact with cuTorrent. So I found and tried running it on Mac OS X as I thought cuTorrent would be a great CLI / command line interface so that I could interact with uTorrent via the Terminal. After running it I got errors like ValueError: No JSON object could be decoded and also: $ ./cuTorrent.py -a list -p 56426 cuTorrent By: Saul Bancroft <saul [email protected]> +list+ Traceback (most recent call last): File “./cuTorrent.py”, line 270, in <module> main() File “./cuTorrent.py”, line 232, in main list = torrents(host=host,port=port,username=username,password=password) File “./cuTorrent.py”, line 112, in __init__ self.update() File “./cuTorrent.py”, line 115, in update l = self.connection.webui_ls() File “/private/tmp/tmp/cutorrent.1.0.beta1.tar/cutorrent/uTorrent_py/uTorrent.py”, line 203, in webui_ls return self.webui_action(r’/gui/?list=1′)[‘torrents’] File “/private/tmp/tmp/cutorrent.1.0.beta1.tar/cutorrent/uTorrent_py/uTorrent.py”, line 135, in webui_action return simplejson.loads(webui_response.read()) File “/private/tmp/tmp/cutorrent.1.0.beta1.tar/cutorrent/simplejson/__init__.py”, line 201, in loads return cls(encoding=encoding, **kw).decode(s) File “/private/tmp/tmp/cutorrent.1.0.beta1.tar/cutorrent/simplejson/decoder.py”, line 249, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File “/private/tmp/tmp/cutorrent.1.0.beta1.tar/cutorrent/simplejson/decoder.py”, line 268, in raw_decode raise ValueError(“No JSON object could be decoded”) ValueError: No JSON object could be decoded Since the project on GoogleCode had not been updated in several years, I started looking into rTorrent which is natively a CLI torrent program. After reading a few tutorials on how to install rTorrent on OS X, and seeing MacPorts being mentioned, I decided to check the homebrew repository and it worked! My solution … Continue reading

Posted in Mac | Tagged , , , | Leave a comment