Added ability to save Queue as local Playlist
This commit is contained in:
parent
79e9581bb1
commit
2b4c670ec3
@ -59,6 +59,7 @@ v2.0.1 (UNRELEASED)
|
||||
- Support for Mopidy-Grooveshark.
|
||||
- Fixed slow to start playing from a large tracklist of browsed tracks.
|
||||
- Added link to `Alarm Clock <https://pypi.python.org/pypi/Mopidy-AlarmClock/>`_ (if present).
|
||||
- Added ability to save Queue as local Playlist.
|
||||
|
||||
v2.0.0 (26-3-2015)
|
||||
------------------
|
||||
|
||||
@ -334,7 +334,8 @@
|
||||
<!--/browsepane-->
|
||||
|
||||
<div data-role="content" class="pane" id="currentpane">
|
||||
<a style="float:right" onclick="return clearQueue();" data-role="button">Clear</a><h4>Play Queue</h4>
|
||||
<a style="float:right" onclick="return clearQueue();" data-role="button">Clear</a>
|
||||
<a style="float:right; margin-right: 0.5em" onclick="return saveQueue();" data-role="button">Save</a><h4>Play Queue</h4>
|
||||
<!-- <ul data-role="listview" data-icon="false" data-theme="d" data-inset="true" id="currenttable"></ul>
|
||||
<ul data-role="listview" data-icon="false" data-theme="d" data-inset="true" id="currenttable"></ul> -->
|
||||
<ul class="table" id="currenttable"></ul>
|
||||
|
||||
25
mopidy_musicbox_webclient/static/js/controls.js
vendored
25
mopidy_musicbox_webclient/static/js/controls.js
vendored
@ -227,6 +227,31 @@ function clearQueue() {
|
||||
return false;
|
||||
}
|
||||
|
||||
function saveQueue() {
|
||||
mopidy.tracklist.getTracks().then(function(tracks) {
|
||||
if (tracks.length > 0) {
|
||||
var plname = window.prompt("Playlist name:", "");
|
||||
if (plname != null && plname.trim() != "") {
|
||||
plname = plname.trim();
|
||||
mopidy.playlists.filter({"name": plname}).then(function(existing) {
|
||||
var exists = false;
|
||||
for (var i = 0; i < existing.length; i++) {
|
||||
exists = exists || existing[i].uri.indexOf("m3u:") == 0 || existing[i].uri.indexOf("local:") == 0;
|
||||
}
|
||||
if (!exists || window.confirm("Overwrite existing playlist \"" + plname + "\"?")) {
|
||||
mopidy.playlists.create(plname, "local").then(function(playlist) {
|
||||
playlist.tracks = tracks;
|
||||
mopidy.playlists.save(playlist).then();
|
||||
getPlaylists();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* Buttons
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user