Improve documentation, add sample config and readme.

This commit is contained in:
Anna Rose 2016-04-18 16:32:26 -04:00
parent 321d770263
commit 469212c74c
3 changed files with 29 additions and 0 deletions

24
Readme.md Normal file
View File

@ -0,0 +1,24 @@
# serialboard
serialboard is a simple script that uses the <pinboard.in> API to make following web serials (comics, fiction, etc) easy!
## Installation
First install ruby, then just:
$ gem install bundler
$ bundle install
Now copy config.yml.example to config.yml, and edit it to use your Pinboard API key.
## Usage
Read your web serial, and when you get to the end or a stopping place you want to pick up from later, just bookmark the page on pinboard and tag it with your active tag. (by default the active tag is 'serial') You can do this on as many different sites as you want!
To clean up 'old' bookmarks for each domain, just run:
$ ./pinboard.rb
This will 'delete' all but the most recent bookmark for each domain. (actually it just replaces the active tag with the deleted tag, and un-shares the bookmark) For best results, run this in a daily cron job!

3
config.yml.example Normal file
View File

@ -0,0 +1,3 @@
api_token: replace_with_your_api_token
active_tag_name: serial
deleted_tag_name: serial_deleted

View File

@ -26,12 +26,14 @@ serial_posts.sort! { |x,y| y.time <=> x.time }
domains = []
serial_posts.each do |post|
metric[:posts] += 1
# Extract the domain from the full URL
domain = post.href.sub(/^https?:\/\/(.*?)\/.*$/, "\\1")
if !domains.include? domain
# Record that we've seen the domain now.
domains.push domain
else
# If this is a duplicate, soft-delete it.
post.tag.delete config['active_tag_name']
post.tag.push config['deleted_tag_name']
post.shared = false