-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
77 lines (64 loc) · 2.23 KB
/
main.py
File metadata and controls
77 lines (64 loc) · 2.23 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# maraud, v0.0.1.dev-alpha WIP
# (main code and documentation)
# Copyright (c) 2025 Kian Schmalzl
# -- Links & Resources --
# Github Page ....................... https://github.com/schmalzl/maraud
# Documentation ..................... https://github.com/schmalzl/maraud/blob/master/docs/docs.md
# Releases & Changelog .............. https://github.com/schmalzl/maraud/blob/master/docs/changelog.txt
# Issues & support .................. https://github.com/schmalzl/maraud/issues
# Import sys for pycache deactivation
import sys
# Disable creation of bytecode when debugging.
sys.dont_write_bytecode = True
# main includes
import os # file access and manipulation
import sys # recieve commandline arguments
import platform # OS & architecture information
# yt-dlp downloader api
import yt_dlp # type: ignore
import time # timeout
import colorama # terminal styling
from colorama import init, Fore, Back, Style
# constants
VERSION_STR = "0.0.1.dev-alpha"
REV = "WIP"
COPYRIGHT = "(c) 2025 Kian Schmalzl"
def version():
client_system = platform.system()
architecture = platform.machine()
client = ""
if client_system == "Windows":
client = "win"
elif client_system == "Darwin":
client = "apple"
elif client_system == "Linux":
client = "unix"
full_arch_str = client + "_" + architecture
print(f"maraud ({full_arch_str}, {REV}) {VERSION_STR}")
print(f"Copyright {COPYRIGHT}")
print("")
def help():
print("USAGE...")
def excp_invalidUsage():
print("maraud: " + Fore.LIGHTRED_EX + "fatal error: " + Fore.RESET + "invalid input")
print("process terminated.")
print("")
def run():
init(autoreset=True) # initialize colorama with autoreset enabled.
if len(sys.argv) > 1:
# sys.argv[array]
# check first argv
if(sys.argv[1] == "--version" or sys.argv[1] == "-v"):
version()
elif(sys.argv[1] == "--help" or sys.argv[1] == "-h"):
help()
elif(sys.argv[1] == "-i"):
print("starting...")
else:
excp_invalidUsage()
else:
# throw exception
excp_invalidUsage()
# program entry point
if __name__ == "__main__":
run()