def ed2k(ctx, files, clipboard): to_process = get_files_to_process(files, ctx) links = [] for file in to_process: link = libed2k.get_ed2k_link(file) print(link) links.append(link) if clipboard: pyperclip.copy("\n".join(links)) ctx.obj["output"].success("All links were copied to clipboard.")
def Process(self, file): try: link = libed2k.hash_file(file["path"]) except Exception as e: self.output.error("Failed to generate hash: " + str(e)) return False file["ed2k"] = link file["size"] = os.path.getsize(file["path"]) self.output.success("Generated ed2k link.") if self.show_ed2k: self.output.info(libed2k.get_ed2k_link(file["path"], file["ed2k"])) return True