Using Transmission with Pushover

Since this is now a different topic, I am putting this reply to this post here.

Well… there isn’t one. At least not directly. But don’t worry, I can walk you through it.

It’s much easier than it seems. There are several steps, but you only have to do them once, and setting up the first one will let you use Pushover for anything so it’s well worth your time.

po.sh

What I did was write a shell script “wrapper” that will basically send whatever text I give it as an “argument” via Pushover. I called it “po.sh” because [P]ush[O]ver and I’m devilishly clever when it comes to naming things :wink:

The idea is pretty simple:

  1. Download the script and save it somewhere (I recommend /usr/local/bin/po.sh)

  2. Edit /usr/local/bin/po.sh to include your specific Pushover.net information (token and user key) in the variable names (I tried to make it as clear as possible what goes where)

  3. Make sure /usr/local/bin/po.sh is executable: chmod 755 /usr/local/bin/po.sh

  4. Now, whenever you want to send yourself a push notification, you can just use po.sh "Hello World" or po.sh "This is a thing you might want to know"

Once you have po.sh set up, you can use it for pretty much anything.

Transmission

Transmission has a very cool feature built-in where you can call a shell script (not an AppleScript!) after a torrent finishes downloading.

I have a note that says these variables are available:

$TR_TORRENT_NAME
$TR_TORRENT_ID
$TR_TORRENT_HASH
$TR_TORRENT_DIR
$TR_TIME_LOCALTIME
$TR_APP_VERSION

Unfortunately I cannot seem to remember where I got these, and googling didn’t help, which means I can’t tell you if they are up-to-date and/or if there are any others. But these are all we need right now anyway.

po.sh and Transmission together

We need to write a very short little shell script which will use po.sh to tell us that Transmission has finished.

Here’s what I use:

#!/bin/zsh -f
#
# Purpose: Send me a Pushover notification when 
# Transmission.app finishes downloading

NAME="$0:t"

/usr/local/bin/po.sh "$NAME: $TR_TORRENT_NAME finished \
at $TR_TIME_LOCALTIME. Find it in $TR_TORRENT_DIR"

exit 0

That’s really all we need. Paste that into a plain-text document and save it as something like /usr/local/bin/transmission.sh and make it executable:

chmod 755 /usr/local/bin/transmission.sh

The last step is telling Transmission.app to use the script. The setting for this is just a tiny-bit buried:

  1. Open Transmission’s preferences
  2. Click the “Transfers” tab
  3. Click “Management”
  4. Check the box next to “Call Script” (at the very bottom of the window)
  5. Select the file /usr/local/bin/transmission.sh

It should look like this when you’re done:

As I said, it’s much easier than it seems all written out like this. I tend to be wordy when explaining things because I’d rather err on the side of being overly clear than unclear (and it’s still possible that some or all of this isn’t clear).

If you have questions, let me know.

TJ - I cant believe you did all this work! Thank you.

I tried to follow along, despite me being completely out of my depth here. Incomprehensibly, I got it all to work perfectly on the first try! My biggest challenge was that my Mac doesn’t have a /usr/local/bin/ directory. I finally realized I could just stick it in /usr/local/ and adjust all the scripts.

Now I have to come up with other good uses for pushover!

You’re welcome! I always forget that /usr/local/bin/ isn’t a part of the standard way that macOS ships, since Brew is one of the first things I install, and it sets up all the stuff in /usr/local/ and its various sub-folders. But what you did should be fine.

As far as “all this work”… well, the “hard” part was writing the script, which I did awhile ago. But I figure that for every other person who uses the script I wrote, the benefit of that works gets multiplied (or perhaps even raised to the power of ²).

Then the rest of it was just writing up what I know in a way that someone else could follow, and I enjoy that. I’ve gotten lots of help over the years, so it’s nice to be able to provide help to others as well.

I hope you enjoy Pushover, especially now that you can use it more easily!