Plain Text Notifications On Orbiters

Intergrating third part programs into Linuxmce can be done a few different ways, this looks at a very simple method of sending notifications to all orbiters once an event occurs.

In this test, we use Transmission, specifically Transmission-Daemon (a bit-torrent program), used for downloading ISO’s of different distro’s. The DVD sized Linux ISO’s take a while to download, so why not go watch some TV? Now that your busy doing something else away from your PC, you don’t want to have to keep looking to see if it’s finished, so why not send a notification to your orbiters/MD’s?

You can either setup a Cron job to check for new files in a directory, and get it to send a message once a condition is met, or you can use Transmissions built-in “script-torrent-done-enabled” feature (available in v2.0 and above). If enabled, it runs a predetermined script after a download is finished. The feature doesn’t currently support variables, For example #> echo %completed_filename%, so you have get the finished torrent name a different way:

“script-torrent-done-filename”: “/home/transmission/torrents_parse.sh”

#!/bin/bash
touch /home/transmission/Torrents.txt
transmission-remote -l | grep “100%” -i |cut -c71-100 | while read line
do
if  ! grep -q “$line” /home/transmission/Torrents.txt
then echo $line >> /home/transmission/Torrents.txt
/usr/pluto/bin/MessageSend dcerouter -targetType category -bl 5 1 5 1 809 251 0 9 “Torrent Seeding: `echo; echo $line`” 182 15 70 “test”
fi
done

Script Summary:

Create file Torrents.txt if it doesn’t exist, use transmission-remote to list files that are 100% complete. Check the Torrents.txt file to see if the completed torrent is already in the file, if it isn’t, add  it and send a notification via the MessageSend command. The script is cheep, but works 🙂

The MessageSend command can be manipulated to send just about any notification information, just keep it small enough to fit in the dialog box.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*