From 6b586eb2839246a4139fe3dde94293aefd05a6c3 Mon Sep 17 00:00:00 2001 From: poka Date: Sun, 22 Mar 2020 06:35:11 +0100 Subject: [PATCH] few stuff ... --- crawl.py | 13 +++++++++---- install.sh | 12 ++++++++++++ login.py.template | 3 +++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/crawl.py b/crawl.py index 517c785..1ff176c 100755 --- a/crawl.py +++ b/crawl.py @@ -29,10 +29,8 @@ from yggtorrentscraper import set_yggtorrent_tld set_yggtorrent_tld("se") name = ' '.join(sys.argv[1:]) -#research = os.system("./lib/scrabash.sh search --best=true " + name) +# Search torrent name research = os.popen('./lib/scrabash.sh search --best=true ' + name).read() -#research = run(["./lib/scrabash.sh", "search", "--best-true"]) - print(colored(research, 'yellow')) try: @@ -73,6 +71,11 @@ def rollingFiles(): def checkDisk(): global diskSize diskSize = os.popen('./trans-ctl.sh checkdisk').read() + if re.search("You have reached", diskSize): + fields = diskSize.strip().split() + if "M" in diskSize: + diskSize = float(fields[-1]) + diskEnd = float(diskSize) + torrentSize if torrentSize >= diskLimit: print(colored('This torrent is larger as your disk limit:', 'red')) @@ -105,7 +108,7 @@ def downloadTorrent(): scraper.download_from_torrent_url(research) else: print(colored("Login failed", 'red')) - + sys.exit(1) # Remove tracker def removeTracker(): @@ -122,4 +125,6 @@ rollingFiles() downloadTorrent() removeTracker() +# End print(colored("Done", 'green')) +sys.exit(0) diff --git a/install.sh b/install.sh index c78a3cb..cb3889f 100755 --- a/install.sh +++ b/install.sh @@ -60,11 +60,23 @@ torrengo() { rm /tmp/go1.13.4.linux-amd64.tar.gz } +pip3() { + sudo apt install python3-pip + +} + +iptubes() { + [[ -z $(which pip3) ]] && pip3 + /usr/bin/pip3 install $(curl -s https://raw.githubusercontent.com/Harkame/YggTorrentScraper/master/requirements.txt) +} + # Check installs [[ -z $(which ipfs) ]] && ipfs [[ -z $(which sbotc) ]] && sbotc [[ -z $(which transmission-daemon) ]] && transmission +$@ + echo -e "Installation Complete" exit 0 diff --git a/login.py.template b/login.py.template index daa8bb5..939b3e9 100644 --- a/login.py.template +++ b/login.py.template @@ -1,2 +1,5 @@ user = "" passwd = "" +transUser = "" +transPwd = "" +