mirror of
https://github.com/283375/arcaea-offline-pyside-ui.git
synced 2025-07-01 04:16:26 +00:00
impr: fallback when no chart data in database
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import logging
|
||||
|
||||
from arcaea_offline.database import Database
|
||||
from arcaea_offline.models import Score
|
||||
from arcaea_offline.models import Chart, Score
|
||||
from arcaea_offline_ocr.b30.chieri.v4.ocr import ChieriBotV4Ocr
|
||||
from arcaea_offline_ocr.b30.shared import B30OcrResultItem
|
||||
from PySide6.QtGui import QImage
|
||||
@ -49,4 +49,12 @@ def b30ResultToScore(_: None, qImage: QImage, result: B30OcrResultItem):
|
||||
comment="B30 OCR",
|
||||
)
|
||||
|
||||
if not chart:
|
||||
chart = Chart(
|
||||
song_id=song_id,
|
||||
rating_class=result.rating_class,
|
||||
title=song_id,
|
||||
constant=0.0,
|
||||
)
|
||||
|
||||
return (chart, score)
|
||||
|
@ -85,4 +85,11 @@ class ScoreConverter:
|
||||
comment=f"OCR {QFileInfo(imagePath).fileName()}",
|
||||
)
|
||||
chart = db.get_chart(score.song_id, score.rating_class)
|
||||
if not chart:
|
||||
chart = Chart(
|
||||
song_id=result.song_id,
|
||||
rating_class=result.rating_class,
|
||||
title=result.song_id,
|
||||
constant=0.0,
|
||||
)
|
||||
return (chart, score)
|
||||
|
Reference in New Issue
Block a user