diff --git a/package.json b/package.json index c006516..17ccdeb 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,9 @@ "build:js": "rollup -c", "watch:js": "rollup -c -w", "serve": "python ../server.py", + "serve:gui": "python ../deemix-pyweb.py --dev", "dev": "npm-run-all --parallel serve watch:js watch:styles", + "dev:gui": "npm-run-all --parallel serve:gui watch:js watch:styles", "build": "npm-run-all --sequential clean build:js build:styles" }, "dependencies": { diff --git a/public/js/bundle.js b/public/js/bundle.js index 74791a2..d5eddae 100644 --- a/public/js/bundle.js +++ b/public/js/bundle.js @@ -8,7 +8,7 @@ var t=Object.freeze({});function e(t){return null==t}function n(t){return null!= * vuex v3.5.1 * (c) 2020 Evan You * @license MIT - */var To=("undefined"!=typeof window?window:"undefined"!=typeof global?global:{}).__VUE_DEVTOOLS_GLOBAL_HOOK__;function So(t,e){if(void 0===e&&(e=[]),null===t||"object"!=typeof t)return t;var n,a=(n=function(e){return e.original===t},e.filter(n)[0]);if(a)return a.copy;var i=Array.isArray(t)?[]:{};return e.push({original:t,copy:i}),Object.keys(t).forEach((function(n){i[n]=So(t[n],e)})),i}function zo(t,e){Object.keys(t).forEach((function(n){return e(t[n],n)}))}function Mo(t){return null!==t&&"object"==typeof t}var $o=function(t,e){this.runtime=e,this._children=Object.create(null),this._rawModule=t;var n=t.state;this.state=("function"==typeof n?n():n)||{}},Do={namespaced:{configurable:!0}};Do.namespaced.get=function(){return!!this._rawModule.namespaced},$o.prototype.addChild=function(t,e){this._children[t]=e},$o.prototype.removeChild=function(t){delete this._children[t]},$o.prototype.getChild=function(t){return this._children[t]},$o.prototype.hasChild=function(t){return t in this._children},$o.prototype.update=function(t){this._rawModule.namespaced=t.namespaced,t.actions&&(this._rawModule.actions=t.actions),t.mutations&&(this._rawModule.mutations=t.mutations),t.getters&&(this._rawModule.getters=t.getters)},$o.prototype.forEachChild=function(t){zo(this._children,t)},$o.prototype.forEachGetter=function(t){this._rawModule.getters&&zo(this._rawModule.getters,t)},$o.prototype.forEachAction=function(t){this._rawModule.actions&&zo(this._rawModule.actions,t)},$o.prototype.forEachMutation=function(t){this._rawModule.mutations&&zo(this._rawModule.mutations,t)},Object.defineProperties($o.prototype,Do);var Po,No=function(t){this.register([],t,!1)};No.prototype.get=function(t){return t.reduce((function(t,e){return t.getChild(e)}),this.root)},No.prototype.getNamespace=function(t){var e=this.root;return t.reduce((function(t,n){return t+((e=e.getChild(n)).namespaced?n+"/":"")}),"")},No.prototype.update=function(t){!function t(e,n,a){if(n.update(a),a.modules)for(var i in a.modules){if(!n.getChild(i))return;t(e.concat(i),n.getChild(i),a.modules[i])}}([],this.root,t)},No.prototype.register=function(t,e,n){var a=this;void 0===n&&(n=!0);var i=new $o(e,n);0===t.length?this.root=i:this.get(t.slice(0,-1)).addChild(t[t.length-1],i);e.modules&&zo(e.modules,(function(e,i){a.register(t.concat(i),e,n)}))},No.prototype.unregister=function(t){var e=this.get(t.slice(0,-1)),n=t[t.length-1],a=e.getChild(n);a&&a.runtime&&e.removeChild(n)},No.prototype.isRegistered=function(t){var e=this.get(t.slice(0,-1)),n=t[t.length-1];return e.hasChild(n)};var Lo=function(t){var e=this;void 0===t&&(t={}),!Po&&"undefined"!=typeof window&&window.Vue&&Uo(window.Vue);var n=t.plugins;void 0===n&&(n=[]);var a=t.strict;void 0===a&&(a=!1),this._committing=!1,this._actions=Object.create(null),this._actionSubscribers=[],this._mutations=Object.create(null),this._wrappedGetters=Object.create(null),this._modules=new No(t),this._modulesNamespaceMap=Object.create(null),this._subscribers=[],this._watcherVM=new Po,this._makeLocalGettersCache=Object.create(null);var i=this,r=this.dispatch,s=this.commit;this.dispatch=function(t,e){return r.call(i,t,e)},this.commit=function(t,e,n){return s.call(i,t,e,n)},this.strict=a;var o=this._modules.root.state;jo(this,o,[],this._modules.root),Eo(this,o),n.forEach((function(t){return t(e)})),(void 0!==t.devtools?t.devtools:Po.config.devtools)&&function(t){To&&(t._devtoolHook=To,To.emit("vuex:init",t),To.on("vuex:travel-to-state",(function(e){t.replaceState(e)})),t.subscribe((function(t,e){To.emit("vuex:mutation",t,e)}),{prepend:!0}),t.subscribeAction((function(t,e){To.emit("vuex:action",t,e)}),{prepend:!0}))}(this)},Ro={state:{configurable:!0}};function Io(t,e,n){return e.indexOf(t)<0&&(n&&n.prepend?e.unshift(t):e.push(t)),function(){var n=e.indexOf(t);n>-1&&e.splice(n,1)}}function Fo(t,e){t._actions=Object.create(null),t._mutations=Object.create(null),t._wrappedGetters=Object.create(null),t._modulesNamespaceMap=Object.create(null);var n=t.state;jo(t,n,[],t._modules.root,!0),Eo(t,n,e)}function Eo(t,e,n){var a=t._vm;t.getters={},t._makeLocalGettersCache=Object.create(null);var i=t._wrappedGetters,r={};zo(i,(function(e,n){r[n]=function(t,e){return function(){return t(e)}}(e,t),Object.defineProperty(t.getters,n,{get:function(){return t._vm[n]},enumerable:!0})}));var s=Po.config.silent;Po.config.silent=!0,t._vm=new Po({data:{$$state:e},computed:r}),Po.config.silent=s,t.strict&&function(t){t._vm.$watch((function(){return this._data.$$state}),(function(){}),{deep:!0,sync:!0})}(t),a&&(n&&t._withCommit((function(){a._data.$$state=null})),Po.nextTick((function(){return a.$destroy()})))}function jo(t,e,n,a,i){var r=!n.length,s=t._modules.getNamespace(n);if(a.namespaced&&(t._modulesNamespaceMap[s],t._modulesNamespaceMap[s]=a),!r&&!i){var o=Oo(e,n.slice(0,-1)),l=n[n.length-1];t._withCommit((function(){Po.set(o,l,a.state)}))}var c=a.context=function(t,e,n){var a=""===e,i={dispatch:a?t.dispatch:function(n,a,i){var r=Bo(n,a,i),s=r.payload,o=r.options,l=r.type;return o&&o.root||(l=e+l),t.dispatch(l,s)},commit:a?t.commit:function(n,a,i){var r=Bo(n,a,i),s=r.payload,o=r.options,l=r.type;o&&o.root||(l=e+l),t.commit(l,s,o)}};return Object.defineProperties(i,{getters:{get:a?function(){return t.getters}:function(){return function(t,e){if(!t._makeLocalGettersCache[e]){var n={},a=e.length;Object.keys(t.getters).forEach((function(i){if(i.slice(0,a)===e){var r=i.slice(a);Object.defineProperty(n,r,{get:function(){return t.getters[i]},enumerable:!0})}})),t._makeLocalGettersCache[e]=n}return t._makeLocalGettersCache[e]}(t,e)}},state:{get:function(){return Oo(t.state,n)}}}),i}(t,s,n);a.forEachMutation((function(e,n){!function(t,e,n,a){(t._mutations[e]||(t._mutations[e]=[])).push((function(e){n.call(t,a.state,e)}))}(t,s+n,e,c)})),a.forEachAction((function(e,n){var a=e.root?n:s+n,i=e.handler||e;!function(t,e,n,a){(t._actions[e]||(t._actions[e]=[])).push((function(e){var i,r=n.call(t,{dispatch:a.dispatch,commit:a.commit,getters:a.getters,state:a.state,rootGetters:t.getters,rootState:t.state},e);return(i=r)&&"function"==typeof i.then||(r=Promise.resolve(r)),t._devtoolHook?r.catch((function(e){throw t._devtoolHook.emit("vuex:error",e),e})):r}))}(t,a,i,c)})),a.forEachGetter((function(e,n){!function(t,e,n,a){if(t._wrappedGetters[e])return;t._wrappedGetters[e]=function(t){return n(a.state,a.getters,t.state,t.getters)}}(t,s+n,e,c)})),a.forEachChild((function(a,r){jo(t,e,n.concat(r),a,i)}))}function Oo(t,e){return e.reduce((function(t,e){return t[e]}),t)}function Bo(t,e,n){return Mo(t)&&t.type&&(n=e,e=t,t=t.type),{type:t,payload:e,options:n}}function Uo(t){Po&&t===Po||function(t){if(Number(t.version.split(".")[0])>=2)t.mixin({beforeCreate:n});else{var e=t.prototype._init;t.prototype._init=function(t){void 0===t&&(t={}),t.init=t.init?[n].concat(t.init):n,e.call(this,t)}}function n(){var t=this.$options;t.store?this.$store="function"==typeof t.store?t.store():t.store:t.parent&&t.parent.$store&&(this.$store=t.parent.$store)}}(Po=t)}Ro.state.get=function(){return this._vm._data.$$state},Ro.state.set=function(t){},Lo.prototype.commit=function(t,e,n){var a=this,i=Bo(t,e,n),r=i.type,s=i.payload,o={type:r,payload:s},l=this._mutations[r];l&&(this._withCommit((function(){l.forEach((function(t){t(s)}))})),this._subscribers.slice().forEach((function(t){return t(o,a.state)})))},Lo.prototype.dispatch=function(t,e){var n=this,a=Bo(t,e),i=a.type,r=a.payload,s={type:i,payload:r},o=this._actions[i];if(o){try{this._actionSubscribers.slice().filter((function(t){return t.before})).forEach((function(t){return t.before(s,n.state)}))}catch(t){}var l=o.length>1?Promise.all(o.map((function(t){return t(r)}))):o[0](r);return new Promise((function(t,e){l.then((function(e){try{n._actionSubscribers.filter((function(t){return t.after})).forEach((function(t){return t.after(s,n.state)}))}catch(t){}t(e)}),(function(t){try{n._actionSubscribers.filter((function(t){return t.error})).forEach((function(e){return e.error(s,n.state,t)}))}catch(t){}e(t)}))}))}},Lo.prototype.subscribe=function(t,e){return Io(t,this._subscribers,e)},Lo.prototype.subscribeAction=function(t,e){return Io("function"==typeof t?{before:t}:t,this._actionSubscribers,e)},Lo.prototype.watch=function(t,e,n){var a=this;return this._watcherVM.$watch((function(){return t(a.state,a.getters)}),e,n)},Lo.prototype.replaceState=function(t){var e=this;this._withCommit((function(){e._vm._data.$$state=t}))},Lo.prototype.registerModule=function(t,e,n){void 0===n&&(n={}),"string"==typeof t&&(t=[t]),this._modules.register(t,e),jo(this,this.state,t,this._modules.get(t),n.preserveState),Eo(this,this.state)},Lo.prototype.unregisterModule=function(t){var e=this;"string"==typeof t&&(t=[t]),this._modules.unregister(t),this._withCommit((function(){var n=Oo(e.state,t.slice(0,-1));Po.delete(n,t[t.length-1])})),Fo(this)},Lo.prototype.hasModule=function(t){return"string"==typeof t&&(t=[t]),this._modules.isRegistered(t)},Lo.prototype.hotUpdate=function(t){this._modules.update(t),Fo(this,!0)},Lo.prototype._withCommit=function(t){var e=this._committing;this._committing=!0,t(),this._committing=e},Object.defineProperties(Lo.prototype,Ro);var qo=Qo((function(t,e){var n={};return Ho(e).forEach((function(e){var a=e.key,i=e.val;n[a]=function(){var e=this.$store.state,n=this.$store.getters;if(t){var a=Ko(this.$store,"mapState",t);if(!a)return;e=a.context.state,n=a.context.getters}return"function"==typeof i?i.call(this,e,n):e[i]},n[a].vuex=!0})),n})),Vo=Qo((function(t,e){var n={};return Ho(e).forEach((function(e){var a=e.key,i=e.val;n[a]=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var a=this.$store.commit;if(t){var r=Ko(this.$store,"mapMutations",t);if(!r)return;a=r.context.commit}return"function"==typeof i?i.apply(this,[a].concat(e)):a.apply(this.$store,[i].concat(e))}})),n})),Go=Qo((function(t,e){var n={};return Ho(e).forEach((function(e){var a=e.key,i=e.val;i=t+i,n[a]=function(){if(!t||Ko(this.$store,"mapGetters",t))return this.$store.getters[i]},n[a].vuex=!0})),n})),Wo=Qo((function(t,e){var n={};return Ho(e).forEach((function(e){var a=e.key,i=e.val;n[a]=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var a=this.$store.dispatch;if(t){var r=Ko(this.$store,"mapActions",t);if(!r)return;a=r.context.dispatch}return"function"==typeof i?i.apply(this,[a].concat(e)):a.apply(this.$store,[i].concat(e))}})),n}));function Ho(t){return function(t){return Array.isArray(t)||Mo(t)}(t)?Array.isArray(t)?t.map((function(t){return{key:t,val:t}})):Object.keys(t).map((function(e){return{key:e,val:t[e]}})):[]}function Qo(t){return function(e,n){return"string"!=typeof e?(n=e,e=""):"/"!==e.charAt(e.length-1)&&(e+="/"),t(e,n)}}function Ko(t,e,n){return t._modulesNamespaceMap[n]}function Yo(t,e,n){var a=n?t.groupCollapsed:t.group;try{a.call(t,e)}catch(n){t.log(e)}}function Jo(t){try{t.groupEnd()}catch(e){t.log("—— log end ——")}}function Zo(){var t=new Date;return" @ "+Xo(t.getHours(),2)+":"+Xo(t.getMinutes(),2)+":"+Xo(t.getSeconds(),2)+"."+Xo(t.getMilliseconds(),3)}function Xo(t,e){return function(t,e){return new Array(e+1).join(t)}("0",e-t.toString().length)+t}var tl={Store:Lo,install:Uo,version:"3.5.1",mapState:qo,mapMutations:Vo,mapGetters:Go,mapActions:Wo,createNamespacedHelpers:function(t){return{mapState:qo.bind(null,t),mapGetters:Go.bind(null,t),mapMutations:Vo.bind(null,t),mapActions:Wo.bind(null,t)}},createLogger:function(t){void 0===t&&(t={});var e=t.collapsed;void 0===e&&(e=!0);var n=t.filter;void 0===n&&(n=function(t,e,n){return!0});var a=t.transformer;void 0===a&&(a=function(t){return t});var i=t.mutationTransformer;void 0===i&&(i=function(t){return t});var r=t.actionFilter;void 0===r&&(r=function(t,e){return!0});var s=t.actionTransformer;void 0===s&&(s=function(t){return t});var o=t.logMutations;void 0===o&&(o=!0);var l=t.logActions;void 0===l&&(l=!0);var c=t.logger;return void 0===c&&(c=console),function(t){var d=So(t.state);void 0!==c&&(o&&t.subscribe((function(t,r){var s=So(r);if(n(t,d,s)){var o=Zo(),l=i(t),u="mutation "+t.type+o;Yo(c,u,e),c.log("%c prev state","color: #9E9E9E; font-weight: bold",a(d)),c.log("%c mutation","color: #03A9F4; font-weight: bold",l),c.log("%c next state","color: #4CAF50; font-weight: bold",a(s)),Jo(c)}d=s})),l&&t.subscribeAction((function(t,n){if(r(t,n)){var a=Zo(),i=s(t),o="action "+t.type+a;Yo(c,o,e),c.log("%c action","color: #03A9F4; font-weight: bold",i),Jo(c)}})))}}};var el={state:{currentCommit:null,latestCommit:null,updateAvailable:!1,deemixVersion:null},getters:{getAboutInfo:t=>t},actions:{setAboutInfo({commit:t},e){t("SET_CURRENT_COMMIT",e.currentCommit),t("SET_LATEST_COMMIT",e.latestCommit),t("SET_UPDATE_AVAILABLE",e.updateAvailable),t("SET_DEEMIX_VERSION",e.deemixVersion)}},mutations:{SET_CURRENT_COMMIT:(t,e)=>{t.currentCommit=e},SET_LATEST_COMMIT:(t,e)=>{t.latestCommit=e},SET_UPDATE_AVAILABLE:(t,e)=>{t.updateAvailable=e},SET_DEEMIX_VERSION:(t,e)=>{t.deemixVersion=e}}};const nl=()=>({arl:localStorage.getItem("arl")||"",status:null,user:{id:null,name:"",picture:""}});var al={state:nl(),getters:{getARL:t=>t.arl,getUser:t=>t.user,isLoggedIn:t=>!!t.arl},actions:{login({commit:t,dispatch:e},n){const{arl:a,user:i,status:r}=n;e("setARL",{arl:a}),t("SET_USER",i),t("SET_STATUS",r)},logout({commit:t}){localStorage.removeItem("arl"),t("RESET_LOGIN")},setARL({commit:t},e){let{arl:n,saveOnLocalStorage:a}=e;a=void 0===a||a,t("SET_ARL",n),a&&localStorage.setItem("arl",n)},removeARL({commit:t}){t("SET_ARL",""),localStorage.removeItem("arl")},setUser({commit:t},e){t("SET_USER",e)}},mutations:{SET_ARL(t,e){t.arl=e},SET_STATUS(t,e){t.status=e},SET_USER(t,e){t.user=e},RESET_LOGIN(t){Object.assign(t,nl())}}};var il={state:{artist:"",bitrate:"",cover:"",downloaded:0,errors:[],failed:0,id:"",progress:0,silent:!0,size:0,title:"",type:"",uuid:""},getters:{getErrors:t=>t},actions:{setErrors({commit:t},e){t("SET_ERRORS",e)}},mutations:{SET_ERRORS(t,e){for(const n in t)if(t.hasOwnProperty(n)){const a=e[n];t[n]=a}}}};An.use(tl);var rl=new tl.Store({modules:{about:el,login:al,errors:il},strict:!1});const sl=io.connect(window.location.href);function ol(t,e=null){t&&sl.emit("addToQueue",{url:t,bitrate:e},()=>{})}sl.on("connect",()=>{document.getElementById("start_app_placeholder").classList.add("loading_placeholder--hidden")}),sl.on("init_update",t=>{rl.dispatch("setAboutInfo",t)});var ll={sendAddToQueue:ol};const cl={data:()=>({open:!1,url:""}),mounted(){this.$root.$on("QualityModal:open",this.openModal),this.$refs.modal.addEventListener("webkitAnimationEnd",this.handleAnimationEnd)},methods:{tryToDownloadTrack(t){const{target:e}=t;this.$refs.modal.classList.add("animated","fadeOut"),e.matches(".quality-button")&&ll.sendAddToQueue(this.url,e.dataset.qualityValue)},openModal(t){this.url=t,this.open=!0,this.$refs.modal.classList.add("animated","fadeIn")},handleAnimationEnd(t){const{animationName:e}=t;this.$refs.modal.classList.remove("animated",e),"fadeIn"!==e&&(this.open=!1)}}};var dl=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{directives:[{name:"show",rawName:"v-show",value:t.open,expression:"open"}],ref:"modal",staticClass:"smallmodal",attrs:{id:"modal_quality"},on:{click:function(e){return t.tryToDownloadTrack(e)}}},[n("div",{staticClass:"smallmodal-content"},[n("button",{staticClass:"quality-button",attrs:{"data-quality-value":"9"}},[t._v(t._s(t.$t("globals.download",{thing:"FLAC"})))]),t._v(" "),n("button",{staticClass:"quality-button",attrs:{"data-quality-value":"3"}},[t._v(t._s(t.$t("globals.download",{thing:"MP3 320kbps"})))]),t._v(" "),n("button",{staticClass:"quality-button",attrs:{"data-quality-value":"1"}},[t._v(t._s(t.$t("globals.download",{thing:"MP3 128kbps"})))]),t._v(" "),n("button",{staticClass:"quality-button",attrs:{"data-quality-value":"15"}},[t._v("\n\t\t\t"+t._s(t.$t("globals.download",{thing:"360 Reality Audio [HQ]"}))+"\n\t\t")]),t._v(" "),n("button",{staticClass:"quality-button",attrs:{"data-quality-value":"14"}},[t._v("\n\t\t\t"+t._s(t.$t("globals.download",{thing:"360 Reality Audio [MQ]"}))+"\n\t\t")]),t._v(" "),n("button",{staticClass:"quality-button",attrs:{"data-quality-value":"13"}},[t._v("\n\t\t\t"+t._s(t.$t("globals.download",{thing:"360 Reality Audio [LQ]"}))+"\n\t\t")])])])};dl._withStripped=!0;var ul=function(t,e,n,a,i,r,s,o){const l=("function"==typeof n?n.options:n)||{};l.__file="C:\\Users\\Roberto\\Dev\\repos\\deemix-pyweb\\webui\\src\\components\\TheQualityModal.vue",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=a;{let t;if(e&&(t=function(t){e.call(this,s(t))}),void 0!==t)if(l.functional){const e=l.render;l.render=function(n,a){return t.call(a),e(n,a)}}else{const e=l.beforeCreate;l.beforeCreate=e?[].concat(e,t):[t]}}return l}({render:dl,staticRenderFns:[]},(function(t){t&&t("data-v-48a043f0_0",{source:"\n.smallmodal {\r\n\tposition: fixed;\r\n\tz-index: 1250;\r\n\tleft: 0;\r\n\ttop: 0;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\toverflow: auto;\r\n\tbackground-color: hsla(0, 0%, 0%, 0.4);\r\n\tanimation-duration: 0.3s;\n}\n.smallmodal-content {\r\n\tbackground-color: transparent;\r\n\tmargin: auto;\r\n\twidth: var(--modal-content-width);\r\n\tposition: relative;\r\n\ttop: 50%;\r\n\ttransform: translateY(-50%);\n}\n.smallmodal-content button {\r\n\twidth: 100%;\r\n\tmargin-bottom: 8px;\n}\r\n",map:{version:3,sources:["C:\\Users\\Roberto\\Dev\\repos\\deemix-pyweb\\webui/C:\\Users\\Roberto\\Dev\\repos\\deemix-pyweb\\webui\\src\\components\\TheQualityModal.vue"],names:[],mappings:";AAmBA;CACA,eAAA;CACA,aAAA;CACA,OAAA;CACA,MAAA;CACA,WAAA;CACA,YAAA;CACA,cAAA;CACA,sCAAA;CACA,wBAAA;AACA;AAEA;CACA,6BAAA;CACA,YAAA;CACA,iCAAA;CACA,kBAAA;CACA,QAAA;CACA,2BAAA;AACA;AAEA;CACA,WAAA;CACA,kBAAA;AACA",file:"TheQualityModal.vue",sourcesContent:["\r\n\t\r\n\t\t\r\n\t\t\t{{ $t('globals.download', {thing: 'FLAC'}) }}\r\n\t\t\t{{ $t('globals.download', {thing: 'MP3 320kbps'}) }}\r\n\t\t\t{{ $t('globals.download', {thing: 'MP3 128kbps'}) }}\r\n\t\t\t\r\n\t\t\t\t{{ $t('globals.download', {thing: '360 Reality Audio [HQ]'}) }}\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\t{{ $t('globals.download', {thing: '360 Reality Audio [MQ]'}) }}\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\t{{ $t('globals.download', {thing: '360 Reality Audio [LQ]'}) }}\r\n\t\t\t\r\n\t\t\r\n\t\r\n\r\n\r\n