twitter.prettyprint: Add user-profile.

db4
Doug Coleman 2014-02-12 20:12:54 -08:00
parent bc7680a914
commit 5ad200a41a
1 changed files with 16 additions and 1 deletions

View File

@ -1,6 +1,6 @@
USING: accessors continuations fry http.client images.loader USING: accessors continuations fry http.client images.loader
images.loader.private images.viewer io io.styles kernel memoize images.loader.private images.viewer io io.styles kernel memoize
prettyprint sequences twitter ; prettyprint sequences twitter assocs ;
IN: twitter.prettyprint IN: twitter.prettyprint
MEMO: load-http-image ( url -- image/f ) MEMO: load-http-image ( url -- image/f )
@ -31,6 +31,20 @@ CONSTANT: tweet-metadata-style
{ font-size 10 } { 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. ( status -- )
tweet-table-style [ tweet-table-style [
[ [
@ -55,6 +69,7 @@ CONSTANT: tweet-metadata-style
] tabular-output nl ] tabular-output nl
drop ; drop ;
: user-profile. ( user -- ) user-profile profile. ;
: friends-timeline. ( -- ) friends-timeline [ tweet. ] each ; : friends-timeline. ( -- ) friends-timeline [ tweet. ] each ;
: public-timeline. ( -- ) public-timeline [ tweet. ] each ; : public-timeline. ( -- ) public-timeline [ tweet. ] each ;
: user-timeline. ( user -- ) user-timeline [ tweet. ] each ; : user-timeline. ( user -- ) user-timeline [ tweet. ] each ;