Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
66ec64fa30 | |||
a573edc03a | |||
5d2da989d6 |
27
daemon.py
27
daemon.py
@@ -44,12 +44,6 @@ import ast
|
|||||||
import inputimeout
|
import inputimeout
|
||||||
import telegram_send
|
import telegram_send
|
||||||
|
|
||||||
if getOS() == "windows":
|
|
||||||
import winsound
|
|
||||||
from playsound import playsound
|
|
||||||
else:
|
|
||||||
from playsound import playsound
|
|
||||||
|
|
||||||
menu_choose = None
|
menu_choose = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -273,7 +267,26 @@ def main(source='deamon'):
|
|||||||
|
|
||||||
today = date.today().strftime("%d.%m.%Y")
|
today = date.today().strftime("%d.%m.%Y")
|
||||||
|
|
||||||
if (today == lesson_date) or (getDayNum(today) == lesson_repeat_day):
|
diff = ((datetime.strptime(today, "%d.%m.%Y") - datetime.strptime(lesson_date, "%d.%m.%Y")).days)
|
||||||
|
|
||||||
|
if getConfig("debug"):
|
||||||
|
print(f'{nowtime()} Конференция {CYAN}{lesson_name}{RESET}: Разница дней {BRED}{diff}{RESET}, Повторение {BRED}{lesson_repeat}{RESET}.')
|
||||||
|
|
||||||
|
if diff > 0 and not lesson_repeat:
|
||||||
|
|
||||||
|
if getConfig("remove_old"):
|
||||||
|
|
||||||
|
del lessons_list[lessons_list.index(les)]
|
||||||
|
|
||||||
|
saveJson(files_folder+'lessons.json', lessons_list)
|
||||||
|
appendLog(f'Old lesson named {lesson_name} removed')
|
||||||
|
|
||||||
|
if getConfig("debug"):
|
||||||
|
print(f'{nowtime()} Старая конференция {CYAN}{lesson_name}{RESET} за {CYAN}{lesson_date} {RESET}в {BRED}{lesson_time}{RESET} удалена.')
|
||||||
|
|
||||||
|
lessons_list = getLessons()
|
||||||
|
|
||||||
|
elif (today == lesson_date) or (getDayNum(today) == lesson_repeat_day):
|
||||||
print(f'{BBLACK}================================================{RESET}\n')
|
print(f'{BBLACK}================================================{RESET}\n')
|
||||||
|
|
||||||
print(f'{nowtime()} Найдена конференция {CYAN}{lesson_name}{RESET} в {BRED}{lesson_time}{RESET}. Ждём начала...')
|
print(f'{nowtime()} Найдена конференция {CYAN}{lesson_name}{RESET} в {BRED}{lesson_time}{RESET}. Ждём начала...')
|
||||||
|
56
editor.py
56
editor.py
@@ -65,8 +65,11 @@ def listLessons(from_where='remove'):
|
|||||||
|
|
||||||
|
|
||||||
def sortLessons(dictionary):
|
def sortLessons(dictionary):
|
||||||
dictionary.sort(key = lambda x: datetime.strptime(x['time'], '%H:%M'))
|
if getConfig("debug"):
|
||||||
dictionary.sort(key = lambda x: datetime.strptime(x['date'], '%d.%m.%Y'))
|
print(dictionary)
|
||||||
|
|
||||||
|
dictionary.sort(key = lambda x: datetime.strptime(x["time"], '%H:%M'))
|
||||||
|
dictionary.sort(key = lambda x: datetime.strptime(x["date"], '%d.%m.%Y'))
|
||||||
appendLog('Lessons dictionary sorted')
|
appendLog('Lessons dictionary sorted')
|
||||||
|
|
||||||
|
|
||||||
@@ -95,6 +98,7 @@ def addLesson():
|
|||||||
lessons_got = getLessons()
|
lessons_got = getLessons()
|
||||||
|
|
||||||
lessname = input(f'{RESET}Введите (своё) имя конференции:\n{BBLACK}Нужно лишь для отображения в Discord и самом AutoZoom{RESET}\n\n > {CYAN}')
|
lessname = input(f'{RESET}Введите (своё) имя конференции:\n{BBLACK}Нужно лишь для отображения в Discord и самом AutoZoom{RESET}\n\n > {CYAN}')
|
||||||
|
lessname = strCleaner(lessname)
|
||||||
local_lessons.update({"name": lessname})
|
local_lessons.update({"name": lessname})
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
@@ -204,6 +208,7 @@ def addLesson():
|
|||||||
|
|
||||||
clear()
|
clear()
|
||||||
lesslink = input(f'{RESET}Введите ссылку на конференцию:\n{BBLACK}Формат: {BRED}https://us01web.zoom.us/j/ИДЕНТИФИКАТОР?pwd=ПАРОЛЬ{RESET}\n{BBLACK}Либо введите {YELLOW}1 {BBLACK}для добавления по номеру и паролю{RESET}\n\n > {BRED}').replace(" ", "")
|
lesslink = input(f'{RESET}Введите ссылку на конференцию:\n{BBLACK}Формат: {BRED}https://us01web.zoom.us/j/ИДЕНТИФИКАТОР?pwd=ПАРОЛЬ{RESET}\n{BBLACK}Либо введите {YELLOW}1 {BBLACK}для добавления по номеру и паролю{RESET}\n\n > {BRED}').replace(" ", "")
|
||||||
|
lesslink = strCleaner(lesslink)
|
||||||
|
|
||||||
if lesslink.replace(' ', '') == '1':
|
if lesslink.replace(' ', '') == '1':
|
||||||
clear()
|
clear()
|
||||||
@@ -309,6 +314,8 @@ def editLesson():
|
|||||||
|
|
||||||
clear()
|
clear()
|
||||||
lessname = input(f'{RESET}Введите (своё) имя конференции:\n{BBLACK}Нужно лишь для отображения в Discord и самом AutoZoom{RESET}\n\nОригинальное имя: {CYAN}{lessons_got[edi]["name"]}{RESET}\n\n > {CYAN}')
|
lessname = input(f'{RESET}Введите (своё) имя конференции:\n{BBLACK}Нужно лишь для отображения в Discord и самом AutoZoom{RESET}\n\nОригинальное имя: {CYAN}{lessons_got[edi]["name"]}{RESET}\n\n > {CYAN}')
|
||||||
|
lessname = strCleaner(lessname)
|
||||||
|
|
||||||
if lessname == '':
|
if lessname == '':
|
||||||
lessname = lessons_got[edi]["name"]
|
lessname = lessons_got[edi]["name"]
|
||||||
local_lessons.update({"name": lessname})
|
local_lessons.update({"name": lessname})
|
||||||
@@ -366,10 +373,23 @@ def editLesson():
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
clear()
|
clear()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
lesstime = input(f'{RESET}Введите время конференции ({BRED}ЧЧ:ММ{RESET}):\n\nОригинальное время: {BRED}{lessons_got[edi]["time"]}{RESET}\n\n > {BRED}')
|
lesstime = input(f'{RESET}Введите время конференции ({BRED}ЧЧ:ММ{RESET}):\n\nОригинальное время: {BRED}{lessons_got[edi]["time"]}{RESET}\n\n > {BRED}')
|
||||||
finallesstime = (datetime.strptime(lesstime, "%H:%M"))
|
|
||||||
|
if lesstime == '':
|
||||||
|
finallesstime = lessons_got[edi]["time"]
|
||||||
|
lesstime = lessons_got[edi]["time"]
|
||||||
|
|
||||||
local_lessons.update({"time": lesstime})
|
local_lessons.update({"time": lesstime})
|
||||||
|
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
finallesstime = (datetime.strptime(lesstime, "%H:%M"))
|
||||||
|
finallesstime = lesstime
|
||||||
|
|
||||||
|
local_lessons.update({"time": lesstime})
|
||||||
|
|
||||||
abort = "skip"
|
abort = "skip"
|
||||||
conflict = False
|
conflict = False
|
||||||
conflictles = ''
|
conflictles = ''
|
||||||
@@ -408,12 +428,15 @@ def editLesson():
|
|||||||
|
|
||||||
if abort == "restart":
|
if abort == "restart":
|
||||||
continue
|
continue
|
||||||
|
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
except Exception as exp:
|
except Exception as exp:
|
||||||
none = input(exp)
|
none = input(exp)
|
||||||
pass
|
pass
|
||||||
|
except:
|
||||||
|
continue
|
||||||
|
|
||||||
break
|
break
|
||||||
except:
|
except:
|
||||||
@@ -421,6 +444,7 @@ def editLesson():
|
|||||||
|
|
||||||
clear()
|
clear()
|
||||||
lesslink = input(f'{RESET}Введите ссылку на конференцию:\n{BBLACK}Формат: {BRED}https://us01web.zoom.us/j/ИДЕНТИФИКАТОР?pwd=ПАРОЛЬ{RESET}\n{BBLACK}Либо введите {YELLOW}1 {BBLACK}для добавления по номеру и паролю{RESET}\n\n > {BRED}').replace(" ", "")
|
lesslink = input(f'{RESET}Введите ссылку на конференцию:\n{BBLACK}Формат: {BRED}https://us01web.zoom.us/j/ИДЕНТИФИКАТОР?pwd=ПАРОЛЬ{RESET}\n{BBLACK}Либо введите {YELLOW}1 {BBLACK}для добавления по номеру и паролю{RESET}\n\n > {BRED}').replace(" ", "")
|
||||||
|
lesslink = strCleaner(lesslink)
|
||||||
|
|
||||||
if lesslink.replace(' ', '') == '1':
|
if lesslink.replace(' ', '') == '1':
|
||||||
clear()
|
clear()
|
||||||
@@ -587,6 +611,32 @@ def removeAllLessons():
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def debugLesson():
|
||||||
|
try:
|
||||||
|
from profile import debuglink, name
|
||||||
|
appendLog('Debug link added to the list')
|
||||||
|
|
||||||
|
local_lessons = {}
|
||||||
|
lessons_got = getLessons()
|
||||||
|
|
||||||
|
local_lessons.update({"name": "Debug Lesson"})
|
||||||
|
local_lessons.update({"date": date.today().strftime("%d.%m.%Y")})
|
||||||
|
local_lessons.update({"time": "00:00"})
|
||||||
|
local_lessons.update({"link": debuglink})
|
||||||
|
local_lessons.update({"repeat": False})
|
||||||
|
local_lessons.update({"repeat_day": None})
|
||||||
|
local_lessons.update({"record": True})
|
||||||
|
|
||||||
|
lessons_got.append(dict(local_lessons))
|
||||||
|
sortLessons(lessons_got)
|
||||||
|
saveJson(files_folder+'lessons.json', lessons_got)
|
||||||
|
|
||||||
|
return f"{RESET}Конференция для отладки профиля {CYAN}{name} {RESET}была добавлена."
|
||||||
|
|
||||||
|
except:
|
||||||
|
return f"{RESET}Для отладки нужен профиль {BRED}profile.py {RESET}со ссылкой на конференцию {BRED}debuglink {RESET}и именем {BRED}name{RESET}."
|
||||||
|
|
||||||
|
|
||||||
def editor():
|
def editor():
|
||||||
try:
|
try:
|
||||||
setTitle("AutoZoom (Редактор)", getOS())
|
setTitle("AutoZoom (Редактор)", getOS())
|
||||||
|
19
functions.py
19
functions.py
@@ -31,6 +31,7 @@ default_config = {
|
|||||||
"run_fullscreen": False,
|
"run_fullscreen": False,
|
||||||
"use_rpc": True,
|
"use_rpc": True,
|
||||||
"sounds": True,
|
"sounds": True,
|
||||||
|
"remove_old": True,
|
||||||
"end_mode": "shutdown",
|
"end_mode": "shutdown",
|
||||||
"obs_exe": None,
|
"obs_exe": None,
|
||||||
"obs_core": None,
|
"obs_core": None,
|
||||||
@@ -70,6 +71,14 @@ else:
|
|||||||
clear = lambda: os.system('clear')
|
clear = lambda: os.system('clear')
|
||||||
|
|
||||||
|
|
||||||
|
# Импортирование игралки звуков
|
||||||
|
if getOS() == "windows":
|
||||||
|
import winsound
|
||||||
|
from playsound import playsound
|
||||||
|
elif getOS() == "unix":
|
||||||
|
from playsound import playsound
|
||||||
|
|
||||||
|
|
||||||
# Установка заголовка окна cmd.exe
|
# Установка заголовка окна cmd.exe
|
||||||
def setTitle(title, system):
|
def setTitle(title, system):
|
||||||
if system == "windows":
|
if system == "windows":
|
||||||
@@ -206,6 +215,16 @@ def playSound(soundname, timing=''):
|
|||||||
print(f'{timing} Не удалось проиграть playsound звук "{soundname}" (Ошибка: {exp})')
|
print(f'{timing} Не удалось проиграть playsound звук "{soundname}" (Ошибка: {exp})')
|
||||||
|
|
||||||
|
|
||||||
|
# Функция удаления ненужного мусора из строки
|
||||||
|
def strCleaner(string):
|
||||||
|
|
||||||
|
output = string.replace('"', '\"').replace('\n', '')
|
||||||
|
|
||||||
|
appendLog(f"String cleaned: {output}")
|
||||||
|
|
||||||
|
return output
|
||||||
|
|
||||||
|
|
||||||
# Функция добавления переменных, если их нет
|
# Функция добавления переменных, если их нет
|
||||||
def repairConfig(some_dic):
|
def repairConfig(some_dic):
|
||||||
|
|
||||||
|
@@ -116,6 +116,7 @@ if getOS() != "android":
|
|||||||
libs.append("playsound")
|
libs.append("playsound")
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
|
if not "play-audio" in os.popen('pkg list-all').read():
|
||||||
os.system('pkg install play-audio')
|
os.system('pkg install play-audio')
|
||||||
except:
|
except:
|
||||||
appendLog("Could not install play-audio")
|
appendLog("Could not install play-audio")
|
||||||
|
61
main.py
61
main.py
@@ -36,7 +36,7 @@ import keyboard
|
|||||||
import getpass
|
import getpass
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
|
|
||||||
version = 2.1
|
version = 2.3
|
||||||
path = Path(__file__).resolve().parent
|
path = Path(__file__).resolve().parent
|
||||||
|
|
||||||
def mainMenu():
|
def mainMenu():
|
||||||
@@ -63,7 +63,7 @@ def mainMenu():
|
|||||||
except Exception as exp:
|
except Exception as exp:
|
||||||
appendLog(f'Version number load failed {exp}')
|
appendLog(f'Version number load failed {exp}')
|
||||||
setTitle("Ошибка загрузки данных", getOS())
|
setTitle("Ошибка загрузки данных", getOS())
|
||||||
print(f'Не удалось загрузить данные о последней версии.\nПроверьте подключение к сети и повторите попытку.\n\nСтатус сервера центра обновлений:\n{BRED}https://status.end-play.xyz/786373747{RESET}')
|
print(f'Не удалось загрузить данные о последней версии.\nПроверьте подключение к сети и повторите попытку.\n\nСтатус сервера центра обновлений:\n{BRED}https://stats.uptimerobot.com/OqwR9iAqBg{RESET}')
|
||||||
|
|
||||||
todo = input(f'\nВведите {BRED}ignore {RESET}чтобы выключить проверку обновлений и продолжить\nлибо введите что угодно иное чтобы закрыть программу.\n\n > {BRED}')
|
todo = input(f'\nВведите {BRED}ignore {RESET}чтобы выключить проверку обновлений и продолжить\nлибо введите что угодно иное чтобы закрыть программу.\n\n > {BRED}')
|
||||||
|
|
||||||
@@ -167,8 +167,10 @@ def helpMenu():
|
|||||||
print(f' {BRED}3.{RESET} Центр поддержки')
|
print(f' {BRED}3.{RESET} Центр поддержки')
|
||||||
print(f' {BRED}4.{RESET} Telegram проекта')
|
print(f' {BRED}4.{RESET} Telegram проекта')
|
||||||
print(f' {BRED}5.{RESET} Связаться с автором')
|
print(f' {BRED}5.{RESET} Связаться с автором')
|
||||||
print(f' {BRED}6.{RESET} Сводка информации')
|
print(f' {BRED}6.{RESET} Поддержать проект')
|
||||||
print(f' {BRED}7.{RESET} В главное меню')
|
print(f' {BRED}7.{RESET} Список поддержавших')
|
||||||
|
print(f' {BRED}8.{RESET} Сводка информации')
|
||||||
|
print(f' {BRED}9.{RESET} В главное меню')
|
||||||
|
|
||||||
help_choose = input(f'\n > {BRED}')
|
help_choose = input(f'\n > {BRED}')
|
||||||
|
|
||||||
@@ -222,7 +224,27 @@ def helpMenu():
|
|||||||
appendLog(f'Failed to open AutoZoom\'s developer Telegram: {exp}')
|
appendLog(f'Failed to open AutoZoom\'s developer Telegram: {exp}')
|
||||||
none = input(f'{RESET}Не удалось открыть страницу вашего браузера.\nВы можете открыть адрес самостоятельно: {BRED}https://t.me/profitroll{RESET}\n\n > ')
|
none = input(f'{RESET}Не удалось открыть страницу вашего браузера.\nВы можете открыть адрес самостоятельно: {BRED}https://t.me/profitroll{RESET}\n\n > ')
|
||||||
clear()
|
clear()
|
||||||
if help_choose == '6':
|
elif help_choose == '6':
|
||||||
|
try:
|
||||||
|
clear()
|
||||||
|
appendLog('Opened AutoZoom\'s donation page')
|
||||||
|
webbrowser.open("https://www.end-play.xyz/autozoom/donate")
|
||||||
|
except Exception as exp:
|
||||||
|
clear()
|
||||||
|
appendLog(f'Failed to open AutoZoom\'s donation page: {exp}')
|
||||||
|
none = input(f'{RESET}Не удалось открыть страницу вашего браузера.\nВы можете открыть адрес самостоятельно: {BRED}https://www.end-play.xyz/autozoom/donate{RESET}\n\n > ')
|
||||||
|
clear()
|
||||||
|
elif help_choose == '7':
|
||||||
|
try:
|
||||||
|
clear()
|
||||||
|
print(f'{BBLACK}»{RESET} Список поддержавших проект:\n\n{(requests.get("https://www.end-play.xyz/AutoZoomDonors.txt").text).replace("-", RESET+" •"+BRED)}{RESET}')
|
||||||
|
except Exception as exp:
|
||||||
|
clear()
|
||||||
|
appendLog(f'Failed to load donation list {exp}')
|
||||||
|
print(f'{RESET}Не удалось загрузить данные о списке поддержавших проект.\nВы можете посмотреть его самостоятельно: {BRED}https://www.end-play.xyz/AutoZoomDonors.txt')
|
||||||
|
none = input('\n > ')
|
||||||
|
clear()
|
||||||
|
if help_choose == '8':
|
||||||
clear()
|
clear()
|
||||||
|
|
||||||
if getState("RBTray.exe"):
|
if getState("RBTray.exe"):
|
||||||
@@ -257,7 +279,7 @@ def helpMenu():
|
|||||||
print(f' {BBLACK}•{RESET} Discord RPC: {dsrpc}')
|
print(f' {BBLACK}•{RESET} Discord RPC: {dsrpc}')
|
||||||
none = input('\n > ')
|
none = input('\n > ')
|
||||||
clear()
|
clear()
|
||||||
elif help_choose == '7':
|
elif help_choose == '9':
|
||||||
rpc.inMenu()
|
rpc.inMenu()
|
||||||
clear()
|
clear()
|
||||||
setTitle("AutoZoom (Главная)", getOS())
|
setTitle("AutoZoom (Главная)", getOS())
|
||||||
@@ -282,10 +304,12 @@ def devMenu():
|
|||||||
print(f' {BRED}1.{RESET} PlaySound test')
|
print(f' {BRED}1.{RESET} PlaySound test')
|
||||||
print(f' {BRED}2.{RESET} WinSound test')
|
print(f' {BRED}2.{RESET} WinSound test')
|
||||||
print(f' {BRED}3.{RESET} Play-audio test')
|
print(f' {BRED}3.{RESET} Play-audio test')
|
||||||
print(f' {BRED}4.{RESET} OS check test')
|
print(f' {BRED}4.{RESET} playSound function test')
|
||||||
print(f' {BRED}5.{RESET} Telegram test')
|
print(f' {BRED}5.{RESET} OS check test')
|
||||||
print(f' {BRED}6.{RESET} Color test')
|
print(f' {BRED}6.{RESET} Telegram test')
|
||||||
print(f' {BRED}7.{RESET} Exit to menu')
|
print(f' {BRED}7.{RESET} Zoom meeting test')
|
||||||
|
print(f' {BRED}8.{RESET} Color test')
|
||||||
|
print(f' {BRED}9.{RESET} Exit to menu')
|
||||||
|
|
||||||
choose = input(f'\n > {BRED}')
|
choose = input(f'\n > {BRED}')
|
||||||
|
|
||||||
@@ -304,17 +328,27 @@ def devMenu():
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
elif choose == '4':
|
elif choose == '4':
|
||||||
|
playSound("debug")
|
||||||
|
continue
|
||||||
|
|
||||||
|
elif choose == '5':
|
||||||
clear()
|
clear()
|
||||||
none = input(f'{RESET}{getOS()}\n\n > ')
|
none = input(f'{RESET}{getOS()}\n\n > ')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
elif choose == '5':
|
elif choose == '6':
|
||||||
clear()
|
clear()
|
||||||
import telegram_send
|
import telegram_send
|
||||||
telegram_send.send(messages=["Telegram message test"], parse_mode="markdown", conf=files_folder+"telegram.conf")
|
telegram_send.send(messages=["Telegram message test"], parse_mode="markdown", conf=files_folder+"telegram.conf")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
elif choose == '6':
|
elif choose == '7':
|
||||||
|
clear()
|
||||||
|
print(editor.debugLesson())
|
||||||
|
none = input(f'{RESET}\n > ')
|
||||||
|
continue
|
||||||
|
|
||||||
|
elif choose == '8':
|
||||||
clear()
|
clear()
|
||||||
print(f'{BLACK}███{RED}███{GREEN}███{YELLOW}███{BLUE}███{MAGENTA}███{CYAN}███{WHITE}███')
|
print(f'{BLACK}███{RED}███{GREEN}███{YELLOW}███{BLUE}███{MAGENTA}███{CYAN}███{WHITE}███')
|
||||||
print(f'{BBLACK}███{BRED}███{BGREEN}███{BYELLOW}███{BBLUE}███{BMAGENTA}███{BCYAN}███{BWHITE}███')
|
print(f'{BBLACK}███{BRED}███{BGREEN}███{BYELLOW}███{BBLUE}███{BMAGENTA}███{BCYAN}███{BWHITE}███')
|
||||||
@@ -324,7 +358,7 @@ def devMenu():
|
|||||||
none = input(RESET+'\n > ')
|
none = input(RESET+'\n > ')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
elif choose == '7':
|
elif choose == '9':
|
||||||
rpc.inMenu()
|
rpc.inMenu()
|
||||||
clear()
|
clear()
|
||||||
setTitle("AutoZoom (Главная)", getOS())
|
setTitle("AutoZoom (Главная)", getOS())
|
||||||
@@ -382,6 +416,7 @@ def updater(serv_ver, version):
|
|||||||
print(f' {BRED}1.{RESET} Установить')
|
print(f' {BRED}1.{RESET} Установить')
|
||||||
print(f' {BRED}2.{RESET} Отменить')
|
print(f' {BRED}2.{RESET} Отменить')
|
||||||
updater_decide = input(f'\n > {BRED}')
|
updater_decide = input(f'\n > {BRED}')
|
||||||
|
print(RESET)
|
||||||
|
|
||||||
if updater_decide == '1':
|
if updater_decide == '1':
|
||||||
appendLog('Trying to update AutoZoom')
|
appendLog('Trying to update AutoZoom')
|
||||||
|
24
rpc.py
24
rpc.py
@@ -6,7 +6,7 @@ import sys
|
|||||||
from colors import *
|
from colors import *
|
||||||
from functions import *
|
from functions import *
|
||||||
|
|
||||||
version = '2.1'
|
version = '2.3'
|
||||||
|
|
||||||
import libinstaller
|
import libinstaller
|
||||||
from pypresence import Presence
|
from pypresence import Presence
|
||||||
@@ -59,7 +59,7 @@ def waitLesson(lesson, start):
|
|||||||
if getConfig("use_rpc") and getOS != "android":
|
if getConfig("use_rpc") and getOS != "android":
|
||||||
if connected == False:
|
if connected == False:
|
||||||
connect()
|
connect()
|
||||||
RPC.update(large_image='1024_cover', small_image='status_waiting', large_text=f'AutoZoom • v{version}\nhttp://bit.ly/auto_zoom', small_text='Ожидание', state=f'Ждём начала «{lesson}»', details='Конференция не началась', start=start)
|
RPC.update(large_image='1024_cover', small_image='status_waiting', large_text=f'AutoZoom • v{str(version)}\nhttp://bit.ly/auto_zoom', small_text='Ожидание', state=f'Ждём начала «{lesson}»', details='Конференция не началась', start=start)
|
||||||
appendLog(f'Discord RPC changed to waitLesson (Lesson: {lesson}, Start: {start})')
|
appendLog(f'Discord RPC changed to waitLesson (Lesson: {lesson}, Start: {start})')
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
appendLog('Discord RPC failed to change status')
|
appendLog('Discord RPC failed to change status')
|
||||||
@@ -77,7 +77,7 @@ def onLesson(lesson, start):
|
|||||||
if getConfig("use_rpc") and getOS != "android":
|
if getConfig("use_rpc") and getOS != "android":
|
||||||
if connected == False:
|
if connected == False:
|
||||||
connect()
|
connect()
|
||||||
RPC.update(large_image='1024_cover', small_image='status_lesson', large_text=f'AutoZoom • v{version}\nhttp://bit.ly/auto_zoom', small_text='Конференция', state=f'Слушаем «{lesson}»', details='Идёт конференция', start=start)
|
RPC.update(large_image='1024_cover', small_image='status_lesson', large_text=f'AutoZoom • v{str(version)}\nhttp://bit.ly/auto_zoom', small_text='Конференция', state=f'Слушаем «{lesson}»', details='Идёт конференция', start=start)
|
||||||
appendLog(f'Discord RPC changed to onLesson (Lesson: {lesson}, Start: {start})')
|
appendLog(f'Discord RPC changed to onLesson (Lesson: {lesson}, Start: {start})')
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
appendLog('Discord RPC failed to change status')
|
appendLog('Discord RPC failed to change status')
|
||||||
@@ -95,7 +95,7 @@ def inMenu():
|
|||||||
if getConfig("use_rpc") and getOS != "android":
|
if getConfig("use_rpc") and getOS != "android":
|
||||||
if connected == False:
|
if connected == False:
|
||||||
connect()
|
connect()
|
||||||
RPC.update(large_image='1024_cover', small_image='status_menu', large_text=f'AutoZoom • v{version}\nhttp://bit.ly/auto_zoom', small_text='Главное меню', state='Открыт список опций', details='В главном меню')
|
RPC.update(large_image='1024_cover', small_image='status_menu', large_text=f'AutoZoom • v{str(version)}\nhttp://bit.ly/auto_zoom', small_text='Главное меню', state='Открыт список опций', details='В главном меню')
|
||||||
appendLog('Discord RPC changed to inMenu')
|
appendLog('Discord RPC changed to inMenu')
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
appendLog('Discord RPC failed to change status')
|
appendLog('Discord RPC failed to change status')
|
||||||
@@ -113,7 +113,7 @@ def shutdown(end):
|
|||||||
if getConfig("use_rpc") and getOS != "android":
|
if getConfig("use_rpc") and getOS != "android":
|
||||||
if connected == False:
|
if connected == False:
|
||||||
connect()
|
connect()
|
||||||
RPC.update(large_image='1024_cover', small_image='status_shutdown', large_text=f'AutoZoom • v{version}\nhttp://bit.ly/auto_zoom', small_text='Выключение', state='Отсчёт до авто-выключения', details='Выключение ПК', end=end)
|
RPC.update(large_image='1024_cover', small_image='status_shutdown', large_text=f'AutoZoom • v{str(version)}\nhttp://bit.ly/auto_zoom', small_text='Выключение', state='Отсчёт до авто-выключения', details='Выключение ПК', end=end)
|
||||||
appendLog(f'Discord RPC changed to shutdown (End: {end})')
|
appendLog(f'Discord RPC changed to shutdown (End: {end})')
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
appendLog('Discord RPC failed to change status')
|
appendLog('Discord RPC failed to change status')
|
||||||
@@ -131,7 +131,7 @@ def inSettings():
|
|||||||
if getConfig("use_rpc") and getOS != "android":
|
if getConfig("use_rpc") and getOS != "android":
|
||||||
if connected == False:
|
if connected == False:
|
||||||
connect()
|
connect()
|
||||||
RPC.update(large_image='1024_cover', small_image='status_settings', large_text=f'AutoZoom • v{version}\nhttp://bit.ly/auto_zoom', small_text='Настройки', state='Открыты настройки', details='В главном меню')
|
RPC.update(large_image='1024_cover', small_image='status_settings', large_text=f'AutoZoom • v{str(version)}\nhttp://bit.ly/auto_zoom', small_text='Настройки', state='Открыты настройки', details='В главном меню')
|
||||||
appendLog('Discord RPC changed to inSettings')
|
appendLog('Discord RPC changed to inSettings')
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
appendLog('Discord RPC failed to change status')
|
appendLog('Discord RPC failed to change status')
|
||||||
@@ -149,7 +149,7 @@ def inDebug():
|
|||||||
if getConfig("use_rpc") and getOS != "android":
|
if getConfig("use_rpc") and getOS != "android":
|
||||||
if connected == False:
|
if connected == False:
|
||||||
connect()
|
connect()
|
||||||
RPC.update(large_image='1024_cover', small_image='status_debug', large_text=f'AutoZoom • v{version}\nhttp://bit.ly/auto_zoom', small_text='Отладка', state='Открыто меню отладки', details='В меню разработчика')
|
RPC.update(large_image='1024_cover', small_image='status_debug', large_text=f'AutoZoom • v{str(version)}\nhttp://bit.ly/auto_zoom', small_text='Отладка', state='Открыто меню отладки', details='В меню разработчика')
|
||||||
appendLog('Discord RPC changed to inDebug')
|
appendLog('Discord RPC changed to inDebug')
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
appendLog('Discord RPC failed to change status')
|
appendLog('Discord RPC failed to change status')
|
||||||
@@ -167,7 +167,7 @@ def inEditor():
|
|||||||
if getConfig("use_rpc") and getOS != "android":
|
if getConfig("use_rpc") and getOS != "android":
|
||||||
if connected == False:
|
if connected == False:
|
||||||
connect()
|
connect()
|
||||||
RPC.update(large_image='1024_cover', small_image='status_editing', large_text=f'AutoZoom • v{version}\nhttp://bit.ly/auto_zoom', small_text='Редактор', state='Открыт редактор', details='В главном меню')
|
RPC.update(large_image='1024_cover', small_image='status_editing', large_text=f'AutoZoom • v{str(version)}\nhttp://bit.ly/auto_zoom', small_text='Редактор', state='Открыт редактор', details='В главном меню')
|
||||||
appendLog('Discord RPC changed to inEditor')
|
appendLog('Discord RPC changed to inEditor')
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
appendLog('Discord RPC failed to change status')
|
appendLog('Discord RPC failed to change status')
|
||||||
@@ -185,7 +185,7 @@ def inUpdater():
|
|||||||
if getConfig("use_rpc") and getOS != "android":
|
if getConfig("use_rpc") and getOS != "android":
|
||||||
if connected == False:
|
if connected == False:
|
||||||
connect()
|
connect()
|
||||||
RPC.update(large_image='1024_cover', small_image='status_updating', large_text=f'AutoZoom • v{version}\nhttp://bit.ly/auto_zoom', small_text='Обновление', state='Открыт центр обновлений', details='В главном меню')
|
RPC.update(large_image='1024_cover', small_image='status_updating', large_text=f'AutoZoom • v{str(version)}\nhttp://bit.ly/auto_zoom', small_text='Обновление', state='Открыт центр обновлений', details='В главном меню')
|
||||||
appendLog('Discord RPC changed to inUpdater')
|
appendLog('Discord RPC changed to inUpdater')
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
appendLog('Discord RPC failed to change status')
|
appendLog('Discord RPC failed to change status')
|
||||||
@@ -203,7 +203,7 @@ def inHelp():
|
|||||||
if getConfig("use_rpc") and getOS != "android":
|
if getConfig("use_rpc") and getOS != "android":
|
||||||
if connected == False:
|
if connected == False:
|
||||||
connect()
|
connect()
|
||||||
RPC.update(large_image='1024_cover', small_image='status_support', large_text=f'AutoZoom • v{version}\nhttp://bit.ly/auto_zoom', small_text='Помощь', state='Открыта помощь', details='В главном меню')
|
RPC.update(large_image='1024_cover', small_image='status_support', large_text=f'AutoZoom • v{str(version)}\nhttp://bit.ly/auto_zoom', small_text='Помощь', state='Открыта помощь', details='В главном меню')
|
||||||
appendLog('Discord RPC changed to inHelp')
|
appendLog('Discord RPC changed to inHelp')
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
appendLog('Discord RPC failed to change status')
|
appendLog('Discord RPC failed to change status')
|
||||||
@@ -221,7 +221,7 @@ def lessonEnded():
|
|||||||
if getConfig("use_rpc") and getOS != "android":
|
if getConfig("use_rpc") and getOS != "android":
|
||||||
if connected == False:
|
if connected == False:
|
||||||
connect()
|
connect()
|
||||||
RPC.update(large_image='1024_cover', small_image='status_waiting', large_text=f'AutoZoom • v{version}\nhttp://bit.ly/auto_zoom', small_text='Ожидание', state=f'Ждём указаний', details='Все конференции закончились')
|
RPC.update(large_image='1024_cover', small_image='status_waiting', large_text=f'AutoZoom • v{str(version)}\nhttp://bit.ly/auto_zoom', small_text='Ожидание', state=f'Ждём указаний', details='Все конференции закончились')
|
||||||
appendLog('Discord RPC changed to lessonEnded')
|
appendLog('Discord RPC changed to lessonEnded')
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
appendLog('Discord RPC failed to change status')
|
appendLog('Discord RPC failed to change status')
|
||||||
@@ -238,7 +238,7 @@ def lessonEnded():
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
try:
|
try:
|
||||||
RPC.connect()
|
RPC.connect()
|
||||||
RPC.update(large_image='1024_cover', small_image='status_settings', large_text=f'AutoZoom • v{version}\nhttp://bit.ly/auto_zoom', small_text='Отладка', state='Модуль Discord RPC запущен в режиме тестирования', details='Режим отладки')
|
RPC.update(large_image='1024_cover', small_image='status_settings', large_text=f'AutoZoom • v{str(version)}\nhttp://bit.ly/auto_zoom', small_text='Отладка', state='Модуль Discord RPC запущен в режиме тестирования', details='Режим отладки')
|
||||||
appendLog('Discord RPC changed to debug')
|
appendLog('Discord RPC changed to debug')
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
appendLog('Discord RPC failed to change status')
|
appendLog('Discord RPC failed to change status')
|
||||||
|
26
settings.py
26
settings.py
@@ -413,6 +413,13 @@ def settings3():
|
|||||||
else:
|
else:
|
||||||
logs_val = f'{BRED}ERROR{RESET}'
|
logs_val = f'{BRED}ERROR{RESET}'
|
||||||
|
|
||||||
|
if getConfig("remove_old"):
|
||||||
|
remove_val = f'{BGREEN}Вкл.{RESET}'
|
||||||
|
elif not getConfig("remove_old"):
|
||||||
|
remove_val = f'{BRED}Выкл.{RESET}'
|
||||||
|
else:
|
||||||
|
remove_val = f'{BRED}ERROR{RESET}'
|
||||||
|
|
||||||
shutdown_time_val = getConfig("shutdown_timeout")
|
shutdown_time_val = getConfig("shutdown_timeout")
|
||||||
start_val = getConfig("start")
|
start_val = getConfig("start")
|
||||||
stop_val = getConfig("stop")
|
stop_val = getConfig("stop")
|
||||||
@@ -428,10 +435,13 @@ def settings3():
|
|||||||
print(f' {BRED}3.{RESET} Добавить в автозапуск')
|
print(f' {BRED}3.{RESET} Добавить в автозапуск')
|
||||||
print(f' {BBLACK}{winOnly(BRED, BBLACK, sysname, end=" ")}Автоматически запускать демона при входе в систему\n')
|
print(f' {BBLACK}{winOnly(BRED, BBLACK, sysname, end=" ")}Автоматически запускать демона при входе в систему\n')
|
||||||
|
|
||||||
print(f' {BRED}4.{RESET} Сбросить все настройки')
|
print(f' {BRED}4.{RESET} Удалять старые конференции ({remove_val})')
|
||||||
|
print(f' {BBLACK}Автоматически удалять одноразовые конференции которые были до дня запуска\n')
|
||||||
|
|
||||||
|
print(f' {BRED}5.{RESET} Сбросить все настройки')
|
||||||
print(f' {BBLACK}Восстановить настройки по умолчанию\n')
|
print(f' {BBLACK}Восстановить настройки по умолчанию\n')
|
||||||
|
|
||||||
print(f' {BRED}5.{RESET} Назад')
|
print(f' {BRED}6.{RESET} Назад')
|
||||||
print(f' {BBLACK}Вернуться на предыдущую страницу{RESET}\n')
|
print(f' {BBLACK}Вернуться на предыдущую страницу{RESET}\n')
|
||||||
|
|
||||||
print(f' {BBLACK}Для переключения параметров Вкл/Выкл просто введите номер{RESET}') #\n Если окно приложения слишком мелкое - увеличьте его или листайте это меню{RESET}')
|
print(f' {BBLACK}Для переключения параметров Вкл/Выкл просто введите номер{RESET}') #\n Если окно приложения слишком мелкое - увеличьте его или листайте это меню{RESET}')
|
||||||
@@ -468,18 +478,18 @@ def settings3():
|
|||||||
|
|
||||||
shutil.copyfile('daemon.bat', 'startdaemon.bat')
|
shutil.copyfile('daemon.bat', 'startdaemon.bat')
|
||||||
|
|
||||||
with open('startdaemon.bat', 'r') as f :
|
with open('startdaemon.bat', 'r', encoding='utf-8') as f :
|
||||||
filedata = f.read()
|
filedata = f.read()
|
||||||
filedata = filedata.replace('python daemon.py', f'python {path}\\daemon.py')
|
filedata = filedata.replace('python daemon.py', f'python {path}\\daemon.py')
|
||||||
|
|
||||||
with open('startdaemon.bat', 'w') as f:
|
with open('startdaemon.bat', 'w', encoding="utf-8") as f:
|
||||||
f.write(filedata)
|
f.write(filedata)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
swl.create_lnk(f'{path}\\startdaemon.bat', f'{pathlib.Path.home()}\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\AutoZoomDaemon.lnk')
|
swl.create_lnk(f'{path}\\startdaemon.bat', f'{pathlib.Path.home()}\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\AutoZoomDaemon.lnk')
|
||||||
appendLog('Autorun script added')
|
appendLog('Autorun script added')
|
||||||
|
|
||||||
none = input(f'Демон AutoZoom был добавлен в автозапуск.\nПуть: {BRED}{pathlib.Path.home()}\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\AutoZoomDaemon.lnk{RESET}\n\n > ')
|
none = input(f'{RESET}Демон AutoZoom был добавлен в автозапуск.\nПуть: {BRED}{pathlib.Path.home()}\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\AutoZoomDaemon.lnk{RESET}\n\n > ')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
except Exception as exp:
|
except Exception as exp:
|
||||||
@@ -494,6 +504,10 @@ def settings3():
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
elif settings_choose == '4':
|
elif settings_choose == '4':
|
||||||
|
setConfig("remove_old", not getConfig("remove_old"))
|
||||||
|
appendLog(f'Changed option "remove_old" to {getConfig("remove_old")}')
|
||||||
|
|
||||||
|
elif settings_choose == '5':
|
||||||
appendLog('Resetting configuration')
|
appendLog('Resetting configuration')
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
@@ -527,7 +541,7 @@ def settings3():
|
|||||||
clear()
|
clear()
|
||||||
continue
|
continue
|
||||||
|
|
||||||
elif settings_choose == '5':
|
elif settings_choose == '6':
|
||||||
appendLog('Returned to settings page 2')
|
appendLog('Returned to settings page 2')
|
||||||
clear()
|
clear()
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user