Skip to content

Instantly share code, notes, and snippets.

@yyolk
Last active October 31, 2022 00:23
Show Gist options
  • Select an option

  • Save yyolk/6326235 to your computer and use it in GitHub Desktop.

Select an option

Save yyolk/6326235 to your computer and use it in GitHub Desktop.
rtorrent + pushover howto & sample

#script to use pushover for rtorrent notifications

Used for openelec unofficial rtorrent addon but can be part of any rtorrent setup.

  1. Buy Pushover for iOS or Android
  2. Create a new app, and upload a custom icon for your notifications.
  3. Download or copy rtorrent-notification.rb into a new file
  4. Insert your new app's API token in script under token
  5. Use your Pushover user ID for user in script
  6. chmod +x rtorrent-notifaction.rb
  7. Append line from below to your setup's rtorrent.rc, along with path to where you put rtorrent-notification.rb and reload rtorrent.
#!/usr/bin/env ruby
require "net/https"
token = "PUSHOVER_TOKEN"
user = "PUSHOVER_USER"
url = URI.parse("https://api.pushover.net/1/messages")
req = Net::HTTP::Post.new(url.path)
req.set_form_data({
:token => token,
:user => user,
:message => "Torrent Finished! #{ARGV[1..-1].join(" ")}",
})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
# append this to your .rtorrent.rc
system.method.set_key=event.download.finished,notificationscript,"execute={ruby,/Path/To/rtorrent-notification.rb,$d.get_name=}"
@sv2241
Copy link
Copy Markdown

sv2241 commented Apr 3, 2015

./rtorrent-notification.rb:14:in <main>': undefined methodjoin' for nil:NilClass (NoMethodError)

@gdob
Copy link
Copy Markdown

gdob commented Dec 14, 2015

This is nice, unfortunately I’m not receiving the torrent name, but only “Torrent Finished!”. Using rTorrent 0.9.6. Hmm…

@t3chskel
Copy link
Copy Markdown

t3chskel commented Jul 7, 2016

@gdob Change the :message line in rtorrent-notifications.rb to this:

:message => "Torrent Finished! #{ARGV[0]}",

@beyondunreal79
Copy link
Copy Markdown

Where exactly does this get appended in rtorrent.rc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment