Coder Social home page Coder Social logo

agorf / what2read Goto Github PK

View Code? Open in Web Editor NEW
26.0 3.0 0.0 230 KB

Lightweight interface to Goodreads books with weighted scoring and sorting

License: MIT License

Ruby 72.72% HTML 20.34% CSS 4.50% Shell 0.28% Dockerfile 2.16%
books goodreads goodreads-api server rating score

what2read's Introduction

what2read

Given the shortage of time and the abundance of great books, it makes sense to read books in order of importance. what2read helps you answer a very specific question: "Which book should I read next?"

This is how it looks like:

screenshot

It consists of three scripts:

bin/generate-oauth-access-token

Facilitates in creating the necessary OAuth access tokens for the Goodreads API. It is run once (see Configuration for more info).

bin/import-books

Accesses your bookshelves on Goodreads and imports books into an SQLite database. It also downloads book covers from Goodreads, OpenLibrary and Google (fallbacks). When run more than once, it re-imports books but skips covers that have already been downloaded.

config.ru

Sets up an HTTP server listing books in sortable columns: title, authors, ISBN, pages, score, rating, ratings, shelves.

score is an additional calculated column that takes into account both a book's average rating and number of ratings, giving a more accurate estimate of its standing.

Installation

Clone the repo:

$ git clone https://github.com/agorf/what2read.git
$ cd what2read

With Docker, you don't need Ruby, Bundler, Gems etc. Just build the image:

$ docker-compose build what2read

If you don't have Docker, install the necessary Gems with Bundler:

$ bundle install

Configuration

You need to do the following only once.

Step 1: Create an environment file

$ cp .env.sample .env
$ chmod go-r .env # so that other users cannot read it

Step 2: Create a Goodreads API key

Visit Goodreads and apply for a developer API key. Copy the key and the secret and set them as GOODREADS_API_KEY and GOODREADS_API_SECRET in the .env file respectively.

Step 3: Set the Goodreads user ID

Visit Goodreads and go to your profile page. Copy your numeric user ID from the URL and set it as GOODREADS_USER_ID in the .env file.

Note that this works for any Goodreads user id you're connected with.

Step 4: Create an OAuth access token

With Docker:

$ docker-compose run --rm what2read ./bin/generate-oauth-access-token

Without Docker:

$ bundle exec ruby bin/generate-oauth-access-token

Follow the printed instructions:

Open https://www.goodreads.com/oauth/authorize?oauth_token=... in a browser

Press ENTER after you have authorized the app

Place the following into your `.env` file:

OAUTH_ACCESS_TOKEN=...
OAUTH_ACCESS_SECRET=...

Copy the last two lines and place them in the .env file, replacing the existing ones that are empty.

You are now ready to use the script.

Usage

Import or re-import books with Docker:

$ docker-compose run --rm what2read ./bin/import-books

Without Docker:

$ bundle exec ruby -I lib bin/import-books

Run the server with Docker:

$ docker-compose up what2read

Without Docker:

$ bundle exec rackup -I lib

Press Ctrl-C to stop the server.

View the books:

$ xdg-open http://localhost:9292/

License

MIT

Author

Angelos Orfanakos, https://agorf.gr/

what2read's People

Contributors

agorf avatar dependabot[bot] 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

Watchers

 avatar  avatar  avatar

what2read's Issues

Adding the ability for the front end to prompt authorisation

Awesome project! Setup was really easy.

Is there any plan to add some kind of authorisation through the front end? So that I can host it then share it with my family and friends (without having to have them as friends on goodreads)?

I am assuming that this would be a large piece of work because it would mean generating the books during server runtime rather than in an automated script?

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.