def download(putioAcc): gui = ncurses.gui_Curses() pos = gui.displaySelector("Choose your file:", putioAcc.displayFiles()) del gui ids = putioAcc.getItemFiles(pos, 'id') name = putioAcc.getItemFiles(pos, 'name') putioAcc.downloadFile(ids, name)
def delete(putioAcc): gui = ncurses.gui_Curses() pos = gui.displayMultiSelector("Choose your file:", putioAcc.displayFiles()) del gui l_ids = [] for position in pos: l_ids.append(putioAcc.getItemFiles(position, 'id')) for ids in l_ids: putioAcc.deleteFiles(ids)
self.blockSZ = 8192 while True: self.buffer = self.u.read(self.blockSZ) if not self.buffer: break self.fileSizeDL += len(self.buffer) self.f.write(self.buffer) os.system('clear') print(self.fileName) self.f.close() return target + name if __name__ == '__main__': torrent = torrents() gui = ncurses.gui_Curses() putioAcc = putio.putio() # torrent.searchKickass("arrow s01") d_torrent, l_torrent = torrent.searchCpasbien(gui.entry("Your series...")) pos = gui.displayMultiSelector("Choose your torrents...", l_torrent) del gui if len(sys.argv) >= 2: if sys.argv[1] == '--only': for url in pos: torrent.download(d_torrent[l_torrent[url - 1]], "/tmp/", d_torrent[l_torrent[url - 1]].split("/")[-1]) else: print("Unknown option") else: for url in pos: putioAcc.addTorrent(torrent.download(d_torrent[l_torrent[url - 1]], "/tmp/", d_torrent[l_torrent[url - 1]].split("/")[-1]))