Update check!

This is a minor update, introducing an update check.
If a new version is available, the user will be prompted to update it.
Also .gitignore so I don't have to remove files before commiting
This commit is contained in:
nanometer5088
2022-09-19 09:06:22 -03:00
parent d5493a407d
commit 4fd0ef66a6
5 changed files with 166 additions and 2 deletions

133
.gitignore vendored Normal file
View File

@@ -0,0 +1,133 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
#Project-generated files
config.json
vencedores.txt

1
VERSION Normal file
View File

@@ -0,0 +1 @@
0.4

View File

@@ -144,7 +144,16 @@ WARNING = {
o arquivo config.json
Pressione ENTER para jogar!
"""}
""",
"newversion": """
Há uma nova versão disponível!
Atualizações trazem melhorias de performance e jogabilidade!
Faça download da nova versão aqui:
https://github.com/nanometer5088/bingo/archive/refs/heads/main.zip
Pressione ENTER para continuar
"""}
GAME = {
"presskey": "Selecione outra cartela (1, 2, 3 ou 4) ou pressione ENTER para sortear "}

View File

@@ -144,7 +144,16 @@ WARNING = {
the config.json file
Press ENTER to play!
"""}
""",
"newversion": """
There's a new version available!
Updates bring performance and gameplay improvements!
Download the new version here:
https://github.com/nanometer5088/bingo/archive/refs/heads/main.zip
Pressione ENTER para continuar
"""}
GAME = {
"presskey": "Select another card (1, 2, 3 or 4) or press ENTER to draw "}

View File

@@ -38,6 +38,18 @@ def inicio(locale):
#Início do programa e indrodução para o usuário
os.system("cls || clear")
x = input(locale.START["intro"])
#Verifica por atualizações, e avisa o usuário caso encontre alguma
try:
import requests
data = requests.get("https://raw.githubusercontent.com/nanometer5088/bingo/main/VERSION")
version = open('VERSION', 'r', encoding='utf=8')
if version.readline().rstrip() < (data.text):
os.system("cls || clear")
input(locale.WARNING["newversion"])
except requests.exceptions.ConnectionError:
print()
#Detecção e instalação das dependências - Caso não estejam instaladas,
#a instalação ocorre e o programa é encerrado. O usuário é avisado para reiniciar
#o programa ao finalizar