diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..c3b60ae --- /dev/null +++ b/Readme.md @@ -0,0 +1,24 @@ +# serialboard + +serialboard is a simple script that uses the 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! diff --git a/config.yml.example b/config.yml.example new file mode 100644 index 0000000..875fd87 --- /dev/null +++ b/config.yml.example @@ -0,0 +1,3 @@ +api_token: replace_with_your_api_token +active_tag_name: serial +deleted_tag_name: serial_deleted diff --git a/serialboard.rb b/serialboard.rb index 13be70d..ac411ea 100755 --- a/serialboard.rb +++ b/serialboard.rb @@ -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