Merge lp:~vthompson/music-app/lookup-file into lp:music-app/trusty

Proposed by Victor Thompson
Status: Merged
Approved by: Victor Thompson
Approved revision: 551
Merged at revision: 557
Proposed branch: lp:~vthompson/music-app/lookup-file
Merge into: lp:music-app/trusty
Diff against target: 73 lines (+18/-17)
1 file modified
music-app.qml (+18/-17)
To merge this branch: bzr merge lp:~vthompson/music-app/lookup-file
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Andrew Hayzen Approve
Review via email: mp+229612@code.launchpad.net

Commit message

* Use mediascanner SongsModel.lookup() function to play song from Music Scope
* Catch the filled signal for the SongsModel used for playing an album from the Music Scope

Description of the change

* Use mediascanner SongsModel.lookup() function to play song from Music Scope
* Catch the filled signal for the SongsModel used for playing an album from the Music Scope

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Andrew Hayzen (ahayzen) wrote :

Looks good so far, see inline diff comments. Also I wonder if selectedAlbum should be set back to false at the end of onFilled?

review: Needs Fixing
Revision history for this message
Victor Thompson (vthompson) wrote :

I'll reset selectedAlbum back to false... I don't think we'd catch the filled signal again. BUT if it's called when a new song is added by ms2 we wouldn't want the album to reload.

I think we should still have the track var be set to false by default. The code that handles lookup [1] throws an exception when found which should exit the function... leaving the track variable false as we are assuming.

[1] http://bazaar.launchpad.net/~mediascanner-team/mediascanner2/trunk/view/head:/src/mediascanner/MediaStore.cc#L394

lp:~vthompson/music-app/lookup-file updated
550. By Victor Thompson

Reset selectedAlbum... just in case.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andrew Hayzen (ahayzen) wrote :

What would happen if album A was selected in the scope, the user changed the queue, and then album A was selected again. I think nothing would happen as the model would not Fill again?

Suggest blanking the filter at the end of onFilled and then inside onFilled wrap all the code in a check to ensure the filter is not blank.

review: Needs Fixing
lp:~vthompson/music-app/lookup-file updated
551. By Victor Thompson

Clear filter

Revision history for this message
Andrew Hayzen (ahayzen) wrote :

Looks good :)

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'music-app.qml'
--- music-app.qml 2014-08-06 23:41:30 +0000
+++ music-app.qml 2014-08-07 00:46:20 +0000
@@ -205,6 +205,7 @@
205 target: UriHandler205 target: UriHandler
206206
207 function processAlbum(uri) {207 function processAlbum(uri) {
208 selectedAlbum = true;
208 var split = uri.split("/");209 var split = uri.split("/");
209210
210 if (split.length < 2) {211 if (split.length < 2) {
@@ -215,16 +216,6 @@
215 // Filter by artist and album216 // Filter by artist and album
216 songsAlbumArtistModel.artist = decodeURIComponent(split[0]);217 songsAlbumArtistModel.artist = decodeURIComponent(split[0]);
217 songsAlbumArtistModel.album = decodeURIComponent(split[1]);218 songsAlbumArtistModel.album = decodeURIComponent(split[1]);
218
219 // Play album it tracks exist
220 if (songsAlbumArtistModel.rowCount > 0) {
221 // trackClicked(model, index, play, clear=true) will clear the model
222 trackClicked(songsAlbumArtistModel, 0, true, true);
223 }
224 else {
225 console.debug("Unknown artist-album " + uri + ", skipping")
226 return;
227 }
228 }219 }
229220
230 function processFile(uri, play) {221 function processFile(uri, play) {
@@ -232,13 +223,8 @@
232223
233 var track = false;224 var track = false;
234225
235 // Search for track in songs model226 // Lookup track in songs model
236 for (var i=0; i < allSongsModel.rowCount; i++) {227 track = musicStore.lookup(decodeURIComponent(uri));
237 if (decodeURIComponent(allSongsModel.get(i, allSongsModel.RoleModelData).filename) === uri) {
238 track = allSongsModel.get(i, allSongsModel.RoleModelData);
239 break;
240 }
241 }
242228
243 if (!track) {229 if (!track) {
244 console.debug("Unknown file " + uri + ", skipping")230 console.debug("Unknown file " + uri + ", skipping")
@@ -383,6 +369,7 @@
383 property string timestamp // used to scrobble369 property string timestamp // used to scrobble
384 property var chosenElement: null370 property var chosenElement: null
385 property bool toolbarShown: musicToolbar.shown371 property bool toolbarShown: musicToolbar.shown
372 property bool selectedAlbum: false
386 signal collapseExpand();373 signal collapseExpand();
387 signal collapseSwipeDelete(int index);374 signal collapseSwipeDelete(int index);
388 signal onToolbarShownChanged(bool shown, var currentPage, var currentTab)375 signal onToolbarShownChanged(bool shown, var currentPage, var currentTab)
@@ -518,6 +505,20 @@
518 SongsModel {505 SongsModel {
519 id: songsAlbumArtistModel506 id: songsAlbumArtistModel
520 store: musicStore507 store: musicStore
508 onFilled: {
509 // Play album it tracks exist
510 if (rowCount > 0 && selectedAlbum) {
511 trackClicked(songsAlbumArtistModel, 0, true, true);
512 } else if (selectedAlbum) {
513 console.debug("Unknown artist-album " + artist + "/" + album + ", skipping")
514 }
515
516 selectedAlbum = false;
517
518 // Clear filter for artist and album
519 songsAlbumArtistModel.artist = ""
520 songsAlbumArtistModel.album = ""
521 }
521 }522 }
522523
523 // WHERE THE MAGIC HAPPENS524 // WHERE THE MAGIC HAPPENS

Subscribers

People subscribed via source and target branches

to status/vote changes: