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