wolffd@0
|
1 % ---
|
wolffd@0
|
2 % This is the wrapper and loader class for magnatagatune db
|
wolffd@0
|
3 % and related data
|
wolffd@0
|
4 % ---
|
wolffd@0
|
5
|
wolffd@0
|
6 classdef MTTClipDB < handle
|
wolffd@0
|
7
|
wolffd@0
|
8 properties (SetAccess = 'private')
|
wolffd@0
|
9
|
wolffd@0
|
10 % ---
|
wolffd@0
|
11 % TODO: create global "db_magnaclips" class pointer
|
wolffd@0
|
12 % ---
|
wolffd@0
|
13
|
wolffd@0
|
14 annots;
|
wolffd@0
|
15 annots_filenames;
|
wolffd@0
|
16 annots_ids;
|
wolffd@0
|
17 annots_names;
|
wolffd@0
|
18
|
wolffd@0
|
19 % inverse ids for comparison
|
wolffd@0
|
20 comparison_ids;
|
wolffd@0
|
21
|
wolffd@0
|
22 clip_info_proper;
|
wolffd@0
|
23 clip_info_proper_names;
|
wolffd@0
|
24
|
wolffd@0
|
25 % magnagenre_childof;
|
wolffd@0
|
26
|
wolffd@0
|
27 % genre database
|
wolffd@0
|
28 genredb;
|
wolffd@0
|
29
|
wolffd@0
|
30 % artist database
|
wolffd@0
|
31 artistdb;
|
wolffd@0
|
32
|
wolffd@0
|
33 % tag databses
|
wolffd@0
|
34 tagdb;
|
wolffd@0
|
35
|
wolffd@0
|
36 fmtagdb;
|
wolffd@0
|
37
|
wolffd@0
|
38 % @todo: get data
|
wolffd@0
|
39 mbtagdb;
|
wolffd@0
|
40 end
|
wolffd@0
|
41
|
wolffd@0
|
42 properties (Hidden)
|
wolffd@0
|
43 % hidden properties
|
wolffd@0
|
44
|
wolffd@0
|
45 end
|
wolffd@0
|
46
|
wolffd@0
|
47 methods
|
wolffd@0
|
48
|
wolffd@0
|
49 % ---
|
wolffd@0
|
50 % constructore
|
wolffd@0
|
51 % ---
|
wolffd@0
|
52 function db = MTTClipDB()
|
wolffd@0
|
53
|
wolffd@0
|
54 % ---
|
wolffd@0
|
55 % TODO: restructure data / db.mat
|
wolffd@0
|
56 % ---
|
wolffd@0
|
57
|
wolffd@0
|
58 load 'db.mat';
|
wolffd@0
|
59
|
wolffd@0
|
60 db.annots = annots;
|
wolffd@0
|
61 db.annots_ids = annots_ids;
|
wolffd@0
|
62 db.annots_names = annots_names;
|
wolffd@0
|
63 db.annots_filenames = annots_filenames;
|
wolffd@0
|
64
|
wolffd@0
|
65 % comparison ids
|
wolffd@0
|
66 db.comparison_ids = sparse(comparison_ids,1, 1:numel(comparison_ids));
|
wolffd@0
|
67
|
wolffd@0
|
68 db.clip_info_proper = clip_info_proper;
|
wolffd@0
|
69 db.clip_info_proper_names = clip_info_proper_names;
|
wolffd@0
|
70
|
wolffd@0
|
71 % Genre in new structure for textual annotations
|
wolffd@0
|
72 db.genredb = AnnotDB(magnagenres, clip_magnagenres, annots_ids);
|
wolffd@0
|
73
|
wolffd@0
|
74 % Artist for each clip
|
wolffd@0
|
75 db.artistdb = artistdb; %AnnotDB('clips_by_annot', db.clip_info_proper(:, 4), annots_ids);
|
wolffd@0
|
76
|
wolffd@0
|
77 % Magnatagatune Tags
|
wolffd@0
|
78 db.tagdb = tagdb; % AnnotDB(annots_names, annots, annots_ids);
|
wolffd@0
|
79
|
wolffd@0
|
80 % Last Fm Tags
|
wolffd@0
|
81 db.fmtagdb = fmtagdb; % LFMTagsDB(db.artistdb);
|
wolffd@0
|
82
|
wolffd@0
|
83 % musicbrainz tags
|
wolffd@0
|
84 db.mbtagdb = mbtagdb; % LFMTagsDB(db.artistdb);
|
wolffd@0
|
85
|
wolffd@0
|
86 % db.clip_magnagenres = clip_magnagenres;
|
wolffd@0
|
87 % db.magnagenres = magnagenres;
|
wolffd@0
|
88 % db.magnagenre_childof = magnagenre_childof;
|
wolffd@0
|
89
|
wolffd@0
|
90 end
|
wolffd@0
|
91
|
wolffd@0
|
92 % ---
|
wolffd@0
|
93 % member functions
|
wolffd@0
|
94 % ---
|
wolffd@0
|
95 function out = genres(db)
|
wolffd@0
|
96 % returns the magnatune genre list
|
wolffd@0
|
97
|
wolffd@0
|
98 out = db.genredb.lexicon;
|
wolffd@0
|
99 end
|
wolffd@0
|
100
|
wolffd@0
|
101 function clips = clips_by_genre_name(db, name)
|
wolffd@0
|
102 % returns all clips having the assigned genre
|
wolffd@0
|
103
|
wolffd@0
|
104 clips = MTTClip( db.genredb.owner( name));
|
wolffd@0
|
105 end
|
wolffd@0
|
106
|
wolffd@0
|
107 function out = tags(db)
|
wolffd@0
|
108 % returns the magnatune artist list
|
wolffd@0
|
109
|
wolffd@0
|
110 out = db.tagdb.lexicon;
|
wolffd@0
|
111 end
|
wolffd@0
|
112
|
wolffd@0
|
113
|
wolffd@0
|
114 function out = artists(db)
|
wolffd@0
|
115 % returns the magnatune artist list
|
wolffd@0
|
116
|
wolffd@0
|
117 out = db.artistdb.lexicon;
|
wolffd@0
|
118 end
|
wolffd@0
|
119
|
wolffd@0
|
120 function clips = clips_by_artist_name(db, name)
|
wolffd@0
|
121 % returns all clips having the assigned artist
|
wolffd@0
|
122
|
wolffd@0
|
123 clips = MTTClip( db.artistdb.owner( name));
|
wolffd@0
|
124 end
|
wolffd@0
|
125 end
|
wolffd@0
|
126
|
wolffd@0
|
127 % ---
|
wolffd@0
|
128 % Hidden Methods
|
wolffd@0
|
129 % ---
|
wolffd@0
|
130 methods (Hidden = true, Access = private)
|
wolffd@0
|
131
|
wolffd@0
|
132 function out = clips_by_genre(db, genre_id)
|
wolffd@0
|
133 % returns clip ids given a genre id
|
wolffd@0
|
134
|
wolffd@0
|
135 pos = (db.clip_magnagenres(:,genre_id) == 1);
|
wolffd@0
|
136
|
wolffd@0
|
137 % return clip ids, not pos
|
wolffd@0
|
138 out = db.annots_ids(pos);
|
wolffd@0
|
139 end
|
wolffd@0
|
140 end
|
wolffd@0
|
141 end |