Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
Amazed | 6802b12abb | |
Amazed | ba70cdac89 | |
Amazed | 324de3b126 | |
Amazed | 4e258543c2 | |
Amazed | 6fe13463fa | |
Amazed | 30f838008c | |
Amazed | f6b7fbc8bf |
|
@ -0,0 +1,6 @@
|
|||
build/
|
||||
dist/
|
||||
venv/
|
||||
.idea/
|
||||
__pycache__/
|
||||
*.pyc
|
15
main.py
15
main.py
|
@ -6,7 +6,7 @@ import socket
|
|||
import zlib
|
||||
import sys
|
||||
from PySide6.QtCore import QThread, QTimer, Signal
|
||||
from PySide6.QtWidgets import QApplication, QMainWindow, QFileDialog
|
||||
from PySide6.QtWidgets import QApplication, QMainWindow, QFileDialog, QMessageBox
|
||||
from lib.enumresponse import EnumResponse
|
||||
from lib.giantsenumresponseparser import GiantsEnumResponseParser
|
||||
from lib.packet import Packet
|
||||
|
@ -18,7 +18,7 @@ import yaml
|
|||
|
||||
installed_maps = {}
|
||||
API_BASE_URL = "https://gckmaps.hipstercat.fr"
|
||||
SLEEP_TIME = 20 * 1000
|
||||
SLEEP_TIME = 1 * 60 * 1000
|
||||
CONFIG = {}
|
||||
|
||||
|
||||
|
@ -132,6 +132,7 @@ def read_configuration():
|
|||
global CONFIG
|
||||
if not os.path.exists(config_file):
|
||||
# create it
|
||||
QMessageBox.information(None, "GMD - Giants Maps Downloader", "Welcome to GMD!\n\nThis tool runs in the background to automatically download and upload hosted maps. For this to work, GMD needs to know where maps must be installed.\n\nPlease select where Giants.exe is after clicking OK.", QMessageBox.Ok)
|
||||
giants_exe_path, _filename = QFileDialog.getOpenFileName(None, caption="Open Giants.exe", filter="Giants.exe")
|
||||
if not giants_exe_path:
|
||||
sys.exit(1)
|
||||
|
@ -207,7 +208,7 @@ class MapsBackground(QThread):
|
|||
self.log(f"Error while fetching map info: {e}")
|
||||
return
|
||||
if req.status_code != 200:
|
||||
self.log(f"Could not download map from server, got status_code {req.status_code}")
|
||||
self.log(f"Could not download map from server, got status_code {req.status_code}: {req.text}")
|
||||
return
|
||||
j = req.json()
|
||||
blob_location = j["blob_location"]
|
||||
|
@ -249,10 +250,16 @@ class MapsBackground(QThread):
|
|||
map_data = {"name": map_name, "b64_data": b64_data}
|
||||
try:
|
||||
req = requests.post(f"{API_BASE_URL}/maps", json=map_data)
|
||||
except Exception as e:
|
||||
self.log(f"There was an error while uploading map: {e} {req.text}")
|
||||
return
|
||||
|
||||
try:
|
||||
req.raise_for_status()
|
||||
except Exception as e:
|
||||
self.log(f"There was an error while uploading map: {e}")
|
||||
self.log(f"There was an error while uploading map: {e} {req.text}")
|
||||
return
|
||||
|
||||
self.log("Upload successful")
|
||||
|
||||
def all_servers_download(self) -> None:
|
||||
|
|
|
@ -37,4 +37,4 @@ exe = EXE(pyz,
|
|||
disable_windowed_traceback=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None )
|
||||
entitlements_file=None , icon='icon.ico')
|
||||
|
|
|
@ -24,6 +24,9 @@ class Ui_MainWindow(object):
|
|||
if not MainWindow.objectName():
|
||||
MainWindow.setObjectName(u"MainWindow")
|
||||
MainWindow.resize(449, 230)
|
||||
icon = QIcon()
|
||||
icon.addFile(u"icon.png", QSize(), QIcon.Normal, QIcon.Off)
|
||||
MainWindow.setWindowIcon(icon)
|
||||
self.centralwidget = QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName(u"centralwidget")
|
||||
self.centralwidget.setEnabled(True)
|
||||
|
|
|
@ -13,6 +13,10 @@
|
|||
<property name="windowTitle">
|
||||
<string>GMD - Giants Maps Downloader</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
<normaloff>icon.png</normaloff>icon.png</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
|
|
Loading…
Reference in New Issue