#!/usr/bin/python3 ################################################################################ # Author: Poka (poka@p2p.legal) # Version: 0.0.2 # License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) # Git: https://git.p2p.legal/axiom-team/astroport ################################################################################ # Config tkdelay = 3 displayDetails = "true" import requests import json import sys import os import subprocess import login import time import re # Load scraper from yggcrawl import YggTorrentScraper scraper = YggTorrentScraper(requests.session()) 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) research = os.popen('./lib/scrabash.sh search --best=true ' + name).read() #research = run(["./lib/scrabash.sh", "search", "--best-true"]) print(research) try: research.index("No torrent found") except ValueError: True else: sys.exit(1) if displayDetails == "true": detail = subprocess.call(["lib/scrabash.sh", "get_details", research]) #torrentSize = diskSize = subprocess.call(["./trans-ctl.sh", "checkdisk"]) if diskSize >= 15: print("You have filled the entire space allocated to torrents: " + diskSize) sys.exit("Disk full") # Download torrent file if(scraper.login(login.user, login.passwd)): print("Login success") scraper.download_from_torrent_url(research) else: print("Login failed") # Remove tracker print("Start to remove tracker ...") time.sleep(1) print("Wait " + str(tkdelay) + " seconds to get peers before remove tracker...") time.sleep(tkdelay) subprocess.call(["./trans-ctl.sh", "rmtracker", name]) print("Done")