The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

irctor-queue - Log RTorrent actions to a file

DESCRIPTION

This program is meant to be called by RTorrent's event handlers. It logs actions to a log file based on the arguments it receives.

Optionally, when RTorrent tells it that a torrent has finished, irctor-queue can inspect the downloaded content and call unrar(1) in these situations:

  • The content is a single rar file. If the rar archive contains more than one file/directory, a directory will be created to contain them, with the same name as the archive without the ".rar" suffix)

  • The content is a directory with a rar archive that contains a single file/directory

  • The content is a directory containing CD[1-9] subdirectories which have rar archives (containing only a single file/directory each)

POE::Component::IRC::Plugin::RTorrentStatus follows the log file created by this program and announces various events on IRC.

CONFIGURATION

.rtorrent.rc must have the following lines in it. /tmp/torrentlog is the log file it will write to. Change it if you want to keep it elsewhere. Note that irctor_finished needs to know where you keep your completed files (last argument).

 # irctor-queue hooks, with unrar
 system.method.set_key = event.download.inserted_new,irctor_inserted_new,"execute=irctor-queue,/tmp/torrentlog,inserted_new,$d.get_name=,$d.get_size_bytes=1,$d.get_tied_to_file=1"
 system.method.set_key = event.download.hash_queued, irctor_hash_queued, "execute=irctor-queue,/tmp/torrentlog,hash_queued, $d.get_name=,$d.get_size_bytes=1,$d.get_completed_bytes=1,$d.get_tied_to_file=1,$d.get_complete=1,$d.get_down_total=1"
 system.method.set_key = event.download.finished,    irctor_finished,    "execute=irctor-queue,/tmp/torrentlog,finished,    $d.get_name=,$d.get_base_filename=1,/home/leech/torrent/complete"

With unrar functionality

If wou want the unrar functionality, you must add a 1 argument to the end of irctor_finised:

 system.method.set_key = event.download.finished,    irctor_finished,    "execute=irctor-queue,/tmp/torrentlog,finished,    $d.get_name=,$d.get_base_filename=1,/home/leech/torrent/complete,1"

If you have an RTorrent hook which moves completed downloads to some directory, make sure the name of that hook comes before (according to ASCII sorting) the name of the irctor_finished hook. This is necessary because RTorrent executes hooks in alphabetical order.

AUTHOR

Hinrik Örn Sigurðsson, hinrik.sig@gmail.com

LICENSE AND COPYRIGHT

Copyright 2010 Hinrik Örn Sigurðsson

This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.