Last active
May 30, 2022 14:39
-
-
Save g-r-a-v-e-l-y/35a91ca9948700b00b6a043cfcbaeb3d to your computer and use it in GitHub Desktop.
I use Transmission and sabnzbd behind a basic auth http proxy kinda like this now
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on adding folder items to thisFolder after receiving added_items | |
repeat with addedFile in added_items | |
tell application "Finder" | |
if (the name of the addedFile ends with "torrent") then | |
set transmissionRemote to "/usr/local/bin/transmission-remote https://TRANSMISSION_HOST/transmission -n 'USERNAME:PASSWORD' --add '" & POSIX path of addedFile & "' | sed 's/\"//g' | grep -oE '[^ ]+$'" | |
set fileName to name of (info for addedFile) | |
display notification fileName with title "Torrent Janitor - Queueing Torrent" | |
set transmissionResponse to do shell script transmissionRemote | |
display notification fileName with title "Torrent Janitor - " & transmissionResponse | |
tell application "Finder" | |
delete addedFile | |
end tell | |
end if | |
if (the name of the addedFile ends with "nzb") then | |
set curlOneLiner to "/usr/bin/curl -u USERNAME:PASSWORD --basic https://SABNZBD_HOST/api -F 'apikey=API_KEY' -F 'mode=addfile' -F 'name=@" & POSIX path of addedFile & "'" | |
set fileName to name of (info for addedFile) | |
display notification "Queueing " & fileName & "for download." with title "Usenet NZB Janitor" | |
set curlOneLinerResponse to do shell script curlOneLiner | |
display notification fileName & ": " & curlOneLinerResponse with title "Usenet NZB Janitor" | |
tell application "Finder" | |
delete addedFile | |
end tell | |
end if | |
end tell | |
end repeat | |
end adding folder items to |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment