forked from philipmat/discogs-xml2db
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel.py
151 lines (134 loc) · 3.32 KB
/
model.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
class Artist:
def __init__(self):
self.id = 0
self.name = ''
self.realname = ''
self.images = []
#self.urls = {'wikipedia':None, 'myspace':None,'other':[]}
self.urls = []
self.namevariations = []
self.aliases = []
self.profile = ''
self.members = []#MemberNameList, foreign key name, class Artist
self.groups = []#GroupNameList, foreign key name, class Artist
#self.artistType = 0 #0 = person, 1 = group
#self.artist_id = ''
self.data_quality = ''
class Release:
def __init__(self):
self.id = 0
self.status = ''
self.title = ''
self.country = ''
self.released = ''
self.notes = ''
self.genres = []
self.styles = []
self.images = []
self.formats = []
self.labels = []
self.anv = '' #used only if artist name is missing
self.artist = ''
self.artists = [] #join
self.tracklist = [] #join
self.extraartists = []
self.data_quality = ''
self.master_id = 0
self.identifiers = []
self.companies = []
self.videos = []
class Master:
def __init__(self):
self.id = 0
#self.status = ''
self.title = ''
self.main_release = 0
self.year = 0
self.notes = ''
self.genres = []
self.styles = []
self.images = []
self.artist = ''
self.artists = [] #join
self.extraartists = []
self.data_quality = ''
self.videos = []
#self.tracklist = []
class ArtistJoin:
def __init__(self):
self.artist1 = ''
self.join_relation = ''
class Extraartist:
def __init__(self):
self.name = ''
self.roles = []
class ReleaseLabel:
def __init__(self):
self.name = ''
self.catno = ''
class Label:
def __init__(self):
self.id = 0
self.name = ''
self.images = []
self.contactinfo = ''
self.profile = ''
self.parentLabel = ''
self.urls = []
self.sublabels = []
self.data_quality = ''
class Format:
def __init__(self):
self.name = ''
self.qty = 0
self.text = ''
self.descriptions = []
class Style:
def __init__(self, name):
self.name = name
#self.genres = []
class Genre:
def __init__(self, name):
self.name = name
class Track:
def __init__(self):
self.artists = []
self.artistJoins = []
self.extraartists = []
self.title = ''
self.duration = ''
self.position = ''
class ImageInfo:
def __init__(self):
self.height = 0
self.imageType = None #enum ImageType.PRIMARY or ImageType.SECONDARY
self.uri = ''
self.uri150 = ''
self.width = 0
class ImageType:
PRIMARY = 0
SECONDARY = 1
class Video:
def __init__(self):
self.duration = 0
self.embed = ''
self.title = ''
self.description = ''
self.uri = ''
class ArtistCredit:
def __init__(self):
self.id = 0
self.join = ''
self.tracks = ''
self.roles = []
self.anv = ''
self.name = ''
class Identifier:
def __init__(self):
self.type = ''
self.value = ''
self.description = ''
class ParserStopError(Exception):
"""Raised by a parser to signal that it wants to stop parsing."""
def __init__(self, count):
self.records_parsed = count