utils on another script

pull/1172/head
cooler 4 years ago
parent 61fff84a91
commit fe173decc6

2
.gitignore vendored

@ -242,4 +242,4 @@ reddit-bot-351418-5560ebc49cac.json
video_creation/data/videos.json video_creation/data/videos.json
video_creation/data/envvars.txt video_creation/data/envvars.txt
config.toml config.toml

@ -14,6 +14,7 @@ from utils.console import print_markdown, print_step, print_substep
from utils import settings from utils import settings
from utils.id import id from utils.id import id
from utils.version import checkversion from utils.version import checkversion
from utils.common import clear, setConsoleSize
from video_creation.background import ( from video_creation.background import (
download_background, download_background,
@ -26,44 +27,12 @@ from video_creation.voices import save_text_to_mp3
__VERSION__ = "2.4.1" __VERSION__ = "2.4.1"
### 3 util functions. by github.com/notcooler ### # Set console size so the banner looks good. #
def getPlatform(): setConsoleSize(389, 20);
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 ###
# Clear console # # Clear console #
clear() clear()
# Set console size so the banner looks good. #
setConsoleSize(389, 20);
# Print Banner # Print Banner
print( print(
""" """

@ -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 ###
Loading…
Cancel
Save