-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
28 lines (24 loc) · 877 Bytes
/
run.py
File metadata and controls
28 lines (24 loc) · 877 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
from src.worker import Worker
import sys
import os
def print_usage():
print("Usage:")
print(" run.py")
print(" run.py --dry-run")
print(" run.py --refresh <movie|series|standup> <count>")
if len(sys.argv) > 1 and sys.argv[1] in ["-d", "--dry-run"]:
Worker().start(dry_run=True)
elif len(sys.argv) > 1 and sys.argv[1] == "--refresh":
if len(sys.argv) != 4:
print_usage()
raise SystemExit(1)
if os.getuid() != 0:
print("You are not running this script as root. This may cause issues with reading files on filesystem\n")
Worker().start(dry_run=False, refresh_media_type=sys.argv[2], refresh_count=sys.argv[3])
elif len(sys.argv) == 1:
if os.getuid() != 0:
print("You are not running this script as root. This may cause issues with reading files on filesystem\n")
Worker().start(dry_run=False)
else:
print_usage()
raise SystemExit(1)