Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion speedup/dbconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,21 @@ def connect_db(cfg, set_search_path=False):
columns = {table:columns.split() for table, columns in {
'label': 'id name contact_info profile parent_name data_quality',
'label_url': 'label_id url',
'artist': 'id name realname profile data_quality',
'label_image': 'label_id type width height',

'artist': 'id name realname profile data_quality',
'artist_alias': 'artist_id alias_name',
'artist_namevariation': 'artist_id name',
'artist_url': 'artist_id url',
'group_member': 'group_artist_id member_artist_id member_name',
'artist_image': 'artist_id type width height',

'master': 'id title year main_release data_quality',
'master_artist': 'master_id artist_id artist_name anv position join_string role',
'master_video': 'master_id duration title description uri',
'master_genre': 'master_id genre',
'master_style': 'master_id style',
'master_image': 'master_id type width height',

'release': 'id title released country notes data_quality master_id',
'release_artist': 'release_id artist_id artist_name extra anv position join_string role tracks',
Expand All @@ -82,6 +85,7 @@ def connect_db(cfg, set_search_path=False):
'release_identifier': 'release_id description type value',
'release_track': 'release_id sequence position parent title duration',
'release_track_artist': 'release_id track_sequence artist_id artist_name extra anv position join_string role tracks',
'release_image': 'release_id type width height',
}.items()}


Expand Down
10 changes: 8 additions & 2 deletions speedup/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,11 @@ def __init__(self, *args, **kwargs):
super().__init__('label', *args, **kwargs)

main_fields = ['id', 'name', 'contactinfo', 'profile', 'parentLabel', 'data_quality']
image_fields = ['type', 'width', 'height']
self.actions = (
('label', _write_entity, [main_fields]),
('label_url', _write_rows, ['urls']),
('label_image', _write_fields_rows, ['images', image_fields]),
)

def validate(self, label):
Expand All @@ -163,12 +165,14 @@ def __init__(self, *args, **kwargs):
super().__init__('artist', *args, **kwargs)

main_fields = ['id', 'name', 'realname', 'profile', 'data_quality']
image_fields = ['type', 'width', 'height']
self.actions = (
('artist', _write_entity, [main_fields]),
('artist_alias', _write_rows, ['aliases']),
('artist_namevariation', _write_rows, ['namevariations']),
('artist_url', _write_rows, ['urls']),
('group_member', self.write_group_members, None),
('artist_image', _write_fields_rows, ['images', image_fields]),
)

@staticmethod
Expand All @@ -192,12 +196,14 @@ def __init__(self, *args, **kwargs):
main_fields = ['id', 'title', 'year', 'main_release', 'data_quality']
artist_fields = ['id', 'name', 'anv', 'position', 'join', 'role']
video_fields = ['duration', 'title', 'description', 'src']
image_fields = ['type', 'width', 'height']
self.actions = (
('master', _write_entity, [main_fields]),
('master_artist', _write_fields_rows, ['artists', artist_fields]),
('master_video', _write_fields_rows, ['videos', video_fields]),
('master_genre', _write_rows, ['genres']),
('master_style', _write_rows, ['styles']),
('master_image', _write_fields_rows, ['images', image_fields]),

)

Expand All @@ -214,7 +220,7 @@ def __init__(self, *args, **kwargs):
company_fields = [ 'id', 'name', 'entity_type', 'entity_type_name', 'resource_url']
identifier_fields = [ 'description', 'type', 'value']
track_fields = ['sequence', 'position', 'parent', 'title', 'duration']

image_fields = ['type', 'width', 'height']
self.artist_fields = [ 'id', 'name', 'extra', 'anv', 'position', 'join', 'role', 'tracks']

self.actions = (
Expand All @@ -227,7 +233,7 @@ def __init__(self, *args, **kwargs):
('release_company', _write_fields_rows, ['companies', company_fields]),
('release_identifier', _write_fields_rows, ['identifiers', identifier_fields]),
('release_track', _write_fields_rows, ['tracklist', track_fields]),

('release_image', _write_fields_rows, ['images', image_fields]),
# Two special operations
('release_artist', self.write_artists, None),
('release_track_artist', self.write_track_artists, None),
Expand Down
5 changes: 2 additions & 3 deletions speedup/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@ def build_entity(self, entity_id, element):
'urls'):
setattr(artist, t, list(self.children_text(e)))

# --- images don't seem to bring much information
#elif t in ('images',):
# setattr(artist, t, list(self.element_attributes(e, ImageInfo)))
elif t in ('images',):
setattr(artist, t, list(self.element_attributes(e, ImageInfo)))

elif t == 'members':
setattr(artist, t, list(self.element_members(e)))
Expand Down
29 changes: 29 additions & 0 deletions speedup/sql/CreateTables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ CREATE TABLE artist_alias (
alias_artist_id integer
);

CREATE TABLE artist_image (
artist_id integer NOT NULL,
type text,
width integer,
height integer
);

CREATE TABLE group_member (
group_artist_id integer NOT NULL,
member_artist_id integer NOT NULL,
Expand All @@ -51,6 +58,13 @@ CREATE TABLE label_url (
url text NOT NULL
);

CREATE TABLE label_image (
label_id integer NOT NULL,
type text,
width integer,
height integer
);

--- masters
CREATE TABLE master (
id integer NOT NULL,
Expand Down Expand Up @@ -92,6 +106,13 @@ CREATE TABLE master_style (
style text
);

CREATE TABLE master_image (
master_id integer NOT NULL,
type text,
width integer,
height integer
);

--- releases
CREATE TABLE release (
id integer NOT NULL,
Expand Down Expand Up @@ -195,4 +216,12 @@ CREATE TABLE release_company (
entity_type text,
entity_type_name text,
uri text
);

CREATE TABLE release_image (
release_id integer NOT NULL,
type text,
width integer,
height integer
);