comparison core/magnatagatune/makro_import_magnatagatune_mbtags.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function out = makro_import_magnatagatune_mbtags();
2 load db.mat
3 clip_info_proper_names
4 cnt_workd = 0;
5
6 mbtagdb = AnnotDB();
7
8 failedartists = [];
9
10 for i = 1:size(clip_info_proper,1)
11 % ---
12 % get internal artist id
13 % ---
14 artistintid = artistdb.get_annot_id(lower(clip_info_proper{i,4}));
15
16 % do we have an mbid if not skip?
17 if isempty(clip_info_proper{i,12}) || strcmp(clip_info_proper{i,12}, '-')
18 continue;
19 end
20
21 % do we have tags for this artist?
22 if ~isempty( mbtagdb.annotids_for_owner(artistintid)) || sum(failedartists== artistintid)> 0;
23 continue
24 end
25
26 try
27 % ---
28 % ok, lets get the tags
29 % ---
30 [tags,count, out] = mb_retrieve_tags_for_artist_id(clip_info_proper{i,12});
31
32 if ~isempty(tags)
33 cprint(0,'loaded info for %s: found %s, %s',clip_info_proper{i,4},artist_found,artist_mbid);
34
35 % ---
36 % TODO: save tags in map
37 % ---
38 for i=1:numel(tags)
39 mbtagdb.add_pair(artistintid, tags{i}, count(i));
40 end
41 cnt_workd = cnt_workd + 1;
42
43 else
44 cprint(0,'no tags received for %s:%s',clip_info_proper{i,4});
45 % TODO: mark no tags received for this
46 failedartists(end+1) = artistintid;
47 end
48 pause(1)
49 catch
50 end
51
52 end
53
54 failedartists
55 numel(failedartists);
56 clear failedartists
57 save ('db.mat','mbtagdb','-append')