Skip to content

Commit

Permalink
documentation of import
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentperez authored and laurentperez committed Jun 11, 2017
1 parent 4ee7d38 commit 50ed5ec
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ The actions supported as of today:
* favorite
* favorites (with optional "detailed" parameter)
* playlist
* playlistcreate
* playlistdelete
* playlistexport
* playlistimport
* lockvolumes / unlockvolumes (experimental, will enforce the volume that was selected when locking!)
* repeat (on/off)
* shuffle (on/off)
Expand Down
6 changes: 3 additions & 3 deletions lib/actions/playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ function importPlaylist(player, values) {
const title = item.title;
const uri = item.uri;
// there is no way to batch import in Controller UI, we must import one by one
// since adduri requires a synchronous browse for index updateID, we block
// block should be low enough, tested on WiFi + play:5
// since adduri requires a synchronous browse for index updateID, we pause.
// pause should be low enough for the HTTP roundtrips, tested on WiFi + play:5
sleep(600);
return player.coordinator.importPlaylist(sqid, uri, title);
});
Expand All @@ -44,7 +44,7 @@ function importPlaylist(player, values) {
// TODO timeout, document batch post postman/curl
}
else {
// single uri or internal rsq jffs to jffs merge
// single uri or internal rsq jffs to jffs appending
const title = decodeURIComponent(values[1]);
const uri = values.slice(2).map(x => "/" + x).join().replace(/,/g,'').replace(/\//,'');
return player.coordinator
Expand Down
4 changes: 2 additions & 2 deletions static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ <h3>Actions</h3>
<li><strong>playlistcreate</strong> (parameter is playlist name, will return a suitable <code>name</code> used for export, import and delete, see below)</li>
<li><strong>playlistdelete</strong> (parameter is <code>name</code> of the playlist)</li>
<li><strong>playlistexport</strong> for backup purposes in case of factory reset or hardware failure (will return a json-representation of all playlists (optional parameter is <code>name</code>, will return the desired playlist contents)</li>
<li><strong>playlistimport</strong> (parameters : <code>sqid</code> of the playlist / optional: track or playlist title / optional: track or playlist uri obtained by playlistexport. Example : <code>/1/track title/x-file-cifs://MacBook-Air-de-laurent-2/Music/iTunes/iTunes Media/Music/artist/album/track file.mp3</code> or for appending a playlist to another one : <code>/1/playlist title/file:///jffs/settings/savedqueues.rsq#2</code>. Note : invalid local uri track paths will not trigger an error, the device currently does not return an UPnP error code for unmatched Controller files.
<li><strong>playlistimport</strong> (parameters : <code>name</code> of the playlist / optional: track or playlist name / optional: track or playlist uri obtained by playlistexport. Example : <code>/target playlist name/track title/x-file-cifs://MacBook-Air-de-laurent-2/Music/iTunes/iTunes Media/Music/artist/album/track file.mp3</code> or for appending a playlist to another one : <code>/target playlist name/source playlist name/file:///jffs/settings/savedqueues.rsq#2</code>. Note : invalid local uri track paths will not trigger an error, the device currently does not return an UPnP error code for unmatched Controller files.
<br/>
to import a whole playlist : save the response generated by playlistexport/<code>name</code> as a file, and POST the file contents to playlistimport/<code>sqid</code>. Example: TODO. Be patient, large playlists can take time.</li>
to import a whole playlist : save the response generated by playlistexport/<code>name</code> as a file, and POST the file contents to playlistimport/<code>name</code>. Example: <code>curl -v POST http://localhost:5005/playlistimport/playlist name/places.json -d @export.json --header "Content-Type: application/json"</code>. Be patient, large playlists can take time.</li>
<li><strong>lockvolumes</strong> / <strong>unlockvolumes</strong> (experimental, will enforce the volume that was selected when locking!)</li>
<li><strong>repeat</strong> (on/off)</li>
<li><strong>shuffle</strong> (on/off)</li>
Expand Down

0 comments on commit 50ed5ec

Please sign in to comment.