Get db value from crawl.py and fix checkdisk with good values
This commit is contained in:
parent
3c360cfd58
commit
ea94ab06ea
22
crawl.py
22
crawl.py
|
@ -39,13 +39,25 @@ except ValueError:
|
||||||
True
|
True
|
||||||
else:
|
else:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if displayDetails == "true":
|
|
||||||
detail = subprocess.call(["lib/scrabash.sh", "get_details", research])
|
|
||||||
|
|
||||||
#torrentSize =
|
idTorrent = os.popen('./lib/scrabash.sh get_details ' + research).read()
|
||||||
|
dbPath = "./data/nfo/{}/db.py".format(idTorrent.rstrip())
|
||||||
|
torrentDB = os.popen('cat ' + dbPath).read()
|
||||||
|
|
||||||
diskSize = subprocess.call(["./trans-ctl.sh", "checkdisk"])
|
print(torrentDB)
|
||||||
if diskSize >= 15:
|
print("---")
|
||||||
|
|
||||||
|
torrentDBFile = open(dbPath, "r")
|
||||||
|
|
||||||
|
for line in torrentDBFile:
|
||||||
|
if re.search("Size", line):
|
||||||
|
fields = line.strip().split()
|
||||||
|
torrentSize = float(fields[2]) #kopa
|
||||||
|
|
||||||
|
diskSize = os.popen('./trans-ctl.sh checkdisk').read()
|
||||||
|
#print(diskSize)
|
||||||
|
diskEnd = float(diskSize) + torrentSize
|
||||||
|
if diskEnd >= 15:
|
||||||
print("You have filled the entire space allocated to torrents: " + diskSize)
|
print("You have filled the entire space allocated to torrents: " + diskSize)
|
||||||
sys.exit("Disk full")
|
sys.exit("Disk full")
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Config
|
||||||
|
print=true
|
||||||
|
|
||||||
name="${@:2}"
|
name="${@:2}"
|
||||||
nameR=$(echo $name | sed -e 's/[^ ]*=[^ ]*//ig')
|
nameR=$(echo $name | sed -e 's/[^ ]*=[^ ]*//ig')
|
||||||
|
|
||||||
|
@ -34,11 +37,14 @@ get_details() {
|
||||||
torrentSize=$(echo "$torrentSize" | tr -d 'Go')
|
torrentSize=$(echo "$torrentSize" | tr -d 'Go')
|
||||||
torrentSeeders=$(echo "$result" | grep -w "Seeders :" | awk -F ": " '{ print $2 }')
|
torrentSeeders=$(echo "$result" | grep -w "Seeders :" | awk -F ": " '{ print $2 }')
|
||||||
|
|
||||||
|
echo "$idTorrent"
|
||||||
|
|
||||||
echo "Name = '$torrentName'
|
echo "Name = '$torrentName'
|
||||||
Url = '$torrentUrl'
|
Url = '$torrentUrl'
|
||||||
Size = $torrentSize
|
Size = $torrentSize
|
||||||
Unity = '$unity'
|
Unity = '$unity'
|
||||||
Seeders = $torrentSeeders" > ./data/nfo/$idTorrent/db.py
|
Seeders = $torrentSeeders
|
||||||
|
ID = $idTorrent" > ./data/nfo/$idTorrent/db.py
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ getid() {
|
||||||
checkdisk() {
|
checkdisk() {
|
||||||
diskSize=$(du -hs data/files/ | awk '{ print $1 }')
|
diskSize=$(du -hs data/files/ | awk '{ print $1 }')
|
||||||
[[ $diskSize =~ "G" ]] && diskSize=$(echo $diskSize | tr -d 'G') || return 0
|
[[ $diskSize =~ "G" ]] && diskSize=$(echo $diskSize | tr -d 'G') || return 0
|
||||||
[[ "$diskSize" -ge "$diskLimit" ]] && echo "You have reached the maximum space allocated to torrents: $diskSize"
|
[[ "$diskSize" -ge "$diskLimit" ]] && echo "You have reached the maximum space allocated to torrents: $diskSize" || echo "$diskSize" | tr ',' '.'
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
|
Loading…
Reference in New Issue