Fixing scan torrents.

This commit is contained in:
Dessalines 2018-12-21 13:31:21 -08:00
parent 9234811618
commit 08a3aa9095
1 changed files with 54 additions and 57 deletions

View File

@ -6,6 +6,8 @@ cd ..
torrents_csv="`pwd`/torrents.csv"
scanned_out="`pwd`/infohashes_scanned.txt"
touch $scanned_out
help="Run ./scan_torrents.sh [TORRENTS_DIR] \nor goto https://gitlab.com/dessalines/torrents.csv for more help"
if [ "$1" == "-h" ] || [ -z "$1" ]; then
echo -e $help
@ -26,14 +28,11 @@ fi
# Loop over all torrents
pushd $torrents_dir
for torrent_file in *.torrent; do
# for torrent_file in *.torrent; do
find `pwd` -name "*.torrent" | sort -n | grep -vFf $scanned_out | while read torrent_file ; do
file_infohash=$(basename $torrent_file | cut -d'.' -f 1)
if rg -Nq $file_infohash $scanned_out; then
echo "$file_infohash already scanned"
else
# Scrape it
health_text=$(torrent-tracker-health --torrent $torrent_file --timeout 1000 --addTrackers={udp://tracker.coppersurfer.tk:6969/announce,udp://tracker.internetwarriors.net:1337/announce,udp://tracker.opentrackr.org:1337/announce,udp://exodus.desync.com:6969/announce,udp://explodie.org:6969/announce})
@ -100,8 +99,6 @@ for torrent_file in *.torrent; do
echo $file_infohash >> $scanned_out
fi
done
popd