#!/bin/bash

# Absolute paths for torrent app and bin
TORRENT_APP="/Applications/Zach/Internet/Transmission.app"
TORRENT_BIN="${TORRENT_APP}/Contents/MacOS/Transmission"

# Bail if WoW is running
if ps auwx | grep -v grep | grep -q "World of Warcraft/World of Warcraft.app/Contents/MacOS/World of Warcraft"; then
	exit 0
fi

# Start the torrent app if it isn't running
if ! ps auwx | grep -v grep | grep -q "${TORRENT_BIN}"; then
	open "${TORRENT_APP}"
fi
