SF.net SVN: supercollider:[9087] trunk/build/examples/demonstrations/ GetTheTwits.scd

View: New views
1 Messages — Rating Filter:   Alert me  

SF.net SVN: supercollider:[9087] trunk/build/examples/demonstrations/ GetTheTwits.scd

by nescivi-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Revision: 9087
          http://supercollider.svn.sourceforge.net/supercollider/?rev=9087&view=rev
Author:   nescivi
Date:     2009-04-20 22:20:36 +0000 (Mon, 20 Apr 2009)

Log Message:
-----------
added Eric Skogen's script to get all the SuperCollider twitter examples

Added Paths:
-----------
    trunk/build/examples/demonstrations/GetTheTwits.scd

Added: trunk/build/examples/demonstrations/GetTheTwits.scd
===================================================================
--- trunk/build/examples/demonstrations/GetTheTwits.scd                        (rev 0)
+++ trunk/build/examples/demonstrations/GetTheTwits.scd 2009-04-20 22:20:36 UTC (rev 9087)
@@ -0,0 +1,44 @@
+// =====================================================================
+// Twitter is popular amongst some SC users.
+// This is a script to retrieve all the supercollider twits
+// Original code by Eric Skogen, with some tweaks by Marije Baalman (nescivi)
+// =====================================================================
+
+// NOTE: to use this script you need to have installed the Quark: XML
+// See the Quarks helpfile on how to install this Quark.
+// You also need to have "curl" installed on your system.
+
+(
+var p, a, l, d, doc;
+p = Pipe.new(
+  "curl http://search.twitter.com/search.atom?q=%23supercollider+play",
+  "r"
+);
+a = "";
+l = p.getLine;
+while({l.notNil}, {a = a + l; l = p.getLine; });
+p.close;
+
+d = DOMDocument.new;
+d.parseXML(a);
+t = d.getElementsByTagName("entry").collect { |e|
+
+  "// by " + e.getElementsByTagName("author").first
+          .getElementsByTagName("name").first.getText() + ":\n" +
+
+  e.getElementsByTagName("title").first.getText()
+
+};
+
+Document( "supercollider tweets", "// #supercollider tweets\n\n\n" +
+  t.join("\n\n\n\n")).syntaxColorize;
+)
+
+
+
+// THE CAVEAT SLIDE
+// a slight delay is to be expected, to await the gathering of twitters' reply.
+// (do not be alarmed. all part of the show, my friends)
+// oh and yeah you'll need the XML Quark
+// (http://quarks.svn.sourceforge.net/viewvc/quarks/XML/)
+// and it only works if you can run Pipe


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

_______________________________________________
sc-dev mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-dev/
search: http://www.listarc.bham.ac.uk/lists/sc-dev/search/