2019-09-16 20:48:03 +08:00
|
|
|
# -*- coding: utf-8 -*-
|
2020-02-03 16:18:21 +08:00
|
|
|
import asyncio
|
|
|
|
|
2019-09-16 20:48:03 +08:00
|
|
|
import aiohttp
|
|
|
|
|
2022-02-15 00:18:46 +08:00
|
|
|
import utils.request
|
|
|
|
|
2022-06-18 21:46:14 +08:00
|
|
|
VERSION = 'v1.6.1'
|
2019-09-16 20:48:03 +08:00
|
|
|
|
|
|
|
|
2020-02-03 16:18:21 +08:00
|
|
|
def check_update():
|
|
|
|
asyncio.ensure_future(_do_check_update())
|
|
|
|
|
|
|
|
|
|
|
|
async def _do_check_update():
|
2019-11-29 23:48:43 +08:00
|
|
|
try:
|
2022-02-15 00:18:46 +08:00
|
|
|
async with utils.request.http_session.get(
|
|
|
|
'https://api.github.com/repos/xfgryujk/blivechat/releases/latest'
|
|
|
|
) as r:
|
|
|
|
data = await r.json()
|
|
|
|
if data['name'] != VERSION:
|
|
|
|
print('---------------------------------------------')
|
|
|
|
print('New version available:', data['name'])
|
|
|
|
print(data['body'])
|
|
|
|
print('Download:', data['html_url'])
|
|
|
|
print('---------------------------------------------')
|
2019-11-29 23:48:43 +08:00
|
|
|
except aiohttp.ClientConnectionError:
|
|
|
|
print('Failed to check update: connection failed')
|
2020-11-28 21:53:49 +08:00
|
|
|
except asyncio.TimeoutError:
|
|
|
|
print('Failed to check update: timeout')
|