Skip to content

Commit 081ded0

Browse files
committed
add update url list
1 parent cd2a125 commit 081ded0

File tree

2 files changed

+40
-29
lines changed

2 files changed

+40
-29
lines changed

.Update/Upgrade.1.1.zip

142 Bytes
Binary file not shown.

Utils/GitThread.py

+40-29
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,19 @@ class UpgradeThread(QObject):
280280
"""自动更新
281281
"""
282282

283-
Url = 'https://raw.githubusercontent.com/PyQt5/PyQtClient/master/.Update/Upgrade.json'
284-
ZipUrl = 'https://raw.githubusercontent.com/PyQt5/PyQtClient/master/.Update/Upgrade.{}.zip'
285-
286-
# Url = 'https://raw.githubusercontent.com/IronyYou/test/master/Update/Upgrade.json'
287-
# ZipUrl = 'https://raw.githubusercontent.com/IronyYou/test/master/Update/Upgrade.{}.zip'
283+
UpdateUrl = [
284+
('https://github.com/PyQt5/PyQtClient/raw/master/.Update/Upgrade.json',
285+
'https://github.com/PyQt5/PyQtClient/raw/master/.Update/Upgrade.{}.zip'
286+
),
287+
('https://gitee.com/PyQt5/PyQtClient/raw/master/.Update/Upgrade.json',
288+
'https://gitee.com/PyQt5/PyQtClient/raw/master/.Update/Upgrade.{}.zip'
289+
),
290+
('https://pyqt.site/PyQt5/PyQtClient/raw/master/.Update/Upgrade.json',
291+
'https://pyqt.site/PyQt5/PyQtClient/raw/master/.Update/Upgrade.{}.zip'
292+
),
293+
('https://pyqt5.com/PyQt5/PyQtClient/raw/master/.Update/Upgrade.json',
294+
'https://pyqt5.com/PyQt5/PyQtClient/raw/master/.Update/Upgrade.{}.zip')
295+
]
288296

289297
@classmethod
290298
def quit(cls):
@@ -352,29 +360,32 @@ def download(self, file, url):
352360
AppLog.debug('download {} end'.format(file))
353361

354362
def run(self):
355-
show = True
356-
try:
357-
req = requests.get(self.Url)
358-
AppLog.info(req.text)
359-
if req.status_code != 200:
360-
AppLog.info('update thread end')
361-
UpgradeThread.quit()
362-
return
363-
content = req.json()
364-
for version, text in content:
365-
if Version.version < version:
366-
if show:
367-
Signals.updateDialogShowed.emit()
368-
QThread.msleep(1000)
369-
show = False
370-
Signals.updateTextChanged.emit(str(Version.version),
371-
str(version), text)
372-
self.download(Constants.UpgradeFile.format(version),
373-
self.ZipUrl.format(version))
374-
Signals.updateFinished.emit(self.tr('update completed'))
375-
except Exception as e:
376-
Signals.updateFinished.emit(
377-
self.tr('update failed: {}').format(str(e)))
378-
AppLog.exception(e)
363+
for url_ver, url_zip in self.UpdateUrl:
364+
try:
365+
show = True
366+
req = requests.get(url_ver)
367+
AppLog.info(req.text)
368+
if req.status_code != 200:
369+
AppLog.info('update thread end')
370+
UpgradeThread.quit()
371+
return
372+
content = req.json()
373+
for version, text in content:
374+
if Version.version < version:
375+
if show:
376+
Signals.updateDialogShowed.emit()
377+
QThread.msleep(1000)
378+
show = False
379+
Signals.updateTextChanged.emit(str(Version.version),
380+
str(version), text)
381+
self.download(Constants.UpgradeFile.format(version),
382+
url_zip.format(version))
383+
Signals.updateFinished.emit(self.tr('update completed'))
384+
break
385+
except Exception as e:
386+
Signals.updateFinished.emit(
387+
self.tr('update failed: {}').format(str(e)))
388+
AppLog.exception(e)
389+
379390
AppLog.info('update thread end')
380391
UpgradeThread.quit()

0 commit comments

Comments
 (0)