Skip to content

Instantly share code, notes, and snippets.

@smetj
Created August 21, 2016 11:41
Show Gist options
  • Save smetj/cf30493f90ab10889d408391d7759a72 to your computer and use it in GitHub Desktop.
Save smetj/cf30493f90ab10889d408391d7759a72 to your computer and use it in GitHub Desktop.
---
lookups:
event:
module: wishbone.lookup.event
modules:
input:
module: wishbone.input.twitter
description: Collects events of the authenticated user
arguments:
consumer_key: abcdefghijklmnopqrstuvwxyz
consumer_secret: abcdefghijklmnopqrstuvwxyz
access_token: abcdefghijklmnopqrstuvwxyz
access_token_secret: abcdefghijklmnopqrstuvwxyz
timeline: true
filter_favs:
module: wishbone.flow.jq
description: Filters the the favorite events
arguments:
conditions:
- name: favorites
expression: '(.event | test( "^favorite$" )) and (.source.screen_name | test ( "^smetj$" ))'
queue: outbox
bookmark:
module: wishbone.function.twitterbookmark
description: Extracts the necessary bookmark information from the like
split_type:
module: wishbone.flow.jq
description: Splits url or text bookmarks each to their own queue
arguments:
selection: "@tmp"
conditions:
- name: bookmark
expression: .bookmark.type | test( "^bookmark$" )
queue: bookmark
- name: text
expression: .bookmark.type | test( "^text$" )
queue: text
construct_bookmark:
module: wishbone.function.modify
description: Creates a URL bookmark in the desired format
arguments:
expressions:
- merge: ['@tmp.bookmark.summary', '@tmp.bookmark.tags', '@tmp.bookmark.items']
- join: ['@tmp.bookmark.items', ', ', '@tmp.bookmark.text']
- template: ['@tmp.result', '- {url} ({user}, {text})', '@tmp.bookmark']
- set: ['/home/smetj/Dropbox/Files/notes/url.txt', '@tmp.filename']
construct_text:
module: wishbone.function.modify
description: Creates a text bookmark in the desired format
arguments:
expressions:
- template: ['@tmp.result', '- {date} {user}: {text}', '@tmp.bookmark']
- set: ['/home/smetj/Dropbox/Files/notes/text.txt', '@tmp.filename']
funnel:
module: wishbone.flow.funnel
output:
module: wishbone.output.file
description: Writes the data to the requested file
arguments:
selection: "@tmp.result"
location: ~~event("@tmp.filename")
keep_file_open: false
routingtable:
- input.outbox -> filter_favs.inbox
- filter_favs.outbox -> bookmark.inbox
- bookmark.outbox -> split_type.inbox
- split_type.bookmark -> construct_bookmark.inbox
- construct_bookmark.outbox -> funnel.bookmark
- split_type.text -> construct_text.inbox
- construct_text.outbox -> funnel.text
- funnel.outbox -> output.inbox
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment