Last active
January 17, 2021 20:15
-
-
Save elamperti/d1ced3a405090fc6e4805307a0dc78c1 to your computer and use it in GitHub Desktop.
Cron script to transform magnet links into .torrent files
This file contains hidden or 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
#!/bin/bash | |
## Follow the guide: | |
## https://github.com/elamperti/dotfiles/blob/master/docs/sonarr-with-tixati.md | |
## Or see the magnet2torrent.py script here: | |
## https://github.com/elamperti/Magnet2Torrent | |
magnet_folder=$USER/.sonarr | |
if [ ! -d "${magnet_folder}" ]; then | |
echo "Magnet folder not found" | |
exit 1 | |
fi | |
pushd "${magnet_folder}" &>/dev/null | |
for magnet_file in *.magnet; do | |
if [ -f "$magnet_file" ]; then | |
torrent_file="${magnet_file%.magnet}.torrent" | |
echo "Creating $torrent_file" | |
/home/$USER/bin/magnet2torrent.py "${magnet_file}" "${torrent_file}" | |
if [ $? -eq 0 ]; then | |
rm "${magnet_file}" && echo "Removed magnet file ${magnet_file}" | |
fi | |
fi | |
done | |
popd &>/dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @ms766, this is just part of a setup, check the links commented above for details: