[Enhance][Bug fix][Doc] ETR for songdb tool & Update notify

- Add support for ETR difficulties in the `update_song.py` tool
- Make content bundle updates mandatory for client
- README update
This commit is contained in:
Lost-MSth
2024-03-17 22:35:52 +08:00
parent 328be5b923
commit a05bb4854d
5 changed files with 25 additions and 12 deletions

View File

@@ -48,6 +48,7 @@ This procedure is mainly used for study and research, and shall not be used for
- :x: 加密下载 Encrypted downloading
- 下载校验 Download check
- 下载频次限制 Download rate limit
- 内容捆绑包热更新 Content bundle hot update
- 购买系统 Purchase system
- 单曲和曲包 Single & Pack
- :x: 捆绑包 Pack bundle
@@ -129,6 +130,11 @@ It is just so interesting. What it can do is under exploration.
[English](https://github.com/Lost-MSth/Arcaea-server/wiki/Environment-construction)
-->
## 子项目 Sub repositories
[Arcaea-Bundler](https://github.com/Lost-MSth/Arcaea-Bundler)
: 用于生成和解包内容捆绑包 Used to pack or unpack content bundles
## 使用说明 Instruction for use
[中文](https://github.com/Lost-MSth/Arcaea-server/wiki/%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E)
@@ -148,6 +154,7 @@ It is just so interesting. What it can do is under exploration.
歌曲数据库来自 Using song database from
~~[BotArcAPI releases](https://github.com/TheSnowfield/BotArcAPI/releases)~~
[ArcaeaSongDatabase](https://github.com/Arcaea-Infinity/ArcaeaSongDatabase)
[ArcaeaSongDatabase Fork](https://github.com/CuSO4Deposit/ArcaeaSongDatabase)
> 从v2.9开始不再提供歌曲数据
> Since v2.9, song data will not be provided.

View File

@@ -12,7 +12,7 @@ class Config:
SONG_FILE_HASH_PRE_CALCULATE = True
GAME_API_PREFIX = '/saikyoukaze/27' # str | list[str]
GAME_API_PREFIX = '/desks/28' # str | list[str]
OLD_GAME_API_PREFIX = [] # str | list[str]
ALLOW_APPVERSION = [] # list[str]

View File

@@ -0,0 +1,5 @@
## Arcaea Bundle Folder
[Arcaea-Bundler](https://github.com/Lost-MSth/Arcaea-Bundler)
There must be pairs of bundle file and JSON metadata file with the same name. The bundle file's suffix is `.cb` and the metadata file's suffix is `.json`.

View File

@@ -110,9 +110,8 @@ def header_check(request) -> ArcError:
if Config.ALLOW_APPVERSION: # 版本检查
if 'AppVersion' not in headers or headers['AppVersion'] not in Config.ALLOW_APPVERSION:
return LowVersion('Invalid app version', 5)
if 'ContentBundle' in headers and headers['ContentBundle'] != BundleParser.max_bundle_version[headers['AppVersion']]:
return LowVersion('Invalid content bundle version', 11)
if 'ContentBundle' in headers and headers['ContentBundle'] != BundleParser.max_bundle_version[headers['AppVersion']]:
return LowVersion('Invalid content bundle version', 11)
if has_arc_hash and not ArcHashChecker(request).check():
return NoAccess('Invalid request')

View File

@@ -34,7 +34,7 @@ class Connect():
return True
def insert(cursor, song_id, name, a, b, c, d, update_type=0):
def insert(cursor, song_id, name, a, b, c, d, e, update_type=0):
'''Insert a new song into database.'''
if update_type == 0 or update_type == 1:
cursor.execute(
@@ -45,12 +45,12 @@ def insert(cursor, song_id, name, a, b, c, d, update_type=0):
return
elif update_type == 1:
# 重复则更新,以`arcsong.db`数据为准
cursor.execute('''update chart set name=?, rating_pst=?, rating_prs=?, rating_ftr=?, rating_byn=? where song_id=?''',
(name, a, b, c, d, song_id))
cursor.execute('''update chart set name=?, rating_pst=?, rating_prs=?, rating_ftr=?, rating_byn=?, rating_etr=? where song_id=?''',
(name, a, b, c, d, e, song_id))
return
cursor.execute(
'''insert into chart values (?,?,?,?,?,?)''', (song_id, name, a, b, c, d))
'''insert into chart values (?,?,?,?,?,?,?)''', (song_id, name, a, b, c, d, e))
def from_song_datebase():
@@ -61,17 +61,19 @@ def from_song_datebase():
if 'songs' in tables:
c.execute(
'''select sid, name_en, rating_pst, rating_prs, rating_ftr, rating_byn from songs''')
data = c.fetchall()
data = []
for x in c.fetchall():
data.append((x[0], x[1], x[2], x[3], x[4], x[5], -1))
elif 'charts' in tables:
c.execute(
'''select song_id, rating_class, name_en, rating from charts''')
songs = {}
for song_id, rating_class, name_en, rating in c.fetchall():
if song_id not in songs:
songs[song_id] = [-1, -1, -1, -1, name_en]
songs[song_id] = [-1, -1, -1, -1, -1, name_en]
songs[song_id][rating_class] = rating
data = [(x, y[-1], y[0], y[1], y[2], y[3])
data = [(x, y[-1], y[0], y[1], y[2], y[3], y[4])
for x, y in songs.items()]
else:
print('Error: Cannot find table `songs` or `charts` in the database.')
@@ -91,7 +93,7 @@ def from_song_datebase():
# 清空数据表后更新
c.execute('''delete from chart''')
for x in data:
insert(c, x[0], x[1], x[2], x[3], x[4], x[5], update_type)
insert(c, x[0], x[1], x[2], x[3], x[4], x[5], x[6], update_type)
print('Seems to be done.')