-
Notifications
You must be signed in to change notification settings - Fork 0
/
handlers.js
executable file
·106 lines (95 loc) · 3.29 KB
/
handlers.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
const {ipcRenderer} = require('electron')
const UI = require('./ui').UI
const Core = require('./core').Core
var player = require("./player")
var fs = require("fs")
var Player_ = new player.Player()
var core = new Core()
UI.LoadControlButtons(Player_)
UI.playlistDisplay(Player_)
var songsLoaderFirstTime = true
ipcRenderer.send('check', 1)
var pathLib = ""
ipcRenderer.on('libpath', (event, arg) =>{
if(arg == ""){
}
else{
console.log(arg)
if(window.songsLoaderFirstTime==true)
{UI.songsLoader('create')
console.log(window.songsLoaderFirstTime)}
else{
UI.songsLoader('show')
console.log(window.songsLoaderFirstTime)
}
core.add(arg).then(
function(SongsDB){
var ele = document.getElementById("drag-file")
var so = document.getElementById("songs")
so.style.display = 'block'
so.style.backgroundImage = 'linear-gradient(to top, #86377b 20%, #27273c 80%);'
UI.songsLoader('hide')
if(window.songsLoaderFirstTime==true){
Player_.Init(SongsDB)
window.songsLoaderFirstTime = false
console.log("here")
}
else{
console.log("here")
Player_.AddSongsDataBase(SongsDB)
}
UI.ListDisplaySongs(SongsDB, Player_)
UI.hideDragAndDrop()
M.toast({html: 'Songs Added', classes: 'rounded'})
}
)
}
})
// var lib = core.Init(libPath)
// drop.style.display = 'none'
UI.showDragAndDrop('create')
document.addEventListener('drop', function (e) {
e.preventDefault();
e.stopPropagation();
var pathLib = ""
for (let f of e.dataTransfer.files) {
console.log('File(s) you dragged here: ', f.path)
pathLib = f.path
}
if(window.songsLoaderFirstTime==true)
{UI.songsLoader('create')
console.log(window.songsLoaderFirstTime)}
else{
UI.songsLoader('show')
console.log(window.songsLoaderFirstTime)
}
console.log(pathLib)
core.add(pathLib).then(
function(SongsDB){
// setTimeout(()=>{
var ele = document.getElementById("drag-file")
var so = document.getElementById("songs")
so.style.display = 'block'
so.style.backgroundImage = 'linear-gradient(to top, #86377b 20%, #27273c 80%);'
UI.songsLoader('hide')
if(window.songsLoaderFirstTime==true){
Player_.Init(SongsDB)
window.songsLoaderFirstTime = false
console.log("here")
}
else{
console.log("here")
Player_.AddSongsDataBase(SongsDB)
}
UI.ListDisplaySongs(SongsDB, Player_)
UI.hideDragAndDrop()
M.toast({html: 'Songs Added', classes: 'rounded'})
ipcRenderer.send('lib', pathLib)
// setPath(path)
}
)
});
document.addEventListener('dragover', function (e) {
e.preventDefault();
e.stopPropagation();
});