platypush/platypush/backend/http/dist/static/js/chunk-2d21da1a.867fde19.js

2 lines
6.7 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d21da1a"],{d1b9:function(e,r,t){"use strict";t.r(r);t("38cf");var n=t("7a23");function a(e,r,t,a,s,u){var c=Object(n["z"])("Loading"),i=Object(n["z"])("MusicPlugin");return Object(n["r"])(),Object(n["e"])(n["a"],null,[s.loading?(Object(n["r"])(),Object(n["e"])(c,{key:0})):Object(n["f"])("",!0),Object(n["h"])(i,{"plugin-name":"music.mpd",loading:s.loading,config:t.config,tracks:s.tracks,status:s.status,onPlay:u.play,onPause:u.pause,onStop:u.stop,onPrevious:u.previous,onNext:u.next,onClear:u.clear,onSetVolume:u.setVolume,onSeek:u.seek,onConsume:u.consume,onRandom:u.random,onRepeat:u.repeat,onStatusUpdate:r[1]||(r[1]=function(e){return u.refreshStatus(!0)}),onPlaylistUpdate:r[2]||(r[2]=function(e){return u.refreshTracks(!0)}),onNewPlayingTrack:r[3]||(r[3]=function(e){return u.refreshStatus(!0)})},null,8,["loading","config","tracks","status","onPlay","onPause","onStop","onPrevious","onNext","onClear","onSetVolume","onSeek","onConsume","onRandom","onRepeat"])],64)}t("d81d"),t("13d5"),t("4fad"),t("d3b7"),t("ac1f"),t("3ca3"),t("1276"),t("ddb0");var s=t("3835"),u=(t("96cf"),t("1da1")),c=t("0d41"),i=t("3e54"),o=t("3a5e"),p={name:"MusicMpd",components:{Loading:o["a"],MusicPlugin:c["default"]},mixins:[i["a"]],props:{config:{type:Object,default:function(){}}},data:function(){return{loading:!1,tracks:[],status:{}}},methods:{refreshTracks:function(e){var r=this;return Object(u["a"])(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 Object(u["a"])(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=Object(s["a"])(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 u=a.split(":").map((function(e){return parseInt(e)})),c=Object(s["a"])(u,2);e["elapsed"]=c[0],e["duration"]=c[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]])})))()},refresh:function(e){var r=this;return Object(u["a"])(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)]);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 Object(u["a"])(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=7;break;case 5:return t.next=7,r.request("music.mpd.play");case 7:return t.next=9,r.refreshStatus(!0);case 9:case"end":return t.stop()}}),t)})))()},pause:function(){var e=this;return Object(u["a"])(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 Object(u["a"])(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 Object(u["a"])(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 Object(u["a"])(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 Object(u["a"])(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 Object(u["a"])(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 Object(u["a"])(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 Object(u["a"])(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: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 Object(u["a"])(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: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 Object(u["a"])(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:e});case 2:return t.next=4,r.refreshStatus(!0);case 4:case"end":return t.stop()}}),t)})))()}},mounted:function(){this.refresh()}};p.render=a;r["default"]=p}}]);
//# sourceMappingURL=chunk-2d21da1a.867fde19.js.map