-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmangadb.py
More file actions
66 lines (54 loc) · 1.54 KB
/
mangadb.py
File metadata and controls
66 lines (54 loc) · 1.54 KB
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
57
58
59
60
61
62
63
64
65
'''
funzioni e classi
'''
from storm.locals import Date, Unicode, DateTime, Int, \
create_database, Store, Storm, Reference
from mangareader import dirname
from os import path
database = create_database("sqlite:" + path.join(dirname, "database"))
store = Store(database)
class Chapter(Storm):
'''
Oggetto gestito da Storm
'''
__storm_table__ = "chapters"
id = Int(primary=True)
name = Unicode()
number = Int()
status = Int()
id_manga = Int()
link = Unicode()
data = DateTime()
manga = Reference(id_manga, "Manga.id")
def __repr__(self):
return "<Chapter('%s', '%s', '%s', '%s', '%s', '%s', '%s')>" \
% (self.id, self.name, self.number, \
self.link, self.status, self.data, self.id_manga)
class Manga(Storm):
'''
Oggetto gestito da Storm
'''
__storm_table__ = "mangas"
id = Int(primary=True)
name = Unicode()
link = Unicode()
status = Int()
data = DateTime()
def __repr__(self):
return "<Manga('%s', '%s', '%s', '%s', '%s')>" \
% (self.id, self.name, self.link, \
self.status, self.data)
class Mail(Storm):
'''
Oggetto gestito da Storm
'''
__storm_table__ = "mails"
id = Int(primary=True)
from_addr = Unicode()
to_addr = Unicode()
subject = Unicode()
smtp = Unicode()
def __repr__(self):
return "<mail('%s', '%s', '%s', '%s', '%s')>" \
% (self.id, self.from_addr, self.to_addr, \
self.subject, self.smtp)