add tracker announce URLs to torrents for sharing

This commit is contained in:
eyedeekay
2024-10-05 19:58:48 -04:00
parent 1d21233933
commit cc68ba51fa
2 changed files with 10 additions and 10 deletions

View File

@ -53,7 +53,6 @@ To do this we'll use a shell script to generate the page.
#! /usr/bin/env sh #! /usr/bin/env sh
tagList() { tagList() {
echo " <div class=\"tags\">Tags:"
for torrent in i2psnark/*.torrent; do for torrent in i2psnark/*.torrent; do
filename=$(echo $torrent | sed 's|.torrent||g') filename=$(echo $torrent | sed 's|.torrent||g')
title=$(echo $filename | sed 's|-| |g' | sed 's|i2psnark/||g') title=$(echo $filename | sed 's|-| |g' | sed 's|i2psnark/||g')
@ -64,7 +63,6 @@ tagList() {
done done
done done
done done
echo " </div>"
} }
generatePage() { generatePage() {
@ -82,17 +80,19 @@ generatePage() {
echo "</head>" echo "</head>"
echo "<body>" echo "<body>"
cd "$SHARE" cd "$SHARE"
echo " <div class=\"tags\">Tags:"
tagList | sort -u tagList | sort -u
echo " </div>"
for torrent in i2psnark/*.torrent; do for torrent in i2psnark/*.torrent; do
transmission-edit -a "http://$zzzot_announce/a" "$torrent" transmission-edit -a "http://$zzzot_announce/a" "$torrent" 2> "$BACK/err" 1> "$BACK/log"
filename=$(echo $torrent | sed 's|.torrent||g') filename=$(echo $torrent | sed 's|.torrent||g')
title=$(echo $filename | sed 's|-| |g' | sed 's|i2psnark/||g') title=$(echo $filename | sed 's|-| |g' | sed 's|i2psnark/||g')
tags=$(echo $title | sed 's|\.| |g' | sed 's|@| |g') tags=$(echo $title | sed 's|\.| |g' | sed 's|@| |g')
echo " <div id="$filename" class=\"$tags\">" echo " <div id="$filename" class=\"lvix2 $tags\">"
echo " <a href=\"$torrent\">$title</a></br>" echo " <a href=\"$torrent\">$title</a></br>"
echo " <div class=\"tags\">Tags:" echo " <div class=\"tags\">Tags:"
for tag in $tags; do for tag in $tags; do
echo "<a class=\"$tag lvix1\" href=\"#$tag\">$tag</a>" echo " <a class=\"$tag lvix1\" href=\"#$tag\">$tag</a>"
done done
echo " </div>" echo " </div>"
echo " </div>" echo " </div>"

View File

@ -1,7 +1,6 @@
#! /usr/bin/env sh #! /usr/bin/env sh
tagList() { tagList() {
echo " <div class=\"tags\">Tags:"
for torrent in i2psnark/*.torrent; do for torrent in i2psnark/*.torrent; do
filename=$(echo $torrent | sed 's|.torrent||g') filename=$(echo $torrent | sed 's|.torrent||g')
title=$(echo $filename | sed 's|-| |g' | sed 's|i2psnark/||g') title=$(echo $filename | sed 's|-| |g' | sed 's|i2psnark/||g')
@ -12,7 +11,6 @@ tagList() {
done done
done done
done done
echo " </div>"
} }
generatePage() { generatePage() {
@ -30,7 +28,9 @@ generatePage() {
echo "</head>" echo "</head>"
echo "<body>" echo "<body>"
cd "$SHARE" cd "$SHARE"
echo " <div class=\"tags\">Tags:"
tagList | sort -u tagList | sort -u
echo " </div>"
for torrent in i2psnark/*.torrent; do for torrent in i2psnark/*.torrent; do
transmission-edit -a "http://$zzzot_announce/a" "$torrent" 2> "$BACK/err" 1> "$BACK/log" transmission-edit -a "http://$zzzot_announce/a" "$torrent" 2> "$BACK/err" 1> "$BACK/log"
filename=$(echo $torrent | sed 's|.torrent||g') filename=$(echo $torrent | sed 's|.torrent||g')
@ -40,7 +40,7 @@ generatePage() {
echo " <a href=\"$torrent\">$title</a></br>" echo " <a href=\"$torrent\">$title</a></br>"
echo " <div class=\"tags\">Tags:" echo " <div class=\"tags\">Tags:"
for tag in $tags; do for tag in $tags; do
echo "<a class=\"$tag lvix1\" href=\"#$tag\">$tag</a>" echo " <a class=\"$tag lvix1\" href=\"#$tag\">$tag</a>"
done done
echo " </div>" echo " </div>"
echo " </div>" echo " </div>"
@ -91,7 +91,7 @@ if [ $(whoami) = "i2psvc" ]; then
export BACK=$(pwd) export BACK=$(pwd)
export SHARE=/var/lib/i2p/i2p-config/plugins/zzzot/eepsite/docroot/ export SHARE=/var/lib/i2p/i2p-config/plugins/zzzot/eepsite/docroot/
generatePage | tee /var/lib/i2p/i2p-config/plugins/zzzot/eepsite/docroot/index.html generatePage | tee /var/lib/i2p/i2p-config/plugins/zzzot/eepsite/docroot/index.html
cp -v script.js /var/lib/i2p/i2p-config/plugins/zzzot/eepsite/docroot/script.js cp script.js /var/lib/i2p/i2p-config/plugins/zzzot/eepsite/docroot/script.js
else else
if [ ! -d "$HOME/.i2p/plugins/zzzot/eepsite/docroot" ]; then if [ ! -d "$HOME/.i2p/plugins/zzzot/eepsite/docroot" ]; then
echo "zzzot directory does not exist, did you read the instructions?" echo "zzzot directory does not exist, did you read the instructions?"
@ -105,7 +105,7 @@ else
export BACK=$(pwd) export BACK=$(pwd)
export SHARE="$HOME/.i2p/plugins/zzzot/eepsite/docroot/" export SHARE="$HOME/.i2p/plugins/zzzot/eepsite/docroot/"
generatePage | tee "$HOME/.i2p/plugins/zzzot/eepsite/docroot/index.html" generatePage | tee "$HOME/.i2p/plugins/zzzot/eepsite/docroot/index.html"
cp -v script.js "$HOME/.i2p/plugins/zzzot/eepsite/docroot/script.js" cp script.js "$HOME/.i2p/plugins/zzzot/eepsite/docroot/script.js"
else else
echo "i2psnark directory does not exist, did you install I2P using a \`.deb\`?" echo "i2psnark directory does not exist, did you install I2P using a \`.deb\`?"
exit 1 exit 1