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