platypush/platypush/backend/http/webapp/dist/static/js/2957-legacy.a0d5f651.js

2 lines
15 KiB
JavaScript

"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[2957],{2957:function(e,r,t){t.r(r),t.d(r,{default:function(){return d}});t(2481),t(4916),t(4765);var n=t(6252);function a(e,r,t,a,s,i){var u=(0,n.up)("Loading"),o=(0,n.up)("MusicPlugin");return(0,n.wg)(),(0,n.iD)(n.HY,null,[s.loading?((0,n.wg)(),(0,n.j4)(u,{key:0})):(0,n.kq)("",!0),(0,n.Wm)(o,{"plugin-name":"music.mpd",loading:s.loading,config:t.config,tracks:s.tracks,status:s.status,playlists:s.playlists,"edited-playlist":s.editedPlaylist,"edited-playlist-tracks":s.editedPlaylistTracks,"track-info":s.trackInfo,"search-results":s.searchResults,"library-results":s.libraryResults,path:s.path,onPlay:i.play,onPause:i.pause,onStop:i.stop,onPrevious:i.previous,onNext:i.next,onClear:i.clear,onSetVolume:i.setVolume,onSeek:i.seek,onConsume:i.consume,onRandom:i.random,onRepeat:i.repeat,onStatusUpdate:r[0]||(r[0]=function(e){return i.refreshStatus(!0)}),onPlaylistUpdate:r[1]||(r[1]=function(e){return i.refresh(!0)}),onNewPlayingTrack:r[2]||(r[2]=function(e){return i.refreshStatus(!0)}),onRemoveFromTracklist:i.removeFromTracklist,onAddToTracklist:i.addToTracklist,onSwapTracks:i.swapTracks,onLoadPlaylist:i.loadPlaylist,onPlayPlaylist:i.playPlaylist,onRemovePlaylist:i.removePlaylist,onTracklistMove:i.moveTracklistTracks,onTracklistSave:i.saveToPlaylist,onPlaylistEdit:i.playlistEditChanged,onAddToTracklistFromEditedPlaylist:i.addToTracklistFromEditedPlaylist,onRemoveFromPlaylist:i.removeFromPlaylist,onInfo:r[3]||(r[3]=function(e){return s.trackInfo=e}),onPlaylistAdd:i.playlistAdd,onAddToPlaylist:i.addToPlaylist,onPlaylistTrackMove:i.playlistTrackMove,onSearch:i.search,onSearchClear:r[4]||(r[4]=function(e){return s.searchResults=[]}),onCd:i.cd},null,8,["loading","config","tracks","status","playlists","edited-playlist","edited-playlist-tracks","track-info","search-results","library-results","path","onPlay","onPause","onStop","onPrevious","onNext","onClear","onSetVolume","onSeek","onConsume","onRandom","onRepeat","onRemoveFromTracklist","onAddToTracklist","onSwapTracks","onLoadPlaylist","onPlayPlaylist","onRemovePlaylist","onTracklistMove","onTracklistSave","onPlaylistEdit","onAddToTracklistFromEditedPlaylist","onRemoveFromPlaylist","onPlaylistAdd","onAddToPlaylist","onPlaylistTrackMove","onSearch","onCd"])],64)}var s=t(6084),i=t(8534),u=(t(1539),t(9720),t(1249),t(3123),t(3948),t(2707),t(8309),t(8783),t(7327),t(5666),t(5781)),o=t(6813),c=t(1232),l={name:"MusicMpd",components:{Loading:c.Z,MusicPlugin:u["default"]},mixins:[o.Z],props:{config:{type:Object,default:function(){}}},data:function(){return{loading:!1,tracks:[],playlists:[],status:{},editedPlaylist:null,editedPlaylistTracks:[],trackInfo:null,searchResults:[],libraryResults:[],path:"/"}},methods:{refreshTracks:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e||(r.loading=!0),t.prev=1,t.next=4,r.request("music.mpd.playlistinfo");case 4:r.tracks=t.sent;case 5:return t.prev=5,r.loading=!1,t.finish(5);case 8:case"end":return t.stop()}}),t,null,[[1,,5,8]])})))()},refreshStatus:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e||(r.loading=!0),t.prev=1,t.t0=Object,t.next=5,r.request("music.mpd.status");case 5:t.t1=t.sent,r.status=t.t0.entries.call(t.t0,t.t1).reduce((function(e,r){var t=(0,s.Z)(r,2),n=t[0],a=t[1];switch(n){case"bitrate":case"volume":e[n]=parseInt(a);break;case"consume":case"random":case"repeat":case"single":e[n]=!!parseInt(a);break;case"song":e["playingPos"]=parseInt(a);break;case"time":var i=a.split(":").map((function(e){return parseInt(e)})),u=(0,s.Z)(i,2);e["elapsed"]=u[0],e["duration"]=u[1];break;case"elapsed":break;default:e[n]=a;break}return e}),{});case 7:return t.prev=7,r.loading=!1,t.finish(7);case 10:case"end":return t.stop()}}),t,null,[[1,,7,10]])})))()},refreshPlaylists:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e||(r.loading=!0),t.prev=1,t.next=4,r.request("music.mpd.listplaylists");case 4:r.playlists=t.sent.map((function(e){return{name:e.playlist,lastModified:e["last-modified"]}})).sort((function(e,r){return e.name.localeCompare(r.name)}));case 5:return t.prev=5,r.loading=!1,t.finish(5);case 8:case"end":return t.stop()}}),t,null,[[1,,5,8]])})))()},refresh:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e||(r.loading=!0),t.prev=1,t.next=4,Promise.all([r.refreshTracks(e),r.refreshStatus(e),r.refreshPlaylists(e)]);case 4:return t.prev=4,r.loading=!1,t.finish(4);case 7:case"end":return t.stop()}}),t,null,[[1,,4,7]])})))()},play:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(null==(null===e||void 0===e?void 0:e.pos)){t.next=5;break}return t.next=3,r.request("music.mpd.play_pos",{pos:e.pos});case 3:t.next=12;break;case 5:if(null===e||void 0===e||!e.file){t.next=10;break}return t.next=8,r.request("music.mpd.play",{resource:e.file});case 8:t.next=12;break;case 10:return t.next=12,r.request("music.mpd.play");case 12:return t.next=14,r.refreshStatus(!0);case 14:case"end":return t.stop()}}),t)})))()},pause:function(){var e=this;return(0,i.Z)(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return r.next=2,e.request("music.mpd.pause");case 2:return r.next=4,e.refreshStatus(!0);case 4:case"end":return r.stop()}}),r)})))()},stop:function(){var e=this;return(0,i.Z)(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return r.next=2,e.request("music.mpd.stop");case 2:return r.next=4,e.refreshStatus(!0);case 4:case"end":return r.stop()}}),r)})))()},previous:function(){var e=this;return(0,i.Z)(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return r.next=2,e.request("music.mpd.previous");case 2:return r.next=4,e.refreshStatus(!0);case 4:case"end":return r.stop()}}),r)})))()},next:function(){var e=this;return(0,i.Z)(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return r.next=2,e.request("music.mpd.next");case 2:return r.next=4,e.refreshStatus(!0);case 4:case"end":return r.stop()}}),r)})))()},clear:function(){var e=this;return(0,i.Z)(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return r.next=2,e.request("music.mpd.clear");case 2:return r.next=4,Promise.all([e.refreshStatus(!0),e.refreshTracks(!0)]);case 4:case"end":return r.stop()}}),r)})))()},setVolume:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(e!==r.status.volume){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,r.request("music.mpd.set_volume",{volume:e});case 4:return t.next=6,r.refreshStatus(!0);case 6:case"end":return t.stop()}}),t)})))()},seek:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,r.request("music.mpd.seek",{position:e});case 2:return t.next=4,r.refreshStatus(!0);case 4:case"end":return t.stop()}}),t)})))()},repeat:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,r.request("music.mpd.repeat",{value:parseInt(+e)});case 2:return t.next=4,r.refreshStatus(!0);case 4:case"end":return t.stop()}}),t)})))()},random:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,r.request("music.mpd.random",{value:parseInt(+e)});case 2:return t.next=4,r.refreshStatus(!0);case 4:case"end":return t.stop()}}),t)})))()},consume:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,r.request("music.mpd.consume",{value:parseInt(+e)});case 2:return t.next=4,r.refreshStatus(!0);case 4:case"end":return t.stop()}}),t)})))()},addToTracklist:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e.file&&(e=e.file),t.next=3,r.request("music.mpd.add",{resource:e});case 3:return t.next=5,r.refresh(!0);case 5:case"end":return t.stop()}}),t)})))()},addToTracklistFromEditedPlaylist:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(n=r.editedPlaylistTracks[e.pos],n){t.next=3;break}return t.abrupt("return");case 3:return t.next=5,r.request("music.mpd.add",{resource:n.file});case 5:return t.next=7,r.refresh(!0);case 7:if(!e.play){t.next=10;break}return t.next=10,r.request("music.mpd.play_pos",{pos:r.tracks.length-1});case 10:case"end":return t.stop()}}),t)})))()},removeFromPlaylist:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,r.request("music.mpd.playlistdelete",{pos:e,name:r.playlists[r.editedPlaylist].name});case 2:return t.next=4,r.playlistEditChanged(r.editedPlaylist);case 4:case"end":return t.stop()}}),t)})))()},removeFromTracklist:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,r.request("music.mpd.delete",{positions:e.sort()});case 2:return t.next=4,r.refresh(!0);case 4:case"end":return t.stop()}}),t)})))()},swapTracks:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,r.request("music.mpd.move",{from_pos:e[0],to_pos:e[1]});case 2:return t.next=4,r.refresh(!0);case 4:case"end":return t.stop()}}),t)})))()},playPlaylist:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,r._loadPlaylist(e,!0);case 2:case"end":return t.stop()}}),t)})))()},loadPlaylist:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,r._loadPlaylist(e,!1);case 2:case"end":return t.stop()}}),t)})))()},_loadPlaylist:function(e,r){var t=this;return(0,i.Z)(regeneratorRuntime.mark((function n(){var a;return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return a=t.playlists[e],n.next=3,t.request("music.mpd.load",{playlist:a.name,play:r});case 3:return n.next=5,t.refresh(!0);case 5:case"end":return n.stop()}}),n)})))()},removePlaylist:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(n=r.playlists[e],confirm("Are you REALLY sure that you want to remove the playlist ".concat(n.name,"?"))){t.next=3;break}return t.abrupt("return");case 3:return t.next=5,r.request("music.mpd.rm",{playlist:n.name});case 5:return t.next=7,r.refreshPlaylists(!0);case 7:case"end":return t.stop()}}),t)})))()},saveToPlaylist:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,r.request("music.mpd.save",{name:e});case 2:return t.next=4,r.refreshPlaylists(!0);case 4:case"end":return t.stop()}}),t)})))()},moveTracklistTracks:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,r.request("music.mpd.move",{from_pos:e.from,to_pos:e.to});case 2:return t.next=4,r.refreshTracks(!0);case 4:case"end":return t.stop()}}),t)})))()},playlistAdd:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,r.request("music.mpd.playlistadd",{uri:e,name:r.playlists[r.editedPlaylist].name});case 2:return t.next=4,r.playlistEditChanged(r.editedPlaylist);case 4:case"end":return t.stop()}}),t)})))()},playlistEditChanged:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(r.editedPlaylist=e,null!=e){t.next=3;break}return t.abrupt("return");case 3:return r.loading=!0,t.prev=4,t.next=7,r.request("music.mpd.listplaylistinfo",{name:r.playlists[e].name});case 7:r.editedPlaylistTracks=t.sent;case 8:return t.prev=8,r.loading=!1,t.finish(8);case 11:case"end":return t.stop()}}),t,null,[[4,,8,11]])})))()},addToPlaylist:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Promise.all(e.playlists.map(function(){var t=(0,i.Z)(regeneratorRuntime.mark((function t(n){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,r.request("music.mpd.playlistadd",{uri:e.track.file,name:r.playlists[n].name});case 2:return t.next=4,r.playlistEditChanged(n);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 2:case"end":return t.stop()}}),t)})))()},playlistTrackMove:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,r.request("music.mpd.playlistmove",{name:r.playlists[e.playlist].name,from_pos:e.from,to_pos:e.to});case 2:return t.next=4,r.playlistEditChanged(e.playlist);case 4:case"end":return t.stop()}}),t)})))()},search:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return r.loading=!0,t.prev=1,t.next=4,r.request("music.mpd.search",{filter:e});case 4:r.searchResults=t.sent;case 5:return t.prev=5,r.loading=!1,t.finish(5);case 8:case"end":return t.stop()}}),t,null,[[1,,5,8]])})))()},cd:function(e){var r=this;return(0,i.Z)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return r.loading=!0,t.prev=1,t.next=4,r.request("music.mpd.lsinfo",{uri:e});case 4:r.libraryResults=t.sent.filter((function(e){return!e.playlist})),r.path=e;case 6:return t.prev=6,r.loading=!1,t.finish(6);case 9:case"end":return t.stop()}}),t,null,[[1,,6,9]])})))()}},mounted:function(){this.refresh(),this.cd(this.path)}},p=t(3744);const m=(0,p.Z)(l,[["render",a]]);var d=m}}]);
//# sourceMappingURL=2957-legacy.a0d5f651.js.map