Merge lp:~jamesh/mediascanner2/qmlplugin-updates into lp:mediascanner2

Proposed by James Henstridge
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
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.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:234
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://code.launchpad.net/~jamesh/mediascanner2/qmlplugin-updates/+merge/218351/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/mediascanner2-ci/61/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mediascanner2-utopic-amd64-ci/2
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mediascanner2-utopic-armhf-ci/2
        deb: http://jenkins.qa.ubuntu.com/job/mediascanner2-utopic-armhf-ci/2/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mediascanner2-utopic-i386-ci/2

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/mediascanner2-ci/61/rebuild

review: Needs Fixing (continuous-integration)
235. By James Henstridge

Update qmltypes.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
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.

review: Needs Information
Revision history for this message
James Henstridge (jamesh) wrote :

We will need to rebuild unity-scope-mediascanner too, yes. We don't currently have any other users. If we are settling down on a stable ABI though, we'll probably want to make a few more changes than just this (e.g. move MediaFile's members to a private struct, get rid of its big long constructor, etc). I'm not sure if we want to do this right now though.

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Since we don't currently have other users than the scope, we can do this.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
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 mfb->setAlbum(g_value_get_string(val));
6 else if (tagname == GST_TAG_ALBUM_ARTIST)
7 mfb->setAlbumArtist(g_value_get_string(val));
8+ else if (tagname == GST_TAG_GENRE)
9+ mfb->setGenre(g_value_get_string(val));
10 } else if (G_VALUE_HOLDS(val, GST_TYPE_DATE_TIME)) {
11 if (tagname == GST_TAG_DATE_TIME) {
12 GstDateTime *dt = static_cast<GstDateTime*>(g_value_get_boxed(val));
13@@ -139,6 +141,8 @@
14 } else if (G_VALUE_HOLDS_UINT(val)) {
15 if (tagname == GST_TAG_TRACK_NUMBER) {
16 mfb->setTrackNumber(g_value_get_uint(val));
17+ } else if (tagname == GST_TAG_ALBUM_VOLUME_NUMBER) {
18+ mfb->setDiscNumber(g_value_get_uint(val));
19 }
20 }
21
22
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
28 namespace mediascanner {
29
30-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,
31- int track_number, int duration, MediaType type) :
32- 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) {
33+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+ int disc_number, int track_number, int duration, MediaType type) :
35+ 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
37 }
38
39@@ -62,6 +62,14 @@
40 return date;
41 }
42
43+const std::string& MediaFile::getGenre() const noexcept {
44+ return genre;
45+}
46+
47+int MediaFile::getDiscNumber() const noexcept {
48+ return disc_number;
49+}
50+
51 int MediaFile::getTrackNumber() const noexcept {
52 return track_number;
53 }
54@@ -88,6 +96,8 @@
55 album == other.album &&
56 album_artist == other.album_artist &&
57 date == other.date &&
58+ genre == other.genre &&
59+ disc_number == other.disc_number &&
60 track_number == other.track_number &&
61 duration == other.duration &&
62 type == other.type;
63
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 public:
69
70 MediaFile(std::string filename) : filename(filename), content_type(""), etag(""), title(""), date(""), author(""),
71- album(""), album_artist(""), track_number(0), duration(0), type(UnknownMedia) {}
72- 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,
73- int track_number, int duration, MediaType type);
74+ album(""), album_artist(""), genre(""), disc_number(0), track_number(0), duration(0), type(UnknownMedia) {}
75+ 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+ int disc_number, int track_number, int duration, MediaType type);
77 MediaFile() = delete;
78
79 const std::string& getFileName() const noexcept;
80@@ -42,8 +42,10 @@
81 const std::string& getAlbum() const noexcept;
82 const std::string& getAlbumArtist() const noexcept;
83 const std::string& getDate() const noexcept;
84+ const std::string& getGenre() const noexcept;
85 std::string getUri() const;
86
87+ int getDiscNumber() const noexcept;
88 int getTrackNumber() const noexcept;
89 int getDuration() const noexcept;
90 MediaType getType() const noexcept;
91@@ -62,6 +64,8 @@
92 std::string author;
93 std::string album;
94 std::string album_artist;
95+ std::string genre;
96+ int disc_number;
97 int track_number;
98 int duration; // In seconds.
99 MediaType type;
100
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 author(mf.getAuthor()),
106 album(mf.getAlbum()),
107 album_artist(mf.getAlbumArtist()),
108+ genre(mf.getGenre()),
109+ disc_number(mf.getDiscNumber()),
110 track_number(mf.getTrackNumber()),
111 duration(mf.getDuration()) {
112 }
113
114 MediaFile MediaFileBuilder::build() const {
115 return MediaFile(filename, content_type, etag, title, date, author,
116- album, album_artist, track_number, duration, type);
117+ album, album_artist, genre, disc_number, track_number, duration, type);
118 }
119
120 void MediaFileBuilder::setType(MediaType t) {
121@@ -103,6 +105,20 @@
122 album_artist_set = true;
123 }
124
125+void MediaFileBuilder::setGenre(const std::string &g) {
126+ if(genre_set)
127+ throw std::invalid_argument("Tried to set genre when it was already set.");
128+ genre = g;
129+ genre_set = true;
130+}
131+
132+void MediaFileBuilder::setDiscNumber(int n) {
133+ if(disc_number_set)
134+ throw std::invalid_argument("Tried to set disc number when it was already set.");
135+ disc_number = n;
136+ disc_number_set = true;
137+}
138+
139 void MediaFileBuilder::setTrackNumber(int n) {
140 if(track_number_set)
141 throw std::invalid_argument("Tried to set track number when it was already set.");
142
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 void setAuthor(const std::string &a);
148 void setAlbum(const std::string &a);
149 void setAlbumArtist(const std::string &a);
150+ void setGenre(const std::string &g);
151+ void setDiscNumber(int n);
152 void setTrackNumber(int n);
153 void setDuration(int d);
154
155@@ -87,11 +89,17 @@
156 bool album_artist_set = false;
157 std::string album_artist;
158
159+ bool genre_set = false;
160+ std::string genre;
161+
162+ bool disc_number_set = false;
163+ int disc_number = 0;
164+
165+ bool track_number_set = false;
166 int track_number = 0;
167- bool track_number_set = false;
168
169+ bool duration_set = false;
170 int duration = 0;
171- bool duration_set = false;
172 };
173
174 }
175
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
181 // Increment this whenever changing db schema.
182 // It will cause dbstore to rebuild its tables.
183-static const int schemaVersion = 4;
184+static const int schemaVersion = 5;
185
186 struct MediaStorePrivate {
187 sqlite3 *db;
188@@ -175,9 +175,11 @@
189 etag TEXT,
190 title TEXT,
191 date TEXT,
192- artist TEXT, -- Only relevant to audio
193- album TEXT, -- Only relevant to audio
194- album_artist TEXT, -- Only relevant to audio
195+ artist TEXT, -- Only relevant to audio
196+ album TEXT, -- Only relevant to audio
197+ album_artist TEXT, -- Only relevant to audio
198+ genre TEXT, -- Only relevant to audio
199+ disc_number INTEGER, -- Only relevant to audio
200 track_number INTEGER, -- Only relevant to audio
201 duration INTEGER,
202 type INTEGER -- 0=Audio, 1=Video
203@@ -191,9 +193,11 @@
204 etag TEXT,
205 title TEXT,
206 date TEXT,
207- artist TEXT, -- Only relevant to audio
208- album TEXT, -- Only relevant to audio
209- album_artist TEXT, -- Only relevant to audio
210+ artist TEXT, -- Only relevant to audio
211+ album TEXT, -- Only relevant to audio
212+ album_artist TEXT, -- Only relevant to audio
213+ genre TEXT, -- Only relevant to audio
214+ disc_number INTEGER, -- Only relevant to audio
215 track_number INTEGER, -- Only relevant to audio
216 duration INTEGER,
217 type INTEGER -- 0=Audio, 1=Video
218@@ -283,7 +287,7 @@
219 }
220
221 void MediaStorePrivate::insert(const MediaFile &m) const {
222- Statement query(db, "INSERT OR REPLACE INTO media (filename, content_type, etag, title, date, artist, album, album_artist, track_number, duration, type) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
223+ 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 string fname = m.getFileName();
225 string title = m.getTitle();
226 if(title.empty())
227@@ -299,9 +303,11 @@
228 if (album_artist.empty())
229 album_artist = m.getAuthor();
230 query.bind(8, album_artist);
231- query.bind(9, m.getTrackNumber());
232- query.bind(10, m.getDuration());
233- query.bind(11, (int)m.getType());
234+ query.bind(9, m.getGenre());
235+ query.bind(10, m.getDiscNumber());
236+ query.bind(11, m.getTrackNumber());
237+ query.bind(12, m.getDuration());
238+ query.bind(13, (int)m.getType());
239 query.step();
240
241 const char *typestr = m.getType() == AudioMedia ? "song" : "video";
242@@ -327,10 +333,12 @@
243 const string author = query.getText(5);
244 const string album = query.getText(6);
245 const string album_artist = query.getText(7);
246- int track_number = query.getInt(8);
247- int duration = query.getInt(9);
248- MediaType type = (MediaType)query.getInt(10);
249- return MediaFile(filename, content_type, etag, title, date, author, album, album_artist, track_number, duration, type);
250+ const string genre = query.getText(8);
251+ int disc_number = query.getInt(9);
252+ int track_number = query.getInt(10);
253+ int duration = query.getInt(11);
254+ MediaType type = (MediaType)query.getInt(12);
255+ return MediaFile(filename, content_type, etag, title, date, author, album, album_artist, genre, disc_number, track_number, duration, type);
256 }
257
258 static vector<MediaFile> collect_media(Statement &query) {
259@@ -343,7 +351,7 @@
260
261 MediaFile MediaStorePrivate::lookup(const std::string &filename) const {
262 Statement query(db, R"(
263-SELECT filename, content_type, etag, title, date, artist, album, album_artist, track_number, duration, type
264+SELECT filename, content_type, etag, title, date, artist, album, album_artist, genre, disc_number, track_number, duration, type
265 FROM media
266 WHERE filename = ?
267 )");
268@@ -357,7 +365,7 @@
269 vector<MediaFile> MediaStorePrivate::query(const std::string &core_term, MediaType type, int limit) const {
270 if (core_term == "") {
271 Statement query(db, R"(
272-SELECT filename, content_type, etag, title, date, artist, album, album_artist, track_number, duration, type
273+SELECT filename, content_type, etag, title, date, artist, album, album_artist, genre, disc_number, track_number, duration, type
274 FROM media
275 WHERE type == ?
276 LIMIT ?
277@@ -367,7 +375,7 @@
278 return collect_media(query);
279 } else {
280 Statement query(db, R"(
281-SELECT filename, content_type, etag, title, date, artist, album, album_artist, track_number, duration, type
282+SELECT filename, content_type, etag, title, date, artist, album, album_artist, genre, disc_number, track_number, duration, type
283 FROM media JOIN (
284 SELECT docid, rank(matchinfo(media_fts), 1.0, 0.5, 0.75) AS rank
285 FROM media_fts WHERE media_fts MATCH ?
286@@ -425,9 +433,9 @@
287
288 vector<MediaFile> MediaStorePrivate::getAlbumSongs(const Album& album) const {
289 Statement query(db, R"(
290-SELECT filename, content_type, etag, title, date, artist, album, album_artist, track_number, duration, type FROM media
291+SELECT filename, content_type, etag, title, date, artist, album, album_artist, genre, disc_number, track_number, duration, type FROM media
292 WHERE album = ? AND album_artist = ? AND type = ?
293-ORDER BY track_number
294+ORDER BY disc_number, track_number
295 )");
296 query.bind(1, album.getTitle());
297 query.bind(2, album.getArtist());
298@@ -449,7 +457,7 @@
299
300 std::vector<MediaFile> MediaStore::listSongs(const std::string& artist, const std::string& album, const std::string& album_artist, int limit) const {
301 std::string qs(R"(
302-SELECT filename, content_type, etag, title, date, artist, album, album_artist, track_number, duration, type
303+SELECT filename, content_type, etag, title, date, artist, album, album_artist, genre, disc_number, track_number, duration, type
304 FROM media
305 WHERE type = ?
306 )");
307@@ -463,7 +471,7 @@
308 qs += " AND album_artist = ?";
309 }
310 qs += R"(
311-ORDER BY album_artist, album, track_number, title
312+ORDER BY album_artist, album, disc_number, track_number, title
313 LIMIT ?
314 )";
315 Statement query(p->db, qs.c_str());
316
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 }
322 }
323
324+QVariant AlbumModelBase::get(int row, AlbumModelBase::Roles role) const {
325+ return data(index(row, 0), role);
326+}
327+
328 QHash<int, QByteArray> AlbumModelBase::roleNames() const {
329 return roles;
330 }
331
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 class AlbumModelBase : public QAbstractListModel {
337 Q_OBJECT
338 Q_ENUMS(Roles)
339+ Q_PROPERTY(int rowCount READ rowCount) // NOTIFY modelReset
340 public:
341 enum Roles {
342 RoleTitle,
343@@ -41,6 +42,8 @@
344 explicit AlbumModelBase(QObject *parent = 0);
345 int rowCount(const QModelIndex &parent=QModelIndex()) const override;
346 QVariant data(const QModelIndex &index, int role) const override;
347+
348+ Q_INVOKABLE QVariant get(int row, Roles role) const;
349 protected:
350 QHash<int, QByteArray> roleNames() const override;
351 void updateResults(const std::vector<mediascanner::Album> &results);
352
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 }
358 }
359
360+QVariant ArtistsModel::get(int row, ArtistsModel::Roles role) const {
361+ return data(index(row, 0), role);
362+}
363+
364 QHash<int, QByteArray> ArtistsModel::roleNames() const {
365 return roles;
366 }
367
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 Q_PROPERTY(mediascanner::qml::MediaStoreWrapper* store READ getStore WRITE setStore)
373 Q_PROPERTY(bool albumArtists READ getAlbumArtists WRITE setAlbumArtists)
374 Q_PROPERTY(int limit READ getLimit WRITE setLimit)
375+ Q_PROPERTY(int rowCount READ rowCount) // NOTIFY modelReset
376 public:
377 enum Roles {
378 RoleArtist,
379@@ -43,6 +44,8 @@
380 explicit ArtistsModel(QObject *parent = 0);
381 int rowCount(const QModelIndex &parent=QModelIndex()) const override;
382 QVariant data(const QModelIndex &index, int role) const override;
383+
384+ Q_INVOKABLE QVariant get(int row, Roles role) const;
385 protected:
386 QHash<int, QByteArray> roleNames() const override;
387
388
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 roles[Roles::RoleAlbum] = "album";
394 roles[Roles::RoleAlbumArtist] = "albumArtist";
395 roles[Roles::RoleDate] = "date";
396+ roles[Roles::RoleGenre] = "genre";
397+ roles[Roles::RoleDiscNumber] = "discNumber";
398 roles[Roles::RoleTrackNumber] = "trackNumber";
399 roles[Roles::RoleDuration] = "duration";
400 roles[Roles::RoleArt] = "art";
401@@ -70,6 +72,10 @@
402 return QString::fromStdString(media.getAlbumArtist());
403 case RoleDate:
404 return QString::fromStdString(media.getDate());
405+ case RoleGenre:
406+ return QString::fromStdString(media.getGenre());
407+ case RoleDiscNumber:
408+ return media.getDiscNumber();
409 case RoleTrackNumber:
410 return media.getTrackNumber();
411 case RoleDuration:
412@@ -81,6 +87,10 @@
413 }
414 }
415
416+QVariant MediaFileModelBase::get(int row, MediaFileModelBase::Roles role) const {
417+ return data(index(row, 0), role);
418+}
419+
420 QHash<int, QByteArray> MediaFileModelBase::roleNames() const {
421 return roles;
422 }
423
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 class MediaFileModelBase : public QAbstractListModel {
429 Q_OBJECT
430 Q_ENUMS(Roles)
431+ Q_PROPERTY(int rowCount READ rowCount) // NOTIFY modelReset
432 public:
433 enum Roles {
434 RoleModelData,
435@@ -43,6 +44,8 @@
436 RoleAlbum,
437 RoleAlbumArtist,
438 RoleDate,
439+ RoleGenre,
440+ RoleDiscNumber,
441 RoleTrackNumber,
442 RoleDuration,
443 RoleArt,
444@@ -51,6 +54,8 @@
445 explicit MediaFileModelBase(QObject *parent = 0);
446 int rowCount(const QModelIndex &parent=QModelIndex()) const override;
447 QVariant data(const QModelIndex &index, int role) const override;
448+
449+ Q_INVOKABLE QVariant get(int row, Roles role) const;
450 protected:
451 QHash<int, QByteArray> roleNames() const override;
452 void updateResults(const std::vector<mediascanner::MediaFile> &results);
453
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 return QString::fromStdString(media.getDate());
459 }
460
461+QString MediaFileWrapper::genre() const {
462+ return QString::fromStdString(media.getGenre());
463+}
464+
465+int MediaFileWrapper::discNumber() const {
466+ return media.getDiscNumber();
467+}
468+
469 int MediaFileWrapper::trackNumber() const {
470 return media.getTrackNumber();
471 }
472
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 Q_PROPERTY(QString album READ album CONSTANT)
478 Q_PROPERTY(QString albumArtist READ albumArtist CONSTANT)
479 Q_PROPERTY(QString date READ date CONSTANT)
480+ Q_PROPERTY(QString genre READ genre CONSTANT)
481+ Q_PROPERTY(int discNumber READ discNumber CONSTANT)
482 Q_PROPERTY(int trackNumber READ trackNumber CONSTANT)
483 Q_PROPERTY(int duration READ duration CONSTANT)
484 Q_PROPERTY(QString art READ art CONSTANT)
485@@ -53,6 +55,8 @@
486 QString album() const;
487 QString albumArtist() const;
488 QString date() const;
489+ QString genre() const;
490+ int discNumber() const;
491 int trackNumber() const;
492 int duration() const;
493 QString art() const;
494
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 "RoleArt": 2
500 }
501 }
502+ Property { name: "rowCount"; type: "int"; isReadonly: true }
503+ Method {
504+ name: "get"
505+ type: "QVariant"
506+ Parameter { name: "row"; type: "int" }
507+ Parameter { name: "role"; type: "Roles" }
508+ }
509 }
510 Component {
511 name: "mediascanner::qml::AlbumsModel"
512@@ -43,6 +50,13 @@
513 Property { name: "store"; type: "mediascanner::qml::MediaStoreWrapper"; isPointer: true }
514 Property { name: "albumArtists"; type: "bool" }
515 Property { name: "limit"; type: "int" }
516+ Property { name: "rowCount"; type: "int"; isReadonly: true }
517+ Method {
518+ name: "get"
519+ type: "QVariant"
520+ Parameter { name: "row"; type: "int" }
521+ Parameter { name: "role"; type: "Roles" }
522+ }
523 }
524 Component {
525 name: "mediascanner::qml::MediaFileModelBase"
526@@ -60,11 +74,20 @@
527 "RoleAlbum": 7,
528 "RoleAlbumArtist": 8,
529 "RoleDate": 9,
530- "RoleTrackNumber": 10,
531- "RoleDuration": 11,
532- "RoleArt": 12
533+ "RoleGenre": 10,
534+ "RoleDiscNumber": 11,
535+ "RoleTrackNumber": 12,
536+ "RoleDuration": 13,
537+ "RoleArt": 14
538 }
539 }
540+ Property { name: "rowCount"; type: "int"; isReadonly: true }
541+ Method {
542+ name: "get"
543+ type: "QVariant"
544+ Parameter { name: "row"; type: "int" }
545+ Parameter { name: "role"; type: "Roles" }
546+ }
547 }
548 Component {
549 name: "mediascanner::qml::MediaFileWrapper"
550@@ -80,6 +103,8 @@
551 Property { name: "album"; type: "string"; isReadonly: true }
552 Property { name: "albumArtist"; type: "string"; isReadonly: true }
553 Property { name: "date"; type: "string"; isReadonly: true }
554+ Property { name: "genre"; type: "string"; isReadonly: true }
555+ Property { name: "discNumber"; type: "int"; isReadonly: true }
556 Property { name: "trackNumber"; type: "int"; isReadonly: true }
557 Property { name: "duration"; type: "int"; isReadonly: true }
558 Property { name: "art"; type: "string"; isReadonly: true }
559
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 track += " " + RNDWORD;
565 }
566 string fname = to_string(i) + ".mp3";
567- MediaFile mf(fname, "audio/mp3", "", track, "2013-01-01", artist, album, artist, trackCount, rnd() % 300, AudioMedia);
568+ MediaFile mf(fname, "audio/mp3", "", track, "2013-01-01", artist, album, artist, "", 0, trackCount, rnd() % 300, AudioMedia);
569 store.insert(mf);
570 i++;
571 //printf("%s, %s, %s\n", artist.c_str(), album.c_str(), track.c_str());
572
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 checkAttr("album", "Spiderbait");
578 checkAttr("albumArtist", "Spiderbait");
579 checkAttr("date", "2013-11-15");
580+ checkAttr("genre", "rock");
581+ checkAttr("discNumber", 1);
582 checkAttr("trackNumber", 1);
583 checkAttr("duration", 235);
584 checkAttr("art", "image://albumart/artist=Spiderbait&album=Spiderbait");
585
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 query: ""
591 }
592
593- ListView {
594- id: songs_view
595- model: songs_model
596- }
597-
598 TestCase {
599 name: "SongsSearchModelTests"
600- function test_foo() {
601+ function test_search() {
602+ // By default, the model lists all songs.
603+ compare(songs_model.rowCount, 7, "songs_model.rowCount == 7");
604+ songs_model.query = "revolution";
605+ compare(songs_model.rowCount, 1, "songs_model.rowCount == 1");
606+ compare(songs_model.get(0, SongsSearchModel.RoleTitle), "Revolution");
607 }
608 }
609 }
610
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 }
616
617 TEST_F(MediaStoreTest, equality) {
618- MediaFile audio1("a", "type", "etag", "1900", "b", "c", "d", "e", 1, 5, AudioMedia);
619- MediaFile audio2("aa", "type", "etag", "1900", "b", "c", "d", "e", 1, 5, AudioMedia);
620+ MediaFile audio1("a", "type", "etag", "1900", "b", "c", "d", "e", "f", 0, 1, 5, AudioMedia);
621+ MediaFile audio2("aa", "type", "etag", "1900", "b", "c", "d", "e", "f", 0, 1, 5, AudioMedia);
622
623- MediaFile video1("a", "type", "etag", "b", "1900", "c", "d", "e", 0, 5, VideoMedia);
624- MediaFile video2("aa", "type", "etag", "b", "1900", "c", "d", "e", 0, 5, VideoMedia);
625+ MediaFile video1("a", "type", "etag", "b", "1900", "c", "d", "e", "f", 0, 0, 5, VideoMedia);
626+ MediaFile video2("aa", "type", "etag", "b", "1900", "c", "d", "e", "f", 0, 0, 5, VideoMedia);
627
628 EXPECT_EQ(audio1, audio1);
629 EXPECT_EQ(video1, video1);
630@@ -70,7 +70,7 @@
631 }
632
633 TEST_F(MediaStoreTest, lookup) {
634- MediaFile audio("aaa", "type", "etag", "bbb bbb", "1900-01-01", "ccc", "ddd", "eee", 3, 5, AudioMedia);
635+ MediaFile audio("aaa", "type", "etag", "bbb bbb", "1900-01-01", "ccc", "ddd", "eee", "fff", 0, 3, 5, AudioMedia);
636 MediaStore store(":memory:", MS_READ_WRITE);
637 store.insert(audio);
638
639@@ -79,8 +79,8 @@
640 }
641
642 TEST_F(MediaStoreTest, roundtrip) {
643- MediaFile audio("aaa", "type", "etag", "bbb bbb", "1900-01-01", "ccc", "ddd", "eee", 3, 5, AudioMedia);
644- MediaFile video("aaa2", "type", "etag", "bbb bbb", "2012-01-01", "ccc", "ddd", "eee", 0, 5, VideoMedia);
645+ MediaFile audio("aaa", "type", "etag", "bbb bbb", "1900-01-01", "ccc", "ddd", "eee", "fff", 0, 3, 5, AudioMedia);
646+ MediaFile video("aaa2", "type", "etag", "bbb bbb", "2012-01-01", "ccc", "ddd", "eee", "fff", 0, 0, 5, VideoMedia);
647 MediaStore store(":memory:", MS_READ_WRITE);
648 store.insert(audio);
649 store.insert(video);
650@@ -93,7 +93,7 @@
651 }
652
653 TEST_F(MediaStoreTest, query_by_album) {
654- MediaFile audio("/path/foo.ogg", "", "", "title", "1900-01-01", "artist", "album", "albumartist", 3, 5, AudioMedia);
655+ MediaFile audio("/path/foo.ogg", "", "", "title", "1900-01-01", "artist", "album", "albumartist", "genre", 0, 3, 5, AudioMedia);
656 MediaStore store(":memory:", MS_READ_WRITE);
657 store.insert(audio);
658
659@@ -103,7 +103,7 @@
660 }
661
662 TEST_F(MediaStoreTest, query_by_artist) {
663- MediaFile audio("/path/foo.ogg", "", "", "title", "1900-01-01", "artist", "album", "albumartist", 3, 5, AudioMedia);
664+ MediaFile audio("/path/foo.ogg", "", "", "title", "1900-01-01", "artist", "album", "albumartist", "genre", 1, 3, 5, AudioMedia);
665 MediaStore store(":memory:", MS_READ_WRITE);
666 store.insert(audio);
667
668@@ -113,18 +113,18 @@
669 }
670
671 TEST_F(MediaStoreTest, query_ranking) {
672- MediaFile audio1("/path/foo1.ogg", "", "", "title", "1900-01-01", "artist", "album", "albumartist", 3, 5, AudioMedia);
673- MediaFile audio2("/path/foo2.ogg", "", "", "title aaa", "1900-01-01", "artist", "album", "albumartist", 3, 5, AudioMedia);
674- MediaFile audio3("/path/foo3.ogg", "", "", "title", "1900-01-01", "artist aaa", "album", "albumartist", 3, 5, AudioMedia);
675- MediaFile audio4("/path/foo4.ogg", "", "", "title", "1900-01-01", "artist", "album aaa", "albumartist", 3, 5, AudioMedia);
676- MediaFile audio5("/path/foo5.ogg", "", "", "title aaa", "1900-01-01", "artist aaa", "album aaa", "albumartist", 3, 5, AudioMedia);
677+ MediaFile audio1("/path/foo1.ogg", "", "", "title", "1900-01-01", "artist", "album", "albumartist", "genre", 1, 3, 5, AudioMedia);
678+ MediaFile audio2("/path/foo2.ogg", "", "", "title aaa", "1900-01-01", "artist", "album", "albumartist", "genre", 1, 3, 5, AudioMedia);
679+ MediaFile audio3("/path/foo3.ogg", "", "", "title", "1900-01-01", "artist aaa", "album", "albumartist", "genre", 1, 3, 5, AudioMedia);
680+ MediaFile audio4("/path/foo4.ogg", "", "", "title", "1900-01-01", "artist", "album aaa", "albumartist", "genre", 1, 3, 5, AudioMedia);
681+ MediaFile audio5("/path/foo5.ogg", "", "", "title aaa", "1900-01-01", "artist aaa", "album aaa", "albumartist", "genre", 1, 3, 5, AudioMedia);
682
683- MediaStore store(":memory:", MS_READ_WRITE);
684- store.insert(audio1);
685- store.insert(audio2);
686- store.insert(audio3);
687- store.insert(audio4);
688- store.insert(audio5);
689+ MediaStore store(":memory:", MS_READ_WRITE);
690+ store.insert(audio1);
691+ store.insert(audio2);
692+ store.insert(audio3);
693+ store.insert(audio4);
694+ store.insert(audio5);
695
696 vector<MediaFile> result = store.query("aaa", AudioMedia);
697 ASSERT_EQ(result.size(), 4);
698@@ -135,9 +135,9 @@
699 }
700
701 TEST_F(MediaStoreTest, query_limit) {
702- MediaFile audio1("/path/foo5.ogg", "", "", "title aaa", "1900-01-01", "artist aaa", "album aaa", "albumartist", 3, 5, AudioMedia);
703- MediaFile audio2("/path/foo2.ogg", "", "", "title aaa", "1900-01-01", "artist", "album", "albumartist", 3, 5, AudioMedia);
704- MediaFile audio3("/path/foo4.ogg", "", "", "title", "1900-01-01", "artist", "album aaa", "albumartist", 3, 5, AudioMedia);
705+ MediaFile audio1("/path/foo5.ogg", "", "", "title aaa", "1900-01-01", "artist aaa", "album aaa", "albumartist", "genre", 1, 3, 5, AudioMedia);
706+ MediaFile audio2("/path/foo2.ogg", "", "", "title aaa", "1900-01-01", "artist", "album", "albumartist", "genre", 1, 3, 5, AudioMedia);
707+ MediaFile audio3("/path/foo4.ogg", "", "", "title", "1900-01-01", "artist", "album aaa", "albumartist", "genre", 1, 3, 5, AudioMedia);
708
709 MediaStore store(":memory:", MS_READ_WRITE);
710 store.insert(audio1);
711@@ -151,8 +151,8 @@
712 }
713
714 TEST_F(MediaStoreTest, query_short) {
715- MediaFile audio1("/path/foo5.ogg", "", "", "title xyz", "1900-01-01", "artist", "album", "albumartist", 3, 5, AudioMedia);
716- MediaFile audio2("/path/foo2.ogg", "", "", "title xzy", "1900-01-01", "artist", "album", "albumartist", 3, 5, AudioMedia);
717+ MediaFile audio1("/path/foo5.ogg", "", "", "title xyz", "1900-01-01", "artist", "album", "albumartist", "genre", 1, 3, 5, AudioMedia);
718+ MediaFile audio2("/path/foo2.ogg", "", "", "title xzy", "1900-01-01", "artist", "album", "albumartist", "genre", 1, 3, 5, AudioMedia);
719
720 MediaStore store(":memory:", MS_READ_WRITE);
721 store.insert(audio1);
722@@ -165,9 +165,9 @@
723 }
724
725 TEST_F(MediaStoreTest, query_empty) {
726- MediaFile audio1("/path/foo5.ogg", "", "", "title aaa", "1900-01-01", "artist aaa", "album aaa", "albumartist", 3, 5, AudioMedia);
727- MediaFile audio2("/path/foo2.ogg", "", "", "title aaa", "1900-01-01", "artist", "album", "albumartist", 3, 5, AudioMedia);
728- MediaFile audio3("/path/foo4.ogg", "", "", "title", "1900-01-01", "artist", "album aaa", "albumartist", 3, 5, AudioMedia);
729+ MediaFile audio1("/path/foo5.ogg", "", "", "title aaa", "1900-01-01", "artist aaa", "album aaa", "albumartist", "genre", 1, 3, 5, AudioMedia);
730+ MediaFile audio2("/path/foo2.ogg", "", "", "title aaa", "1900-01-01", "artist", "album", "albumartist", "genre", 1, 3, 5, AudioMedia);
731+ MediaFile audio3("/path/foo4.ogg", "", "", "title", "1900-01-01", "artist", "album aaa", "albumartist", "genre", 1, 3, 5, AudioMedia);
732
733 MediaStore store(":memory:", MS_READ_WRITE);
734 store.insert(audio1);
735@@ -180,8 +180,8 @@
736 }
737
738 TEST_F(MediaStoreTest, unmount) {
739- MediaFile audio1("/media/username/dir/fname.ogg", "", "", "bbb bbb", "2000-01-01", "ccc", "ddd", "eee", 1, 5, AudioMedia);
740- MediaFile audio2("/home/username/Music/fname.ogg", "", "", "bbb bbb", "1900-01-01", "ccc", "ddd", "eee", 42, 5, AudioMedia);
741+ MediaFile audio1("/media/username/dir/fname.ogg", "", "", "bbb bbb", "2000-01-01", "ccc", "ddd", "eee", "ffff", 0, 1, 5, AudioMedia);
742+ MediaFile audio2("/home/username/Music/fname.ogg", "", "", "bbb bbb", "1900-01-01", "ccc", "ddd", "eee", "ffff", 0, 42, 5, AudioMedia);
743 MediaStore store(":memory:", MS_READ_WRITE);
744 store.insert(audio1);
745 store.insert(audio2);
746@@ -210,10 +210,10 @@
747 }
748
749 TEST_F(MediaStoreTest, queryAlbums) {
750- MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "Various Artists", 1, 5, AudioMedia);
751- MediaFile audio2("/home/username/Music/track2.ogg", "", "", "TitleTwo", "1900-01-01", "ArtistTwo", "AlbumOne", "Various Artists", 2, 5, AudioMedia);
752- MediaFile audio3("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistThree", "AlbumOne", "Various Artists", 3, 5, AudioMedia);
753- MediaFile audio4("/home/username/Music/fname.ogg", "", "", "TitleFour", "1900-01-01", "ArtistFour", "AlbumTwo", "ArtistFour", 1, 5, AudioMedia);
754+ MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "Various Artists", "genre", 1, 1, 5, AudioMedia);
755+ MediaFile audio2("/home/username/Music/track2.ogg", "", "", "TitleTwo", "1900-01-01", "ArtistTwo", "AlbumOne", "Various Artists", "genre", 1, 2, 5, AudioMedia);
756+ MediaFile audio3("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistThree", "AlbumOne", "Various Artists", "genre", 1, 3, 5, AudioMedia);
757+ MediaFile audio4("/home/username/Music/fname.ogg", "", "", "TitleFour", "1900-01-01", "ArtistFour", "AlbumTwo", "ArtistFour", "genre", 1, 1, 5, AudioMedia);
758
759 MediaStore store(":memory:", MS_READ_WRITE);
760 store.insert(audio1);
761@@ -241,10 +241,10 @@
762 }
763
764 TEST_F(MediaStoreTest, queryAlbums_limit) {
765- MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "Various Artists", 1, 5, AudioMedia);
766- MediaFile audio2("/home/username/Music/track2.ogg", "", "", "TitleTwo", "1900-01-01", "ArtistTwo", "AlbumOne", "Various Artists", 2, 5, AudioMedia);
767- MediaFile audio3("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistThree", "AlbumOne", "Various Artists", 3, 5, AudioMedia);
768- MediaFile audio4("/home/username/Music/fname.ogg", "", "", "TitleFour", "1900-01-01", "ArtistFour", "AlbumTwo", "ArtistFour", 1, 5, AudioMedia);
769+ MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "Various Artists", "genre", 1, 1, 5, AudioMedia);
770+ MediaFile audio2("/home/username/Music/track2.ogg", "", "", "TitleTwo", "1900-01-01", "ArtistTwo", "AlbumOne", "Various Artists", "genre", 1, 2, 5, AudioMedia);
771+ MediaFile audio3("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistThree", "AlbumOne", "Various Artists", "genre", 1, 3, 5, AudioMedia);
772+ MediaFile audio4("/home/username/Music/fname.ogg", "", "", "TitleFour", "1900-01-01", "ArtistFour", "AlbumTwo", "ArtistFour", "genre", 1, 1, 5, AudioMedia);
773
774 MediaStore store(":memory:", MS_READ_WRITE);
775 store.insert(audio1);
776@@ -259,10 +259,10 @@
777 }
778
779 TEST_F(MediaStoreTest, queryAlbums_empty) {
780- MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "Various Artists", 1, 5, AudioMedia);
781- MediaFile audio2("/home/username/Music/track2.ogg", "", "", "TitleTwo", "1900-01-01", "ArtistTwo", "AlbumOne", "Various Artists", 2, 5, AudioMedia);
782- MediaFile audio3("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistThree", "AlbumOne", "Various Artists", 3, 5, AudioMedia);
783- MediaFile audio4("/home/username/Music/fname.ogg", "", "", "TitleFour", "1900-01-01", "ArtistFour", "AlbumTwo", "ArtistFour", 1, 5, AudioMedia);
784+ MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "Various Artists", "genre", 1, 1, 5, AudioMedia);
785+ MediaFile audio2("/home/username/Music/track2.ogg", "", "", "TitleTwo", "1900-01-01", "ArtistTwo", "AlbumOne", "Various Artists", "genre", 1, 2, 5, AudioMedia);
786+ MediaFile audio3("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistThree", "AlbumOne", "Various Artists", "genre", 1, 3, 5, AudioMedia);
787+ MediaFile audio4("/home/username/Music/fname.ogg", "", "", "TitleFour", "1900-01-01", "ArtistFour", "AlbumTwo", "ArtistFour", "genre", 1, 1, 5, AudioMedia);
788
789 MediaStore store(":memory:", MS_READ_WRITE);
790 store.insert(audio1);
791@@ -277,9 +277,9 @@
792 }
793
794 TEST_F(MediaStoreTest, getAlbumSongs) {
795- MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "Various Artists", 1, 5, AudioMedia);
796- MediaFile audio2("/home/username/Music/track2.ogg", "", "", "TitleTwo", "1900-01-01", "ArtistTwo", "AlbumOne", "Various Artists", 2, 5, AudioMedia);
797- MediaFile audio3("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistThree", "AlbumOne", "Various Artists", 3, 5, AudioMedia);
798+ MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "Various Artists", "genre", 1, 1, 5, AudioMedia);
799+ MediaFile audio2("/home/username/Music/track2.ogg", "", "", "TitleTwo", "1900-01-01", "ArtistTwo", "AlbumOne", "Various Artists", "genre", 1, 2, 5, AudioMedia);
800+ MediaFile audio3("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistThree", "AlbumOne", "Various Artists", "genre", 1, 3, 5, AudioMedia);
801
802 MediaStore store(":memory:", MS_READ_WRITE);
803 store.insert(audio1);
804@@ -295,7 +295,7 @@
805 }
806
807 TEST_F(MediaStoreTest, getETag) {
808- MediaFile file("/path/file.ogg", "audio/ogg", "etag", "title", "2013", "artist", "album", "artist", 1, 5, AudioMedia);
809+ MediaFile file("/path/file.ogg", "audio/ogg", "etag", "title", "2013", "artist", "album", "artist", "genre", 1, 1, 5, AudioMedia);
810
811 MediaStore store(":memory:", MS_READ_WRITE);
812 store.insert(file);
813@@ -305,12 +305,12 @@
814 }
815
816 TEST_F(MediaStoreTest, listSongs) {
817- MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "ArtistOne", 1, 5, AudioMedia);
818- MediaFile audio2("/home/username/Music/track2.ogg", "", "", "TitleTwo", "1900-01-01", "ArtistOne", "AlbumOne", "ArtistOne", 2, 5, AudioMedia);
819- MediaFile audio3("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistOne", "AlbumTwo", "ArtistOne", 3, 5, AudioMedia);
820- MediaFile audio4("/home/username/Music/track4.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumThree", "ArtistTwo", 1, 5, AudioMedia);
821- MediaFile audio5("/home/username/Music/track5.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumFour", "Various Artists", 1, 5, AudioMedia);
822- MediaFile audio6("/home/username/Music/track6.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumFour", "Various Artists", 2, 5, AudioMedia);
823+ MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "ArtistOne", "genre", 1, 1, 5, AudioMedia);
824+ MediaFile audio2("/home/username/Music/track2.ogg", "", "", "TitleTwo", "1900-01-01", "ArtistOne", "AlbumOne", "ArtistOne", "genre", 1, 2, 5, AudioMedia);
825+ MediaFile audio3("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistOne", "AlbumTwo", "ArtistOne", "genre", 1, 3, 5, AudioMedia);
826+ MediaFile audio4("/home/username/Music/track4.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumThree", "ArtistTwo", "genre", 1, 1, 5, AudioMedia);
827+ MediaFile audio5("/home/username/Music/track5.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumFour", "Various Artists", "genre", 1, 1, 5, AudioMedia);
828+ MediaFile audio6("/home/username/Music/track6.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumFour", "Various Artists", "genre", 1, 2, 5, AudioMedia);
829
830 MediaStore store(":memory:", MS_READ_WRITE);
831 store.insert(audio1);
832@@ -352,11 +352,11 @@
833 }
834
835 TEST_F(MediaStoreTest, listAlbums) {
836- MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "ArtistOne", 1, 5, AudioMedia);
837- MediaFile audio2("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistOne", "AlbumTwo", "ArtistOne", 3, 5, AudioMedia);
838- MediaFile audio3("/home/username/Music/track4.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumThree", "ArtistTwo", 1, 5, AudioMedia);
839- MediaFile audio4("/home/username/Music/track5.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumFour", "Various Artists", 1, 5, AudioMedia);
840- MediaFile audio5("/home/username/Music/track6.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumFour", "Various Artists", 2, 5, AudioMedia);
841+ MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "ArtistOne", "genre", 1, 1, 5, AudioMedia);
842+ MediaFile audio2("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistOne", "AlbumTwo", "ArtistOne", "genre", 1, 3, 5, AudioMedia);
843+ MediaFile audio3("/home/username/Music/track4.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumThree", "ArtistTwo", "genre", 1, 1, 5, AudioMedia);
844+ MediaFile audio4("/home/username/Music/track5.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumFour", "Various Artists", "genre", 1, 1, 5, AudioMedia);
845+ MediaFile audio5("/home/username/Music/track6.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumFour", "Various Artists", "genre", 1, 2, 5, AudioMedia);
846
847 MediaStore store(":memory:", MS_READ_WRITE);
848 store.insert(audio1);
849@@ -387,11 +387,11 @@
850 }
851
852 TEST_F(MediaStoreTest, listArtists) {
853- MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "ArtistOne", 1, 5, AudioMedia);
854- MediaFile audio2("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistOne", "AlbumTwo", "ArtistOne", 3, 5, AudioMedia);
855- MediaFile audio3("/home/username/Music/track4.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumThree", "ArtistTwo", 1, 5, AudioMedia);
856- MediaFile audio4("/home/username/Music/track5.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumFour", "Various Artists", 1, 5, AudioMedia);
857- MediaFile audio5("/home/username/Music/track6.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumFour", "Various Artists", 2, 5, AudioMedia);
858+ MediaFile audio1("/home/username/Music/track1.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumOne", "ArtistOne", "genre", 1, 1, 5, AudioMedia);
859+ MediaFile audio2("/home/username/Music/track3.ogg", "", "", "TitleThree", "1900-01-01", "ArtistOne", "AlbumTwo", "ArtistOne", "genre", 1, 3, 5, AudioMedia);
860+ MediaFile audio3("/home/username/Music/track4.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumThree", "ArtistTwo", "genre", 1, 1, 5, AudioMedia);
861+ MediaFile audio4("/home/username/Music/track5.ogg", "", "", "TitleOne", "1900-01-01", "ArtistOne", "AlbumFour", "Various Artists", "genre", 1, 1, 5, AudioMedia);
862+ MediaFile audio5("/home/username/Music/track6.ogg", "", "", "TitleFour", "1900-01-01", "ArtistTwo", "AlbumFour", "Various Artists", "genre", 1, 2, 5, AudioMedia);
863
864 MediaStore store(":memory:", MS_READ_WRITE);
865 store.insert(audio1);
866
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
872 store.insert(MediaFile("/path/foo1.ogg", "audio/ogg", "etag",
873 "Straight Through The Sun", "2013-11-15", "Spiderbait",
874- "Spiderbait", "Spiderbait", 1, 235, AudioMedia));
875+ "Spiderbait", "Spiderbait", "rock", 1, 1, 235, AudioMedia));
876 store.insert(MediaFile("/path/foo2.ogg", "audio/ogg", "etag",
877 "It's Beautiful", "2013-11-15", "Spiderbait",
878- "Spiderbait", "Spiderbait", 2, 220, AudioMedia));
879+ "Spiderbait", "Spiderbait", "rock", 1, 2, 220, AudioMedia));
880
881 store.insert(MediaFile("/path/foo3.ogg", "audio/ogg", "etag",
882 "Buy Me a Pony", "1996-10-04", "Spiderbait",
883- "Ivy and the Big Apples", "Spiderbait", 3, 104, AudioMedia));
884+ "Ivy and the Big Apples", "Spiderbait", "rock", 1, 3, 104, AudioMedia));
885
886 store.insert(MediaFile("/path/foo4.ogg", "audio/ogg", "etag",
887 "Peaches & Cream", "2004-03-08", "The John Butler Trio",
888- "Sunrise Over Sea", "The John Butler Trio", 2, 407, AudioMedia));
889+ "Sunrise Over Sea", "The John Butler Trio", "roots", 1, 2, 407, AudioMedia));
890 store.insert(MediaFile("/path/foo5.ogg", "audio/ogg", "etag",
891 "Zebra", "2004-03-08", "The John Butler Trio",
892- "Sunrise Over Sea", "The John Butler Trio", 10, 237, AudioMedia));
893+ "Sunrise Over Sea", "The John Butler Trio", "roots", 1, 10, 237, AudioMedia));
894
895 store.insert(MediaFile("/path/foo6.ogg", "audio/ogg", "etag",
896 "Revolution", "2010-01-01", "The John Butler Trio",
897- "April Uprising", "The John Butler Trio", 1, 305, AudioMedia));
898+ "April Uprising", "The John Butler Trio", "roots", 1, 1, 305, AudioMedia));
899 store.insert(MediaFile("/path/foo7.ogg", "audio/ogg", "etag",
900 "One Way Road", "2010-01-01", "The John Butler Trio",
901- "April Uprising", "The John Butler Trio", 2, 185, AudioMedia));
902+ "April Uprising", "The John Butler Trio", "roots", 1, 2, 185, AudioMedia));
903 }
904
905 private:

Subscribers

People subscribed via source and target branches