home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Talk
Any way to programmatically play a playlist? Command line, WiFi Remote, MPExtended?
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="johanj" data-source="post: 1180577" data-attributes="member: 88055"><p>Your request should work if you change to provider 4. List of providers is found in the wiki<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite2" alt=";)" title="Wink ;)" loading="lazy" data-shortname=";)" /></p><p><a href="http://wiki.team-mediaportal.com/1_MEDIAPORTAL_1/17_Extensions/Remote_Access/MPExtended/Developers/MAS_providers" target="_blank">http://wiki.team-mediaportal.com/1_MEDIAPORTAL_1/17_Extensions/Remote_Access/MPExtended/Developers/MAS_providers</a></p><p></p><p>You will need to know the id of the track or album in order to add them to a playlist. This can be retrieved by other MAS call. Example of usage of both MPExt. and WifiRemote.</p><p></p><p>self.addTrackToPlaylist = function() {</p><p> CF.getJoin("l" + Joins.music.lstTracks + ":" + self.currentTrackIndex + ":" + "d1", function(j, v, t) {</p><p> var id = t["[trackId]"];</p><p> var params = "provider=4" + "&id=" + encodeURIComponent(id);</p><p> Controller.getActiveClient().rpc(self, "MediaAccessService", "GetMusicTrackBasicById", params, function(data) {</p><p> var params2 = "provider=4&playlistId=" + self.playlists[self.selectedPlaylistIndex].Id + "&type=1&id=" + encodeURIComponent(id)// + "&position=" +(self.playlistTracksArrayMPE.length-1);</p><p> Controller.getActiveClient().rpc(self, "MediaAccessService", "AddPlaylistItem", params2, function(success) {</p><p> if (success) {</p><p> self.Log("Track added to playlist")</p><p> var dataArray = [];</p><p> dataArray.push(data);</p><p> self.addItemsToPlaylists(dataArray);</p><p> } else {</p><p> self.Log("Track failed to be added to playlist")</p><p> }</p><p> });</p><p> });</p><p> });</p><p>};</p><p></p><p>self.addTrackToLoadedPlaylist = function() {</p><p> CF.getJoin("l" + Joins.music.lstTracks + ":" + self.currentTrackIndex + ":" + "d1", function(j, v, t) {</p><p> var id = t["[trackId]"];</p><p> var params = "provider=4" + "&type=1&id=" + encodeURIComponent(id);</p><p> Controller.getActiveClient().rpc(self, "MediaAccessService", "GetExternalMediaInfo", params, function(playInfo) {</p><p> WifiRemote.enqueueMusicTrack(id, playInfo);</p><p> WifiRemote.retrieveMusicPlaylist();</p><p> });</p><p> });</p><p>};</p><p></p><p>self.addAlbumToLoadedPlaylist = function() {</p><p> CF.getJoin("l" + Joins.music.lstAlbums + ":" + self.currentAlbumIndex + ":" + "d1", function(j, v, t) {</p><p> var id = t["[id]"];</p><p> var params = "provider=4" + "&type=7&id=" + encodeURIComponent(id);</p><p> Controller.getActiveClient().rpc(self, "MediaAccessService", "GetExternalMediaInfo", params, function(playInfo) {</p><p> WifiRemote.enqueueMusicAlbum(id, playInfo);</p><p> WifiRemote.retrieveMusicPlaylist();</p><p> });</p><p> });</p><p>};</p></blockquote><p></p>
[QUOTE="johanj, post: 1180577, member: 88055"] Your request should work if you change to provider 4. List of providers is found in the wiki;) [URL]http://wiki.team-mediaportal.com/1_MEDIAPORTAL_1/17_Extensions/Remote_Access/MPExtended/Developers/MAS_providers[/URL] You will need to know the id of the track or album in order to add them to a playlist. This can be retrieved by other MAS call. Example of usage of both MPExt. and WifiRemote. self.addTrackToPlaylist = function() { CF.getJoin("l" + Joins.music.lstTracks + ":" + self.currentTrackIndex + ":" + "d1", function(j, v, t) { var id = t["[trackId]"]; var params = "provider=4" + "&id=" + encodeURIComponent(id); Controller.getActiveClient().rpc(self, "MediaAccessService", "GetMusicTrackBasicById", params, function(data) { var params2 = "provider=4&playlistId=" + self.playlists[self.selectedPlaylistIndex].Id + "&type=1&id=" + encodeURIComponent(id)// + "&position=" +(self.playlistTracksArrayMPE.length-1); Controller.getActiveClient().rpc(self, "MediaAccessService", "AddPlaylistItem", params2, function(success) { if (success) { self.Log("Track added to playlist") var dataArray = []; dataArray.push(data); self.addItemsToPlaylists(dataArray); } else { self.Log("Track failed to be added to playlist") } }); }); }); }; self.addTrackToLoadedPlaylist = function() { CF.getJoin("l" + Joins.music.lstTracks + ":" + self.currentTrackIndex + ":" + "d1", function(j, v, t) { var id = t["[trackId]"]; var params = "provider=4" + "&type=1&id=" + encodeURIComponent(id); Controller.getActiveClient().rpc(self, "MediaAccessService", "GetExternalMediaInfo", params, function(playInfo) { WifiRemote.enqueueMusicTrack(id, playInfo); WifiRemote.retrieveMusicPlaylist(); }); }); }; self.addAlbumToLoadedPlaylist = function() { CF.getJoin("l" + Joins.music.lstAlbums + ":" + self.currentAlbumIndex + ":" + "d1", function(j, v, t) { var id = t["[id]"]; var params = "provider=4" + "&type=7&id=" + encodeURIComponent(id); Controller.getActiveClient().rpc(self, "MediaAccessService", "GetExternalMediaInfo", params, function(playInfo) { WifiRemote.enqueueMusicAlbum(id, playInfo); WifiRemote.retrieveMusicPlaylist(); }); }); }; [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Talk
Any way to programmatically play a playlist? Command line, WiFi Remote, MPExtended?
Contact us
RSS
Top
Bottom