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