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