2021-01-21 14:00:58 +02:00
# -*- coding: utf-8 -*-
2021-01-15 23:01:23 +02:00
import sys
2021-04-24 03:08:43 +03:00
import pip
2021-01-15 23:01:23 +02:00
import webbrowser
import os
2021-01-21 14:00:58 +02:00
import time
2021-01-15 23:01:23 +02:00
import platform
import subprocess
from pathlib import Path
2021-01-21 14:00:58 +02:00
from functions import *
2021-04-30 03:25:36 +03:00
appendLog ( ' main.py start initialized ' , startup = True )
2021-01-21 14:00:58 +02:00
2021-04-30 03:25:36 +03:00
setTitle ( " " , getOS ( ) )
from daemon import main
import settings
import editor
2021-01-21 14:00:58 +02:00
import rpc
if getConfig ( " use_colors " ) :
from colors import *
else :
RESET = ' '
BLACK = RED = GREEN = YELLOW = BLUE = MAGENTA = CYAN = WHITE = ' '
BBLACK = BRED = BGREEN = BYELLOW = BBLUE = BMAGENTA = BCYAN = BWHITE = ' '
ULINE = REVERSE = ' '
import libinstaller
2021-01-15 23:01:23 +02:00
import wget
import requests
2021-01-21 14:00:58 +02:00
import keyboard
2021-04-24 03:08:43 +03:00
import getpass
2021-01-15 23:01:23 +02:00
from zipfile import ZipFile
2021-08-01 11:14:33 +03:00
version = 2.3
2021-01-15 23:01:23 +02:00
path = Path ( __file__ ) . resolve ( ) . parent
def mainMenu ( ) :
try :
2021-04-30 03:25:36 +03:00
setTitle ( " AutoZoom (Главная) " , getOS ( ) )
2021-01-21 14:00:58 +02:00
2021-01-15 23:01:23 +02:00
global version
global path
2021-04-24 03:08:43 +03:00
appendLog ( ' Main menu opened ' )
2021-01-21 14:00:58 +02:00
rpc . inMenu ( )
2021-01-15 23:01:23 +02:00
while True :
2021-04-24 03:08:43 +03:00
if getConfig ( " update_check " ) :
print ( f ' { RESET } Загрузка данных о последней версии... ' )
try :
2021-04-30 03:25:36 +03:00
setTitle ( " Загрузка данных... " , getOS ( ) )
2021-04-24 03:08:43 +03:00
serv_ver = requests . get ( " https://www.end-play.xyz/AutoZoomVersion.txt " ) . text
2021-04-30 03:25:36 +03:00
setTitle ( " AutoZoom (Главная) " , getOS ( ) )
ignore = False
2021-04-24 03:08:43 +03:00
clear ( )
except Exception as exp :
appendLog ( f ' Version number load failed { exp } ' )
2021-04-30 03:25:36 +03:00
setTitle ( " Ошибка загрузки данных " , getOS ( ) )
2021-08-01 11:14:33 +03:00
print ( f ' Н е удалось загрузить данные о последней версии.\n Проверьте подключение к сети и повторите попытку. \n \n Статус сервера центра обновлений: \n { BRED } https://stats.uptimerobot.com/OqwR9iAqBg { RESET } ' )
2021-04-30 03:25:36 +03:00
todo = input ( f ' \n Введите { BRED } ignore { RESET } чтобы выключить проверку обновлений и продолжить \n либо введите что угодно иное чтобы закрыть программу. \n \n > { BRED } ' )
if todo . lower ( ) == ' ignore ' :
setConfig ( " update_check " , False )
serv_ver = ' '
appendLog ( ' Skipping update check ' )
setTitle ( " AutoZoom (Главная) " , getOS ( ) )
ignore = True
clear ( )
else :
rpc . disconnect ( )
sys . exit ( )
2021-04-24 03:08:43 +03:00
2021-04-30 03:25:36 +03:00
if ignore == False and float ( serv_ver ) > float ( version ) :
2021-04-24 03:08:43 +03:00
show_version = f ' ( { BRED } ! { RESET } ) '
else :
show_version = ' '
2021-01-15 23:01:23 +02:00
else :
2021-04-30 03:25:36 +03:00
show_version = f ' ( { BRED } ! { RESET } ) '
setTitle ( " AutoZoom (Главная) " , getOS ( ) )
2021-04-24 03:08:43 +03:00
serv_ver = ' disabled '
appendLog ( ' Skipping update check ' )
2021-04-30 03:25:36 +03:00
clear ( )
2021-04-24 03:08:43 +03:00
2021-01-21 14:00:58 +02:00
print ( f ' { BBLACK } » { RESET } Главное меню \n ' )
print ( f ' { BRED } 1. { RESET } Запуск ' )
print ( f ' { BRED } 2. { RESET } Редактор ' )
print ( f ' { BRED } 3. { RESET } Настройки ' )
print ( f ' { BRED } 4. { RESET } Обновление { show_version } ' )
print ( f ' { BRED } 5. { RESET } Помощь и связь ' )
print ( f ' { BRED } 6. { RESET } Закрыть приложение ' )
2021-04-30 03:25:36 +03:00
if getConfig ( " debug " ) :
print ( f ' { BRED } 10. { RESET } Меню разработчика ' )
menu_choose = input ( f ' \n { RESET } > { BRED } ' )
2021-01-22 14:53:33 +02:00
print ( RESET )
2021-01-15 23:01:23 +02:00
if menu_choose == ' 1 ' :
2021-04-24 03:08:43 +03:00
appendLog ( ' Went to daemon ' )
2021-01-15 23:01:23 +02:00
main ( ' menu ' )
elif menu_choose == ' 2 ' :
2021-04-24 03:08:43 +03:00
appendLog ( ' Went to editor ' )
2021-01-21 14:00:58 +02:00
rpc . inEditor ( )
2021-04-30 03:25:36 +03:00
editor . editor ( )
2021-01-15 23:01:23 +02:00
elif menu_choose == ' 3 ' :
2021-04-24 03:08:43 +03:00
appendLog ( ' Went to settings ' )
2021-01-21 14:00:58 +02:00
rpc . inSettings ( )
2021-04-30 03:25:36 +03:00
settings . settings ( )
2021-01-15 23:01:23 +02:00
elif menu_choose == ' 4 ' :
2021-04-24 03:08:43 +03:00
appendLog ( ' Went to updater ' )
2021-01-21 14:00:58 +02:00
rpc . inUpdater ( )
2021-01-15 23:01:23 +02:00
updater ( serv_ver , version )
elif menu_choose == ' 5 ' :
2021-04-24 03:08:43 +03:00
appendLog ( ' Went to help ' )
2021-01-21 14:00:58 +02:00
rpc . inHelp ( )
2021-01-15 23:01:23 +02:00
helpMenu ( )
elif menu_choose == ' 6 ' :
2021-04-30 03:25:36 +03:00
appendLog ( ' Exited AutoZoom from main menu ' , shutdown = True )
2021-01-21 14:00:58 +02:00
rpc . disconnect ( )
2021-01-15 23:01:23 +02:00
clear ( )
sys . exit ( )
2021-04-30 03:25:36 +03:00
elif menu_choose == ' 10 ' :
if getConfig ( " debug " ) :
appendLog ( ' Went to help ' )
rpc . inDebug ( )
devMenu ( )
else :
clear ( )
2021-01-15 23:01:23 +02:00
else :
clear ( )
continue
2021-01-21 14:00:58 +02:00
except KeyboardInterrupt :
rpc . disconnect ( )
2021-01-15 23:01:23 +02:00
clear ( )
2021-01-21 14:00:58 +02:00
print ( f ' Закрываем приложение { BGREEN } AutoZoom { RESET } ... ' )
sys . exit ( )
2021-01-15 23:01:23 +02:00
def os_arch ( ) :
is_64bits = sys . maxsize > 2 * * 32
if is_64bits :
return ' 64bit '
else :
return ' 32bit '
def helpMenu ( ) :
try :
while True :
2021-04-30 03:25:36 +03:00
setTitle ( " AutoZoom (Помощь) " , getOS ( ) )
2021-04-24 03:08:43 +03:00
appendLog ( ' Help menu opened ' )
2021-01-15 23:01:23 +02:00
clear ( )
global version
global path
2021-01-21 14:00:58 +02:00
print ( f ' { BBLACK } » { RESET } Меню помощи \n ' )
print ( f ' { BRED } 1. { RESET } Документация ' )
2021-04-24 03:08:43 +03:00
print ( f ' { BRED } 2. { RESET } Сайт проекта ' )
print ( f ' { BRED } 3. { RESET } Центр поддержки ' )
print ( f ' { BRED } 4. { RESET } Telegram проекта ' )
print ( f ' { BRED } 5. { RESET } Связаться с автором ' )
2021-08-01 11:14:33 +03:00
print ( f ' { BRED } 6. { RESET } Поддержать проект ' )
print ( f ' { BRED } 7. { RESET } Список поддержавших ' )
print ( f ' { BRED } 8. { RESET } Сводка информации ' )
print ( f ' { BRED } 9. { RESET } В главное меню ' )
2021-04-30 03:25:36 +03:00
2021-01-21 14:00:58 +02:00
help_choose = input ( f ' \n > { BRED } ' )
2021-01-15 23:01:23 +02:00
if help_choose == ' 1 ' :
try :
clear ( )
2021-04-24 03:08:43 +03:00
appendLog ( ' Opened AutoZoom wiki ' )
2021-01-15 23:01:23 +02:00
webbrowser . open ( " https://github.com/profitrollgame/autozoom/wiki " )
2021-04-24 03:08:43 +03:00
except Exception as exp :
2021-01-15 23:01:23 +02:00
clear ( )
2021-04-24 03:08:43 +03:00
appendLog ( f ' Failed to open AutoZoom wiki: { exp } ' )
2021-01-21 14:00:58 +02:00
none = input ( f ' { RESET } Н е удалось открыть страницу вашего браузера.\n Вы можете открыть адрес самостоятельно: { BRED } https://github.com/profitrollgame/autozoom/wiki { RESET } \n \n > ' )
2021-01-15 23:01:23 +02:00
clear ( )
elif help_choose == ' 2 ' :
try :
clear ( )
2021-04-24 03:08:43 +03:00
appendLog ( ' Opened AutoZoom website ' )
webbrowser . open ( " https://www.end-play.xyz/autozoom " )
except Exception as exp :
clear ( )
appendLog ( f ' Failed to open AutoZoom website: { exp } ' )
none = input ( f ' { RESET } Н е удалось открыть страницу вашего браузера.\n Вы можете открыть адрес самостоятельно: { BRED } https://www.end-play.xyz/autozoom { RESET } \n \n > ' )
clear ( )
elif help_choose == ' 3 ' :
try :
clear ( )
appendLog ( ' Opened AutoZoom support center ' )
webbrowser . open ( " https://www.tidio.com/talk/ydqcvfvgkud3jjk2482uaesvjpeohlh3 " )
except Exception as exp :
clear ( )
appendLog ( f ' Failed to open AutoZoom support center: { exp } ' )
none = input ( f ' { RESET } Н е удалось открыть страницу вашего браузера.\n Вы можете открыть адрес самостоятельно: { BRED } https://www.tidio.com/talk/ydqcvfvgkud3jjk2482uaesvjpeohlh3 { RESET } \n \n > ' )
clear ( )
elif help_choose == ' 4 ' :
try :
clear ( )
appendLog ( ' Opened AutoZoom Telegram group ' )
2021-01-15 23:01:23 +02:00
webbrowser . open ( " https://t.me/auto_zoom " )
2021-04-24 03:08:43 +03:00
except Exception as exp :
2021-01-15 23:01:23 +02:00
clear ( )
2021-04-24 03:08:43 +03:00
appendLog ( f ' Failed to open AutoZoom Telegram group: { exp } ' )
2021-01-21 14:00:58 +02:00
none = input ( f ' { RESET } Н е удалось открыть страницу вашего браузера.\n Вы можете открыть адрес самостоятельно: { BRED } https://t.me/auto_zoom { RESET } \n \n > ' )
2021-01-15 23:01:23 +02:00
clear ( )
2021-04-24 03:08:43 +03:00
elif help_choose == ' 5 ' :
2021-01-15 23:01:23 +02:00
try :
clear ( )
2021-04-24 03:08:43 +03:00
appendLog ( ' Opened AutoZoom \' s developer Telegram ' )
2021-01-15 23:01:23 +02:00
webbrowser . open ( " https://t.me/profitroll " )
2021-04-24 03:08:43 +03:00
except Exception as exp :
2021-01-15 23:01:23 +02:00
clear ( )
2021-04-24 03:08:43 +03:00
appendLog ( f ' Failed to open AutoZoom \' s developer Telegram: { exp } ' )
2021-01-21 14:00:58 +02:00
none = input ( f ' { RESET } Н е удалось открыть страницу вашего браузера.\n Вы можете открыть адрес самостоятельно: { BRED } https://t.me/profitroll { RESET } \n \n > ' )
2021-01-15 23:01:23 +02:00
clear ( )
2021-08-01 11:14:33 +03:00
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 ' :
2021-01-15 23:01:23 +02:00
clear ( )
2021-04-30 03:25:36 +03:00
if getState ( " RBTray.exe " ) :
rbtray = f ' { BGREEN } Активен { RESET } '
else :
rbtray = f ' { BRED } Неактивен { RESET } '
if rpc . connected :
dsrpc = f ' { BGREEN } Активен { RESET } '
else :
dsrpc = f ' { BRED } Неактивен { RESET } '
appendLog ( f ' Showing system information: \n ============================================= \n Helpful data for fault search: \n \n OS: { platform . system ( ) } \n Release: { platform . release ( ) } \n Arch: { os_arch ( ) } \n Py Ver: { platform . python_version ( ) } \n PIP Ver: { pip . __version__ } \n Impl: { platform . python_implementation ( ) } \n Rev: { platform . python_revision ( ) } \n Py Path: { sys . path [ 4 ] } \n AZ Ver: { version } \n AZ User: { getpass . getuser ( ) } \n AZ User Home: { Path . home ( ) } \n AZ Path: { path } \n RBTray: { str ( getState ( " RBTray.exe " ) ) } \n RPC: { str ( rpc . connected ) } \n ============================================= ' )
2021-01-21 14:00:58 +02:00
print ( f ' { BBLACK } » { RESET } Информация о системе \n ' )
print ( ' Система: ' )
print ( f ' { BBLACK } • { RESET } О С : { YELLOW } { platform . system ( ) } { RESET } ' )
print ( f ' { BBLACK } • { RESET } Релиз: { YELLOW } { platform . release ( ) } { RESET } ' )
print ( f ' { BBLACK } • { RESET } Разрядность: { YELLOW } { os_arch ( ) } { RESET } ' )
print ( ' \n Python: ' )
print ( f ' { BBLACK } • { RESET } Версия: { YELLOW } { platform . python_version ( ) } { RESET } ' )
2021-04-24 03:08:43 +03:00
print ( f ' { BBLACK } • { RESET } Версия PIP: { YELLOW } { pip . __version__ } { RESET } ' )
2021-01-21 14:00:58 +02:00
print ( f ' { BBLACK } • { RESET } Вариант: { YELLOW } { platform . python_implementation ( ) } { RESET } ' )
print ( f ' { BBLACK } • { RESET } Ревизия: { YELLOW } { platform . python_revision ( ) } { RESET } ' )
print ( f ' { BBLACK } • { RESET } Расположение: { BRED } { sys . path [ 4 ] } { RESET } ' )
print ( ' \n AutoZoom: ' )
print ( f ' { BBLACK } • { RESET } Версия: { YELLOW } { version } { RESET } ' )
2021-04-24 03:08:43 +03:00
print ( f ' { BBLACK } • { RESET } Пользователь: { YELLOW } { getpass . getuser ( ) } { RESET } ' )
2021-04-30 03:25:36 +03:00
print ( f ' { BBLACK } • { RESET } Папка пользователя: { BRED } { Path . home ( ) } { RESET } ' )
2021-01-21 14:00:58 +02:00
print ( f ' { BBLACK } • { RESET } Расположение: { BRED } { path } { RESET } ' )
2021-04-30 03:25:36 +03:00
print ( ' \n Интеграции: ' )
print ( f ' { BBLACK } • { RESET } RBTray: { rbtray } ' )
print ( f ' { BBLACK } • { RESET } Discord RPC: { dsrpc } ' )
2021-01-15 23:01:23 +02:00
none = input ( ' \n > ' )
clear ( )
2021-08-01 11:14:33 +03:00
elif help_choose == ' 9 ' :
2021-01-21 14:00:58 +02:00
rpc . inMenu ( )
2021-01-15 23:01:23 +02:00
clear ( )
2021-04-30 03:25:36 +03:00
setTitle ( " AutoZoom (Главная) " , getOS ( ) )
2021-01-15 23:01:23 +02:00
return
else :
clear ( )
continue
except KeyboardInterrupt :
2021-01-21 14:00:58 +02:00
rpc . inMenu ( )
2021-01-15 23:01:23 +02:00
clear ( )
return
2021-04-30 03:25:36 +03:00
def devMenu ( ) :
try :
while True :
setTitle ( " AutoZoom (Отладка) " , getOS ( ) )
appendLog ( ' Help menu opened ' )
clear ( )
print ( f ' { BBLACK } » { RESET } Меню отладки \n ' )
print ( f ' { BRED } 1. { RESET } PlaySound test ' )
print ( f ' { BRED } 2. { RESET } WinSound test ' )
print ( f ' { BRED } 3. { RESET } Play-audio test ' )
2021-05-08 01:28:41 +03:00
print ( f ' { BRED } 4. { RESET } playSound function test ' )
print ( f ' { BRED } 5. { RESET } OS check test ' )
print ( f ' { BRED } 6. { RESET } Telegram test ' )
print ( f ' { BRED } 7. { RESET } Zoom meeting test ' )
print ( f ' { BRED } 8. { RESET } Color test ' )
print ( f ' { BRED } 9. { RESET } Exit to menu ' )
2021-04-30 03:25:36 +03:00
choose = input ( f ' \n > { BRED } ' )
if choose == ' 1 ' :
from playsound import playsound
playsound ( sounds_folder + " debug.wav " )
continue
elif choose == ' 2 ' :
import winsound
winsound . PlaySound ( sounds_folder + " debug.wav " , winsound . SND_FILENAME )
continue
elif choose == ' 3 ' :
os . system ( f ' play-audio { sounds_folder } debug.wav ' )
continue
elif choose == ' 4 ' :
2021-05-08 01:28:41 +03:00
playSound ( " debug " )
continue
elif choose == ' 5 ' :
2021-04-30 03:25:36 +03:00
clear ( )
none = input ( f ' { RESET } { getOS ( ) } \n \n > ' )
continue
2021-05-08 01:28:41 +03:00
elif choose == ' 6 ' :
2021-04-30 03:25:36 +03:00
clear ( )
import telegram_send
telegram_send . send ( messages = [ " Telegram message test " ] , parse_mode = " markdown " , conf = files_folder + " telegram.conf " )
continue
2021-05-08 01:28:41 +03:00
elif choose == ' 7 ' :
clear ( )
print ( editor . debugLesson ( ) )
none = input ( f ' { RESET } \n > ' )
continue
elif choose == ' 8 ' :
2021-04-30 03:25:36 +03:00
clear ( )
print ( f ' { BLACK } ███ { RED } ███ { GREEN } ███ { YELLOW } ███ { BLUE } ███ { MAGENTA } ███ { CYAN } ███ { WHITE } ███ ' )
print ( f ' { BBLACK } ███ { BRED } ███ { BGREEN } ███ { BYELLOW } ███ { BBLUE } ███ { BMAGENTA } ███ { BCYAN } ███ { BWHITE } ███ ' )
print ( f ' { RESET } RESET ' )
print ( f ' { REVERSE } REVERSE { RESET } ' )
print ( f ' { ULINE } UNDERLINE { RESET } ' )
none = input ( RESET + ' \n > ' )
continue
2021-05-08 01:28:41 +03:00
elif choose == ' 9 ' :
2021-04-30 03:25:36 +03:00
rpc . inMenu ( )
clear ( )
setTitle ( " AutoZoom (Главная) " , getOS ( ) )
return
else :
clear ( )
continue
except KeyboardInterrupt :
rpc . inMenu ( )
clear ( )
return
2021-01-15 23:01:23 +02:00
def updater ( serv_ver , version ) :
try :
while True :
2021-04-30 03:25:36 +03:00
setTitle ( " AutoZoom (Обновления) " , getOS ( ) )
2021-04-24 03:08:43 +03:00
appendLog ( ' Updater menu opened ' )
2021-01-15 23:01:23 +02:00
clear ( )
2021-04-24 03:08:43 +03:00
2021-04-30 03:25:36 +03:00
if getConfig ( " update_check " ) and float ( serv_ver ) > float ( version ) :
2021-01-21 14:00:58 +02:00
show_version = f ' ( { BRED } ! { RESET } ) '
2021-01-15 23:01:23 +02:00
serv_ver = serv_ver . rstrip ( ' \n ' )
2021-01-21 14:00:58 +02:00
show_action = f ' Обновить до { BGREEN } { serv_ver } { RESET } '
changelog_text = f ' Изменения в версии { BGREEN } { serv_ver } { RESET } : '
2021-01-15 23:01:23 +02:00
changelog_footer = ' \n Обновитесь чтобы вышеуказанное работало. '
2021-04-24 03:08:43 +03:00
elif serv_ver == ' disabled ' :
show_version = ' '
show_action = f ' Переустановить '
changelog_text = f ' Изменения в вашей версии: '
changelog_footer = ' '
2021-01-15 23:01:23 +02:00
else :
show_version = ' '
show_action = f ' Переустановить '
changelog_text = f ' Изменения в вашей версии: '
changelog_footer = ' '
2021-01-21 14:00:58 +02:00
print ( f ' { BBLACK } » { RESET } Меню обновлений \n ' )
print ( f ' { BRED } 1. { RESET } { show_action } ' )
print ( f ' { BRED } 2. { RESET } Список изменений ' )
print ( f ' { BRED } 3. { RESET } В главное меню ' )
2021-04-30 03:25:36 +03:00
if not getConfig ( " update_check " ) :
print ( f ' \n { BRED } Внимание! { RESET } У вас выключена проверка обновлений. \n Если это было сделанно временно - включите её в настройках. ' )
2021-01-21 14:00:58 +02:00
updater_choose = input ( f ' \n > { BRED } ' )
2021-04-24 03:08:43 +03:00
2021-01-15 23:01:23 +02:00
if updater_choose == ' 1 ' :
2021-04-24 03:08:43 +03:00
appendLog ( ' Choosed to update ' )
2021-01-15 23:01:23 +02:00
while True :
clear ( )
2021-01-21 14:00:58 +02:00
print ( f ' { RESET } Подтвердите действие: \n ' )
print ( f ' { BRED } 1. { RESET } Установить ' )
print ( f ' { BRED } 2. { RESET } Отменить ' )
2021-04-30 03:25:36 +03:00
updater_decide = input ( f ' \n > { BRED } ' )
2021-05-08 01:28:41 +03:00
print ( RESET )
2021-01-15 23:01:23 +02:00
if updater_decide == ' 1 ' :
2021-04-24 03:08:43 +03:00
appendLog ( ' Trying to update AutoZoom ' )
2021-01-15 23:01:23 +02:00
clear ( )
2021-01-21 14:00:58 +02:00
try :
wget . download ( ' https://www.end-play.xyz/AutoZoomLatest.zip ' , out = ' AutoZoomLatest.zip ' )
2021-04-24 03:08:43 +03:00
appendLog ( ' Latest zip downloaded ' )
except Exception as exp :
2021-04-30 03:25:36 +03:00
print ( f ' { RESET } Н е удалось загрузить архив с последней версией.\n Проверьте подключение к сети и повторите попытку. \n \n Статус сервера центра обновлений: \n { BRED } https://status.end-play.xyz/786373747 { RESET } ' )
2021-04-24 03:08:43 +03:00
appendLog ( f ' Failed to download zip: { exp } ' )
2021-04-30 03:25:36 +03:00
none = input ( f ' \n > { BRED } ' )
2021-01-21 14:00:58 +02:00
continue
2021-01-15 23:01:23 +02:00
with ZipFile ( ' AutoZoomLatest.zip ' , ' r ' ) as zipObj :
zipObj . extractall ( )
2021-04-30 03:25:36 +03:00
print ( f ' { RESET } В с е файлы были успешно загружены' )
2021-04-24 03:08:43 +03:00
appendLog ( ' Latest zip extracted ' )
2021-01-15 23:01:23 +02:00
if os . path . exists ( " AutoZoomLatest.zip " ) :
2021-04-24 03:08:43 +03:00
os . remove ( " AutoZoomLatest.zip " )
appendLog ( ' Latest used zip deleted ' )
2021-01-15 23:01:23 +02:00
clear ( )
2021-04-30 03:25:36 +03:00
none = input ( f ' { RESET } Обновление завершено, перезапустите AutoZoom. \n \n > ' )
2021-01-21 14:00:58 +02:00
rpc . disconnect ( )
clear ( )
2021-04-30 03:25:36 +03:00
print ( f ' { RESET } Закрываем приложение { BGREEN } AutoZoom { RESET } ... ' )
2021-04-24 03:08:43 +03:00
appendLog ( ' Exiting AutoZoom after an update ' )
2021-01-15 23:01:23 +02:00
sys . exit ( )
elif updater_decide == ' 2 ' :
clear ( )
2021-04-24 03:08:43 +03:00
appendLog ( ' Aborted update ' )
2021-01-15 23:01:23 +02:00
break
else :
continue
2021-04-24 03:08:43 +03:00
2021-01-15 23:01:23 +02:00
elif updater_choose == ' 2 ' :
2021-04-24 03:08:43 +03:00
appendLog ( ' Choosed to check changelog ' )
2021-01-21 14:00:58 +02:00
try :
changelog = requests . get ( " https://www.end-play.xyz/AutoZoomChangelog.txt " )
changelog . encoding = None
2021-04-24 03:08:43 +03:00
appendLog ( ' Changelog loaded ' )
2021-01-21 14:00:58 +02:00
clear ( )
print ( f ' { RESET } { changelog_text } \n ' )
print ( changelog . text )
print ( changelog_footer )
none = input ( ' \n > ' )
continue
2021-04-24 03:08:43 +03:00
except Exception as exp :
2021-04-30 03:25:36 +03:00
clear ( )
2021-01-21 14:00:58 +02:00
print ( f ' { RESET } Н е удалось загрузить чейнджлог.\n Проверьте подключение к сети и повторите попытку. \n \n Статус сервера центра обновлений: \n { BRED } https://status.end-play.xyz/786373747 { RESET } ' )
2021-04-24 03:08:43 +03:00
appendLog ( f ' Failed to check changelog: { exp } ' )
2021-01-21 14:00:58 +02:00
none = input ( ' \n > ' )
continue
2021-04-24 03:08:43 +03:00
2021-01-15 23:01:23 +02:00
elif updater_choose == ' 3 ' :
2021-01-21 14:00:58 +02:00
rpc . inMenu ( )
2021-01-15 23:01:23 +02:00
clear ( )
2021-04-24 03:08:43 +03:00
appendLog ( ' Returning to main menu ' )
2021-04-30 03:25:36 +03:00
setTitle ( " AutoZoom (Главная) " , getOS ( ) )
2021-01-15 23:01:23 +02:00
return
2021-04-24 03:08:43 +03:00
2021-01-15 23:01:23 +02:00
else :
continue
2021-04-24 03:08:43 +03:00
2021-01-21 14:00:58 +02:00
except KeyboardInterrupt :
rpc . inMenu ( )
2021-01-15 23:01:23 +02:00
clear ( )
return
if __name__ == ' __main__ ' :
2021-01-21 14:00:58 +02:00
from functions import getConfig
2021-04-30 03:25:36 +03:00
from daemon import clear , getOS , setTitle
2021-01-21 14:00:58 +02:00
import time
2021-04-30 03:25:36 +03:00
setTitle ( " Загрузка main... " , getOS ( ) )
2021-01-15 23:01:23 +02:00
clear ( )
2021-01-21 14:00:58 +02:00
if getConfig ( " run_fullscreen " ) :
keyboard . press ( ' alt, enter ' )
time . sleep ( .25 )
keyboard . release ( ' alt, enter ' )
2021-04-24 03:08:43 +03:00
2021-04-30 03:25:36 +03:00
setTitle ( " AutoZoom (Главная) " , getOS ( ) )
2021-01-21 14:00:58 +02:00
mainMenu ( )
2021-04-07 23:57:02 +03:00
sys . exit ( )