Improve documentation, add sample config and readme.
This commit is contained in:
parent
321d770263
commit
469212c74c
24
Readme.md
Normal file
24
Readme.md
Normal 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
3
config.yml.example
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
api_token: replace_with_your_api_token
|
||||||
|
active_tag_name: serial
|
||||||
|
deleted_tag_name: serial_deleted
|
|
@ -26,12 +26,14 @@ serial_posts.sort! { |x,y| y.time <=> x.time }
|
||||||
domains = []
|
domains = []
|
||||||
serial_posts.each do |post|
|
serial_posts.each do |post|
|
||||||
metric[:posts] += 1
|
metric[:posts] += 1
|
||||||
|
# Extract the domain from the full URL
|
||||||
domain = post.href.sub(/^https?:\/\/(.*?)\/.*$/, "\\1")
|
domain = post.href.sub(/^https?:\/\/(.*?)\/.*$/, "\\1")
|
||||||
|
|
||||||
if !domains.include? domain
|
if !domains.include? domain
|
||||||
# Record that we've seen the domain now.
|
# Record that we've seen the domain now.
|
||||||
domains.push domain
|
domains.push domain
|
||||||
else
|
else
|
||||||
|
# If this is a duplicate, soft-delete it.
|
||||||
post.tag.delete config['active_tag_name']
|
post.tag.delete config['active_tag_name']
|
||||||
post.tag.push config['deleted_tag_name']
|
post.tag.push config['deleted_tag_name']
|
||||||
post.shared = false
|
post.shared = false
|
||||||
|
|
Loading…
Reference in New Issue
Block a user