From 66ec64fa30e1fd673a9cb05be0fad72cbc35c450 Mon Sep 17 00:00:00 2001 From: Profitroll Date: Sun, 1 Aug 2021 11:14:33 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20v2.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- editor.py | 45 +++++++++++++++++++++++++-------------------- functions.py | 18 ++++++++++++++---- main.py | 34 ++++++++++++++++++++++++++++------ rpc.py | 2 +- 4 files changed, 68 insertions(+), 31 deletions(-) diff --git a/editor.py b/editor.py index da9da3a..fe19561 100644 --- a/editor.py +++ b/editor.py @@ -30,7 +30,7 @@ def listLessons(from_where='remove'): repeat = 'Вкл.' else: repeat = 'Выкл.' - + if les[1]["record"]: record = 'Вкл.' else: @@ -40,7 +40,7 @@ def listLessons(from_where='remove'): repeat_day = getDay(les[1]["repeat_day"]) except: repeat_day = 'Не повторяется' - + length = len(str(les[0])) spacer_all = 6 * ' ' @@ -58,7 +58,7 @@ def listLessons(from_where='remove'): if from_where == 'editor': none = input('\n\n > ') - + except KeyboardInterrupt: clear() return @@ -67,7 +67,7 @@ def listLessons(from_where='remove'): def sortLessons(dictionary): if getConfig("debug"): 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') @@ -98,6 +98,7 @@ def addLesson(): lessons_got = getLessons() lessname = input(f'{RESET}Введите (своё) имя конференции:\n{BBLACK}Нужно лишь для отображения в Discord и самом AutoZoom{RESET}\n\n > {CYAN}') + lessname = strCleaner(lessname) local_lessons.update({"name": lessname}) while True: @@ -143,9 +144,9 @@ def addLesson(): finallessdate = lessdate except: continue - + local_lessons.update({"date": finallessdate}) - + break except: continue @@ -175,7 +176,7 @@ def addLesson(): else: conflictles += f', {CYAN}{lesson["name"]}{RESET}' confstr = 'конференциями' - + if conflict: while True: clear() @@ -191,7 +192,7 @@ def addLesson(): else: continue - + if abort == "restart": continue else: @@ -207,6 +208,7 @@ def addLesson(): 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 = strCleaner(lesslink) if lesslink.replace(' ', '') == '1': clear() @@ -255,7 +257,7 @@ def addLesson(): finallessrecord = False local_lessons.update({"record": finallessrecord}) break - + lessons_got.append(dict(local_lessons)) sortLessons(lessons_got) @@ -297,7 +299,7 @@ def editLesson(): except: clear() continue - + try: probe = lessons_got[edi]["name"] break @@ -312,6 +314,8 @@ def editLesson(): clear() 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 == '': lessname = lessons_got[edi]["name"] local_lessons.update({"name": lessname}) @@ -360,9 +364,9 @@ def editLesson(): finallessdate = lessdate except: continue - + local_lessons.update({"date": finallessdate}) - + break except: continue @@ -405,7 +409,7 @@ def editLesson(): else: conflictles += f', {CYAN}{lesson["name"]}{RESET}' confstr = 'конференциями' - + if conflict: while True: clear() @@ -440,6 +444,7 @@ def editLesson(): 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 = strCleaner(lesslink) if lesslink.replace(' ', '') == '1': clear() @@ -447,10 +452,10 @@ def editLesson(): clear() lesspasswd = input(f'{RESET}Введите код доступа (пароль) конференции:\n\n > {BRED}') lesslink = f'https://us01web.zoom.us/j/{lessid.replace(" ", "")}?pwd={lesspasswd.replace(" ", "")}' - + if lesslink == '': lesslink = lessons_got[edi]["link"] - + local_lessons.update({"link": lesslink}) while True: @@ -511,7 +516,7 @@ def editLesson(): finallessrecord = False local_lessons.update({"record": finallessrecord}) break - + del lessons_got[edi] lessons_got.append(dict(local_lessons)) sortLessons(lessons_got) @@ -548,7 +553,7 @@ def removeLesson(): except: clear() continue - + try: del_name = lessons_local[rem]["name"] del_date = lessons_local[rem]["date"] @@ -560,7 +565,7 @@ def removeLesson(): time.sleep(3) clear() continue - + sortLessons(lessons_local) saveJson(files_folder+'lessons.json', lessons_local) clear() @@ -586,7 +591,7 @@ def removeAllLessons(): with open(files_folder+'lessons.json', 'w', encoding="utf-8") as f: f.write("[]") f.close() - + appendLog('All lessons removed') clear() none = input('Все конференции были удалены.\n\n > ') @@ -679,7 +684,7 @@ def editor(): mainMenu() else: continue - + except KeyboardInterrupt: appendLog('Exiting back to main menu') rpc.inMenu() diff --git a/functions.py b/functions.py index 63c0b09..4beb7a2 100644 --- a/functions.py +++ b/functions.py @@ -194,7 +194,7 @@ def playSound(soundname, timing=''): if getConfig("debug"): print(f'{timing} Не удалось проиграть playsound звук "{soundname}" (Ошибка: {exp})') - + elif getOS() == "android": try: @@ -202,7 +202,7 @@ def playSound(soundname, timing=''): except Exception as exp: appendLog(f'Could not play play-audio: {exp}') - + else: try: @@ -215,6 +215,16 @@ def playSound(soundname, timing=''): 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): @@ -311,7 +321,7 @@ def setConfig(some_var, some_val): config_list[some_var] = some_val saveJson(files_folder+'config.json', config_list) appendLog(f'Changed variable "{somevar}" to {some_val}') - + except: return "Error" @@ -392,7 +402,7 @@ def getState(process="CptHost.exe"): return True else: return False - + except Exception as exp: appendLog(f'Failed to get state using tasklist: {exp}') diff --git a/main.py b/main.py index accf1c3..f6a2deb 100644 --- a/main.py +++ b/main.py @@ -36,7 +36,7 @@ import keyboard import getpass from zipfile import ZipFile -version = 2.2 +version = 2.3 path = Path(__file__).resolve().parent def mainMenu(): @@ -63,7 +63,7 @@ def mainMenu(): except Exception as exp: appendLog(f'Version number load failed {exp}') 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}') @@ -167,8 +167,10 @@ def helpMenu(): print(f' {BRED}3.{RESET} Центр поддержки') print(f' {BRED}4.{RESET} Telegram проекта') print(f' {BRED}5.{RESET} Связаться с автором') - print(f' {BRED}6.{RESET} Сводка информации') - print(f' {BRED}7.{RESET} В главное меню') + print(f' {BRED}6.{RESET} Поддержать проект') + print(f' {BRED}7.{RESET} Список поддержавших') + print(f' {BRED}8.{RESET} Сводка информации') + print(f' {BRED}9.{RESET} В главное меню') help_choose = input(f'\n > {BRED}') @@ -222,7 +224,27 @@ def helpMenu(): appendLog(f'Failed to open AutoZoom\'s developer Telegram: {exp}') none = input(f'{RESET}Не удалось открыть страницу вашего браузера.\nВы можете открыть адрес самостоятельно: {BRED}https://t.me/profitroll{RESET}\n\n > ') 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() if getState("RBTray.exe"): @@ -257,7 +279,7 @@ def helpMenu(): print(f' {BBLACK}•{RESET} Discord RPC: {dsrpc}') none = input('\n > ') clear() - elif help_choose == '7': + elif help_choose == '9': rpc.inMenu() clear() setTitle("AutoZoom (Главная)", getOS()) diff --git a/rpc.py b/rpc.py index d82e414..f99bb19 100644 --- a/rpc.py +++ b/rpc.py @@ -6,7 +6,7 @@ import sys from colors import * from functions import * -version = '2.2' +version = '2.3' import libinstaller from pypresence import Presence