-
Notifications
You must be signed in to change notification settings - Fork 1
/
models.py
56 lines (48 loc) · 1.72 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
from enum import IntEnum
# This needs to be redesigned, it is only for the first test
class Card():
def __init__(self, uid_from_set, lang, name, power, keywords, effect, quote, image_path, filename, cardset = "", use_3d_effect = 0, author = ""):
self.uid_from_set = uid_from_set # 0
self.lang = lang # 1
self.name = name # 3
self.power = power
self.keywords = keywords
self.effect = effect
self.quote = quote
self.image_path = image_path # 6
self.filename = filename # 7
self.cardset = cardset #8
self.use_3d_effect = use_3d_effect
self.author = author
#Image data
self.cropped_final_card_base64 = ""
self.final_card_base_64 = ""
self.artwork_base64 = ""
self.set_icon_base64 = ""
#Used to init from a db record
def __init__(self, **args):
# added late in dev, force default value in case not present
self.use_3d_effect = 0
self.__dict__.update(args)
def toDdObj(self):
return {
'cardset': self.cardset,
'uid_from_set': self.uid_from_set,
'lang': self.lang,
'name': self.name,
'power': self.power,
'keywords': self.keywords,
'effect': self.effect,
'quote': self.quote,
'image_path': self.image_path,
'filename':self.filename,
'use_3d_effect':self.use_3d_effect,
'author':self.author
}
def relativePath(self):
return os.path.join(f"{self.cardset}", f"{self.lang}", "cropped", f"{self.image_path}")
class ThreeDEffectKind(IntEnum):
NONE = 0
TOPHALF = 1
TOPRIGHTHALF = 2