1
0
Fork 0
mirror of https://github.com/ldericher/fftcgtool synced 2025-01-15 15:02:59 +00:00

fix face URLs

This commit is contained in:
Jörn-Michael Miehe 2021-09-02 03:11:31 +02:00
parent b99dc00499
commit eea92bf5f1
2 changed files with 12 additions and 4 deletions

View file

@ -41,6 +41,12 @@ class CardDB:
self.__pickle()
def get_face_url(self, face: str) -> str:
if face in self.__face_to_url:
return self.__face_to_url[face]
else:
return face
def upload_prompt(self) -> None:
faces = list(set([
card[lang].face

View file

@ -39,6 +39,8 @@ class TTSDeck(Cards):
return cls(codes, name, description)
def tts_object(self, language: Language) -> dict[str, any]:
carddb = CardDB()
# unique face urls used
unique_faces = set([
card[language].face
@ -46,7 +48,7 @@ class TTSDeck(Cards):
])
# lookup for indices of urls
url_indices = {
face_indices = {
url: i + 1
for i, url in enumerate(unique_faces)
}
@ -56,9 +58,9 @@ class TTSDeck(Cards):
str(i): {
"NumWidth": "10",
"NumHeight": "7",
"FaceURL": url,
"FaceURL": carddb.get_face_url(face),
"BackURL": CARD_BACK_URL,
} for url, i in url_indices.items()
} for face, i in face_indices.items()
}
# values both in main deck and each contained card
@ -83,7 +85,7 @@ class TTSDeck(Cards):
{
"Nickname": card[language].name,
"Description": card[language].text,
"CardID": 100 * url_indices[card[language].face] + card.index,
"CardID": 100 * face_indices[card[language].face] + card.index,
"Name": "Card",
"Hands": True,