#!/usr/bin/perl
#line 2 batchaddars.in

use warnings;
use strict;

use URI;

my ($BROWSER) = "echo";
my (@ARGUMENTS) = "--new-tab";

#use Data::Dumper;

# lookup tables.
my (%Vocal) = (
  'alto' => '5',
  'background' => '12',
  'baritone' => '6',
  'bass' => '7',
  'bass-baritone' => '231',
  'choir' => '13',
  'contra-tenor' => '8',
  'contralto' => '230',
  'lead' => '4',
  'mezzo-soprano' => '9',
  'soprano' => '10',
  'tenor' => '11'
)
;
#line 15 batchaddars.in
my (%Instrument) = (
  '[select instrument]' => '0',
  'accordion' => '64',
  'acoustic bass guitar' => '73',
  'acoustic guitar' => '76',
  'acoustic upright bass' => '71',
  'aeolian harp' => '89',
  'afuche' => '136',
  'alphorn' => '41',
  'alto clarinet' => '24',
  'alto flute' => '423',
  'alto recorder' => '363',
  'alto saxophone' => '35',
  'alto violin' => '226',
  'appalachian dulcimer' => '90',
  'aracaic and other bowed string-instruments' => '296',
  'bagpipe' => '18',
  'balalaika' => '91',
  'bandoneón' => '263',
  'banghu' => '291',
  'banhu' => '291',
  'banjo' => '92',
  'bansuri' => '251',
  'baritone guitar' => '377',
  'baritone horn' => '42',
  'baritone saxophone' => '37',
  'bass' => '70',
  'bass clarinet' => '25',
  'bass guitar' => '277',
  'bass recorder' => '365',
  'bass trombone' => '228',
  'bassoon' => '19',
  'bells' => '151',
  'bendir' => '420',
  'berimbau' => '93',
  'biwa' => '94',
  'bodhrán' => '249',
  'bongos' => '128',
  'bouzouki' => '95',
  'bowed psaltery' => '299',
  'bowed string instruments' => '275',
  'brass' => '38',
  'brushes' => '397',
  'bugle' => '51',
  'bull-roarer' => '202',
  'c-bass recorder' => '366',
  'cabasa' => '136',
  'cajón' => '413',
  'calliope' => '170',
  'carillon' => '171',
  'castanets' => '137',
  'celesta' => '172',
  'cello' => '84',
  'chacha' => '412',
  'chamberlin' => '330',
  'chapman stick' => '238',
  'chimes' => '415',
  'chiêng' => '341',
  'chromatic harmonica' => '376',
  'chập choa' => '343',
  'cittern' => '307',
  'cizhonghu' => '288',
  'clarinet' => '23',
  'classical guitar' => '77',
  'claves' => '138',
  'clavichord' => '173',
  'clavinet' => '227',
  'concertina' => '65',
  'conch' => '205',
  'congas' => '127',
  'contrabass' => '83',
  'contrabass clarinet' => '26',
  'contrabass recorder' => '367',
  'contrabassoon' => '20',
  'cornet' => '39',
  'cornett' => '273',
  'cowbell' => '208',
  'crotales' => '214',
  'crwth' => '98',
  'cymbals' => '342',
  'cymbalum' => '326',
  'daf' => '403',
  'dan trung and dan klom-put' => '381',
  'darbuka' => '419',
  'denis d\'or' => '160',
  'didgeridoo' => '204',
  'dinh tăktàr' => '394',
  'diyingehu' => '290',
  'djembe' => '335',
  'dobro' => '240',
  'double bass' => '83',
  'double reed' => '17',
  'doyra' => '140',
  'drum machine' => '162',
  'drums' => '125',
  'drumset' => '126',
  'dubreq stylophone' => '161',
  'ebow' => '404',
  'electric bass guitar' => '74',
  'electric cello' => '278',
  'electric guitar' => '78',
  'electric piano' => '329',
  'electric sitar' => '316',
  'electric upright bass' => '72',
  'electric violin' => '282',
  'electronic instruments' => '159',
  'english horn' => '21',
  'euphonium' => '199',
  'f-bass recorder' => '365',
  'fiddle' => '85',
  'fipple flutes' => '264',
  'flugelhorn' => '43',
  'flute' => '27',
  'frame drum' => '421',
  'free reed' => '63',
  'french horn' => '44',
  'gadulka' => '301',
  'gaohu' => '286',
  'garklein recorder' => '361',
  'gayageum' => '99',
  'gehu' => '289',
  'geomungo' => '100',
  'ghatam' => '408',
  'glass (h)armonica' => '357',
  'glockenspiel' => '215',
  'goblet drum' => '338',
  'gong' => '340',
  'gongs' => '339',
  'grand piano' => '181',
  'great bass recorder' => '366',
  'greek baglama' => '306',
  'gudok' => '300',
  'guitar' => '229',
  'guitars' => '75',
  'gumbri' => '402',
  'güiro' => '141',
  'hammered dulcimer' => '101',
  'hammond organ' => '177',
  'handbells' => '346',
  'handclaps' => '398',
  'hardart' => '187',
  'hardingfele' => '102',
  'harmonica' => '66',
  'harmonium' => '178',
  'harp' => '81',
  'harpsichord' => '174',
  'hawaiian guitar' => '400',
  'heckelphone' => '261',
  'hmông flute' => '389',
  'horn' => '40',
  'huqin' => '283',
  'hurdy gurdy' => '103',
  'jew\'s harp' => '104',
  'jing hú' => '284',
  'k\'long pút' => '355',
  'kanun' => '360',
  'kazoo' => '188',
  'kemenche' => '281',
  'keyboard' => '232',
  'keyed brass instruments' => '203',
  'khen la´' => '388',
  'khim' => '359',
  'khèn meò' => '395',
  'ki pah' => '384',
  'kinnor' => '317',
  'kithara' => '318',
  'koke' => '386',
  'kokyu' => '293',
  'komungo' => '105',
  'kora' => '106',
  'kortholt' => '334',
  'koto' => '107',
  'kèn bầu' => '380',
  'la' => '341',
  'langeleik' => '319',
  'lasso d\'amore' => '189',
  'lute' => '108',
  'lyre' => '109',
  'madal' => '242',
  'mandola' => '308',
  'mandolin' => '96',
  'maracas' => '142',
  'marimba' => '216',
  'matouqin' => '294',
  'mbira' => '110',
  'mellophone' => '56',
  'mellotron' => '175',
  'melodica' => '67',
  'mendoza' => '143',
  'mexican vihuela' => '117',
  'minimoog' => '349',
  'moog' => '348',
  'moon lute' => '310',
  'morin khuur' => '294',
  'musical bow' => '97',
  'musical saw' => '190',
  'mõ' => '337',
  'nai' => '369',
  'natural brass instruments' => '49',
  'nose flute' => '270',
  'nyckelharpa' => '298',
  'não bạt' => '343',
  'oboe' => '22',
  'ocarina' => '29',
  'omnichord' => '352',
  'ondes martenot' => '163',
  'ophicleide' => '57',
  'organ' => '176',
  'other flutes' => '265',
  'other instruments' => '185',
  'other percussion' => '221',
  'other string instruments' => '88',
  'oud' => '304',
  'pan flute' => '30',
  'pang gu ly hu hmông' => '392',
  'percussion instruments' => '124',
  'phách' => '379',
  'piano' => '180',
  'piccolo' => '31',
  'pipe organ' => '179',
  'plucked string instruments' => '302',
  'programming' => '353',
  'psaltery' => '111',
  'pí thiu' => '416',
  'ratchet' => '211',
  'rattle' => '411',
  'rebab' => '309',
  'rebec' => '276',
  'recorder' => '32',
  'reed organ' => '274',
  'reeds' => '233',
  'rek' => '406',
  'rhodes piano' => '182',
  'sackbut' => '198',
  'sampler' => '164',
  'sanh tiên' => '347',
  'sanshin' => '315',
  'santoor' => '358',
  'santur' => '325',
  'sanxián' => '314',
  'sapek clappers' => '418',
  'sarod' => '250',
  'saxophone' => '33',
  'saó ôi flute' => '387',
  'serpent' => '197',
  'shakers' => '417',
  'shakuhachi' => '224',
  'shamisen' => '112',
  'sheng' => '68',
  'sho' => '262',
  'shofar' => '60',
  'singing bowl' => '191',
  'singular reed' => '234',
  'sitar' => '113',
  'slide brass instruments' => '272',
  'slide guitar' => '79',
  'slide whistle' => '268',
  'snare drum' => '129',
  'song loan' => '356',
  'sopranino recorder' => '362',
  'soprano saxophone' => '34',
  'soprano violin' => '280',
  'sousaphone' => '200',
  'spanish acoustic guitar' => '206',
  'spanish vihuela' => '332',
  'spoons' => '210',
  'steel guitar' => '80',
  'steelpan' => '344',
  'string instruments' => '69',
  'struck string instruments' => '322',
  'subcontrabass recorder' => '368',
  'suikinkutsu' => '192',
  'synclavier' => '165',
  'synthesizer' => '166',
  'syrinx' => '370',
  'sáo meò' => '393',
  'sáo trúc' => '269',
  'tabla' => '241',
  'tambourine' => '333',
  'tanbou ka' => '410',
  'teleharmonium' => '167',
  'temple blocks' => '222',
  'tenor horn (alto horn)' => '45',
  'tenor recorder' => '364',
  'tenor saxophone' => '36',
  'theremin' => '168',
  'ti bwa' => '409',
  'tibetan water drum' => '350',
  'tieu flute' => '401',
  'timbales' => '132',
  'timpani' => '217',
  'tin whistle' => '267',
  'tiple' => '331',
  'tiểu cô' => '336',
  'toy piano' => '328',
  'tranverse flute' => '422',
  'treble recorder' => '363',
  'treble violin' => '279',
  'tres' => '115',
  'triangle' => '133',
  'trombone' => '46',
  'trumpet' => '47',
  'tràm plè' => '385',
  'trắng jâu' => '391',
  'trắng lu' => '390',
  'trống bông' => '382',
  'tuba' => '48',
  'tubular bells' => '218',
  'tuned percussion' => '150',
  'turkish baglama' => '305',
  'turntable(s)' => '236',
  'udu' => '407',
  'uilleann pipes' => '248',
  'ukulele' => '114',
  'upright piano' => '184',
  'vacuum cleaner' => '375',
  'valve trombone' => '237',
  'valved brass instruments' => '271',
  'vertical flute' => '28',
  'vibraphone' => '219',
  'vibraslap' => '212',
  'vielle' => '116',
  'vietnamese guitar' => '399',
  'viola' => '87',
  'viola d\'amore' => '119',
  'viola da gamba' => '118',
  'viola organista' => '297',
  'violin' => '86',
  'violins' => '82',
  'violotta' => '120',
  'vocoder' => '354',
  'wagner tuba' => '201',
  'warr guitar' => '323',
  'washboard' => '209',
  'washtub bass' => '121',
  'waterphone' => '351',
  'whip' => '134',
  'whistle' => '345',
  'willow flute' => '266',
  'wind instruments' => '15',
  'wood block' => '213',
  'woodwind' => '16',
  'xalam (khalam)' => '122',
  'xylophone' => '220',
  'yehu' => '292',
  'yángqín' => '324',
  'zarb' => '405',
  'zhonghu' => '287',
  'zhongruan' => '311',
  'zither' => '123',
  'Èrhú' => '285',
  'Đing buốt' => '383',
  'Đing nǎm' => '396',
  'Đàn bầu' => '321',
  'Đàn nguyệt' => '312',
  'Đàn nhị' => '295',
  'Đàn tam' => '414',
  'Đàn tam thập lục' => '327',
  'Đàn tranh' => '320',
  'Đàn tứ dây' => '303',
  'Đàn tỳ bà' => '313',
  'Đại cô' => '336'
)
;
#line 16 batchaddars.in
my (%Orchestra) = (
  'chamber' => '245',
  'other' => '246',
  'symphony' => '244'
)
;
#line 17 batchaddars.in
my (%Type) = (
  'artist' => {
    'artist' => {
      'collaborated on' => '11',
      'does/did support for' => '15',
      'does/did vocal support for' => '14',
      'has sibling' => '7',
      'is the parent of' => '6',
      'is/was a supporting musician for' => '13',
      'is/was amember of' => '2',
      'is/was involved with' => '9',
      'is/was married to' => '8',
      'musical relationship' => '1',
      'performs as' => '4',
      'personal relationship' => '5'
    },
    'release' => {
      '[select a relationship type]' => '0',
      'arranged' => '15',
      'audio engineered' => '20',
      'compilations' => '40',
      'compiled' => '41',
      'composed' => '14',
      'composition' => '13',
      'conducted' => '9',
      'dj-mixed' => '38',
      'engineered' => '19',
      'has a miscellaneous role on' => '25',
      'has tribute album(s)' => '44',
      'live sound engineered' => '22',
      'mastered' => '45',
      'mixed' => '23',
      'orchestra performed' => '5',
      'orchestrated' => '48',
      'performance' => '1',
      'performed' => '2',
      'performed chorus master on' => '43',
      'performed on' => '3',
      'performed vocal on' => '4',
      'produced' => '18',
      'produced material that was sampled in' => '12',
      'production' => '17',
      'provided art direction on' => '30',
      'provided artist &amp; repertoire support for' => '28',
      'provided booking for' => '27',
      'provided creative direction on' => '29',
      'provided design/illustration on' => '31',
      'provided graphic design on' => '32',
      'provided instrumentation for' => '47',
      'provided legal representation for' => '26',
      'provided merchandising for' => '36',
      'provided photography on' => '33',
      'provided travel arrangements for' => '34',
      'published' => '35',
      'recorded' => '24',
      'remixed' => '11',
      'remixes' => '10',
      'sound engineered' => '21',
      'wrote the libretto for' => '42',
      'wrote the lyrics for' => '16'
    },
    'track' => {
      'arranged' => '15',
      'audio engineered' => '20',
      'compilations' => '38',
      'compiled' => '39',
      'composed' => '14',
      'composition' => '13',
      'conducted' => '9',
      'dj-mixed' => '40',
      'engineered' => '19',
      'has a miscellaneous role on' => '25',
      'live sound engineered' => '22',
      'mastered' => '41',
      'mixed' => '23',
      'orchestra performed' => '5',
      'orchestrated' => '44',
      'performance' => '1',
      'performed' => '2',
      'performed on' => '3',
      'performed vocal on' => '4',
      'produced' => '18',
      'produced material that was sampled in' => '12',
      'production' => '17',
      'provided art direction on' => '30',
      'provided artist &amp; repertoire support for' => '28',
      'provided booking for' => '27',
      'provided creative direction on' => '29',
      'provided design/illustration on' => '31',
      'provided graphic design on' => '32',
      'provided instrumentation for' => '43',
      'provided legal representation for' => '26',
      'provided merchandising for' => '36',
      'provided photography on' => '33',
      'provided travel arrangements for' => '34',
      'published' => '35',
      'recorded' => '24',
      'remixed' => '11',
      'remixes' => '10',
      'sound engineered' => '21',
      'wrote the lyrics for' => '16'
    }
  },
  'release' => {
    'artist' => {
      '[select a relationship type]' => '0',
      'arranged' => '15',
      'audio engineered' => '20',
      'compilations' => '40',
      'compiled' => '41',
      'composed' => '14',
      'composition' => '13',
      'conducted' => '9',
      'dj-mixed' => '38',
      'engineered' => '19',
      'has a miscellaneous role on' => '25',
      'has tribute album(s)' => '44',
      'live sound engineered' => '22',
      'mastered' => '45',
      'mixed' => '23',
      'orchestra performed' => '5',
      'orchestrated' => '48',
      'performance' => '1',
      'performed' => '2',
      'performed chorus master on' => '43',
      'performed on' => '3',
      'performed vocal on' => '4',
      'produced' => '18',
      'produced material that was sampled in' => '12',
      'production' => '17',
      'provided art direction on' => '30',
      'provided artist &amp; repertoire support for' => '28',
      'provided booking for' => '27',
      'provided creative direction on' => '29',
      'provided design/illustration on' => '31',
      'provided graphic design on' => '32',
      'provided instrumentation for' => '47',
      'provided legal representation for' => '26',
      'provided merchandising for' => '36',
      'provided photography on' => '33',
      'provided travel arrangements for' => '34',
      'published' => '35',
      'recorded' => '24',
      'remixed' => '11',
      'remixes' => '10',
      'sound engineered' => '21',
      'wrote the libretto for' => '42',
      'wrote the lyrics for' => '16'
    },
    'release' => {
      'compilations' => '8',
      'covers or other versions' => '1',
      'is a cover of' => '13',
      'is a dj-mix of' => '9',
      'is a live performance of' => '11',
      'is a mash-up of' => '5',
      'is a remaster of' => '3',
      'is a remix of' => '7',
      'is the earliest release of' => '2',
      'remixes' => '4'
    },
    'track' => {
      '[select a relationship type]' => '0',
      'provides samples for' => '2'
    }
  },
  'track' => {
    'artist' => {
      'arranged' => '15',
      'audio engineered' => '20',
      'compilations' => '38',
      'compiled' => '39',
      'composed' => '14',
      'composition' => '13',
      'conducted' => '9',
      'dj-mixed' => '40',
      'engineered' => '19',
      'has a miscellaneous role on' => '25',
      'live sound engineered' => '22',
      'mastered' => '41',
      'mixed' => '23',
      'orchestra performed' => '5',
      'orchestrated' => '44',
      'performance' => '1',
      'performed' => '2',
      'performed on' => '3',
      'performed vocal on' => '4',
      'produced' => '18',
      'produced material that was sampled in' => '12',
      'production' => '17',
      'provided art direction on' => '30',
      'provided artist &amp; repertoire support for' => '28',
      'provided booking for' => '27',
      'provided creative direction on' => '29',
      'provided design/illustration on' => '31',
      'provided graphic design on' => '32',
      'provided instrumentation for' => '43',
      'provided legal representation for' => '26',
      'provided merchandising for' => '36',
      'provided photography on' => '33',
      'provided travel arrangements for' => '34',
      'published' => '35',
      'recorded' => '24',
      'remixed' => '11',
      'remixes' => '10',
      'sound engineered' => '21',
      'wrote the lyrics for' => '16'
    },
    'release' => {
      '[select a relationship type]' => '0',
      'provides samples for' => '2'
    },
    'track' => {
      'compilations' => '10',
      'contains samples from' => '7',
      'covers or other versions' => '1',
      'is a compilation of' => '12',
      'is a cover of' => '5',
      'is a dj-mix of' => '13',
      'is a mash-up of' => '8',
      'is a medley of' => '14',
      'is a remaster of' => '3',
      'is a remix of' => '11',
      'is the earliest release of' => '2',
      'is the earliest version of' => '4',
      'remixes' => '6'
    }
  }
)
;
#line 18 batchaddars.in

# split input into stanzas
my (@stanzas);
my (@lines);
my ($nonblank) = 0;

while(<>) {
  chomp;
  if ($_ eq "") {
    if($nonblank) {
      push @stanzas, \@lines;
      @lines =();
    }
    next;
  }
  next if /^#/;
  $nonblank = 1;
  push @lines, $_;
}

# the list of edits we are about to commit
my (@edits);

# until the heat death of the universe
foreach my $stanza (@stanzas) {
  my @lines = @{$stanza};
  
  # parse first and second entity
  my ($type0, @id0) = parseEntityLine(shift @lines);
  my ($type1, @id1) = parseEntityLine(shift @lines);

  #print join ",",$type0, $type1; print "\n";
  #print join ",",@id0; print "\n";
  #print join ",",@id1; print "\n";

  # Parse remaining lines, extract relationship parameters
  my (%param) = map {
    lc $1 => $_ if (s/^\s*(\w+)\s*[:=]?(?:\s*|$)//);
  } @lines;
  
  # --- canonicalize parameters ---
  #print Dumper(\%param);
  
  # Type
  die "(Relationship) Type not specified" unless exists $param{type};
  foreach (keys %{$Type{$type0}{$type1}}) {
    $param{type} = $Type{$_}{$type0}{$type1} if exists $param{$_};
    delete $param{$_};
  }
  $param{type} = $Type{$type0}{$type1}{$param{type}} 
    if exists $Type{$type0}{$type1}{$param{type}};

  # Guest, Additional, Minor
  foreach (qw(guest additional minor)) {
    if (exists $param{$_}) {
      if ($param{$_} =~ m/1|Y(es)?|^$/i) {
        $param{$_} = 1;
      } else {
        $param{$_} = 0;
      }
    }
  }
  
  # Vocal
  foreach (keys %Vocal) {
    $param{vocal} = $Vocal{$_} if exists $param{$_};
    delete $param{$_};
  }
  $param{vocal} = $Vocal{$param{vocal}} 
    if exists $param{vocal} && exists $Vocal{$param{vocal}};

  # Instrument
  foreach (keys %Instrument) {
    $param{instrument} = $Instrument{$_} if exists $param{$_};
    delete $param{$_};
  }
  $param{instrument} = $Instrument{$param{instrument}}
    if exists $param{instrument} && exists $Instrument{$param{instrument}};

  # Orchestra
  foreach (keys %Orchestra) {
    $param{orchestra} = $Orchestra{$_} if exists $param{$_};
    delete $param{$_};
  }
  $param{orchestra} = $Orchestra{$param{instrument}}
    if exists $param{orchestra} && exists $Orchestra{$param{orchestra}};

  # BeginDate -- YYYY-MM-DD
  if (exists $param{begindate}) {
    my ($date) = $param{begindate};
    delete $param{begindate};
    if ($date =~ m/(\d+)-(\d+)-(\d+)/) {
      $param{begindate_y} = $1;
      $param{begindate_m} = $2;
      $param{begindate_d} = $3;
    }
  }
  
  # EndDate
  if (exists $param{enddate}) {
    my ($date) = $param{enddate};
    delete $param{enddate};
    if ($date =~ m/(\d+)-(\d+)-(\d+)/) {
      $param{enddate_y} = $1;
      $param{enddate_m} = $2;
      $param{enddate_d} = $3;
    }
  }

  #print Dumper(\%param);

  # construct url...

  # type -> linktypeid
  if ($param{type} =~ m/^\d+$/) {
    $param{linktypeid} = $param{type};
    delete $param{type};
  } else {
    die "(Relationship) Type '".$param{type}."' unknown";
  }
  
  # additional -> attr_additional_0
  if (exists $param{additional}) {
    $param{attr_additional_0} = $param{additional};
    delete $param{additional};
  }

  # guest -> attr_guest_0
  if (exists $param{guest}) {
    $param{attr_guest_0} = $param{guest};
    delete $param{guest};
  }

  # minor -> attr_minor_0
  if (exists $param{minor}) {
    $param{attr_minor_0} = $param{minor};
    delete $param{minor};
  }
  
  # instrument -> attr_instrument_0
  if (exists $param{instrument}) {
    $param{attr_instrument_0} = $param{instrument};
    delete $param{instrument};
  }
  
  # orchestra -> attr_orchestra_0
  if (exists $param{orchestra}) {
    $param{attr_orchestra_0} = $param{orchestra};
    delete $param{orchestra};
  }
  
  # vocal -> attr_vocal_0
  if (exists $param{vocal}) {
    $param{attr_vocal_0} = $param{vocal};
    delete $param{vocal};
  }

  # note -> notetext
  if (exists $param{note}) {
    $param{notetext} = $param{note};
    delete $param{note};
  }
  
  #print Dumper(\%param);
  
  # bleh... the server still wants "album=..."
  my ($linktype0) = $type0 eq "release" ? "album" : $type0;
  my ($linktype1) = $type1 eq "release" ? "album" : $type1;
  
  # Foreach (Entity1, Entity2) pair
  foreach my $id0 (@id0) { foreach my $id1 (@id1) {
    my (%edit) = (
      link0 => $linktype0 . "=" . $id0,
      link1 => $linktype1 . "=" . $id1,
    );
    foreach (keys %param) {
      $edit{$_} = $param{$_};
    }
    push @edits, \%edit;
  }}
}

foreach my $edit (@edits) {
  my $uri = new URI "http://musicbrainz.org/edit/relationship/add.html";
  
  $uri->query_form($edit);
  
  print $uri->as_string, "\n";
  
  # open a new tab in browser...
  system $BROWSER, @ARGUMENTS, $uri->as_string;

  # Delay a few seconds to reduce load.
  sleep 3 + rand(4);
}

sub parseEntityLine {
  my ($line) = @_;
  
  #print $line;
  
  # extract entity type from line
  die "Could not find entity type" 
    unless $line =~ s/^\s*(artist|release|track)(?::|\s)\s*//i;
  
  my ($type) = lc $1;

  # extract entities from line
  my (@ids) = split /(?:,|\s)\s*/, $line; # )()
  
  die "No entities specified" if $#ids == -1;

  # Convert entityid(TrackID, etc...) to entity number (cache this data
  # within an invocation)
  #@ids = artistIDsToNumbers @ids if $type == "artist";
  
  return $type, @ids;
}
