Add types
This commit is contained in:
parent
5701f354ba
commit
78a5d5e9d9
4 changed files with 187 additions and 0 deletions
0
Alias.zig
Normal file
0
Alias.zig
Normal file
13
src/Alias.zig
Normal file
13
src/Alias.zig
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
const MBID = @import("MBID.zig");
|
||||
|
||||
pub const Alias = struct {
|
||||
name: []const u8,
|
||||
sort_name: []const u8,
|
||||
type_id: ?MBID,
|
||||
type: ?[]const u8, // Could be an enum
|
||||
locale: ?[]const u8,
|
||||
primary: ?bool,
|
||||
begin: ?i64,
|
||||
end: ?i64,
|
||||
ended: bool,
|
||||
};
|
||||
173
src/Entities.zig
Normal file
173
src/Entities.zig
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
const MBID = @import("MBID.zig");
|
||||
const Alias = @import("Alias.zig");
|
||||
|
||||
pub const Artist = struct {
|
||||
id: MBID,
|
||||
name: []const u8,
|
||||
sort_name: []const u8,
|
||||
type_id: null, // Idk what this is
|
||||
type: enum { person, group, orchestra, choir, character, other },
|
||||
disambiguation: []const u8,
|
||||
gender: ?[]const u8,
|
||||
//gender: ?enum {
|
||||
// male,
|
||||
// female,
|
||||
// other
|
||||
//};
|
||||
gender_id: null,
|
||||
country: []const u8,
|
||||
area: ?Area,
|
||||
begin_area: ?Area,
|
||||
end_area: ?Area,
|
||||
life_span: struct { ended: bool, begin: i64, end: i64 },
|
||||
isnis: ?[][]const u8,
|
||||
ipis: ?[][]const u8,
|
||||
aliases: ?[]Alias,
|
||||
annotation: []const u8,
|
||||
};
|
||||
|
||||
pub const ArtistCredit = struct { artists: []Artist, artists_names: ?[][]const u8, artists_join_phrase: ?[]const u8, mbid: MBID, name: []const u8 };
|
||||
|
||||
pub const Event = struct {
|
||||
name: []const u8,
|
||||
type: enum { concert, festival, stage_performance, award_ceremony, launch_event, convention_expo, masterclass_clinic },
|
||||
cancelled: bool,
|
||||
dates: struct { begin: i64, end: i64 },
|
||||
selist: []const u8, //Will need to write a parser for this
|
||||
time: []const u8,
|
||||
aliases: ?[]Alias,
|
||||
disambiguation: []const u8,
|
||||
annotation: []const u8,
|
||||
};
|
||||
|
||||
pub const Label = struct {
|
||||
name: []const u8,
|
||||
disambiguation: []const u8,
|
||||
type: []enum {
|
||||
imprint,
|
||||
original_production,
|
||||
bootleg_production,
|
||||
reissue_production,
|
||||
distributor,
|
||||
holding,
|
||||
rights_society,
|
||||
},
|
||||
area: []const u8, // This in ISO-3166 format, and is referred to as "Country" on a different page
|
||||
label_code: []const u8,
|
||||
ipi_codes: [][]const u8, // There could be multiple for artists, unsure about albums
|
||||
isni_codes: [][]const u8, // See above
|
||||
date_period: struct { begin_date: i64, end_date: i64 },
|
||||
aliases: ?[]Alias,
|
||||
annotation: []const u8,
|
||||
mbid: MBID,
|
||||
};
|
||||
|
||||
pub const Place = struct { name: []const u8, type: enum([]const u8) { studio, venue = enum { ampitheatre, club, concert_hall_theatre, festival_stage }, stadium, indoor_arena, educational_institution, park, religious_building, pressing_plant, other }, address: []const u8, coordinates: struct { lat: i32, lon: i32 }, area: ?Area, dates: struct { begin: i64, end: i64 }, aliases: ?[]Alias, mbid: MBID, disambiguation: []const u8, annotation: []const u8 };
|
||||
|
||||
pub const Recording = struct {
|
||||
title: []const u8,
|
||||
artists: []Artist,
|
||||
length: f64, // I don't know what this looks like yet
|
||||
isrc: []const u8,
|
||||
mbid: MBID,
|
||||
disambiguation: []const u8,
|
||||
annotation: []const u8,
|
||||
};
|
||||
|
||||
pub const Release = struct {
|
||||
title: []const u8,
|
||||
artists: []Artist,
|
||||
date: i64,
|
||||
country: []const u8, // Consider making a file that exhaustievly lists ISO-3166 codes
|
||||
catalogue_number: []const u8,
|
||||
barcode: u64,
|
||||
status: enum { official, promotion, bootleg, pseudo_release, withdrawn, expunged, cancelled },
|
||||
packaging: enum { book, box, cardboard_paper_sleeve, cassette_case, clamshell_case, digibook, digifile, digipak, discbox_slider, fatbox, gatefold_cover, jewel_case, keep_case, longbox, metal_tin, plastic_sleeve, slidepack, slim_jewel, snap_case, super_jewel_box, other, none },
|
||||
language: []const u8, // ISO-639-3
|
||||
script: []const u8, // ISO-15924
|
||||
mbid: MBID,
|
||||
disambiguation: []const u8,
|
||||
annotation: []const u8,
|
||||
data_quality: enum {
|
||||
high,
|
||||
default,
|
||||
low,
|
||||
},
|
||||
media: []Medium,
|
||||
};
|
||||
|
||||
pub const Medium = struct {
|
||||
title: []const u8,
|
||||
format: enum([]const u8) {
|
||||
compact_disc = enum([]const u8) {
|
||||
compact_disc,
|
||||
copy_control_cd,
|
||||
data_cd,
|
||||
dts_cd,
|
||||
enhanced_cd,
|
||||
hdcd,
|
||||
mixed_mode_cd,
|
||||
cd_r,
|
||||
eight_cm_cd,
|
||||
blu_spec_cd,
|
||||
minimax_cd,
|
||||
shm_cd,
|
||||
hqcd,
|
||||
cd_plus_g = enum { cd_plug_g, eight_cm_cd_plus_g },
|
||||
},
|
||||
vinyl = enum([]const u8) { seven_inch_vinyl, ten_inch_vinyl, twelve_inch_vinyl, flexi_disc = enum { flexi_disc, seven_inch_flexi_disc } },
|
||||
digital_media,
|
||||
cassette = enum { cassette, microcassette },
|
||||
dvd = enum { dvd, dvd_audio, dvd_video },
|
||||
sacd = enum([]const u8) { hybrid_sacd = enum { hybrid_sacd, hybrid_sacd_cd_layer, hybrig_sacd_sacd_layer }, shm_sacd },
|
||||
dualdisc = enum {
|
||||
dualdisc,
|
||||
dualdisc_cd_side,
|
||||
dualdisc_dvd_video_side,
|
||||
dualdisc_dvd_audio_side,
|
||||
},
|
||||
minidisc,
|
||||
blu_ray = enum { blu_ray, blu_ray_r },
|
||||
hd_dvd,
|
||||
vcd = enum { vcd, svcd },
|
||||
cdv,
|
||||
umd,
|
||||
shellac = enum {
|
||||
shellac,
|
||||
seven_inch_shellac,
|
||||
ten_inch_shellac,
|
||||
twelve_inch_shellac,
|
||||
},
|
||||
acetate = enum {
|
||||
acetate,
|
||||
seven_inch_acetate,
|
||||
ten_inch_acetate,
|
||||
twelve_inch_acetate,
|
||||
},
|
||||
sd_card = enum { sd_card, slotmusic },
|
||||
other = enum([]const u8) { betamax, cartridge = enum { cartridge, hipac, playtape }, ced, dat, dcc, dvdplus = enum { dvdplus_cd_side, dvd_plus_dvd_video_side, dvd_plus_dvd_audio_side }, edison_diamond_disc, floppy_disk = enum { floppy_disk, three_half_inch_floppy_disk, five_quarter_inch_floppy_disk, zip_disk }, laserdisc = enum { laserdisc, eight_inch_laserdisc, twelve_inch_laserdisc }, music_card, pathe_disc, piano_roll, playbutton, reel_to_reel, tefifon, usb_flash_drive, vhd, vhs, vinyldisc, wax_cylinder },
|
||||
},
|
||||
};
|
||||
|
||||
//pub const Track
|
||||
|
||||
pub const ReleaseGroup = struct {
|
||||
title: []const u8,
|
||||
artists: []Artist, // Mentions using ArtistCredits for multiple artists. Will need to see a JSOn response to know what to do here
|
||||
types: struct { primary: enum([]const u8) { single = enum { us, uk, japan }, ep, broadcast, other }, secondary: ?[]enum([]const u8) { compilation, soundtrack, spokenword, interview, audiobook, audio_drama, live, remix, dj_mix, mixtape_street, demo, field_recording } },
|
||||
mbid: MBID,
|
||||
disambiguation: []const u8,
|
||||
annotation: []const u8,
|
||||
};
|
||||
|
||||
pub const Series = struct { name: []const u8, type: enum([]const u8) { release_group_series = enum { release_group_series, release_group_award, podcast }, release_series, recording_series = enum { recording_series, recording_award }, work_series = enum { work_series, catalogue, work_award }, artist_series = enum { artist_series, artist_award }, event_series = enum { even_series, tour, festival, run, residency, award_ceremony } }, ordering_type: []const u8, aliases: []Alias, mbid: MBID, disambiguation: []const u8, annotation: []const u8 };
|
||||
|
||||
pub const URL = []const u8;
|
||||
|
||||
pub const Work = struct { name: []const u8, type: enum { discrete, aggregate }, aliases: []Alias, lyrics_languages: [][]const u8, iswc: []const u8, mbid: MBID, disambiguation: []const u8, annotation: []const u8 };
|
||||
|
||||
pub const Area = struct { name: []const u8, type: enum { country, subdivision, county, municipality, city, district, island }, dates: struct { begin: i64, end: i64 }, iso_3166_codes: [][]const u8, aliases: []Alias, mbid: MBID, annotation: []const u8 };
|
||||
|
||||
pub const Genre = [][]const u8;
|
||||
|
||||
pub const Instrument = struct { name: []const u8, type: enum { wind, string, percussion, electronic, family, ensemble, other }, description: []const u8, aliases: []Alias, mbid: MBID, disambiguation: []const u8, annotation: []const u8 };
|
||||
1
src/MBID.zig
Normal file
1
src/MBID.zig
Normal file
|
|
@ -0,0 +1 @@
|
|||
pub const MBID = []const u8;
|
||||
Loading…
Add table
Add a link
Reference in a new issue