Giter Site home page Giter Site logo

p2k's Introduction

P2K (Pocket to Kindle)

P2K (Pocket to Kindle) is a Rails application that sends articles from your Pocket to Kindle e-reader.

Build Status Coverage Status Dependency Status

Currently live at http://p2k.co

Author: Emir Aydin - http://emiraydin.com

Personal Note: This is my first 'official' Rails app, so if you spot any problems or you know a better practice, please let me know.

Setup Instructions

To make this application run, you'll need to add 2 more files that I couldn't put in this repo since they contain sensitive infomation.

1. config/application.yml

This file stores all your application passwords and constants. Get your Pocket API key here: http://getpocket.com/developer/

Create a file named application.yml inside /config folder. It should look something like this:

# config/application.yml
# This file stores all the application constants

defaults: &defaults
  POCKET_CONSUMER_KEY: "YOUR_POCKET_API_KEY"
  READABILITY_PARSER_KEY: "YOUR_READABILITY_API_KEY"
  DIFFBOT_API_KEY: "YOUR_DIFFBOT_API_KEY"
  DELIVERY_EMAIL_SMTP: "smtp.mymailprovider.com"
  DELIVERY_EMAIL_PORT: portnumber
  DELIVERY_EMAIL_ADDRESS: "[email protected]"
  DELIVERY_EMAIL_PASSWORD: "passfor-delivery@myapp"
  MANDRILL_API_KEY: "YOUR_MANDRILL_API_KEY"

development:
  <<: *defaults
  APP_PATH: "http://localhost:3000"
  POCKET_REDIRECT_URI: "http://localhost:3000/welcome/home"
  DATABASE_HOST: "localhost"
  DATABASE_USERNAME: "my-db-username"
  DATABASE_PASSWORD: "my-db-password"

test:
  <<: *defaults
  DATABASE_HOST: "localhost"
  DATABASE_USERNAME: "my-test-username"
  DATABASE_PASSWORD: "my-test-password"

production:
  <<: *defaults
  APP_PATH: "http://myapp.com"
  POCKET_REDIRECT_URI: "http://myapp.com/welcome/home"
  DATABASE_HOST: "SOME IP"
  DATABASE_USERNAME: "my-db-username"
  DATABASE_PASSWORD: "my-db-password"

2. config/secrets.yml

This file contains application secrets for all your Rails environments. You can generate them using rake secret command.

development:
  secret_key_base: PUT-SOME-HASH-HERE

test:
  secret_key_base: PUT-SOME-HASH-HERE

# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
  secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

Dependencies

1. Kindlegen application

We need Kindlegen application to parse our ebook into MOBI format, which will then be delivered to the users. I'm using the Kindlerb gem to download and operate the Kindlegen executable, so please make sure you follow the gem documentation here for setup: https://github.com/emiraydin/kindlerb.

2. ImageMagick for image compression and optimization

This application uses [ImageMagick] (http://www.imagemagick.org/script/binary-releases.php) to optimize and compress images before putting it into a Kindle supported ebook file. You'll need the ImageMagick binaries in order to make the convert command work.

3. Parsing Articles

I'm using Diffbot Article API and Readability Parser API interchangeably to parse articles properly before sending them to Kindle. Make sure you get your API keys and put them in your config/application.yml as shown above.

4. Cron jobs for deliveries

This application uses [whenever] (https://github.com/javan/whenever) gem to run cron jobs for deliveries. You need to run the command whenever -i inside your application directory in order to update your crontab file and start deliveries.

If you don't want to use whenever gem, you can use Unix cronjobs by typing the command crontab -e and adding the line below: 0 * * * * /home/username/cronjob.sh >> /home/username/logfile.log 2>&1

Your cronjob.sh will look something like this:

#!/bin/bash
# Add Ruby to PATH (necessary for some installations)
export PATH=$PATH:/usr/local/bin
# Run the delivery processor
cd /home/username/app && rails runner -e production "DeliveryProcessor.check"

License

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

p2k's People

Contributors

emiraydin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

p2k's Issues

Cannot access p2k account

When I go to p2k.co, I am redirected to https://p2k.co/plan/choose

When I enter my email address that I previously signed up with, it gives me a warning saying that email address exists.

Because of this, I cannot edit my deliveries.

Robust practice

You probably should add some cucumber test just to ensure that your app is stable

  • test it with ci like (travis or semphore, circle ci), that will help other people to help you.

Generate image for the first page

Hello,
Nice work !

I would like tu propose an improvement, currently when a document is sent to kindle, the image is very generic. I would like to propose a image generated from top 10 words of the document or from its titles in order to simplify browsing et differentiate 2 different document. What do you think ?

Option to download book instead of email

It would be useful to be able to download the output rather than emailing to the kindle address.
This would enable a larger number of articles to be fetched and uploaded to the device (via Calibre for example)

Getting blank deliveries

Hi! First, thanks for the service, it is very cool.

Since a Month or so i'm receiving some blank deliveries on my Kindle.

Delivering articles with specific tag

Hi Emir,

what about adding functionality to deliver articles using the given tag? I consider such feature as pretty useful, even for one time delivery.

Cheers

https://p2k.co down

Error message on website:

"We're sorry, but something went wrong.

If you are the application owner check the logs for more information."

Could you kindly see what's going on in the past few hours? I am a paying customer. Thank you!

remember Kindle email address

Particularly an issue for people like me who don't want automated sending.

I'm not sure whether you're storing state in your app -- if not, I imagine a cookie would work OK?

deliver _oldest_ option

As a person who uses Pocket as a queue, not a stack, I would like there to be an option to deliver the oldest instead of most recent articles. Could be implemented as another radio button, or as a toggle that affects the N Articles and M Minutes options.

Insert links to favorite and archive the content

It would be interesting to do the same readability, which in each content, put two links:

  • Favorite this article;
  • Archive this article.

Thus, the kindle itself, would be able to label and archive any item you want to search in the future.

fail with better error message if payload is too large for Amazon

Hi, I'm using your hosted service. So far it's worked once, but currently I get an error:

We're sorry, but something went wrong.
If you are the application owner check the logs for more information.

I'm attempting to send the latest 20 articles. Oh, I just tried a time-limited bucket of articles, and it worked. I wonder if I hit a capacity limit somewhere? Anyway, there's a bug. I'm happy to provide additional information if I can! Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.