More efficient scanning

This commit is contained in:
Dessalines 2018-11-27 15:13:19 -07:00
parent 0d61e84f2f
commit 8b87a5d6d1
1 changed files with 6 additions and 3 deletions

View File

@ -70,7 +70,7 @@ for torrent_file in *.torrent; do
if [ "$found_seeders" != "$seeders" ]; then
# Delete the original infohash line
rg -N -v "$infohash" $torrents_csv > torfile.tmp.2; mv torfile.tmp.2 $torrents_csv
rg -Nv "$infohash" $torrents_csv > torfile.tmp.2; mv torfile.tmp.2 $torrents_csv
# Append the add lines to the torrents.csv file
echo -e "\n$add_line" >> $torrents_csv
@ -90,8 +90,11 @@ for torrent_file in *.torrent; do
# Deleting the line if it existed
if [ ! -z "$infohash" ]; then
# This removes lines that have no seeders
echo -e "$name has no seeders, removing if existed."
grep -v "$infohash" $torrents_csv > torfile.tmp.2; mv torfile.tmp.2 $torrents_csv
echo -e "$name has no seeders"
if rg -Nq $infohash $torrents_csv; then
echo "Removing $name from $torrents_csv"
rg -Nv "$infohash" $torrents_csv > torfile.tmp.2; mv torfile.tmp.2 $torrents_csv
fi
fi
fi