Skip to content

Commit

Permalink
make torrents code
Browse files Browse the repository at this point in the history
  • Loading branch information
Nondzu committed Sep 16, 2023
1 parent ebed6e8 commit cb8a180
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions make_torrent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import os
import subprocess
import time

def generate_torrents(input_folder, output_folder):
trackers = [
"https://atrack.pow7.com/announce",
"udp:https://explodie.org:6969/announce",
"udp:https://p4p.arenabg.com:1337/announce",
"https://pow7.com:80/announce",
"udp:https://tracker.opentrackr.org:1337/announce",
"udp:https://tracker.tiny-vps.com:6969/announce",
"https://tracker2.itzmx.com:6961/announce",
"udp:https://open.stealth.si:80/announce",
"https://p4p.arenabg.com:1337/announce",
"https://tracker.opentrackr.org:1337/announce"
]

folders = [f for f in os.listdir(input_folder) if os.path.isdir(os.path.join(input_folder, f))]
total_folders = len(folders)

start_time = time.time()

for i, folder in enumerate(folders, start=1):
output_file = os.path.join(output_folder, f"{folder}.torrent")
command = ["mktorrent", "-l", "22", "-p", "-o", output_file]

for tracker in trackers:
command.extend(["-a", tracker])

command.append(os.path.join(input_folder, folder))

print(f"Processing {i} of {total_folders}: {folder}")

folder_start_time = time.time()
subprocess.run(command)
folder_end_time = time.time()

print(f"Time taken for {folder}: {folder_end_time - folder_start_time} seconds")

end_time = time.time()

print(f"Total time taken: {end_time - start_time} seconds")

# Usage
generate_torrents("/home/kamil/ml/models/WizardLM", "/home/kamil/app/wi1")

0 comments on commit cb8a180

Please sign in to comment.