Saturday, July 20, 2013

opensubtitles-client #nodejs #javascript integration with RTorrent


After writing the npm module opensubtitles-client to be able to download subtitles from the command line I felt the need to integrate it with rtorrent. With the following configuration after a torrent is finished, subtitler will try to download subtitles for it.

On .rtorrent.rc add:

system.method.set_key =event.download.finished,move_complete,"execute=subtitler,$d.get_base_path="

If you want you create a script file with several instructions and tweak subtitler arguments like:

system.method.set_key =event.download.finished,move_complete,"execute=~/torrent_finish.sh,$d.get_base_path="
and on ~/torrent_finish.sh:

#!/bin/sh

#always download 2 subtitles file in english to torrent and log it
subtitler "$1" -n 2 -lang eng >> /tmp/rtorrentFinish

My life has become so much easier...now I just need to connect my USB hard drive to the tv...

Just a note: RTorrent is running on my raspberry, also with nodejs v0.10.2...

Links:
https://github.com/aetheon/node-opensubtitles-client
https://npmjs.org/package/opensubtitles-client