Merge lp:~jamesh/mediascanner2/qmlplugin-updates into lp:mediascanner2
- qmlplugin-updates
- Merge into trunk
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Jussi Pakkanen | ||||||||
Approved revision: | 234 | ||||||||
Merged at revision: | 230 | ||||||||
Proposed branch: | lp:~jamesh/mediascanner2/qmlplugin-updates | ||||||||
Merge into: | lp:mediascanner2 | ||||||||
Diff against target: |
905 lines (+228/-110) 20 files modified
src/daemon/MetadataExtractor.cc (+4/-0) src/mediascanner/MediaFile.cc (+13/-3) src/mediascanner/MediaFile.hh (+7/-3) src/mediascanner/MediaFileBuilder.cc (+17/-1) src/mediascanner/MediaFileBuilder.hh (+10/-2) src/mediascanner/MediaStore.cc (+30/-22) src/qml/Ubuntu/MediaScanner/AlbumModelBase.cc (+4/-0) src/qml/Ubuntu/MediaScanner/AlbumModelBase.hh (+3/-0) src/qml/Ubuntu/MediaScanner/ArtistsModel.cc (+4/-0) src/qml/Ubuntu/MediaScanner/ArtistsModel.hh (+3/-0) src/qml/Ubuntu/MediaScanner/MediaFileModelBase.cc (+10/-0) src/qml/Ubuntu/MediaScanner/MediaFileModelBase.hh (+5/-0) src/qml/Ubuntu/MediaScanner/MediaFileWrapper.cc (+8/-0) src/qml/Ubuntu/MediaScanner/MediaFileWrapper.hh (+4/-0) src/qml/Ubuntu/MediaScanner/plugin.qmltypes (+28/-3) src/utils/scaletest.cc (+1/-1) test/qml/tst_mediastore.qml (+2/-0) test/qml/tst_songsearchmodel.qml (+6/-6) test/test_mediastore.cc (+62/-62) test/test_qml.cc (+7/-7) |
||||||||
To merge this branch: | bzr merge lp:~jamesh/mediascanner2/qmlplugin-updates | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jussi Pakkanen (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+218351@code.launchpad.net |
Commit message
Add genre and discNumber metadata fields to the media index, and expose it in the QML binding.
Add rowCount property and get(row, role) method to each of the model classes in the QML binding.
Description of the change
Updates to the QML interface for music-app.
PS Jenkins bot (ps-jenkins) wrote : | # |
- 235. By James Henstridge
-
Update qmltypes.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:235
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Jussi Pakkanen (jpakkane) wrote : | # |
Code-wise this looks good and can be merged.
However this increases the size of MediaFile, which means it is an ABI break. How are we dealing with this? What packages are affected and can we just transition them all in the same silo?
Also noted is that we don't have a symbols file or visibility specifications. Let's not block this MR for those but we should probably add them sooner rather than later.
James Henstridge (jamesh) wrote : | # |
We will need to rebuild unity-scope-
Jussi Pakkanen (jpakkane) wrote : | # |
Since we don't currently have other users than the scope, we can do this.
Preview Diff
1 | === modified file 'src/daemon/MetadataExtractor.cc' | |||
2 | --- src/daemon/MetadataExtractor.cc 2014-04-03 09:05:20 +0000 | |||
3 | +++ src/daemon/MetadataExtractor.cc 2014-05-08 07:17:36 +0000 | |||
4 | @@ -129,6 +129,8 @@ | |||
5 | 129 | mfb->setAlbum(g_value_get_string(val)); | 129 | mfb->setAlbum(g_value_get_string(val)); |
6 | 130 | else if (tagname == GST_TAG_ALBUM_ARTIST) | 130 | else if (tagname == GST_TAG_ALBUM_ARTIST) |
7 | 131 | mfb->setAlbumArtist(g_value_get_string(val)); | 131 | mfb->setAlbumArtist(g_value_get_string(val)); |
8 | 132 | else if (tagname == GST_TAG_GENRE) | ||
9 | 133 | mfb->setGenre(g_value_get_string(val)); | ||
10 | 132 | } else if (G_VALUE_HOLDS(val, GST_TYPE_DATE_TIME)) { | 134 | } else if (G_VALUE_HOLDS(val, GST_TYPE_DATE_TIME)) { |
11 | 133 | if (tagname == GST_TAG_DATE_TIME) { | 135 | if (tagname == GST_TAG_DATE_TIME) { |
12 | 134 | GstDateTime *dt = static_cast<GstDateTime*>(g_value_get_boxed(val)); | 136 | GstDateTime *dt = static_cast<GstDateTime*>(g_value_get_boxed(val)); |
13 | @@ -139,6 +141,8 @@ | |||
14 | 139 | } else if (G_VALUE_HOLDS_UINT(val)) { | 141 | } else if (G_VALUE_HOLDS_UINT(val)) { |
15 | 140 | if (tagname == GST_TAG_TRACK_NUMBER) { | 142 | if (tagname == GST_TAG_TRACK_NUMBER) { |
16 | 141 | mfb->setTrackNumber(g_value_get_uint(val)); | 143 | mfb->setTrackNumber(g_value_get_uint(val)); |
17 | 144 | } else if (tagname == GST_TAG_ALBUM_VOLUME_NUMBER) { | ||
18 | 145 | mfb->setDiscNumber(g_value_get_uint(val)); | ||
19 | 142 | } | 146 | } |
20 | 143 | } | 147 | } |
21 | 144 | 148 | ||
22 | 145 | 149 | ||
23 | === modified file 'src/mediascanner/MediaFile.cc' | |||
24 | --- src/mediascanner/MediaFile.cc 2014-01-31 07:17:15 +0000 | |||
25 | +++ src/mediascanner/MediaFile.cc 2014-05-08 07:17:36 +0000 | |||
26 | @@ -24,9 +24,9 @@ | |||
27 | 24 | 24 | ||
28 | 25 | namespace mediascanner { | 25 | namespace mediascanner { |
29 | 26 | 26 | ||
33 | 27 | MediaFile::MediaFile(std::string filename, std::string content_type, std::string etag, std::string title, std::string date, std::string author, std::string album, std::string album_artist, | 27 | MediaFile::MediaFile(std::string filename, std::string content_type, std::string etag, std::string title, std::string date, std::string author, std::string album, std::string album_artist, std::string genre, |
34 | 28 | int track_number, int duration, MediaType type) : | 28 | int disc_number, int track_number, int duration, MediaType type) : |
35 | 29 | filename(filename), content_type(content_type), etag(etag), title(title), date(date), author(author), album(album), album_artist(album_artist), track_number(track_number), duration(duration), type(type) { | 29 | filename(filename), content_type(content_type), etag(etag), title(title), date(date), author(author), album(album), album_artist(album_artist), genre(genre), disc_number(disc_number), track_number(track_number), duration(duration), type(type) { |
36 | 30 | 30 | ||
37 | 31 | } | 31 | } |
38 | 32 | 32 | ||
39 | @@ -62,6 +62,14 @@ | |||
40 | 62 | return date; | 62 | return date; |
41 | 63 | } | 63 | } |
42 | 64 | 64 | ||
43 | 65 | const std::string& MediaFile::getGenre() const noexcept { | ||
44 | 66 | return genre; | ||
45 | 67 | } | ||
46 | 68 | |||
47 | 69 | int MediaFile::getDiscNumber() const noexcept { | ||
48 | 70 | return disc_number; | ||
49 | 71 | } | ||
50 | 72 | |||
51 | 65 | int MediaFile::getTrackNumber() const noexcept { | 73 | int MediaFile::getTrackNumber() const noexcept { |
52 | 66 | return track_number; | 74 | return track_number; |
53 | 67 | } | 75 | } |
54 | @@ -88,6 +96,8 @@ | |||
55 | 88 | album == other.album && | 96 | album == other.album && |
56 | 89 | album_artist == other.album_artist && | 97 | album_artist == other.album_artist && |
57 | 90 | date == other.date && | 98 | date == other.date && |
58 | 99 | genre == other.genre && | ||
59 | 100 | disc_number == other.disc_number && | ||
60 | 91 | track_number == other.track_number && | 101 | track_number == other.track_number && |
61 | 92 | duration == other.duration && | 102 | duration == other.duration && |
62 | 93 | type == other.type; | 103 | type == other.type; |
63 | 94 | 104 | ||
64 | === modified file 'src/mediascanner/MediaFile.hh' | |||
65 | --- src/mediascanner/MediaFile.hh 2014-01-31 03:48:16 +0000 | |||
66 | +++ src/mediascanner/MediaFile.hh 2014-05-08 07:17:36 +0000 | |||
67 | @@ -29,9 +29,9 @@ | |||
68 | 29 | public: | 29 | public: |
69 | 30 | 30 | ||
70 | 31 | MediaFile(std::string filename) : filename(filename), content_type(""), etag(""), title(""), date(""), author(""), | 31 | MediaFile(std::string filename) : filename(filename), content_type(""), etag(""), title(""), date(""), author(""), |
74 | 32 | album(""), album_artist(""), track_number(0), duration(0), type(UnknownMedia) {} | 32 | album(""), album_artist(""), genre(""), disc_number(0), track_number(0), duration(0), type(UnknownMedia) {} |
75 | 33 | MediaFile(std::string filename, std::string content_type, std::string etag, std::string title, std::string date, std::string author, std::string album, std::string album_artist, | 33 | MediaFile(std::string filename, std::string content_type, std::string etag, std::string title, std::string date, std::string author, std::string album, std::string album_artist, std::string genre, |
76 | 34 | int track_number, int duration, MediaType type); | 34 | int disc_number, int track_number, int duration, MediaType type); |
77 | 35 | MediaFile() = delete; | 35 | MediaFile() = delete; |
78 | 36 | 36 | ||
79 | 37 | const std::string& getFileName() const noexcept; | 37 | const std::string& getFileName() const noexcept; |
80 | @@ -42,8 +42,10 @@ | |||
81 | 42 | const std::string& getAlbum() const noexcept; | 42 | const std::string& getAlbum() const noexcept; |
82 | 43 | const std::string& getAlbumArtist() const noexcept; | 43 | const std::string& getAlbumArtist() const noexcept; |
83 | 44 | const std::string& getDate() const noexcept; | 44 | const std::string& getDate() const noexcept; |
84 | 45 | const std::string& getGenre() const noexcept; | ||
85 | 45 | std::string getUri() const; | 46 | std::string getUri() const; |
86 | 46 | 47 | ||
87 | 48 | int getDiscNumber() const noexcept; | ||
88 | 47 | int getTrackNumber() const noexcept; | 49 | int getTrackNumber() const noexcept; |
89 | 48 | int getDuration() const noexcept; | 50 | int getDuration() const noexcept; |
90 | 49 | MediaType getType() const noexcept; | 51 | MediaType getType() const noexcept; |
91 | @@ -62,6 +64,8 @@ | |||
92 | 62 | std::string author; | 64 | std::string author; |
93 | 63 | std::string album; | 65 | std::string album; |
94 | 64 | std::string album_artist; | 66 | std::string album_artist; |
95 | 67 | std::string genre; | ||
96 | 68 | int disc_number; | ||
97 | 65 | int track_number; | 69 | int track_number; |
98 | 66 | int duration; // In seconds. | 70 | int duration; // In seconds. |
99 | 67 | MediaType type; | 71 | MediaType type; |
100 | 68 | 72 | ||
101 | === modified file 'src/mediascanner/MediaFileBuilder.cc' | |||
102 | --- src/mediascanner/MediaFileBuilder.cc 2014-01-31 03:48:16 +0000 | |||
103 | +++ src/mediascanner/MediaFileBuilder.cc 2014-05-08 07:17:36 +0000 | |||
104 | @@ -37,13 +37,15 @@ | |||
105 | 37 | author(mf.getAuthor()), | 37 | author(mf.getAuthor()), |
106 | 38 | album(mf.getAlbum()), | 38 | album(mf.getAlbum()), |
107 | 39 | album_artist(mf.getAlbumArtist()), | 39 | album_artist(mf.getAlbumArtist()), |
108 | 40 | genre(mf.getGenre()), | ||
109 | 41 | disc_number(mf.getDiscNumber()), | ||
110 | 40 | track_number(mf.getTrackNumber()), | 42 | track_number(mf.getTrackNumber()), |
111 | 41 | duration(mf.getDuration()) { | 43 | duration(mf.getDuration()) { |
112 | 42 | } | 44 | } |
113 | 43 | 45 | ||
114 | 44 | MediaFile MediaFileBuilder::build() const { | 46 | MediaFile MediaFileBuilder::build() const { |
115 | 45 | return MediaFile(filename, content_type, etag, title, date, author, | 47 | return MediaFile(filename, content_type, etag, title, date, author, |
117 | 46 | album, album_artist, track_number, duration, type); | 48 | album, album_artist, genre, disc_number, track_number, duration, type); |
118 | 47 | } | 49 | } |
119 | 48 | 50 | ||
120 | 49 | void MediaFileBuilder::setType(MediaType t) { | 51 | void MediaFileBuilder::setType(MediaType t) { |
121 | @@ -103,6 +105,20 @@ | |||
122 | 103 | album_artist_set = true; | 105 | album_artist_set = true; |
123 | 104 | } | 106 | } |
124 | 105 | 107 | ||
125 | 108 | void MediaFileBuilder::setGenre(const std::string &g) { | ||
126 | 109 | if(genre_set) | ||
127 | 110 | throw std::invalid_argument("Tried to set genre when it was already set."); | ||
128 | 111 | genre = g; | ||
129 | 112 | genre_set = true; | ||
130 | 113 | } | ||
131 | 114 | |||
132 | 115 | void MediaFileBuilder::setDiscNumber(int n) { | ||
133 | 116 | if(disc_number_set) | ||
134 | 117 | throw std::invalid_argument("Tried to set disc number when it was already set."); | ||
135 | 118 | disc_number = n; | ||
136 | 119 | disc_number_set = true; | ||
137 | 120 | } | ||
138 | 121 | |||
139 | 106 | void MediaFileBuilder::setTrackNumber(int n) { | 122 | void MediaFileBuilder::setTrackNumber(int n) { |
140 | 107 | if(track_number_set) | 123 | if(track_number_set) |
141 | 108 | throw std::invalid_argument("Tried to set track number when it was already set."); | 124 | throw std::invalid_argument("Tried to set track number when it was already set."); |
142 | 109 | 125 | ||
143 | === modified file 'src/mediascanner/MediaFileBuilder.hh' | |||
144 | --- src/mediascanner/MediaFileBuilder.hh 2014-01-31 03:48:16 +0000 | |||
145 | +++ src/mediascanner/MediaFileBuilder.hh 2014-05-08 07:17:36 +0000 | |||
146 | @@ -57,6 +57,8 @@ | |||
147 | 57 | void setAuthor(const std::string &a); | 57 | void setAuthor(const std::string &a); |
148 | 58 | void setAlbum(const std::string &a); | 58 | void setAlbum(const std::string &a); |
149 | 59 | void setAlbumArtist(const std::string &a); | 59 | void setAlbumArtist(const std::string &a); |
150 | 60 | void setGenre(const std::string &g); | ||
151 | 61 | void setDiscNumber(int n); | ||
152 | 60 | void setTrackNumber(int n); | 62 | void setTrackNumber(int n); |
153 | 61 | void setDuration(int d); | 63 | void setDuration(int d); |
154 | 62 | 64 | ||
155 | @@ -87,11 +89,17 @@ | |||
156 | 87 | bool album_artist_set = false; | 89 | bool album_artist_set = false; |
157 | 88 | std::string album_artist; | 90 | std::string album_artist; |
158 | 89 | 91 | ||
159 | 92 | bool genre_set = false; | ||
160 | 93 | std::string genre; | ||
161 | 94 | |||
162 | 95 | bool disc_number_set = false; | ||
163 | 96 | int disc_number = 0; | ||
164 | 97 | |||
165 | 98 | bool track_number_set = false; | ||
166 | 90 | int track_number = 0; | 99 | int track_number = 0; |
167 | 91 | bool track_number_set = false; | ||
168 | 92 | 100 | ||
169 | 101 | bool duration_set = false; | ||
170 | 93 | int duration = 0; | 102 | int duration = 0; |
171 | 94 | bool duration_set = false; | ||
172 | 95 | }; | 103 | }; |
173 | 96 | 104 | ||
174 | 97 | } | 105 | } |
175 | 98 | 106 | ||
176 | === modified file 'src/mediascanner/MediaStore.cc' | |||
177 | --- src/mediascanner/MediaStore.cc 2014-03-07 08:15:52 +0000 | |||
178 | +++ src/mediascanner/MediaStore.cc 2014-05-08 07:17:36 +0000 | |||
179 | @@ -41,7 +41,7 @@ | |||
180 | 41 | 41 | ||
181 | 42 | // Increment this whenever changing db schema. | 42 | // Increment this whenever changing db schema. |
182 | 43 | // It will cause dbstore to rebuild its tables. | 43 | // It will cause dbstore to rebuild its tables. |
184 | 44 | static const int schemaVersion = 4; | 44 | static const int schemaVersion = 5; |
185 | 45 | 45 | ||
186 | 46 | struct MediaStorePrivate { | 46 | struct MediaStorePrivate { |
187 | 47 | sqlite3 *db; | 47 | sqlite3 *db; |
188 | @@ -175,9 +175,11 @@ | |||
189 | 175 | etag TEXT, | 175 | etag TEXT, |
190 | 176 | title TEXT, | 176 | title TEXT, |
191 | 177 | date TEXT, | 177 | date TEXT, |
195 | 178 | artist TEXT, -- Only relevant to audio | 178 | artist TEXT, -- Only relevant to audio |
196 | 179 | album TEXT, -- Only relevant to audio | 179 | album TEXT, -- Only relevant to audio |
197 | 180 | album_artist TEXT, -- Only relevant to audio | 180 | album_artist TEXT, -- Only relevant to audio |
198 | 181 | genre TEXT, -- Only relevant to audio | ||
199 | 182 | disc_number INTEGER, -- Only relevant to audio | ||
200 | 181 | track_number INTEGER, -- Only relevant to audio | 183 | track_number INTEGER, -- Only relevant to audio |
201 | 182 | duration INTEGER, | 184 | duration INTEGER, |
202 | 183 | type INTEGER -- 0=Audio, 1=Video | 185 | type INTEGER -- 0=Audio, 1=Video |
203 | @@ -191,9 +193,11 @@ | |||
204 | 191 | etag TEXT, | 193 | etag TEXT, |
205 | 192 | title TEXT, | 194 | title TEXT, |
206 | 193 | date TEXT, | 195 | date TEXT, |
210 | 194 | artist TEXT, -- Only relevant to audio | 196 | artist TEXT, -- Only relevant to audio |
211 | 195 | album TEXT, -- Only relevant to audio | 197 | album TEXT, -- Only relevant to audio |
212 | 196 | album_artist TEXT, -- Only relevant to audio | 198 | album_artist TEXT, -- Only relevant to audio |
213 | 199 | genre TEXT, -- Only relevant to audio | ||
214 | 200 | disc_number INTEGER, -- Only relevant to audio | ||
215 | 197 | track_number INTEGER, -- Only relevant to audio | 201 | track_number INTEGER, -- Only relevant to audio |
216 | 198 | duration INTEGER, | 202 | duration INTEGER, |
217 | 199 | type INTEGER -- 0=Audio, 1=Video | 203 | type INTEGER -- 0=Audio, 1=Video |
218 | @@ -283,7 +287,7 @@ | |||
219 | 283 | } | 287 | } |
220 | 284 | 288 | ||
221 | 285 | void MediaStorePrivate::insert(const MediaFile &m) const { | 289 | void MediaStorePrivate::insert(const MediaFile &m) const { |
223 | 286 | Statement query(db, "INSERT OR REPLACE INTO media (filename, content_type, etag, title, date, artist, album, album_artist, track_number, duration, type) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); | 290 | Statement query(db, "INSERT OR REPLACE INTO media (filename, content_type, etag, title, date, artist, album, album_artist, genre, disc_number, track_number, duration, type) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); |
224 | 287 | string fname = m.getFileName(); | 291 | string fname = m.getFileName(); |
225 | 288 | string title = m.getTitle(); | 292 | string title = m.getTitle(); |
226 | 289 | if(title.empty()) | 293 | if(title.empty()) |
227 | @@ -299,9 +303,11 @@ | |||
228 | 299 | if (album_artist.empty()) | 303 | if (album_artist.empty()) |
229 | 300 | album_artist = m.getAuthor(); | 304 | album_artist = m.getAuthor(); |
230 | 301 | query.bind(8, album_artist); | 305 | query.bind(8, album_artist); |
234 | 302 | query.bind(9, m.getTrackNumber()); | 306 | query.bind(9, m.getGenre()); |
235 | 303 | query.bind(10, m.getDuration()); | 307 | query.bind(10, m.getDiscNumber()); |
236 | 304 | query.bind(11, (int)m.getType()); | 308 | query.bind(11, m.getTrackNumber()); |
237 | 309 | query.bind(12, m.getDuration()); | ||
238 | 310 | query.bind(13, (int)m.getType()); | ||
239 | 305 | query.step(); | 311 | query.step(); |
240 | 306 | 312 | ||
241 | 307 | const char *typestr = m.getType() == AudioMedia ? "song" : "video"; | 313 | const char *typestr = m.getType() == AudioMedia ? "song" : "video"; |
242 | @@ -327,10 +333,12 @@ | |||
243 | 327 | const string author = query.getText(5); | 333 | const string author = query.getText(5); |
244 | 328 | const string album = query.getText(6); | 334 | const string album = query.getText(6); |
245 | 329 | const string album_artist = query.getText(7); | 335 | const string album_artist = query.getText(7); |
250 | 330 | int track_number = query.getInt(8); | 336 | const string genre = query.getText(8); |
251 | 331 | int duration = query.getInt(9); | 337 | int disc_number = query.getInt(9); |
252 | 332 | MediaType type = (MediaType)query.getInt(10); | 338 | int track_number = query.getInt(10); |
253 | 333 | return MediaFile(filename, content_type, etag, title, date, author, album, album_artist, track_number, duration, type); | 339 | int duration = query.getInt(11); |
254 | 340 | MediaType type = (MediaType)query.getInt(12); | ||
255 | 341 | return MediaFile(filename, content_type, etag, title, date, author, album, album_artist, genre, disc_number, track_number, duration, type); | ||
256 | 334 | } | 342 | } |
257 | 335 | 343 | ||
258 | 336 | static vector<MediaFile> collect_media(Statement &query) { | 344 | static vector<MediaFile> collect_media(Statement &query) { |
259 | @@ -343,7 +351,7 @@ | |||
260 | 343 | 351 | ||
261 | 344 | MediaFile MediaStorePrivate::lookup(const std::string &filename) const { | 352 | MediaFile MediaStorePrivate::lookup(const std::string &filename) const { |
262 | 345 | Statement query(db, R"( | 353 | Statement query(db, R"( |
264 | 346 | SELECT filename, content_type, etag, title, date, artist, album, album_artist, track_number, duration, type | 354 | SELECT filename, content_type, etag, title, date, artist, album, album_artist, genre, disc_number, track_number, duration, type |
265 | 347 | FROM media | 355 | FROM media |
266 | 348 | WHERE filename = ? | 356 | WHERE filename = ? |
267 | 349 | )"); | 357 | )"); |
268 | @@ -357,7 +365,7 @@ | |||
269 | 357 | vector<MediaFile> MediaStorePrivate::query(const std::string &core_term, MediaType type, int limit) const { | 365 | vector<MediaFile> MediaStorePrivate::query(const std::string &core_term, MediaType type, int limit) const { |
270 | 358 | if (core_term == "") { | 366 | if (core_term == "") { |
271 | 359 | Statement query(db, R"( | 367 | Statement query(db, R"( |
273 | 360 | SELECT filename, content_type, etag, title, date, artist, album, album_artist, track_number, duration, type | 368 | SELECT filename, content_type, etag, title, date, artist, album, album_artist, genre, disc_number, track_number, duration, type |
274 | 361 | FROM media | 369 | FROM media |
275 | 362 | WHERE type == ? | 370 | WHERE type == ? |
276 | 363 | LIMIT ? | 371 | LIMIT ? |
277 | @@ -367,7 +375,7 @@ | |||
278 | 367 | return collect_media(query); | 375 | return collect_media(query); |
279 | 368 | } else { | 376 | } else { |
280 | 369 | Statement query(db, R"( | 377 | Statement query(db, R"( |
282 | 370 | SELECT filename, content_type, etag, title, date, artist, album, album_artist, track_number, duration, type | 378 | SELECT filename, content_type, etag, title, date, artist, album, album_artist, genre, disc_number, track_number, duration, type |
283 | 371 | FROM media JOIN ( | 379 | FROM media JOIN ( |
284 | 372 | SELECT docid, rank(matchinfo(media_fts), 1.0, 0.5, 0.75) AS rank | 380 | SELECT docid, rank(matchinfo(media_fts), 1.0, 0.5, 0.75) AS rank |
285 | 373 | FROM media_fts WHERE media_fts MATCH ? | 381 | FROM media_fts WHERE media_fts MATCH ? |
286 | @@ -425,9 +433,9 @@ | |||
287 | 425 | 433 | ||
288 | 426 | vector<MediaFile> MediaStorePrivate::getAlbumSongs(const Album& album) const { | 434 | vector<MediaFile> MediaStorePrivate::getAlbumSongs(const Album& album) const { |
289 | 427 | Statement query(db, R"( | 435 | Statement query(db, R"( |
291 | 428 | SELECT filename, content_type, etag, title, date, artist, album, album_artist, track_number, duration, type FROM media | 436 | SELECT filename, content_type, etag, title, date, artist, album, album_artist, genre, disc_number, track_number, duration, type FROM media |
292 | 429 | WHERE album = ? AND album_artist = ? AND type = ? | 437 | WHERE album = ? AND album_artist = ? AND type = ? |
294 | 430 | ORDER BY track_number | 438 | ORDER BY disc_number, track_number |
295 | 431 | )"); | 439 | )"); |
296 | 432 | query.bind(1, album.getTitle()); | 440 | query.bind(1, album.getTitle()); |
297 | 433 | query.bind(2, album.getArtist()); | 441 | query.bind(2, album.getArtist()); |
298 | @@ -449,7 +457,7 @@ | |||
299 | 449 | 457 | ||
300 | 450 | std::vector<MediaFile> MediaStore::listSongs(const std::string& artist, const std::string& album, const std::string& album_artist, int limit) const { | 458 | std::vector<MediaFile> MediaStore::listSongs(const std::string& artist, const std::string& album, const std::string& album_artist, int limit) const { |
301 | 451 | std::string qs(R"( | 459 | std::string qs(R"( |
303 | 452 | SELECT filename, content_type, etag, title, date, artist, album, album_artist, track_number, duration, type | 460 | SELECT filename, content_type, etag, title, date, artist, album, album_artist, genre, disc_number, track_number, duration, type |
304 | 453 | FROM media | 461 | FROM media |
305 | 454 | WHERE type = ? | 462 | WHERE type = ? |
306 | 455 | )"); | 463 | )"); |
307 | @@ -463,7 +471,7 @@ | |||
308 | 463 | qs += " AND album_artist = ?"; | 471 | qs += " AND album_artist = ?"; |
309 | 464 | } | 472 | } |
310 | 465 | qs += R"( | 473 | qs += R"( |
312 | 466 | ORDER BY album_artist, album, track_number, title | 474 | ORDER BY album_artist, album, disc_number, track_number, title |
313 | 467 | LIMIT ? | 475 | LIMIT ? |
314 | 468 | )"; | 476 | )"; |
315 | 469 | Statement query(p->db, qs.c_str()); | 477 | Statement query(p->db, qs.c_str()); |
316 | 470 | 478 | ||
317 | === modified file 'src/qml/Ubuntu/MediaScanner/AlbumModelBase.cc' | |||
318 | --- src/qml/Ubuntu/MediaScanner/AlbumModelBase.cc 2014-03-24 10:04:19 +0000 | |||
319 | +++ src/qml/Ubuntu/MediaScanner/AlbumModelBase.cc 2014-05-08 07:17:36 +0000 | |||
320 | @@ -50,6 +50,10 @@ | |||
321 | 50 | } | 50 | } |
322 | 51 | } | 51 | } |
323 | 52 | 52 | ||
324 | 53 | QVariant AlbumModelBase::get(int row, AlbumModelBase::Roles role) const { | ||
325 | 54 | return data(index(row, 0), role); | ||
326 | 55 | } | ||
327 | 56 | |||
328 | 53 | QHash<int, QByteArray> AlbumModelBase::roleNames() const { | 57 | QHash<int, QByteArray> AlbumModelBase::roleNames() const { |
329 | 54 | return roles; | 58 | return roles; |
330 | 55 | } | 59 | } |
331 | 56 | 60 | ||
332 | === modified file 'src/qml/Ubuntu/MediaScanner/AlbumModelBase.hh' | |||
333 | --- src/qml/Ubuntu/MediaScanner/AlbumModelBase.hh 2014-03-24 10:04:19 +0000 | |||
334 | +++ src/qml/Ubuntu/MediaScanner/AlbumModelBase.hh 2014-05-08 07:17:36 +0000 | |||
335 | @@ -31,6 +31,7 @@ | |||
336 | 31 | class AlbumModelBase : public QAbstractListModel { | 31 | class AlbumModelBase : public QAbstractListModel { |
337 | 32 | Q_OBJECT | 32 | Q_OBJECT |
338 | 33 | Q_ENUMS(Roles) | 33 | Q_ENUMS(Roles) |
339 | 34 | Q_PROPERTY(int rowCount READ rowCount) // NOTIFY modelReset | ||
340 | 34 | public: | 35 | public: |
341 | 35 | enum Roles { | 36 | enum Roles { |
342 | 36 | RoleTitle, | 37 | RoleTitle, |
343 | @@ -41,6 +42,8 @@ | |||
344 | 41 | explicit AlbumModelBase(QObject *parent = 0); | 42 | explicit AlbumModelBase(QObject *parent = 0); |
345 | 42 | int rowCount(const QModelIndex &parent=QModelIndex()) const override; | 43 | int rowCount(const QModelIndex &parent=QModelIndex()) const override; |
346 | 43 | QVariant data(const QModelIndex &index, int role) const override; | 44 | QVariant data(const QModelIndex &index, int role) const override; |
347 | 45 | |||
348 | 46 | Q_INVOKABLE QVariant get(int row, Roles role) const; | ||
349 | 44 | protected: | 47 | protected: |
350 | 45 | QHash<int, QByteArray> roleNames() const override; | 48 | QHash<int, QByteArray> roleNames() const override; |
351 | 46 | void updateResults(const std::vector<mediascanner::Album> &results); | 49 | void updateResults(const std::vector<mediascanner::Album> &results); |
352 | 47 | 50 | ||
353 | === modified file 'src/qml/Ubuntu/MediaScanner/ArtistsModel.cc' | |||
354 | --- src/qml/Ubuntu/MediaScanner/ArtistsModel.cc 2014-02-28 07:01:44 +0000 | |||
355 | +++ src/qml/Ubuntu/MediaScanner/ArtistsModel.cc 2014-05-08 07:17:36 +0000 | |||
356 | @@ -45,6 +45,10 @@ | |||
357 | 45 | } | 45 | } |
358 | 46 | } | 46 | } |
359 | 47 | 47 | ||
360 | 48 | QVariant ArtistsModel::get(int row, ArtistsModel::Roles role) const { | ||
361 | 49 | return data(index(row, 0), role); | ||
362 | 50 | } | ||
363 | 51 | |||
364 | 48 | QHash<int, QByteArray> ArtistsModel::roleNames() const { | 52 | QHash<int, QByteArray> ArtistsModel::roleNames() const { |
365 | 49 | return roles; | 53 | return roles; |
366 | 50 | } | 54 | } |
367 | 51 | 55 | ||
368 | === modified file 'src/qml/Ubuntu/MediaScanner/ArtistsModel.hh' | |||
369 | --- src/qml/Ubuntu/MediaScanner/ArtistsModel.hh 2014-02-28 07:01:44 +0000 | |||
370 | +++ src/qml/Ubuntu/MediaScanner/ArtistsModel.hh 2014-05-08 07:17:36 +0000 | |||
371 | @@ -35,6 +35,7 @@ | |||
372 | 35 | Q_PROPERTY(mediascanner::qml::MediaStoreWrapper* store READ getStore WRITE setStore) | 35 | Q_PROPERTY(mediascanner::qml::MediaStoreWrapper* store READ getStore WRITE setStore) |
373 | 36 | Q_PROPERTY(bool albumArtists READ getAlbumArtists WRITE setAlbumArtists) | 36 | Q_PROPERTY(bool albumArtists READ getAlbumArtists WRITE setAlbumArtists) |
374 | 37 | Q_PROPERTY(int limit READ getLimit WRITE setLimit) | 37 | Q_PROPERTY(int limit READ getLimit WRITE setLimit) |
375 | 38 | Q_PROPERTY(int rowCount READ rowCount) // NOTIFY modelReset | ||
376 | 38 | public: | 39 | public: |
377 | 39 | enum Roles { | 40 | enum Roles { |
378 | 40 | RoleArtist, | 41 | RoleArtist, |
379 | @@ -43,6 +44,8 @@ | |||
380 | 43 | explicit ArtistsModel(QObject *parent = 0); | 44 | explicit ArtistsModel(QObject *parent = 0); |
381 | 44 | int rowCount(const QModelIndex &parent=QModelIndex()) const override; | 45 | int rowCount(const QModelIndex &parent=QModelIndex()) const override; |
382 | 45 | QVariant data(const QModelIndex &index, int role) const override; | 46 | QVariant data(const QModelIndex &index, int role) const override; |
383 | 47 | |||
384 | 48 | Q_INVOKABLE QVariant get(int row, Roles role) const; | ||
385 | 46 | protected: | 49 | protected: |
386 | 47 | QHash<int, QByteArray> roleNames() const override; | 50 | QHash<int, QByteArray> roleNames() const override; |
387 | 48 | 51 | ||
388 | 49 | 52 | ||
389 | === modified file 'src/qml/Ubuntu/MediaScanner/MediaFileModelBase.cc' | |||
390 | --- src/qml/Ubuntu/MediaScanner/MediaFileModelBase.cc 2014-03-24 10:04:19 +0000 | |||
391 | +++ src/qml/Ubuntu/MediaScanner/MediaFileModelBase.cc 2014-05-08 07:17:36 +0000 | |||
392 | @@ -35,6 +35,8 @@ | |||
393 | 35 | roles[Roles::RoleAlbum] = "album"; | 35 | roles[Roles::RoleAlbum] = "album"; |
394 | 36 | roles[Roles::RoleAlbumArtist] = "albumArtist"; | 36 | roles[Roles::RoleAlbumArtist] = "albumArtist"; |
395 | 37 | roles[Roles::RoleDate] = "date"; | 37 | roles[Roles::RoleDate] = "date"; |
396 | 38 | roles[Roles::RoleGenre] = "genre"; | ||
397 | 39 | roles[Roles::RoleDiscNumber] = "discNumber"; | ||
398 | 38 | roles[Roles::RoleTrackNumber] = "trackNumber"; | 40 | roles[Roles::RoleTrackNumber] = "trackNumber"; |
399 | 39 | roles[Roles::RoleDuration] = "duration"; | 41 | roles[Roles::RoleDuration] = "duration"; |
400 | 40 | roles[Roles::RoleArt] = "art"; | 42 | roles[Roles::RoleArt] = "art"; |
401 | @@ -70,6 +72,10 @@ | |||
402 | 70 | return QString::fromStdString(media.getAlbumArtist()); | 72 | return QString::fromStdString(media.getAlbumArtist()); |
403 | 71 | case RoleDate: | 73 | case RoleDate: |
404 | 72 | return QString::fromStdString(media.getDate()); | 74 | return QString::fromStdString(media.getDate()); |
405 | 75 | case RoleGenre: | ||
406 | 76 | return QString::fromStdString(media.getGenre()); | ||
407 | 77 | case RoleDiscNumber: | ||
408 | 78 | return media.getDiscNumber(); | ||
409 | 73 | case RoleTrackNumber: | 79 | case RoleTrackNumber: |
410 | 74 | return media.getTrackNumber(); | 80 | return media.getTrackNumber(); |
411 | 75 | case RoleDuration: | 81 | case RoleDuration: |
412 | @@ -81,6 +87,10 @@ | |||
413 | 81 | } | 87 | } |
414 | 82 | } | 88 | } |
415 | 83 | 89 | ||
416 | 90 | QVariant MediaFileModelBase::get(int row, MediaFileModelBase::Roles role) const { | ||
417 | 91 | return data(index(row, 0), role); | ||
418 | 92 | } | ||
419 | 93 | |||
420 | 84 | QHash<int, QByteArray> MediaFileModelBase::roleNames() const { | 94 | QHash<int, QByteArray> MediaFileModelBase::roleNames() const { |
421 | 85 | return roles; | 95 | return roles; |
422 | 86 | } | 96 | } |
423 | 87 | 97 | ||
424 | === modified file 'src/qml/Ubuntu/MediaScanner/MediaFileModelBase.hh' | |||
425 | --- src/qml/Ubuntu/MediaScanner/MediaFileModelBase.hh 2014-03-24 10:04:19 +0000 | |||
426 | +++ src/qml/Ubuntu/MediaScanner/MediaFileModelBase.hh 2014-05-08 07:17:36 +0000 | |||
427 | @@ -31,6 +31,7 @@ | |||
428 | 31 | class MediaFileModelBase : public QAbstractListModel { | 31 | class MediaFileModelBase : public QAbstractListModel { |
429 | 32 | Q_OBJECT | 32 | Q_OBJECT |
430 | 33 | Q_ENUMS(Roles) | 33 | Q_ENUMS(Roles) |
431 | 34 | Q_PROPERTY(int rowCount READ rowCount) // NOTIFY modelReset | ||
432 | 34 | public: | 35 | public: |
433 | 35 | enum Roles { | 36 | enum Roles { |
434 | 36 | RoleModelData, | 37 | RoleModelData, |
435 | @@ -43,6 +44,8 @@ | |||
436 | 43 | RoleAlbum, | 44 | RoleAlbum, |
437 | 44 | RoleAlbumArtist, | 45 | RoleAlbumArtist, |
438 | 45 | RoleDate, | 46 | RoleDate, |
439 | 47 | RoleGenre, | ||
440 | 48 | RoleDiscNumber, | ||
441 | 46 | RoleTrackNumber, | 49 | RoleTrackNumber, |
442 | 47 | RoleDuration, | 50 | RoleDuration, |
443 | 48 | RoleArt, | 51 | RoleArt, |
444 | @@ -51,6 +54,8 @@ | |||
445 | 51 | explicit MediaFileModelBase(QObject *parent = 0); | 54 | explicit MediaFileModelBase(QObject *parent = 0); |
446 | 52 | int rowCount(const QModelIndex &parent=QModelIndex()) const override; | 55 | int rowCount(const QModelIndex &parent=QModelIndex()) const override; |
447 | 53 | QVariant data(const QModelIndex &index, int role) const override; | 56 | QVariant data(const QModelIndex &index, int role) const override; |
448 | 57 | |||
449 | 58 | Q_INVOKABLE QVariant get(int row, Roles role) const; | ||
450 | 54 | protected: | 59 | protected: |
451 | 55 | QHash<int, QByteArray> roleNames() const override; | 60 | QHash<int, QByteArray> roleNames() const override; |
452 | 56 | void updateResults(const std::vector<mediascanner::MediaFile> &results); | 61 | void updateResults(const std::vector<mediascanner::MediaFile> &results); |
453 | 57 | 62 | ||
454 | === modified file 'src/qml/Ubuntu/MediaScanner/MediaFileWrapper.cc' | |||
455 | --- src/qml/Ubuntu/MediaScanner/MediaFileWrapper.cc 2014-03-24 10:04:19 +0000 | |||
456 | +++ src/qml/Ubuntu/MediaScanner/MediaFileWrapper.cc 2014-05-08 07:17:36 +0000 | |||
457 | @@ -62,6 +62,14 @@ | |||
458 | 62 | return QString::fromStdString(media.getDate()); | 62 | return QString::fromStdString(media.getDate()); |
459 | 63 | } | 63 | } |
460 | 64 | 64 | ||
461 | 65 | QString MediaFileWrapper::genre() const { | ||
462 | 66 | return QString::fromStdString(media.getGenre()); | ||
463 | 67 | } | ||
464 | 68 | |||
465 | 69 | int MediaFileWrapper::discNumber() const { | ||
466 | 70 | return media.getDiscNumber(); | ||
467 | 71 | } | ||
468 | 72 | |||
469 | 65 | int MediaFileWrapper::trackNumber() const { | 73 | int MediaFileWrapper::trackNumber() const { |
470 | 66 | return media.getTrackNumber(); | 74 | return media.getTrackNumber(); |
471 | 67 | } | 75 | } |
472 | 68 | 76 | ||
473 | === modified file 'src/qml/Ubuntu/MediaScanner/MediaFileWrapper.hh' | |||
474 | --- src/qml/Ubuntu/MediaScanner/MediaFileWrapper.hh 2014-03-24 10:04:19 +0000 | |||
475 | +++ src/qml/Ubuntu/MediaScanner/MediaFileWrapper.hh 2014-05-08 07:17:36 +0000 | |||
476 | @@ -39,6 +39,8 @@ | |||
477 | 39 | Q_PROPERTY(QString album READ album CONSTANT) | 39 | Q_PROPERTY(QString album READ album CONSTANT) |
478 | 40 | Q_PROPERTY(QString albumArtist READ albumArtist CONSTANT) | 40 | Q_PROPERTY(QString albumArtist READ albumArtist CONSTANT) |
479 | 41 | Q_PROPERTY(QString date READ date CONSTANT) | 41 | Q_PROPERTY(QString date READ date CONSTANT) |
480 | 42 | Q_PROPERTY(QString genre READ genre CONSTANT) | ||
481 | 43 | Q_PROPERTY(int discNumber READ discNumber CONSTANT) | ||
482 | 42 | Q_PROPERTY(int trackNumber READ trackNumber CONSTANT) | 44 | Q_PROPERTY(int trackNumber READ trackNumber CONSTANT) |
483 | 43 | Q_PROPERTY(int duration READ duration CONSTANT) | 45 | Q_PROPERTY(int duration READ duration CONSTANT) |
484 | 44 | Q_PROPERTY(QString art READ art CONSTANT) | 46 | Q_PROPERTY(QString art READ art CONSTANT) |
485 | @@ -53,6 +55,8 @@ | |||
486 | 53 | QString album() const; | 55 | QString album() const; |
487 | 54 | QString albumArtist() const; | 56 | QString albumArtist() const; |
488 | 55 | QString date() const; | 57 | QString date() const; |
489 | 58 | QString genre() const; | ||
490 | 59 | int discNumber() const; | ||
491 | 56 | int trackNumber() const; | 60 | int trackNumber() const; |
492 | 57 | int duration() const; | 61 | int duration() const; |
493 | 58 | QString art() const; | 62 | QString art() const; |
494 | 59 | 63 | ||
495 | === modified file 'src/qml/Ubuntu/MediaScanner/plugin.qmltypes' | |||
496 | --- src/qml/Ubuntu/MediaScanner/plugin.qmltypes 2014-03-24 10:28:30 +0000 | |||
497 | +++ src/qml/Ubuntu/MediaScanner/plugin.qmltypes 2014-05-08 07:17:36 +0000 | |||
498 | @@ -18,6 +18,13 @@ | |||
499 | 18 | "RoleArt": 2 | 18 | "RoleArt": 2 |
500 | 19 | } | 19 | } |
501 | 20 | } | 20 | } |
502 | 21 | Property { name: "rowCount"; type: "int"; isReadonly: true } | ||
503 | 22 | Method { | ||
504 | 23 | name: "get" | ||
505 | 24 | type: "QVariant" | ||
506 | 25 | Parameter { name: "row"; type: "int" } | ||
507 | 26 | Parameter { name: "role"; type: "Roles" } | ||
508 | 27 | } | ||
509 | 21 | } | 28 | } |
510 | 22 | Component { | 29 | Component { |
511 | 23 | name: "mediascanner::qml::AlbumsModel" | 30 | name: "mediascanner::qml::AlbumsModel" |
512 | @@ -43,6 +50,13 @@ | |||
513 | 43 | Property { name: "store"; type: "mediascanner::qml::MediaStoreWrapper"; isPointer: true } | 50 | Property { name: "store"; type: "mediascanner::qml::MediaStoreWrapper"; isPointer: true } |
514 | 44 | Property { name: "albumArtists"; type: "bool" } | 51 | Property { name: "albumArtists"; type: "bool" } |
515 | 45 | Property { name: "limit"; type: "int" } | 52 | Property { name: "limit"; type: "int" } |
516 | 53 | Property { name: "rowCount"; type: "int"; isReadonly: true } | ||
517 | 54 | Method { | ||
518 | 55 | name: "get" | ||
519 | 56 | type: "QVariant" | ||
520 | 57 | Parameter { name: "row"; type: "int" } | ||
521 | 58 | Parameter { name: "role"; type: "Roles" } | ||
522 | 59 | } | ||
523 | 46 | } | 60 | } |
524 | 47 | Component { | 61 | Component { |
525 | 48 | name: "mediascanner::qml::MediaFileModelBase" | 62 | name: "mediascanner::qml::MediaFileModelBase" |
526 | @@ -60,11 +74,20 @@ | |||
527 | 60 | "RoleAlbum": 7, | 74 | "RoleAlbum": 7, |
528 | 61 | "RoleAlbumArtist": 8, | 75 | "RoleAlbumArtist": 8, |
529 | 62 | "RoleDate": 9, | 76 | "RoleDate": 9, |
533 | 63 | "RoleTrackNumber": 10, | 77 | "RoleGenre": 10, |
534 | 64 | "RoleDuration": 11, | 78 | "RoleDiscNumber": 11, |
535 | 65 | "RoleArt": 12 | 79 | "RoleTrackNumber": 12, |
536 | 80 | "RoleDuration": 13, | ||
537 | 81 | "RoleArt": 14 | ||
538 | 66 | } | 82 | } |
539 | 67 | } | 83 | } |
540 | 84 | Property { name: "rowCount"; type: "int"; isReadonly: true } | ||
541 | 85 | Method { | ||
542 | 86 | name: "get" | ||
543 | 87 | type: "QVariant" | ||
544 | 88 | Parameter { name: "row"; type: "int" } | ||
545 | 89 | Parameter { name: "role"; type: "Roles" } | ||
546 | 90 | } | ||
547 | 68 | } | 91 | } |
548 | 69 | Component { | 92 | Component { |
549 | 70 | name: "mediascanner::qml::MediaFileWrapper" | 93 | name: "mediascanner::qml::MediaFileWrapper" |
550 | @@ -80,6 +103,8 @@ | |||
551 | 80 | Property { name: "album"; type: "string"; isReadonly: true } | 103 | Property { name: "album"; type: "string"; isReadonly: true } |
552 | 81 | Property { name: "albumArtist"; type: "string"; isReadonly: true } | 104 | Property { name: "albumArtist"; type: "string"; isReadonly: true } |
553 | 82 | Property { name: "date"; type: "string"; isReadonly: true } | 105 | Property { name: "date"; type: "string"; isReadonly: true } |
554 | 106 | Property { name: "genre"; type: "string"; isReadonly: true } | ||
555 | 107 | Property { name: "discNumber"; type: "int"; isReadonly: true } | ||
556 | 83 | Property { name: "trackNumber"; type: "int"; isReadonly: true } | 108 | Property { name: "trackNumber"; type: "int"; isReadonly: true } |
557 | 84 | Property { name: "duration"; type: "int"; isReadonly: true } | 109 | Property { name: "duration"; type: "int"; isReadonly: true } |
558 | 85 | Property { name: "art"; type: "string"; isReadonly: true } | 110 | Property { name: "art"; type: "string"; isReadonly: true } |
559 | 86 | 111 | ||
560 | === modified file 'src/utils/scaletest.cc' | |||
561 | --- src/utils/scaletest.cc 2014-01-31 07:17:15 +0000 | |||
562 | +++ src/utils/scaletest.cc 2014-05-08 07:17:36 +0000 | |||
563 | @@ -84,7 +84,7 @@ | |||
564 | 84 | track += " " + RNDWORD; | 84 | track += " " + RNDWORD; |
565 | 85 | } | 85 | } |
566 | 86 | string fname = to_string(i) + ".mp3"; | 86 | string fname = to_string(i) + ".mp3"; |
568 | 87 | MediaFile mf(fname, "audio/mp3", "", track, "2013-01-01", artist, album, artist, trackCount, rnd() % 300, AudioMedia); | 87 | MediaFile mf(fname, "audio/mp3", "", track, "2013-01-01", artist, album, artist, "", 0, trackCount, rnd() % 300, AudioMedia); |
569 | 88 | store.insert(mf); | 88 | store.insert(mf); |
570 | 89 | i++; | 89 | i++; |
571 | 90 | //printf("%s, %s, %s\n", artist.c_str(), album.c_str(), track.c_str()); | 90 | //printf("%s, %s, %s\n", artist.c_str(), album.c_str(), track.c_str()); |
572 | 91 | 91 | ||
573 | === modified file 'test/qml/tst_mediastore.qml' | |||
574 | --- test/qml/tst_mediastore.qml 2014-03-24 10:04:19 +0000 | |||
575 | +++ test/qml/tst_mediastore.qml 2014-05-08 07:17:36 +0000 | |||
576 | @@ -31,6 +31,8 @@ | |||
577 | 31 | checkAttr("album", "Spiderbait"); | 31 | checkAttr("album", "Spiderbait"); |
578 | 32 | checkAttr("albumArtist", "Spiderbait"); | 32 | checkAttr("albumArtist", "Spiderbait"); |
579 | 33 | checkAttr("date", "2013-11-15"); | 33 | checkAttr("date", "2013-11-15"); |
580 | 34 | checkAttr("genre", "rock"); | ||
581 | 35 | checkAttr("discNumber", 1); | ||
582 | 34 | checkAttr("trackNumber", 1); | 36 | checkAttr("trackNumber", 1); |
583 | 35 | checkAttr("duration", 235); | 37 | checkAttr("duration", 235); |
584 | 36 | checkAttr("art", "image://albumart/artist=Spiderbait&album=Spiderbait"); | 38 | checkAttr("art", "image://albumart/artist=Spiderbait&album=Spiderbait"); |
585 | 37 | 39 | ||
586 | === modified file 'test/qml/tst_songsearchmodel.qml' | |||
587 | --- test/qml/tst_songsearchmodel.qml 2014-02-25 05:54:27 +0000 | |||
588 | +++ test/qml/tst_songsearchmodel.qml 2014-05-08 07:17:36 +0000 | |||
589 | @@ -15,14 +15,14 @@ | |||
590 | 15 | query: "" | 15 | query: "" |
591 | 16 | } | 16 | } |
592 | 17 | 17 | ||
593 | 18 | ListView { | ||
594 | 19 | id: songs_view | ||
595 | 20 | model: songs_model | ||
596 | 21 | } | ||
597 | 22 | |||
598 | 23 | TestCase { | 18 | TestCase { |
599 | 24 | name: "SongsSearchModelTests" | 19 | name: "SongsSearchModelTests" |
601 | 25 | function test_foo() { | 20 | function test_search() { |
602 | 21 | // By default, the model lists all songs. | ||
603 | 22 | compare(songs_model.rowCount, 7, "songs_model.rowCount == 7"); | ||
604 | 23 | songs_model.query = "revolution"; | ||
605 | 24 | compare(songs_model.rowCount, 1, "songs_model.rowCount == 1"); | ||
606 | 25 | compare(songs_model.get(0, SongsSearchModel.RoleTitle), "Revolution"); | ||
607 | 26 | } | 26 | } |
608 | 27 | } | 27 | } |
609 | 28 | } | 28 | } |
610 | 29 | 29 | ||
611 | === modified file 'test/test_mediastore.cc' | |||
612 | --- test/test_mediastore.cc 2014-03-07 08:13:07 +0000 | |||
613 | +++ test/test_mediastore.cc 2014-05-08 07:17:36 +0000 | |||
614 | @@ -54,11 +54,11 @@ | |||
615 | 54 | } | 54 | } |
616 | 55 | 55 | ||
617 | 56 | TEST_F(MediaStoreTest, equality) { | 56 | TEST_F(MediaStoreTest, equality) { |
620 | 57 | MediaFile audio1("a", "type", "etag", "1900", "b", "c", "d", "e", 1, 5, AudioMedia); | 57 | MediaFile audio1("a", "type", "etag", "1900", "b", "c", "d", "e", "f", 0, 1, 5, AudioMedia); |
621 | 58 | MediaFile audio2("aa", "type", "etag", "1900", "b", "c", "d", "e", 1, 5, AudioMedia); | 58 | MediaFile audio2("aa", "type", "etag", "1900", "b", "c", "d", "e", "f", 0, 1, 5, AudioMedia); |
622 | 59 | 59 | ||
625 | 60 | MediaFile video1("a", "type", "etag", "b", "1900", "c", "d", "e", 0, 5, VideoMedia); | 60 | MediaFile video1("a", "type", "etag", "b", "1900", "c", "d", "e", "f", 0, 0, 5, VideoMedia); |
626 | 61 | MediaFile video2("aa", "type", "etag", "b", "1900", "c", "d", "e", 0, 5, VideoMedia); | 61 | MediaFile video2("aa", "type", "etag", "b", "1900", "c", "d", "e", "f", 0, 0, 5, VideoMedia); |
627 | 62 | 62 | ||
628 | 63 | EXPECT_EQ(audio1, audio1); | 63 | EXPECT_EQ(audio1, audio1); |
629 | 64 | EXPECT_EQ(video1, video1); | 64 | EXPECT_EQ(video1, video1); |
630 | @@ -70,7 +70,7 @@ | |||
631 | 70 | } | 70 | } |
632 | 71 | 71 | ||
633 | 72 | TEST_F(MediaStoreTest, lookup) { | 72 | TEST_F(MediaStoreTest, lookup) { |
635 | 73 | MediaFile audio("aaa", "type", "etag", "bbb bbb", "1900-01-01", "ccc", "ddd", "eee", 3, 5, AudioMedia); | 73 | MediaFile audio("aaa", "type", "etag", "bbb bbb", "1900-01-01", "ccc", "ddd", "eee", "fff", 0, 3, 5, AudioMedia); |
636 | 74 | MediaStore store(":memory:", MS_READ_WRITE); | 74 | MediaStore store(":memory:", MS_READ_WRITE); |
637 | 75 | store.insert(audio); | 75 | store.insert(audio); |
638 | 76 | 76 | ||
639 | @@ -79,8 +79,8 @@ | |||
640 | 79 | } | 79 | } |
641 | 80 | 80 | ||
642 | 81 | TEST_F(MediaStoreTest, roundtrip) { | 81 | TEST_F(MediaStoreTest, roundtrip) { |
645 | 82 | MediaFile audio("aaa", "type", "etag", "bbb bbb", "1900-01-01", "ccc", "ddd", "eee", 3, 5, AudioMedia); | 82 | MediaFile audio("aaa", "type", "etag", "bbb bbb", "1900-01-01", "ccc", "ddd", "eee", "fff", 0, 3, 5, AudioMedia); |
646 | 83 | MediaFile video("aaa2", "type", "etag", "bbb bbb", "2012-01-01", "ccc", "ddd", "eee", 0, 5, VideoMedia); | 83 | MediaFile video("aaa2", "type", "etag", "bbb bbb", "2012-01-01", "ccc", "ddd", "eee", "fff", 0, 0, 5, VideoMedia); |
647 | 84 | MediaStore store(":memory:", MS_READ_WRITE); | 84 | MediaStore store(":memory:", MS_READ_WRITE); |
648 | 85 | store.insert(audio); | 85 | store.insert(audio); |
649 | 86 | store.insert(video); | 86 | store.insert(video); |
650 | @@ -93,7 +93,7 @@ | |||
651 | 93 | } | 93 | } |
652 | 94 | 94 | ||
653 | 95 | TEST_F(MediaStoreTest, query_by_album) { | 95 | TEST_F(MediaStoreTest, query_by_album) { |
655 | 96 | MediaFile audio("/path/foo.ogg", "", "", "title", "1900-01-01", "artist", "album", "albumartist", 3, 5, AudioMedia); | 96 | MediaFile audio("/path/foo.ogg", "", "", "title", "1900-01-01", "artist", "album", "albumartist", "genre", 0, 3, 5, AudioMedia); |
656 | 97 | MediaStore store(":memory:", MS_READ_WRITE); | 97 | MediaStore store(":memory:", MS_READ_WRITE); |
657 | 98 | store.insert(audio); | 98 | store.insert(audio); |
658 | 99 | 99 | ||
659 | @@ -103,7 +103,7 @@ | |||
660 | 103 | } | 103 | } |
661 | 104 | 104 | ||
662 | 105 | TEST_F(MediaStoreTest, query_by_artist) { | 105 | TEST_F(MediaStoreTest, query_by_artist) { |
664 | 106 | MediaFile audio("/path/foo.ogg", "", "", "title", "1900-01-01", "artist", "album", "albumartist", 3, 5, AudioMedia); | 106 | MediaFile audio("/path/foo.ogg", "", "", "title", "1900-01-01", "artist", "album", "albumartist", "genre", 1, 3, 5, AudioMedia); |
665 | 107 | MediaStore store(":memory:", MS_READ_WRITE); | 107 | MediaStore store(":memory:", MS_READ_WRITE); |
666 | 108 | store.insert(audio); | 108 | store.insert(audio); |
667 | 109 | 109 | ||
668 | @@ -113,18 +113,18 @@ | |||
669 | 113 | } | 113 | } |
670 | 114 | 114 | ||
671 | 115 | TEST_F(MediaStoreTest, query_ranking) { | 115 | TEST_F(MediaStoreTest, query_ranking) { |
677 | 116 | MediaFile audio1("/path/foo1.ogg", "", "", "title", "1900-01-01", "artist", "album", "albumartist", 3, 5, AudioMedia); | 116 | MediaFile audio1("/path/foo1.ogg", "", "", "title", "1900-01-01", "artist", "album", "albumartist", "genre", 1, 3, 5, AudioMedia); |
678 | 117 | MediaFile audio2("/path/foo2.ogg", "", "", "title aaa", "1900-01-01", "artist", "album", "albumartist", 3, 5, AudioMedia); | 117 | MediaFile audio2("/path/foo2.ogg", "", "", "title aaa", "1900-01-01", "artist", "album", "albumartist", "genre", 1, 3, 5, AudioMedia); |
679 | 118 | MediaFile audio3("/path/foo3.ogg", "", "", "title", "1900-01-01", "artist aaa", "album", "albumartist", 3, 5, AudioMedia); | 118 | MediaFile audio3("/path/foo3.ogg", "", "", "title", "1900-01-01", "artist aaa", "album", "albumartist", "genre", 1, 3, 5, AudioMedia); |
680 | 119 | MediaFile audio4("/path/foo4.ogg", "", "", "title", "1900-01-01", "artist", "album aaa", "albumartist", 3, 5, AudioMedia); | 119 | MediaFile audio4("/path/foo4.ogg", "", "", "title", "1900-01-01", "artist", "album aaa", "albumartist", "genre", 1, 3, 5, AudioMedia); |
681 | 120 | MediaFile audio5("/path/foo5.ogg", "", "", "title aaa", "1900-01-01", "artist aaa", "album aaa", "albumartist", 3, 5, AudioMedia); | 120 | MediaFile audio5("/path/foo5.ogg", "", "", "title aaa", "1900-01-01", "artist aaa", "album aaa", "albumartist", "genre", 1, 3, 5, AudioMedia); |
682 | 121 | 121 | ||
689 | 122 | MediaStore store(":memory:", MS_READ_WRITE); | 122 | MediaStore store(":memory:", MS_READ_WRITE); |
690 | 123 | store.insert(audio1); | 123 | store.insert(audio1); |
691 | 124 | store.insert(audio2); | 124 | store.insert(audio2); |
692 | 125 | store.insert(audio3); | 125 | store.insert(audio3); |
693 | 126 | store.insert(audio4); | 126 | store.insert(audio4); |
694 | 127 | store.insert(audio5); | 127 | store.insert(audio5); |
695 | 128 | 128 | ||
696 | 129 | vector<MediaFile> result = store.query("aaa", AudioMedia); | 129 | vector<MediaFile> result = store.query("aaa", AudioMedia); |
697 | 130 | ASSERT_EQ(result.size(), 4); | 130 | ASSERT_EQ(result.size(), 4); |
698 | @@ -135,9 +135,9 @@ | |||
699 | 135 | } | 135 | } |
700 | 136 | 136 | ||
701 | 137 | TEST_F(MediaStoreTest, query_limit) { | 137 | TEST_F(MediaStoreTest, query_limit) { |
705 | 138 | MediaFile audio1("/path/foo5.ogg", "", "", "title aaa", "1900-01-01", "artist aaa", "album aaa", "albumartist", 3, 5, AudioMedia); | 138 | MediaFile audio1("/path/foo5.ogg", "", "", "title aaa", "1900-01-01", "artist aaa", "album aaa", "albumartist", "genre", 1, 3, 5, AudioMedia); |
706 | 139 | MediaFile audio2("/path/foo2.ogg", "", "", "title aaa", "1900-01-01", "artist", "album", "albumartist", 3, 5, AudioMedia); | 139 | MediaFile audio2("/path/foo2.ogg", "", "", "title aaa", "1900-01-01", "artist", "album", "albumartist", "genre", 1, 3, 5, AudioMedia); |
707 | 140 | MediaFile audio3("/path/foo4.ogg", "", "", "title", "1900-01-01", "artist", "album aaa", "albumartist", 3, 5, AudioMedia); | 140 | MediaFile audio3("/path/foo4.ogg", "", "", "title", "1900-01-01", "artist", "album aaa", "albumartist", "genre", 1, 3, 5, AudioMedia); |
708 | 141 | 141 | ||
709 | 142 | MediaStore store(":memory:", MS_READ_WRITE); | 142 | MediaStore store(":memory:", MS_READ_WRITE); |
710 | 143 | store.insert(audio1); | 143 | store.insert(audio1); |
711 | @@ -151,8 +151,8 @@ | |||
712 | 151 | } | 151 | } |
713 | 152 | 152 | ||
714 | 153 | TEST_F(MediaStoreTest, query_short) { | 153 | TEST_F(MediaStoreTest, query_short) { |
717 | 154 | MediaFile audio1("/path/foo5.ogg", "", "", "title xyz", "1900-01-01", "artist", "album", "albumartist", 3, 5, AudioMedia); | 154 | MediaFile audio1("/path/foo5.ogg", "", "", "title xyz", "1900-01-01", "artist", "album", "albumartist", "genre", 1, 3, 5, AudioMedia); |
718 | 155 | MediaFile audio2("/path/foo2.ogg", "", "", "title xzy", "1900-01-01", "artist", "album", "albumartist", 3, 5, AudioMedia); | 155 | MediaFile audio2("/path/foo2.ogg", "", "", "title xzy", "1900-01-01", "artist", "album", "albumartist", "genre", 1, 3, 5, AudioMedia); |
719 | 156 | 156 | ||
720 | 157 | MediaStore store(":memory:", MS_READ_WRITE); | 157 | MediaStore store(":memory:", MS_READ_WRITE); |
721 | 158 | store.insert(audio1); | 158 | store.insert(audio1); |
722 | @@ -165,9 +165,9 @@ | |||
723 | 165 | } | 165 | } |
724 | 166 | 166 | ||
725 | 167 | TEST_F(MediaStoreTest, query_empty) { | 167 | TEST_F(MediaStoreTest, query_empty) { |
729 | 168 | MediaFile audio1("/path/foo5.ogg", "", "", "title aaa", "1900-01-01", "artist aaa", "album aaa", "albumartist", 3, 5, AudioMedia); | 168 | MediaFile audio1("/path/foo5.ogg", "", "", "title aaa", "1900-01-01", "artist aaa", "album aaa", "albumartist", "genre", 1, 3, 5, AudioMedia); |
730 | 169 | MediaFile audio2("/path/foo2.ogg", "", "", "title aaa", "1900-01-01", "artist", "album", "albumartist", 3, 5, AudioMedia); | 169 | MediaFile audio2("/path/foo2.ogg", "", "", "title aaa", "1900-01-01", "artist", "album", "albumartist", "genre", 1, 3, 5, AudioMedia); |
731 | 170 | MediaFile audio3("/path/foo4.ogg", "", "", "title", "1900-01-01", "artist", "album aaa", "albumartist", 3, 5, AudioMedia); | 170 | MediaFile audio3("/path/foo4.ogg", "", "", "title", "1900-01-01", "artist", "album aaa", "albumartist", "genre", 1, 3, 5, AudioMedia); |
732 | 171 | 171 | ||
733 | 172 | MediaStore store(":memory:", MS_READ_WRITE); | 172 | MediaStore store(":memory:", MS_READ_WRITE); |
734 | 173 | store.insert(audio1); | 173 | store.insert(audio1); |
735 | @@ -180,8 +180,8 @@ | |||
736 | 180 | } | 180 | } |
737 | 181 | 181 | ||
738 | 182 | TEST_F(MediaStoreTest, unmount) { | 182 | TEST_F(MediaStoreTest, unmount) { |
741 | 183 | MediaFile audio1("/media/username/dir/fname.ogg", "", "", "bbb bbb", "2000-01-01", "ccc", "ddd", "eee", 1, 5, AudioMedia); | 183 | MediaFile audio1("/media/username/dir/fname.ogg", "", "", "bbb bbb", "2000-01-01", "ccc", "ddd", "eee", "ffff", 0, 1, 5, AudioMedia); |
742 | 184 | MediaFile audio2("/home/username/Music/fname.ogg", "", "", "bbb bbb", "1900-01-01", "ccc", "ddd", "eee", 42, 5, AudioMedia); | 184 | MediaFile audio2("/home/username/Music/fname.ogg", "", "", "bbb bbb", "1900-01-01", "ccc", "ddd", "eee", "ffff", 0, 42, 5, AudioMedia); |
743 | 185 | MediaStore store(":memory:", MS_READ_WRITE); | 185 | MediaStore store(":memory:", MS_READ_WRITE); |
744 | 186 | store.insert(audio1); | 186 | store.insert(audio1); |
745 | 187 | store.insert(audio2); | 187 | store.insert(audio2); |
746 | @@ -210,10 +210,10 @@ | |||
747 | 210 | } | 210 | } |
748 | 211 | 211 | ||
749 | 212 | TEST_F(MediaStoreTest, queryAlbums) { | 212 | TEST_F(MediaStoreTest, queryAlbums) { |
754 | 213 | MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "Various Artists", 1, 5, AudioMedia); | 213 | MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "Various Artists", "genre", 1, 1, 5, AudioMedia); |
755 | 214 | MediaFile audio2("/home/username/Music/track2.ogg", "", "", "TitleTwo", "1900-01-01", "ArtistTwo", "AlbumOne", "Various Artists", 2, 5, AudioMedia); | 214 | MediaFile audio2("/home/username/Music/track2.ogg", "", "", "TitleTwo", "1900-01-01", "ArtistTwo", "AlbumOne", "Various Artists", "genre", 1, 2, 5, AudioMedia); |
756 | 215 | MediaFile audio3("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistThree", "AlbumOne", "Various Artists", 3, 5, AudioMedia); | 215 | MediaFile audio3("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistThree", "AlbumOne", "Various Artists", "genre", 1, 3, 5, AudioMedia); |
757 | 216 | MediaFile audio4("/home/username/Music/fname.ogg", "", "", "TitleFour", "1900-01-01", "ArtistFour", "AlbumTwo", "ArtistFour", 1, 5, AudioMedia); | 216 | MediaFile audio4("/home/username/Music/fname.ogg", "", "", "TitleFour", "1900-01-01", "ArtistFour", "AlbumTwo", "ArtistFour", "genre", 1, 1, 5, AudioMedia); |
758 | 217 | 217 | ||
759 | 218 | MediaStore store(":memory:", MS_READ_WRITE); | 218 | MediaStore store(":memory:", MS_READ_WRITE); |
760 | 219 | store.insert(audio1); | 219 | store.insert(audio1); |
761 | @@ -241,10 +241,10 @@ | |||
762 | 241 | } | 241 | } |
763 | 242 | 242 | ||
764 | 243 | TEST_F(MediaStoreTest, queryAlbums_limit) { | 243 | TEST_F(MediaStoreTest, queryAlbums_limit) { |
769 | 244 | MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "Various Artists", 1, 5, AudioMedia); | 244 | MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "Various Artists", "genre", 1, 1, 5, AudioMedia); |
770 | 245 | MediaFile audio2("/home/username/Music/track2.ogg", "", "", "TitleTwo", "1900-01-01", "ArtistTwo", "AlbumOne", "Various Artists", 2, 5, AudioMedia); | 245 | MediaFile audio2("/home/username/Music/track2.ogg", "", "", "TitleTwo", "1900-01-01", "ArtistTwo", "AlbumOne", "Various Artists", "genre", 1, 2, 5, AudioMedia); |
771 | 246 | MediaFile audio3("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistThree", "AlbumOne", "Various Artists", 3, 5, AudioMedia); | 246 | MediaFile audio3("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistThree", "AlbumOne", "Various Artists", "genre", 1, 3, 5, AudioMedia); |
772 | 247 | MediaFile audio4("/home/username/Music/fname.ogg", "", "", "TitleFour", "1900-01-01", "ArtistFour", "AlbumTwo", "ArtistFour", 1, 5, AudioMedia); | 247 | MediaFile audio4("/home/username/Music/fname.ogg", "", "", "TitleFour", "1900-01-01", "ArtistFour", "AlbumTwo", "ArtistFour", "genre", 1, 1, 5, AudioMedia); |
773 | 248 | 248 | ||
774 | 249 | MediaStore store(":memory:", MS_READ_WRITE); | 249 | MediaStore store(":memory:", MS_READ_WRITE); |
775 | 250 | store.insert(audio1); | 250 | store.insert(audio1); |
776 | @@ -259,10 +259,10 @@ | |||
777 | 259 | } | 259 | } |
778 | 260 | 260 | ||
779 | 261 | TEST_F(MediaStoreTest, queryAlbums_empty) { | 261 | TEST_F(MediaStoreTest, queryAlbums_empty) { |
784 | 262 | MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "Various Artists", 1, 5, AudioMedia); | 262 | MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "Various Artists", "genre", 1, 1, 5, AudioMedia); |
785 | 263 | MediaFile audio2("/home/username/Music/track2.ogg", "", "", "TitleTwo", "1900-01-01", "ArtistTwo", "AlbumOne", "Various Artists", 2, 5, AudioMedia); | 263 | MediaFile audio2("/home/username/Music/track2.ogg", "", "", "TitleTwo", "1900-01-01", "ArtistTwo", "AlbumOne", "Various Artists", "genre", 1, 2, 5, AudioMedia); |
786 | 264 | MediaFile audio3("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistThree", "AlbumOne", "Various Artists", 3, 5, AudioMedia); | 264 | MediaFile audio3("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistThree", "AlbumOne", "Various Artists", "genre", 1, 3, 5, AudioMedia); |
787 | 265 | MediaFile audio4("/home/username/Music/fname.ogg", "", "", "TitleFour", "1900-01-01", "ArtistFour", "AlbumTwo", "ArtistFour", 1, 5, AudioMedia); | 265 | MediaFile audio4("/home/username/Music/fname.ogg", "", "", "TitleFour", "1900-01-01", "ArtistFour", "AlbumTwo", "ArtistFour", "genre", 1, 1, 5, AudioMedia); |
788 | 266 | 266 | ||
789 | 267 | MediaStore store(":memory:", MS_READ_WRITE); | 267 | MediaStore store(":memory:", MS_READ_WRITE); |
790 | 268 | store.insert(audio1); | 268 | store.insert(audio1); |
791 | @@ -277,9 +277,9 @@ | |||
792 | 277 | } | 277 | } |
793 | 278 | 278 | ||
794 | 279 | TEST_F(MediaStoreTest, getAlbumSongs) { | 279 | TEST_F(MediaStoreTest, getAlbumSongs) { |
798 | 280 | MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "Various Artists", 1, 5, AudioMedia); | 280 | MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "Various Artists", "genre", 1, 1, 5, AudioMedia); |
799 | 281 | MediaFile audio2("/home/username/Music/track2.ogg", "", "", "TitleTwo", "1900-01-01", "ArtistTwo", "AlbumOne", "Various Artists", 2, 5, AudioMedia); | 281 | MediaFile audio2("/home/username/Music/track2.ogg", "", "", "TitleTwo", "1900-01-01", "ArtistTwo", "AlbumOne", "Various Artists", "genre", 1, 2, 5, AudioMedia); |
800 | 282 | MediaFile audio3("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistThree", "AlbumOne", "Various Artists", 3, 5, AudioMedia); | 282 | MediaFile audio3("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistThree", "AlbumOne", "Various Artists", "genre", 1, 3, 5, AudioMedia); |
801 | 283 | 283 | ||
802 | 284 | MediaStore store(":memory:", MS_READ_WRITE); | 284 | MediaStore store(":memory:", MS_READ_WRITE); |
803 | 285 | store.insert(audio1); | 285 | store.insert(audio1); |
804 | @@ -295,7 +295,7 @@ | |||
805 | 295 | } | 295 | } |
806 | 296 | 296 | ||
807 | 297 | TEST_F(MediaStoreTest, getETag) { | 297 | TEST_F(MediaStoreTest, getETag) { |
809 | 298 | MediaFile file("/path/file.ogg", "audio/ogg", "etag", "title", "2013", "artist", "album", "artist", 1, 5, AudioMedia); | 298 | MediaFile file("/path/file.ogg", "audio/ogg", "etag", "title", "2013", "artist", "album", "artist", "genre", 1, 1, 5, AudioMedia); |
810 | 299 | 299 | ||
811 | 300 | MediaStore store(":memory:", MS_READ_WRITE); | 300 | MediaStore store(":memory:", MS_READ_WRITE); |
812 | 301 | store.insert(file); | 301 | store.insert(file); |
813 | @@ -305,12 +305,12 @@ | |||
814 | 305 | } | 305 | } |
815 | 306 | 306 | ||
816 | 307 | TEST_F(MediaStoreTest, listSongs) { | 307 | TEST_F(MediaStoreTest, listSongs) { |
823 | 308 | MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "ArtistOne", 1, 5, AudioMedia); | 308 | MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "ArtistOne", "genre", 1, 1, 5, AudioMedia); |
824 | 309 | MediaFile audio2("/home/username/Music/track2.ogg", "", "", "TitleTwo", "1900-01-01", "ArtistOne", "AlbumOne", "ArtistOne", 2, 5, AudioMedia); | 309 | MediaFile audio2("/home/username/Music/track2.ogg", "", "", "TitleTwo", "1900-01-01", "ArtistOne", "AlbumOne", "ArtistOne", "genre", 1, 2, 5, AudioMedia); |
825 | 310 | MediaFile audio3("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistOne", "AlbumTwo", "ArtistOne", 3, 5, AudioMedia); | 310 | MediaFile audio3("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistOne", "AlbumTwo", "ArtistOne", "genre", 1, 3, 5, AudioMedia); |
826 | 311 | MediaFile audio4("/home/username/Music/track4.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumThree", "ArtistTwo", 1, 5, AudioMedia); | 311 | MediaFile audio4("/home/username/Music/track4.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumThree", "ArtistTwo", "genre", 1, 1, 5, AudioMedia); |
827 | 312 | MediaFile audio5("/home/username/Music/track5.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumFour", "Various Artists", 1, 5, AudioMedia); | 312 | MediaFile audio5("/home/username/Music/track5.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumFour", "Various Artists", "genre", 1, 1, 5, AudioMedia); |
828 | 313 | MediaFile audio6("/home/username/Music/track6.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumFour", "Various Artists", 2, 5, AudioMedia); | 313 | MediaFile audio6("/home/username/Music/track6.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumFour", "Various Artists", "genre", 1, 2, 5, AudioMedia); |
829 | 314 | 314 | ||
830 | 315 | MediaStore store(":memory:", MS_READ_WRITE); | 315 | MediaStore store(":memory:", MS_READ_WRITE); |
831 | 316 | store.insert(audio1); | 316 | store.insert(audio1); |
832 | @@ -352,11 +352,11 @@ | |||
833 | 352 | } | 352 | } |
834 | 353 | 353 | ||
835 | 354 | TEST_F(MediaStoreTest, listAlbums) { | 354 | TEST_F(MediaStoreTest, listAlbums) { |
841 | 355 | MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "ArtistOne", 1, 5, AudioMedia); | 355 | MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "ArtistOne", "genre", 1, 1, 5, AudioMedia); |
842 | 356 | MediaFile audio2("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistOne", "AlbumTwo", "ArtistOne", 3, 5, AudioMedia); | 356 | MediaFile audio2("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistOne", "AlbumTwo", "ArtistOne", "genre", 1, 3, 5, AudioMedia); |
843 | 357 | MediaFile audio3("/home/username/Music/track4.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumThree", "ArtistTwo", 1, 5, AudioMedia); | 357 | MediaFile audio3("/home/username/Music/track4.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumThree", "ArtistTwo", "genre", 1, 1, 5, AudioMedia); |
844 | 358 | MediaFile audio4("/home/username/Music/track5.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumFour", "Various Artists", 1, 5, AudioMedia); | 358 | MediaFile audio4("/home/username/Music/track5.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumFour", "Various Artists", "genre", 1, 1, 5, AudioMedia); |
845 | 359 | MediaFile audio5("/home/username/Music/track6.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumFour", "Various Artists", 2, 5, AudioMedia); | 359 | MediaFile audio5("/home/username/Music/track6.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumFour", "Various Artists", "genre", 1, 2, 5, AudioMedia); |
846 | 360 | 360 | ||
847 | 361 | MediaStore store(":memory:", MS_READ_WRITE); | 361 | MediaStore store(":memory:", MS_READ_WRITE); |
848 | 362 | store.insert(audio1); | 362 | store.insert(audio1); |
849 | @@ -387,11 +387,11 @@ | |||
850 | 387 | } | 387 | } |
851 | 388 | 388 | ||
852 | 389 | TEST_F(MediaStoreTest, listArtists) { | 389 | TEST_F(MediaStoreTest, listArtists) { |
858 | 390 | MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "ArtistOne", 1, 5, AudioMedia); | 390 | MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "ArtistOne", "genre", 1, 1, 5, AudioMedia); |
859 | 391 | MediaFile audio2("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistOne", "AlbumTwo", "ArtistOne", 3, 5, AudioMedia); | 391 | MediaFile audio2("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistOne", "AlbumTwo", "ArtistOne", "genre", 1, 3, 5, AudioMedia); |
860 | 392 | MediaFile audio3("/home/username/Music/track4.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumThree", "ArtistTwo", 1, 5, AudioMedia); | 392 | MediaFile audio3("/home/username/Music/track4.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumThree", "ArtistTwo", "genre", 1, 1, 5, AudioMedia); |
861 | 393 | MediaFile audio4("/home/username/Music/track5.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumFour", "Various Artists", 1, 5, AudioMedia); | 393 | MediaFile audio4("/home/username/Music/track5.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumFour", "Various Artists", "genre", 1, 1, 5, AudioMedia); |
862 | 394 | MediaFile audio5("/home/username/Music/track6.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumFour", "Various Artists", 2, 5, AudioMedia); | 394 | MediaFile audio5("/home/username/Music/track6.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumFour", "Various Artists", "genre", 1, 2, 5, AudioMedia); |
863 | 395 | 395 | ||
864 | 396 | MediaStore store(":memory:", MS_READ_WRITE); | 396 | MediaStore store(":memory:", MS_READ_WRITE); |
865 | 397 | store.insert(audio1); | 397 | store.insert(audio1); |
866 | 398 | 398 | ||
867 | === modified file 'test/test_qml.cc' | |||
868 | --- test/test_qml.cc 2014-02-25 05:54:27 +0000 | |||
869 | +++ test/test_qml.cc 2014-05-08 07:17:36 +0000 | |||
870 | @@ -29,28 +29,28 @@ | |||
871 | 29 | 29 | ||
872 | 30 | store.insert(MediaFile("/path/foo1.ogg", "audio/ogg", "etag", | 30 | store.insert(MediaFile("/path/foo1.ogg", "audio/ogg", "etag", |
873 | 31 | "Straight Through The Sun", "2013-11-15", "Spiderbait", | 31 | "Straight Through The Sun", "2013-11-15", "Spiderbait", |
875 | 32 | "Spiderbait", "Spiderbait", 1, 235, AudioMedia)); | 32 | "Spiderbait", "Spiderbait", "rock", 1, 1, 235, AudioMedia)); |
876 | 33 | store.insert(MediaFile("/path/foo2.ogg", "audio/ogg", "etag", | 33 | store.insert(MediaFile("/path/foo2.ogg", "audio/ogg", "etag", |
877 | 34 | "It's Beautiful", "2013-11-15", "Spiderbait", | 34 | "It's Beautiful", "2013-11-15", "Spiderbait", |
879 | 35 | "Spiderbait", "Spiderbait", 2, 220, AudioMedia)); | 35 | "Spiderbait", "Spiderbait", "rock", 1, 2, 220, AudioMedia)); |
880 | 36 | 36 | ||
881 | 37 | store.insert(MediaFile("/path/foo3.ogg", "audio/ogg", "etag", | 37 | store.insert(MediaFile("/path/foo3.ogg", "audio/ogg", "etag", |
882 | 38 | "Buy Me a Pony", "1996-10-04", "Spiderbait", | 38 | "Buy Me a Pony", "1996-10-04", "Spiderbait", |
884 | 39 | "Ivy and the Big Apples", "Spiderbait", 3, 104, AudioMedia)); | 39 | "Ivy and the Big Apples", "Spiderbait", "rock", 1, 3, 104, AudioMedia)); |
885 | 40 | 40 | ||
886 | 41 | store.insert(MediaFile("/path/foo4.ogg", "audio/ogg", "etag", | 41 | store.insert(MediaFile("/path/foo4.ogg", "audio/ogg", "etag", |
887 | 42 | "Peaches & Cream", "2004-03-08", "The John Butler Trio", | 42 | "Peaches & Cream", "2004-03-08", "The John Butler Trio", |
889 | 43 | "Sunrise Over Sea", "The John Butler Trio", 2, 407, AudioMedia)); | 43 | "Sunrise Over Sea", "The John Butler Trio", "roots", 1, 2, 407, AudioMedia)); |
890 | 44 | store.insert(MediaFile("/path/foo5.ogg", "audio/ogg", "etag", | 44 | store.insert(MediaFile("/path/foo5.ogg", "audio/ogg", "etag", |
891 | 45 | "Zebra", "2004-03-08", "The John Butler Trio", | 45 | "Zebra", "2004-03-08", "The John Butler Trio", |
893 | 46 | "Sunrise Over Sea", "The John Butler Trio", 10, 237, AudioMedia)); | 46 | "Sunrise Over Sea", "The John Butler Trio", "roots", 1, 10, 237, AudioMedia)); |
894 | 47 | 47 | ||
895 | 48 | store.insert(MediaFile("/path/foo6.ogg", "audio/ogg", "etag", | 48 | store.insert(MediaFile("/path/foo6.ogg", "audio/ogg", "etag", |
896 | 49 | "Revolution", "2010-01-01", "The John Butler Trio", | 49 | "Revolution", "2010-01-01", "The John Butler Trio", |
898 | 50 | "April Uprising", "The John Butler Trio", 1, 305, AudioMedia)); | 50 | "April Uprising", "The John Butler Trio", "roots", 1, 1, 305, AudioMedia)); |
899 | 51 | store.insert(MediaFile("/path/foo7.ogg", "audio/ogg", "etag", | 51 | store.insert(MediaFile("/path/foo7.ogg", "audio/ogg", "etag", |
900 | 52 | "One Way Road", "2010-01-01", "The John Butler Trio", | 52 | "One Way Road", "2010-01-01", "The John Butler Trio", |
902 | 53 | "April Uprising", "The John Butler Trio", 2, 185, AudioMedia)); | 53 | "April Uprising", "The John Butler Trio", "roots", 1, 2, 185, AudioMedia)); |
903 | 54 | } | 54 | } |
904 | 55 | 55 | ||
905 | 56 | private: | 56 | private: |
FAILED: Continuous integration, rev:234 /code.launchpad .net/~jamesh/ mediascanner2/ qmlplugin- updates/ +merge/ 218351/ +edit-commit- message
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http:// jenkins. qa.ubuntu. com/job/ mediascanner2- ci/61/ jenkins. qa.ubuntu. com/job/ mediascanner2- utopic- amd64-ci/ 2 jenkins. qa.ubuntu. com/job/ mediascanner2- utopic- armhf-ci/ 2 jenkins. qa.ubuntu. com/job/ mediascanner2- utopic- armhf-ci/ 2/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ mediascanner2- utopic- i386-ci/ 2
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/mediascanne r2-ci/61/ rebuild
http://