-
Notifications
You must be signed in to change notification settings - Fork 10
/
songs-list.js
107 lines (102 loc) · 2.78 KB
/
songs-list.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
107
const WebTorrent = require('webtorrent')
const client = new WebTorrent()
const {ipcRenderer} = require('electron')
require('./ipcRenderer.js')
//magnet:?xt=urn:btih:2f9505e50a48838c7f769c707ed9e29cee2f03ba&dn=%5B2012%5D+Unisonic+-+Unisonic&tr=udp%3A%2F%2Fexodus.desync.com%3A6969&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Fzer0day.ch%3A1337
songs = [
// {
// title: '01 - Cigarrito',
// torrent: 'sadlkjfañlksjfdñlksajdfñlkajsdf',
// index: 1,
// duration: '3:15'
// },
// {
// title: '02 - Tras la barra',
// torrent: 'sadlkjfañlksjfdñlksajdfñlkajsdf',
// index: 1,
// duration: '3:15'
// },
// {
// title: '03 - Alucinante',
// torrent: 'sadlkjfañlksjfdñlksajdfñlkajsdf',
// index: 1,
// duration: '3:15'
// },
// {
// title: '03 - Si la tocas otra vez',
// torrent: 'sadlkjfañlksjfdñlksajdfñlkajsdf',
// index: 1,
// duration: '3:15'
// },
// {
// title: '03 - Un abecedario sin letras',
// torrent: 'sadlkjfañlksjfdñlksajdfñlkajsdf',
// index: 1,
// duration: '3:15'
// },
]
Vue.component('Song', {
template: '\
<div v-bind:class="{ \'light-primary-color\': play, song: notplay}">\
<div class="play-button">\
<i class="material-icons" v-on:click="alert">play_circle_outline</i>\
</div>\
<div class="song-container">\
<a v-on:click="alert" class="song-title primary-text-color"\
style="float: left;"> {{ title }}</a>\
<a style="display: inline-block; float: right"> {{ duration }} </a>\
<p style="font-size: small" class="secondary-text-color"> {{ torrent }} </p>\
</div>\
</div>\
',
props: ['title', 'torrent', 'index', 'duration'],
data: function() {
return {
play: false,
notplay: true
}
},
methods: {
alert: function() {
ipcRenderer.send("play", [this.torrent, this.index, this.title]);
this.play = true;
this.notplay = false;
}
}
})
var magnetInput = new Vue({
el: '#magnet-input',
data: {
magnet: '',
},
methods: {
addMagnet: function() {
ipcRenderer.send('add-torrent', this.magnet)
ipcRenderer.on('update-song', (event, arg) => {
arg.forEach(function(f) {
songs.push(f)
})
})
}
}
})
var example1 = new Vue({
el: '#example-1',
data: {
magnet: '',
songs: songs
},
methods: {
addMagnet: function() {
ipcRenderer.send('add-torrent', this.magnet)
ipcRenderer.on('update-song', (event, arg) => {
arg.forEach(function(f) {
songs.push(f)
})
})
},
log: function(event) {
console.log("play ")
}
}
})