annotate core/magnatagatune/makro_import_magnatagatune_isrc.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 % ---
wolffd@0 2 % import isrcs via albums for magnatune clips
wolffd@0 3
wolffd@0 4 % now, we load the new file and search for the information on the
wolffd@0 5 % actual excerpts we have
wolffd@0 6 % ---
wolffd@0 7 clip_info_proper = db_MTTClip.clip_info_proper;
wolffd@0 8
wolffd@0 9
wolffd@0 10 db = adodb_connect('Driver={MySQL ODBC 5.1 Driver}; Server=10.2.165.196; Database=test; UID=daniel; PWD=wucity;',2000);
wolffd@0 11 sql = 'SELECT download_mp3, artist, albumname, isrc, download_mp3lofi FROM `magnatune_song_info` where 1'; % 401 times not found
wolffd@0 12 [res,resformat] = adodb_query(db, sql);
wolffd@0 13
wolffd@0 14
wolffd@0 15 % these are for keeping book of missing items
wolffd@0 16 not_found = [];
wolffd@0 17 isrc = cell(numel(db_MTTClip.annots_ids),1);
wolffd@0 18 for i = 1:numel(db_MTTClip.annots_ids)
wolffd@0 19 % ---
wolffd@0 20 % identify the clip by url
wolffd@0 21 % ---
wolffd@0 22 % convert search string
wolffd@0 23 s = db_MTTClip.clip_info_proper{i,9};
wolffd@0 24
wolffd@0 25 idx = strcellfind(res.download_mp3,s);
wolffd@0 26 if isempty(idx)
wolffd@0 27 idx = strcellfind(res.download_mp3lofi,s);
wolffd@0 28 end
wolffd@0 29
wolffd@0 30 % we'll have to loosen the search
wolffd@0 31 if isempty(idx) | idx < 1
wolffd@0 32 % warning(sprintf('! %s, album %s, artist %s!',clip_info_proper{i,1},...
wolffd@0 33 % clip_info_proper{i,5},clip_info_proper{i,4}));
wolffd@0 34
wolffd@0 35 % make note ...
wolffd@0 36 not_found = cat(1,not_found,[str2num(clip_info_proper{i,1}), 0]);
wolffd@0 37
wolffd@0 38 not_found(end,2) = 1;
wolffd@0 39 % ---
wolffd@0 40 % ok, no problem, lets look for the album and artist!
wolffd@0 41 % ---
wolffd@0 42 s = char(clip_info_proper{i,5});
wolffd@0 43 idx = strcellfind(res.albumname,s);
wolffd@0 44 end
wolffd@0 45
wolffd@0 46
wolffd@0 47 if isempty(idx) | idx < 1
wolffd@0 48 warning(sprintf('-- Album not found %s, album %s, artist %s!',clip_info_proper{i,1},...
wolffd@0 49 clip_info_proper{i,5},clip_info_proper{i,4}));
wolffd@0 50
wolffd@0 51 not_found(end,2) = 2;
wolffd@0 52 % ---
wolffd@0 53 % search for artist
wolffd@0 54 % ---
wolffd@0 55 s = char(clip_info_proper{i,4});
wolffd@0 56 idx = strcellfind(res.artist,s);
wolffd@0 57 end
wolffd@0 58
wolffd@0 59 if isempty(idx) | idx < 0
wolffd@0 60 warning(sprintf(' ---- Artist not found %s, album %s, artist %s!',clip_info_proper{i,1},...
wolffd@0 61 clip_info_proper{i,5},clip_info_proper{i,4}));
wolffd@0 62 not_found(end,2) = 3;
wolffd@0 63 % % ---
wolffd@0 64 % % this is the last try to get hold of such artists
wolffd@0 65 % % they may be noted as a trackname or description substring in a compilation
wolffd@0 66 % % ---
wolffd@0 67 % s = char(clip_info_proper{i,4});
wolffd@0 68 % idx = substrcellfind(tmp(:,2),s);
wolffd@0 69 else
wolffd@0 70 isrc{i} = char(res.isrc{idx});
wolffd@0 71 end
wolffd@0 72
wolffd@0 73
wolffd@0 74 % report new location/info of album
wolffd@0 75
wolffd@0 76 % ---
wolffd@0 77 % save genre
wolffd@0 78 % ---
wolffd@0 79 %clip_info_extra = cat(1,clip_info_extra,{clip_info_proper{i,1},tmp{idx,rel_cols}});
wolffd@0 80
wolffd@0 81 end
wolffd@0 82
wolffd@0 83