]> gitweb.factorcode.org Git - factor.git/commitdiff
twitter.prettyprint: Add user-profile.
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 13 Feb 2014 04:12:54 +0000 (20:12 -0800)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 13 Feb 2014 04:13:10 +0000 (20:13 -0800)
extra/twitter/prettyprint/prettyprint.factor

index 21b2426339e0d4018df5ea700862478092303b55..26f9f89eb742cfb079dd7efccca7877d3834756b 100644 (file)
@@ -1,6 +1,6 @@
 USING: accessors continuations fry http.client images.loader
 images.loader.private images.viewer io io.styles kernel memoize
-prettyprint sequences twitter ;
+prettyprint sequences twitter assocs ;
 IN: twitter.prettyprint
 
 MEMO: load-http-image ( url -- image/f )
@@ -31,6 +31,20 @@ CONSTANT: tweet-metadata-style
         { font-size 10 }
     } 
 
+: profile. ( user -- )
+    tweet-table-style [
+        [
+            [ dup "profile_image_url" of load-http-image image. ] with-cell
+            [
+                tweet-username-style [
+                    dup "name" of write nl
+                    dup "screen_name" of write
+                ] with-style
+            ] with-cell
+        ] with-row
+    ] tabular-output nl
+    drop ;
+
 : tweet. ( status -- )
     tweet-table-style [
         [
@@ -55,6 +69,7 @@ CONSTANT: tweet-metadata-style
     ] tabular-output nl
     drop ;
 
+: user-profile.      ( user -- ) user-profile      profile. ;
 : friends-timeline.  ( -- )      friends-timeline  [ tweet. ] each ;
 : public-timeline.   ( -- )      public-timeline   [ tweet. ] each ;
 : user-timeline.     ( user -- ) user-timeline     [ tweet. ] each ;