forked from MisterDaneel/Ratio.py
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathratio.py
More file actions
34 lines (25 loc) · 818 Bytes
/
ratio.py
File metadata and controls
34 lines (25 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from code.process_torrent import process_torrent
import argparse
import json
import sys
def parse_args():
"""Create the arguments"""
parser = argparse.ArgumentParser('\nratio.py -c <configuration-file.json>')
parser.add_argument("-c", "--configuration", help="Configuration file")
return parser.parse_args()
def load_configuration(configuration_file):
with open(configuration_file) as f:
configuration = json.load(f)
if 'torrent' not in configuration:
return None
return configuration
if __name__ == "__main__":
args = parse_args()
if args.configuration:
configuration = load_configuration(args.configuration)
else:
sys.exit()
if not configuration:
sys.exit()
to = process_torrent(configuration)
to.tracker_process()