Skip to content

Commit 21cba4d

Browse files
authored
Merge pull request #170 from philipmat/label_parent_id
brings in parentLabel.id
2 parents 4f0800e + 8ee96ab commit 21cba4d

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

discogsxml2db/exporter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class LabelExporter(EntityCsvExporter):
140140
def __init__(self, *args, **kwargs):
141141
super().__init__('label', *args, **kwargs)
142142

143-
main_fields = ['id', 'name', 'contactinfo', 'profile', 'parentLabel', 'data_quality']
143+
main_fields = ['id', 'name', 'contactinfo', 'profile', 'parentLabel', 'parentLabelId', 'data_quality']
144144
image_fields = ['type', 'width', 'height']
145145
self.actions = (
146146
('label', _write_entity, [main_fields]),
@@ -255,7 +255,7 @@ def write_track_artists(self, writer, release):
255255

256256

257257
csv_headers = {table: columns.split() for table, columns in {
258-
'label': 'id name contact_info profile parent_name data_quality',
258+
'label': 'id name contact_info profile parent_name parent_id data_quality',
259259
'label_url': 'label_id url',
260260
'label_image': 'label_id type width height',
261261

discogsxml2db/parser.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,18 @@ def build_entity(self, entity_id, element):
156156
if t in ('data_quality',
157157
'contactinfo',
158158
'name',
159-
'profile',
160-
'parentLabel'):
159+
'profile'):
160+
setattr(label, t, gettext_stripped(e))
161+
162+
elif t in ('parentLabel',):
161163
setattr(label, t, gettext_stripped(e))
164+
setattr(label, "parentLabelId", e.attrib.get("id"))
162165

163166
elif t in ('sublabels',
164167
'urls'):
165168
setattr(label, t, list(self.children_text(e)))
166169

167-
elif t in ('images'):
170+
elif t in ('images',):
168171
setattr(label, t, list(self.element_attributes(e, ImageInfo)))
169172
return label
170173

postgresql/dbconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def connect_db(cfg, set_search_path=False):
5555

5656

5757
columns = {table: columns.split() for table, columns in {
58-
'label': 'id name contact_info profile parent_name data_quality',
58+
'label': 'id name contact_info profile parent_name parent_id data_quality',
5959
'label_url': 'label_id url',
6060
'label_image': 'label_id type width height',
6161

0 commit comments

Comments
 (0)