Need a solution for Sonarr, and putio?
This is what I came up with. Configure Sonarr to dump torrents to a blackhole directory, modify this script. Dump it into your launchd/cron solution and you can upload magnets from your blackhole solution to put.io.
How you download is on you. I might upload my jank solution later.
Use of "blackhole" is problematic. Once I have sometime to perform some generic replacement, I'll update this.
Good Luck.
#!/usr/bin/env bash | |
# authornote: i need to change all mentions of blackhole -> transferdir or something | |
# tested on macos, YMMV | |
# Gist: https://gist.github.com/bdmorin/d3c53e0f495f4947bf61fb55e1c85310 | |
# Set ur putio oath token | |
OAUTH_TOKEN=$(cat ${HOME}/.putio_oauth) | |
# Set ur blackhole directory | |
BH_DIR="${HOME}/Plex/blackhole" | |
# Set ur putio directory id | |
PUTIO_DIR='746080174' | |
# get a tempfile | |
tempfile="$(/usr/bin/env mktemp)" | |
#echo ${tempfile} | |
# get jq location | |
jq="$(/usr/bin/env which jq)" | |
# get curl location | |
curl="$(/usr/bin/env which curl)" | |
# Gather bhole files | |
for MAGNETS in ${BH_DIR}/*.magnet | |
do | |
printf "Processing: %s\n" "${MAGNETS}" | |
${curl} -s -d "save_parent_id=${PUTIO_DIR}" --data-urlencode "url@${MAGNETS}" -o "${tempfile}" "https://api.put.io/v2/transfers/add?oauth_token=${OAUTH_TOKEN}" | |
if [ $(cat ${tempfile} | ${jq} --compact-output --raw-output '.status') == "OK" ] | |
then | |
printf "uploaded: %s\n" "${MAGNETS}" | |
printf "remove these files\n" | |
printf " -- %s\n" "${tempfile}" | |
printf " -- %s\n" "${MAGNETS}" | |
/bin/rm -v "${tempfile}" "${MAGNETS}" | |
else | |
printf "something didn't go right\n" | |
cat ${tempfile} | ${jq} '.' | |
fi | |
done |
Top comments (2)
csmonitor.com/Commentary/Opinion/2...
science20.com/hontas_farmer/cornel...