Mercurial > hg > camir-aes2014
annotate core/magnatagatune/mb_retrieve_artist_id_from_album_info.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
rev | line source |
---|---|
wolffd@0 | 1 function [artist_mbid,artist_found, out] = mb_retrieve_artist_id_from_album_info(artist,album) |
wolffd@0 | 2 |
wolffd@0 | 3 % http://www.musicbrainz.org/ws/2/recording?query=%22we%20will%20rock%20you%22%20AND%20arid:0383dadf-2a4e-4d10-a46a-e9e041da8eb3 |
wolffd@0 | 4 % call python function |
wolffd@0 | 5 str = python('mbid_from_artist_album.py',artist,album) |
wolffd@0 | 6 |
wolffd@0 | 7 % parse text function output |
wolffd@0 | 8 artists = textscan(str,'%s %s','Delimiter','\n'); |
wolffd@0 | 9 mbids = artists{2}; |
wolffd@0 | 10 artist_found = artists{1}{1}; |
wolffd@0 | 11 |
wolffd@0 | 12 % song info API |
wolffd@0 | 13 % url = sprintf('http://www.musicbrainz.org/ws/2/recording?query=%s',urlencode(sprintf('%s AND artist:%s',album,artist))); |
wolffd@0 | 14 url = sprintf('http://www.musicbrainz.org/ws/2/release/%s?inc=artists',urlencode(mbids)); |
wolffd@0 | 15 |
wolffd@0 | 16 [status] = wget(url,' --no-verbose -U firefox -O tmp.xml'); |
wolffd@0 | 17 out = xml2struct('tmp.xml'); |
wolffd@0 | 18 |
wolffd@0 | 19 isrc = []; |
wolffd@0 | 20 artist_mbid = []; |
wolffd@0 | 21 |
wolffd@0 | 22 try |
wolffd@0 | 23 artist_mbid = out.metadata.release.artist_dash_credit.name_dash_credit.artist.Attributes.id; |
wolffd@0 | 24 catch |
wolffd@0 | 25 end |
wolffd@0 | 26 |