--- a/js/playscreen.js Fri Mar 22 17:54:46 2013 +0100
+++ b/js/playscreen.js Wed Mar 27 17:42:35 2013 +0100
@@ -5,7 +5,9 @@
var deltaT = new Date("Wed, 02 May 2012 19:00:00 +0000") / 1000 + adjust;
function solrUrl(table, params) {
- return "http://159.217.144.101:8050/sia-solr/" + table + "/select?" + $.param(params) + "&wt=json&json.wrf=?";
+ var u = "http://159.217.144.101:8050/sia-solr/" + table + "/select?" + $.param(params) + "&wt=json&json.wrf=?";
+ console.log(u);
+ return u;
}
function showData() {
@@ -541,6 +543,17 @@
return b.topic.weight - a.topic.weight;
});
+ if (tweetstoshow.length < 8) {
+ var randtweets = data.randomtweets.filter(function(tw) {
+ return (tw.timestamp > (localpos - localduration / 2)) && (tw.timestamp < (localpos + localduration / 2))
+ });
+ var mod = Math.ceil(randtweets.length / 8);
+ randtweets = randtweets.filter(function(v,k) {
+ return !(k % mod);
+ });
+ tweetstoshow = tweetstoshow.concat(randtweets);
+ }
+
tweetstoshow = tweetstoshow.slice(0,10);
if (selectedWord) {
@@ -903,6 +916,48 @@
loadJson("data/minutes.json", "minutes");
loadJson("data/5secs.json", "fiveseconds");
+ var t = Math.floor(30*Math.random());
+
+ function pad(n) {
+ var r = n.toString();
+ while (r.length < 2) {
+ r = "0" + r;
+ }
+ return r;
+ }
+
+ loadJson(
+ solrUrl(
+ "twitter",
+ {
+ q: "created_at:(*\\:*\\:"
+ + pad(t)
+ + "* OR *\\:*\\:"
+ + (30+t)
+ + "*)",
+ group: "true",
+ "group.field": "created_at",
+ "fl": "id_str,created_at,from_user_name,text,profile_image_url",
+ "rows": 800
+ }
+ ),
+ "randomtweets",
+ function(d) {
+ var randtweets = d.grouped.created_at.groups.map(function(g) {
+ var tweet = g.doclist.docs[0];
+ return {
+ topic: { topic: -1, weight: 0 },
+ timestamp: (new Date(tweet.created_at).valueOf() / 1000 - deltaT),
+ data: tweet
+ }
+ });
+ randtweets.sort(function(a,b) {
+ return a.timestamp - b.timestamp;
+ });
+ return randtweets;
+ }
+ )
+
loadJson(
solrUrl("MMSO", {q: "*:*", fl: "topic*,MMSO_id,multimediaSegment,keywordsFromSocial", rows: 250 }),
"segments",