-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
63 lines (52 loc) · 2.29 KB
/
main.py
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import os
import subprocess
import sys
import src.daemon.daemon
import src.interface.cli
import src.discover.main
"""
Really-Bad-Copenheimer
Copyright (C) <2024> <Jacob Borstell>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
VERSION = "v1.3.0"
if __name__ == "__main__":
logo = f"""
_____ ____ _____ ______ _ _ _ _ ______ _____ __ __ ______ _____
/ ____/ __ \\| __ \\| ____| \\ | | | | | ____|_ _| \\/ | ____| __ \\
| | | | | | |__) | |__ | \\| | |__| | |__ | | | \\ / | |__ | |__) |
| | | | | | ___/| __| | . ` | __ | __| | | | |\\/| | __| | _ /
| |___| |__| | | | |____| |\\ | | | | |____ _| |_| | | | |____| | \\ \\
\\_____\\____/|_| |______|_| \\_|_| |_|______|_____|_| |_|______|_| \\_\\
Copenheimer {VERSION}
https://github.com/JacobborstellCoder/Really-bad-copenheimer
"""
if len(sys.argv) == 1:
print(logo)
print("Usage: [cli | start-daemon]")
print("System commands (intended for use within the program):")
print("[daemon-run | discover-run | rescan-run]")
elif len(sys.argv) == 2:
if sys.argv[1].lower() == "cli":
print(logo)
src.interface.cli.start()
elif sys.argv[1].lower() == "daemon-run":
src.daemon.daemon.start()
elif sys.argv[1].lower() == "discover-run":
src.discover.main.main()
elif sys.argv[1].lower() == "rescan-run":
pass
elif sys.argv[1].lower() == "start-daemon":
if os.name == "posix":
cmd = "( " + sys.executable + " " + __file__ + " daemon-run & )"
print(cmd)
proc = subprocess.Popen(["/bin/zsh", "-c", cmd], stderr=subprocess.STDOUT)