1
0
pk 6 mēneši atpakaļ
vecāks
revīzija
7fc128d905
3 mainītis faili ar 26 papildinājumiem un 3 dzēšanām
  1. 1 0
      .gitignore
  2. 1 1
      Dockerfile
  3. 24 2
      tmp/get.sh

+ 1 - 0
.gitignore

@@ -44,3 +44,4 @@ jspm_packages
 /.ideaDataSources
 /dataSources
 /tmp/
+.vscode/launch.json

+ 1 - 1
Dockerfile

@@ -1,6 +1,6 @@
 FROM node:22-bookworm
 
-RUN apt update -qq && apt install -qq -y wget2
+RUN apt update -qq && apt install -qq -y wget2 aria2
 
 ADD . /home/node/kisybi
 

+ 24 - 2
tmp/get.sh

@@ -2,10 +2,30 @@ export http_proxy=http://192.168.0.11:8117/
 export https_proxy=http://192.168.0.11:8117/
 export no_proxy=192.168.0.11
 
+validate_torrent() {
+  local torrent_file="$1"
+
+  if aria2c -S "$torrent_file"; then
+    echo "Valid: $torrent_file"
+  else
+    echo "Invalid or corrupted: $torrent_file"
+  fi
+}
+
+validate_all_torrents() {
+  local dir="$1"
+
+  # Use find to locate all .torrent files in the specified directory and subdirectories
+  find "$dir" -type f -name "*" | while read -r torrent_file; do
+    validate_torrent "$torrent_file"
+  done
+}
+
+
 mkdir -p done/music
 mkdir -p done/books
-mkdir m
-mkdir b
+mkdir -p m
+mkdir -p b
 
 echo "get all M"
 mv ml_* m
@@ -14,6 +34,7 @@ for f in ml_*; do cat $f; echo; done > ml
 rm -f ml_* 
 wget2 -c -i ml
 rm -f ml
+validate_all_torrents `pwd`
 find . -maxdepth 1 -type f -exec sh -c 'mv "$0" "../done/music/$0.torrent"' {} \;
 
 cd ..
@@ -25,4 +46,5 @@ for f in bl_*; do cat $f; echo; done > bl
 rm -f bl_* 
 wget2 -c -i bl
 rm -f bl
+validate_all_torrents `pwd`
 find . -maxdepth 1 -type f -exec sh -c 'mv "$0" "../done/books/$0.torrent"' {} \;