git ssb

16+

Dominic / patchbay



Tree: bc807ef7bb9327316c4fba7c60dc237ba3879140

Files: bc807ef7bb9327316c4fba7c60dc237ba3879140 / modules / music-release-cc.js

2436 bytesRaw
1var markdown = require('ssb-markdown');
2var h = require('hyperscript');
3var u = require('../util');
4var ref = require('ssb-ref');
5
6//render a message
7
8var plugs = require('../plugs');
9var message_link = plugs.first(exports.message_link = []);
10var message_confirm = plugs.first(exports.message_confirm = []);
11var sbot_links = plugs.first(exports.sbot_links = []);
12var blob_url = plugs.first(exports.blob_url = []);
13
14exports.message_content = function(msg, sbot) {
15 if (msg.value.content.type !== 'music-release-cc')
16 return;
17
18 var tracks = msg.value.content.tracks;
19 return h('div',
20 h('img', { "src" : blob_url(msg.value.content.cover) }),
21 h('h1', msg.value.content.title),
22 h('ol',
23 Object.keys(tracks).map(function(k) {
24 var t = tracks[k];
25 return h('li', t.fname,
26 h("br"),
27 h('audio', {
28 "controls" : true,
29 "src" : blob_url(t.link)
30 }))
31 })),
32 h('p',
33 "More info:", h('a', { href : msg.value.content.archivedotorg }, "archive.org"),
34 h("br"),
35 "License:", h('a', { href : msg.value.content.license }, "Link")))
36}
37
38// copied from like.js
39
40// inspiration for waveform range selection
41
42// idea: handout invite codes for upload of tracks to be cached by the pub
43
44// exports.message_meta = function (msg, sbot) {
45
46// var yupps = h('a')
47
48// pull(
49// sbot_links({dest: msg.key, rel: 'vote'}),
50// pull.collect(function (err, votes) {
51// if(votes.length === 1)
52// yupps.textContent = ' 1 yup'
53// if(votes.length)
54// yupps.textContent = ' ' + votes.length + ' yupps'
55// })
56// )
57
58// return yupps
59// }
60
61// exports.message_action = function (msg, sbot) {
62// if(msg.value.content.type !== 'vote')
63// return h('a', {href: '#', onclick: function () {
64// var yup = {
65// type: 'vote',
66// vote: { link: msg.key, value: 1, expression: 'yup' }
67// }
68// if(msg.value.content.recps) {
69// yup.recps = msg.value.content.recps.map(function (e) {
70// return e && typeof e !== 'string' ? e.link : e
71// })
72// yup.private = true
73// }
74// //TODO: actually publish...
75
76// message_confirm(yup)
77// }}, 'yup')
78
79// }
80
81

Built with git-ssb-web