fix(upload): 上传后默认启用歌曲并清除 /api/songs 缓存
This commit is contained in:
7
app.py
7
app.py
@@ -848,10 +848,17 @@ def upload_file():
|
||||
generated_id = f"{tja_hash}-{music_hash}"
|
||||
# MongoDBのデータも作成
|
||||
db_entry = tja.to_mongo(generated_id, time.time_ns())
|
||||
# アップロード直後に有効化
|
||||
db_entry['enabled'] = True
|
||||
pprint.pprint(db_entry)
|
||||
|
||||
# mongoDBにデータをぶち込む
|
||||
client['taiko']["songs"].insert_one(db_entry)
|
||||
# キャッシュ削除(/api/songs)
|
||||
try:
|
||||
app.cache.delete_memoized(route_api_songs)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# ディレクトリを作成
|
||||
target_dir = pathlib.Path(os.getenv("TAIKO_WEB_SONGS_DIR", "public/songs")) / generated_id
|
||||
|
||||
Reference in New Issue
Block a user