diff --git a/.gitignore b/.gitignore index 793db5d..ccd2d31 100644 --- a/.gitignore +++ b/.gitignore @@ -242,4 +242,4 @@ reddit-bot-351418-5560ebc49cac.json video_creation/data/videos.json video_creation/data/envvars.txt -config.toml +config.toml \ No newline at end of file diff --git a/main.py b/main.py index 893b4e2..81d755e 100755 --- a/main.py +++ b/main.py @@ -14,6 +14,7 @@ from utils.console import print_markdown, print_step, print_substep from utils import settings from utils.id import id from utils.version import checkversion +from utils.common import clear, setConsoleSize from video_creation.background import ( download_background, @@ -26,44 +27,12 @@ from video_creation.voices import save_text_to_mp3 __VERSION__ = "2.4.1" -### 3 util functions. by github.com/notcooler ### -def getPlatform(): - plt = "unknown" - if platform == "linux" or platform == "linux2": - plt = "lin" - elif platform == "win32": - plt = "win" - elif platform == "darwin": - plt = "mac" - return plt - -def clear(): - if getPlatform() == "win": - os.system('cls') - elif getPlatform() == "lin" or getPlatform() == "mac": - os.system('clear') - else: - pass -def setConsoleSize(*_x, **_y): - x = '23' - y = '78' - if _x != None and len(_x) != 0: x = str(_x[0]) - if _y != None and len(_x) != 0: y = str(_x[1]) - if getPlatform() == "win": - os.system(f'mode {y},{x}') - elif getPlatform() == "lin" or getPlatform() == "mac": - os.system(f'resize -s {x} {y}') - else: - pass - -### end util functions ### +# Set console size so the banner looks good. # +setConsoleSize(389, 20); # Clear console # clear() -# Set console size so the banner looks good. # -setConsoleSize(389, 20); - # Print Banner print( """ diff --git a/utils/common.py b/utils/common.py new file mode 100644 index 0000000..3af2149 --- /dev/null +++ b/utils/common.py @@ -0,0 +1,37 @@ +# imports # +from sys import platform +import os + +### 3 util functions. by github.com/notcooler ### +def getPlatform(): + plt = "unknown" + if platform == "linux" or platform == "linux2": + plt = "lin" + elif platform == "win32": + plt = "win" + elif platform == "darwin": + plt = "mac" + return plt + +def clear(): + print(getPlatform()) + if getPlatform() == "win": + os.system('cls') + elif getPlatform() == "lin" or getPlatform() == "mac": + os.system('clear') + else: + pass + +def setConsoleSize(*_x, **_y): + x = '23' + y = '78' + if _x != None and len(_x) != 0: x = str(_x[0]) + if _y != None and len(_x) != 0: y = str(_x[1]) + if getPlatform() == "win": + os.system(f'mode {x},{y}') + elif getPlatform() == "lin" or getPlatform() == "mac": + os.system(f'resize -s {y} {x}') + else: + pass + +### end util functions ### \ No newline at end of file