wolffd@0
|
1 % ---
|
wolffd@0
|
2 % This is the class for magnatagatune clips
|
wolffd@0
|
3 % ---
|
wolffd@0
|
4
|
wolffd@0
|
5 classdef MTTClip < Clip
|
wolffd@0
|
6
|
wolffd@0
|
7 % ---
|
wolffd@0
|
8 % here come the internal clip properties.
|
wolffd@0
|
9 % the database is stored as a global variable
|
wolffd@0
|
10 % ---
|
wolffd@0
|
11
|
wolffd@0
|
12 % ---
|
wolffd@0
|
13 % simple constructor
|
wolffd@0
|
14 % ---
|
wolffd@0
|
15 methods
|
wolffd@0
|
16 function clip = MTTClip(varargin)
|
wolffd@0
|
17 clip = clip@Clip(varargin{:},'db_MTTClip');
|
wolffd@0
|
18 end
|
wolffd@0
|
19
|
wolffd@0
|
20 function out = mp3file(this)
|
wolffd@0
|
21 % returns filename for given genre id
|
wolffd@0
|
22
|
wolffd@0
|
23 out = this.my_db.clip_info_proper{this.my_dbpos,10};
|
wolffd@0
|
24 end
|
wolffd@0
|
25
|
wolffd@0
|
26
|
wolffd@0
|
27 function filename = mp3file_full(this)
|
wolffd@0
|
28 % returns mp3 filename for given clip id
|
wolffd@0
|
29
|
wolffd@0
|
30 global globalvars;
|
wolffd@0
|
31 filename = strcat(globalvars.tstaudiopath,this.mp3file());
|
wolffd@0
|
32 filename = strrep(filename,'\',globalvars.systemslash);
|
wolffd@0
|
33 filename = strrep(filename,'/',globalvars.systemslash);
|
wolffd@0
|
34 end
|
wolffd@0
|
35
|
wolffd@0
|
36 function filename = featurefile_full(this)
|
wolffd@0
|
37 % returns xml filename for given clip id
|
wolffd@0
|
38
|
wolffd@0
|
39 % ---
|
wolffd@0
|
40 % NOTE: the xml files are supposed to be in the folder
|
wolffd@0
|
41 % "xml" as subfolder of the mp3 file path
|
wolffd@0
|
42 % ---
|
wolffd@0
|
43 global globalvars;
|
wolffd@0
|
44 filename = strcat(globalvars.tstaudiopath,'xml\',...
|
wolffd@0
|
45 this.mp3file,'.xml');
|
wolffd@0
|
46
|
wolffd@0
|
47 filename = strrep(filename,'/',globalvars.systemslash);
|
wolffd@0
|
48 filename = strrep(filename,'\',globalvars.systemslash);
|
wolffd@0
|
49 end
|
wolffd@0
|
50
|
wolffd@0
|
51
|
wolffd@0
|
52 % caution. last.fm dbs take a clip
|
wolffd@0
|
53 function [out, score, annotids] = fmtags(this)
|
wolffd@0
|
54
|
wolffd@0
|
55 [out, score, annotids] = this.my_db.fmtagdb.annots(this);
|
wolffd@0
|
56 end
|
wolffd@0
|
57
|
wolffd@0
|
58 % caution. last.fm dbs take a clip
|
wolffd@0
|
59 % TODO: revert this to general annotdb for compability
|
wolffd@0
|
60 function [out, score] = fmtag_ids(this)
|
wolffd@0
|
61
|
wolffd@0
|
62 [out, score] = this.my_db.fmtagdb.annotids_for_owner(this);
|
wolffd@0
|
63 end
|
wolffd@0
|
64
|
wolffd@0
|
65 function [out, score] = genre_ids(this)
|
wolffd@0
|
66 % returns clip genre for given clip id
|
wolffd@0
|
67
|
wolffd@0
|
68 [out, score] = this(1).my_db.genredb.annotids_for_owner([this.id]);
|
wolffd@0
|
69 end
|
wolffd@0
|
70
|
wolffd@0
|
71 function [out, score, annotids] = genres(this)
|
wolffd@0
|
72 % returns name strings for given genre position ids
|
wolffd@0
|
73
|
wolffd@0
|
74 [out, score, annotids] = this(1).my_db.genredb.annots([this.id]);
|
wolffd@0
|
75 end
|
wolffd@0
|
76
|
wolffd@0
|
77 function print(this)
|
wolffd@0
|
78 % prints out the album info
|
wolffd@0
|
79
|
wolffd@0
|
80 fprintf('clip %d: %s by %s,\n on %s \n',this.id, ...
|
wolffd@0
|
81 this.title(), this.artist(), this.album());
|
wolffd@0
|
82
|
wolffd@0
|
83 v = strcat(this.genres(),', ');
|
wolffd@0
|
84 fprintf(' genres: %s\n', strcat(v{:}));
|
wolffd@0
|
85
|
wolffd@0
|
86 v = strcat(this.tags(),', ');
|
wolffd@0
|
87 fprintf(' tags: %s\n', strcat(v{:}));
|
wolffd@0
|
88
|
wolffd@0
|
89 v = strcat(this.fmtags(),', ');
|
wolffd@0
|
90 fprintf(' last.fm tags: %s\n', strcat(v{:}));
|
wolffd@0
|
91
|
wolffd@0
|
92 % if nargout == 0
|
wolffd@0
|
93 % fprintf(out)
|
wolffd@0
|
94 % end
|
wolffd@0
|
95 end
|
wolffd@0
|
96
|
wolffd@0
|
97 end
|
wolffd@0
|
98 end |