Updated External programs: savecategory (markdown)

Jef LeCompte
2020-06-07 19:12:05 -04:00
parent deb1df8d02
commit 44d39ffbab

@@ -15,27 +15,27 @@ Save the script below as `savecategory` and make it executable via `chmod 755 /p
```bash ```bash
#!/bin/sh #!/bin/sh
category=$(basename $1) category="$(basename $1)"
torrent_hash=$2 torrent_hash="$2"
torrent_name=$3 torrent_name="$3"
apiv2=http://localhost:25832/api/v2 host="http://localhost:8112"
username=admin username="admin"
password=adminadmin password="adminadmin"
cookie_file=/config/external/cookie
echo "running savecategory script" echo "running savecategory script"
echo "getting cookie" echo "\tgetting cookie"
curl --silent --fail --show-error --request GET \ cookie=$(curl --silent --fail --show-error \
--url "$apiv2/auth/login?username=$username&password=$password" \ --header "Referer: $host" \
--cookie-jar "$cookie_file" > /dev/null --cookie-jar - \
--request GET "$host/api/v2/auth/login?username=$username&password=$password")
echo "setting $torrent_name to category $category" echo "\tsetting $torrent_name to category $category"
curl --silent --fail --show-error --request GET \ echo "$cookie" | curl --silent --fail --show-error \
--url "$apiv2/torrents/setCategory?hashes=$torrent_hash&category=$category" \ --cookie - \
--cookie "$cookie_file" > /dev/null --request GET "$host/api/v2/torrents/setCategory?hashes=$torrent_hash&category=$category"
echo "completed savecategory script" echo "completed savecategory script"