martinewski wrote:That's how I would do it if I was a leecher

Interesting. Using a separate folder for incomplete files hadn't occurred to me, but could fit well with an idea I had in mind that doesn't rely on Hazel …
Under the Management tab of Transmission > Preferences > Transfers the "Call script: when download completes: <script>" setting can be enabled with a selected shell script to run after
each download completes. Since you probably don't want Transmission to quit while
other downloads are still in progress the script needs to test for that condition. Here's a simple example that checks for incomplete downloads (with a .part extension) and kills Transmission if there aren't any:
- Code: Select all
#!/bin/sh
PATH=/usr/bin
TR_DOWNLOADS=/Path/To/Transmission/Downloads
[[ $(find "${TR_DOWNLOADS}" -name '*.part') == '' ]] && killall -c Transmission
exit
It assumes all incomplete downloads are under a single /Path/To/Transmission/Downloads folder. But if you configure to use a separate folder for that, like in martinewski's example, then the script only has to check there.
That's the basic gist.
One issue I've discovered is that using
killall … to quit Transmission can leave files in a inconsistent state that causes redundant downloading next time it's run, which seems to be avoided by substituting this bit of shell+AppleScript:
- Code: Select all
osascript -e 'tell application "Transmission" to quit'
Two caveats:
• By default, Transmission prompts to quit if transfers are active (e.g. seeding what just finished downloading). Disabling "Prompt user for:" settings under Preferences > General can work around that.
• Being run as an uncompiled script causes Transmission to launch if it isn't already running. Irrelevant in this context but doesn't hurt to be aware of.
Transfer list cleanup is a separate issue. Enabling "Remove from the transfer list when seeding completes" under Preferences > Transfers / Management can help automate that.
Hopefully you've got enough information now, Jitto, to make Transmission auto-quit the way you'd like. And it's no longer a Hazel issue with my method. Anything else that's Transmission-specific might be more appropriate for
its forum.