diff --git a/mopidy_musicbox_webclient/static/index.html b/mopidy_musicbox_webclient/static/index.html
index 9afe5c99..8dcf3065 100644
--- a/mopidy_musicbox_webclient/static/index.html
+++ b/mopidy_musicbox_webclient/static/index.html
@@ -161,7 +161,7 @@
Artists
Play
- Insert a Track Here
+ Insert Below this Track
Remove from Queue
diff --git a/mopidy_musicbox_webclient/static/js/controls.js b/mopidy_musicbox_webclient/static/js/controls.js
index 04b3a69d..f4f11378 100644
--- a/mopidy_musicbox_webclient/static/js/controls.js
+++ b/mopidy_musicbox_webclient/static/js/controls.js
@@ -172,10 +172,8 @@
var pos = index
if (pos === null) {
pos = 0
- }
-
- if (action === PLAY_NEXT) {
- pos = pos + 1
+ } else if (action !== INSERT_AT_INDEX) {
+ pos += 1
}
mopidy.tracklist.add({at_position: pos, uris: trackUris}).then(function (tlTracks) {
@@ -242,7 +240,7 @@
$(this).removeData('tlid')
})
var trackName = popupData[$('#popupQueue').data('track')].name
- $('#select-add').append('')
+ $('#select-add').append('')
}
if (typeof songdata.track.uri !== 'undefined' && songdata.track.uri !== '') {
$('#getPlayingBtn').button('enable')
diff --git a/mopidy_musicbox_webclient/static/js/gui.js b/mopidy_musicbox_webclient/static/js/gui.js
index ea283ef0..c3f52605 100644
--- a/mopidy_musicbox_webclient/static/js/gui.js
+++ b/mopidy_musicbox_webclient/static/js/gui.js
@@ -76,7 +76,6 @@ function setSongTitle (title, refresh_ui) {
}
function setSongInfo (data) {
-// console.log(data, songdata);
if (!data) { return }
if (data.tlid === songdata.tlid) { return }
if (!data.track.name || data.track.name === '') {
@@ -255,6 +254,11 @@ function initSocketevents () {
controls.setPlayState(true)
})
+ mopidy.on('event:trackPlaybackResumed', function (data) {
+ setSongInfo(data.tl_track)
+ controls.setPlayState(true)
+ })
+
mopidy.on('event:playlistsLoaded', function (data) {
showLoading(true)
library.getPlaylists()
diff --git a/tests/js/test_controls.js b/tests/js/test_controls.js
index 381be8e6..83c6dca1 100644
--- a/tests/js/test_controls.js
+++ b/tests/js/test_controls.js
@@ -101,7 +101,7 @@ describe('controls', function () {
it('PLAY_NOW, PLAY_NEXT, and ADD_THIS_BOTTOM should only add one track to the tracklist', function () {
controls.playTracks(PLAY_NOW, mopidy, NEW_TRACKS[0].uri, CURRENT_PLAYLIST_TABLE)
- assert(addSpy.calledWithMatch({at_position: 0, uris: [NEW_TRACKS[0].uri]}), 'PLAY_NOW did not add correct track')
+ assert(addSpy.calledWithMatch({at_position: 1, uris: [NEW_TRACKS[0].uri]}), 'PLAY_NOW did not add correct track')
mopidy.tracklist.clear()
mopidy.tracklist.add({uris: getUris(QUEUE_TRACKS)})
@@ -132,7 +132,7 @@ describe('controls', function () {
it('PLAY_NEXT should insert track after currently playing track by default', function () {
controls.playTracks(PLAY_NOW, mopidy, NEW_TRACKS[0].uri)
- assert(addSpy.calledWithMatch({at_position: 0, uris: [NEW_TRACKS[0].uri]}), 'PLAY_NEXT did not insert track at correct position')
+ assert(addSpy.calledWithMatch({at_position: 1, uris: [NEW_TRACKS[0].uri]}), 'PLAY_NEXT did not insert track at correct position')
})
it('PLAY_NEXT should insert track after reference track index, if provided', function () {
@@ -148,7 +148,7 @@ describe('controls', function () {
it('PLAY_NOW should always insert track at current index', function () {
controls.playTracks(PLAY_NOW, mopidy, NEW_TRACKS[0].uri)
- assert(addSpy.calledWithMatch({at_position: 0, uris: [NEW_TRACKS[0].uri]}), 'PLAY_NOW did not insert track at correct position')
+ assert(addSpy.calledWithMatch({at_position: 1, uris: [NEW_TRACKS[0].uri]}), 'PLAY_NOW did not insert track at correct position')
addSpy.reset()
mopidy.tracklist.clear()