git ssb

0+

ev / microbay



forked from Dominic / patchbay

Commit 1d2a8b5a23e6c1810b78b10c60f7c1a05c9d76ae

get cyphertunes working

Dominic Tarr committed on 7/25/2016, 6:25:33 AM
Parent: 0421b743029a777a497ace8139b0c5f576195292
Parent: 1a2e89c1945e9b2330e4834a9e544adbc12b171d

Files changed

.gitignorechanged
modules/index.jschanged
modules/suggest-mentions.jschanged
modules/audio-mp3.jsadded
modules/meta-image.jsadded
modules/music-release-cc.jsadded
modules/music-release.jsadded
package.jsonchanged
.gitignoreView
@@ -1,5 +1,4 @@
11 node_modules
22 npm-debug.log
33 .npmignore
44 build
5-
modules/index.jsView
@@ -1,8 +1,9 @@
11 module.exports = {
22 "_screen_view.js": require('./_screen_view.js'),
33 "about.js": require('./about.js'),
44 "avatar-edit.js": require('./avatar-edit.js'),
5+ "audio-mp3.js": require('./audio-mp3.js'),
56 "avatar-image.js": require('./avatar-image.js'),
67 "avatar-profile.js": require('./avatar-profile.js'),
78 "avatar.js": require('./avatar.js'),
89 "blob-url.js": require('./blob-url.js'),
@@ -20,8 +21,11 @@
2021 "message-confirm.js": require('./message-confirm.js'),
2122 "message-link.js": require('./message-link.js'),
2223 "message-name.js": require('./message-name.js'),
2324 "message.js": require('./message.js'),
25+ "meta-image.js": require('./meta-image.js'),
26+ "music-release-cc.js": require('./music-release-cc.js'),
27+ "music-release.js": require('./music-release.js'),
2428 "names.js": require('./names.js'),
2529 "notifications.js": require('./notifications.js'),
2630 "post.js": require('./post.js'),
2731 "private.js": require('./private.js'),
@@ -37,4 +41,7 @@
3741 }
3842
3943
4044
45+
46+
47+
modules/suggest-mentions.jsView
@@ -4,8 +4,9 @@
44 return /\.(gif|jpg|png|svg)$/i.test(filename)
55 }
66
77 var sbot_links2 = require('../plugs').first(exports.sbot_links2 = [])
8+var blob_url = require('../plugs').first(exports.blob_url = [])
89
910 exports.suggest = cont.to(function (word, cb) {
1011 if(!/^[@%&!]/.test(word[0])) return cb()
1112 if(word.length < 2) return cb()
@@ -32,12 +33,13 @@
3233 return {
3334 title: e.name + ': ' + e.id.substring(0,10)+' ('+e.rank+')',
3435 value: embed+'['+e.name+']('+e.id+')',
3536 rank: e.rank,
36- image: isImage(e.name) ? 'http://localhost:7777/'+e.id : undefined
37+ image: isImage(e.name) ? blob_url(e.id) : undefined
3738 }
3839 })
3940 cb(null, ary)
4041 })
4142 )
4243 })
4344
45+
modules/audio-mp3.jsView
@@ -1,0 +1,51 @@
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+var plugs = require('../plugs');
9+var message_link = plugs.first(exports.message_link = []);
10+var message_confirm = plugs.first(exports.message_confirm = []);
11+var sbot_links = plugs.first(exports.sbot_links = []);
12+var blob_url = plugs.first(exports.blob_url = []);
13+
14+exports.message_content = function(msg, sbot) {
15+ if (msg.value.content.type !== 'audio-mp3')
16+ return;
17+
18+ var v = msg.value.content;
19+ return h('div',
20+ h('h2', "(" + v.Track + ") " + v.Title),
21+ // h('img', { "src" : blob_url(v.cover) }),
22+ h('audio', {
23+ "controls" : true,
24+ "src" : blob_url(v.link)
25+ }))
26+ // h('dl',
27+ // Object.keys(v).map(function(k) {
28+ // return [
29+ // h("dt", k),
30+ // h("dd", v[k]),
31+ // ]
32+ // })))
33+
34+ // "Album": "the fall of",
35+ // "Crc32": "038becab",
36+ // "Creator": "bleupulp",
37+ // "Format": "VBR MP3",
38+ // "Height": "0",
39+ // "Length": "375.23",
40+ // "Md5": "2c517c8e813da5f940c8c7e77d4b7f3f",
41+ // "Mtime": "1399498698",
42+ // "Name": "2_bleupulp_-_clouds.mp3",
43+ // "Sha1": "9f6a96a3d5571ed1ec2a7da38ffebdcd5f181482",
44+ // "Size": "15009000",
45+
46+ // "Title": "clouds",
47+ // "Track": "2",
48+ // "Width": "0",
49+
50+}
51+
modules/meta-image.jsView
@@ -1,0 +1,48 @@
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+var plugs = require('../plugs');
9+var message_link = plugs.first(exports.message_link = []);
10+var message_confirm = plugs.first(exports.message_confirm = []);
11+var sbot_links = plugs.first(exports.sbot_links = []);
12+var blob_url = plugs.first(exports.blob_url = []);
13+
14+exports.message_content = function(msg, sbot) {
15+ if (msg.value.content.type !== 'meta-image')
16+ return;
17+
18+ var v = msg.value.content;
19+ return h('div',
20+ // h('h2', "(" + v.Track + ") " + v.Title),
21+ h('img', { "src" : blob_url(v.link) }))
22+
23+ // h('dl',
24+ // Object.keys(v).map(function(k) {
25+ // return [
26+ // h("dt", k),
27+ // h("dd", v[k]),
28+ // ]
29+ // })))
30+
31+ // "Album": "the fall of",
32+ // "Crc32": "038becab",
33+ // "Creator": "bleupulp",
34+ // "Format": "VBR MP3",
35+ // "Height": "0",
36+ // "Length": "375.23",
37+ // "Md5": "2c517c8e813da5f940c8c7e77d4b7f3f",
38+ // "Mtime": "1399498698",
39+ // "Name": "2_bleupulp_-_clouds.mp3",
40+ // "Sha1": "9f6a96a3d5571ed1ec2a7da38ffebdcd5f181482",
41+ // "Size": "15009000",
42+
43+ // "Title": "clouds",
44+ // "Track": "2",
45+ // "Width": "0",
46+
47+}
48+
modules/music-release-cc.jsView
@@ -1,0 +1,80 @@
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+var plugs = require('../plugs');
9+var message_link = plugs.first(exports.message_link = []);
10+var message_confirm = plugs.first(exports.message_confirm = []);
11+var sbot_links = plugs.first(exports.sbot_links = []);
12+var blob_url = plugs.first(exports.blob_url = []);
13+
14+exports.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+
modules/music-release.jsView
@@ -1,0 +1,41 @@
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+var plugs = require('../plugs');
9+var message_link = plugs.first(exports.message_link = []);
10+var message_confirm = plugs.first(exports.message_confirm = []);
11+var sbot_links = plugs.first(exports.sbot_links = []);
12+
13+exports.message_content = function(msg, sbot) {
14+ if (msg.value.content.type !== 'music-release')
15+ return;
16+
17+ var v = msg.value.content;
18+ return h('div',
19+ // h('img', { "src" : "http://localhost:7777/" + encodeURIComponent(v.cover) }),
20+ h('h1', v.Title),
21+ h("p", v.Description),
22+ h("dl",
23+
24+ h("dt", "Creator"),
25+ h("dd", v.Creator),
26+
27+ h("dt", "Identifier"),
28+ h("dd", v.Identifier),
29+
30+ h("dt", "Published"),
31+ h("dd", v.Publicdate),
32+
33+ h("dt", "Runtime"),
34+ h("dd", v.Runtime),
35+
36+ h("dt", "Source"),
37+ h("dd", v.Source),
38+
39+ h("dt", "License"),
40+ h("dd", h('a', { href : v.Licenseurl }, "Link"))))
41+}
package.jsonView
@@ -19,8 +19,9 @@
1919 "hypertabs": "^1.2.0",
2020 "mime-types": "^2.1.11",
2121 "moment": "^2.13.0",
2222 "open-external": "^0.1.1",
23+ "peaks.js": "^0.4.7",
2324 "pull-cat": "^1.1.9",
2425 "pull-next": "0.0.0",
2526 "pull-paramap": "^1.1.6",
2627 "pull-reconnect": "^0.0.3",

Built with git-ssb-web