def download_torrents(self,files,run_once): if not files: print("No files found. Taking a break") if run_once==False: time.sleep(1200) else: command = 'rtorrent' for f in files: print(f) name = '"' + f +'"' command = command + ' ' + name print(command) pro = subprocess.Popen(command, shell=True, preexec_fn=os.setsid) time.sleep(1500) os.killpg(pro.pid, signal.SIGTERM) #kills rtorrent process util_functions.remove_files() #removes torrent files
def cleanup_folder(): util_functions.remove_files(extension='.mp4') util_functions.remove_files(extension=".torrent")