Files
Mind-Expanding-Books/utils
PhilipWright96 e86b26a72e Make book reviews up to date (#321)
* Fix import typo

* Fix import typo

* Add yml file to schedule github action

* Undo import changes

* Formatting

* Fix imports

* Imports

* Add file extension

* Kick on branch

* Try using py

* Attempt adding semicolons

* Temporarily remove python call

* Remove space

* Leave only one line in

* Refactor syntax

* Update yml syntax

* Test

* Test

* Test

* Test

* Add import

* Add bs4 module

* Refactor yml

* Add missing quotation marks

* Cat newly created file for testing purposes

* Sort indents

* Properly sort indents

* Add extra import

* Update import

* Update JSON files

* Use secrets for API keys

* Update json

* Update JSON files

* Reorganize workflow

* Move into right directory

* Fix order

* Update JSON files

* Attempt to change account which makes commits

* Kick job

* Update JSON files

* Attempt commit with new bot email

* Kick

* Attempt new kick

* Update JSON files

* Attempt removing email

* Change for kick

* Update JSON files

* Re-add email

* Update JSON files

* Check pwd of github VM

* Update JSON files

* Attempt copying updating books.json to app data

* Update JSON files

* Remove the onpush setting

* Update install method

* Replace touch with just echo call

* Update JSON files

* Remove cat

* Rename email

* Stage individual files instead of all

* Update JSON files

Co-authored-by: Philip Wright <wrightphilip4@gmail.com.github.com>
Co-authored-by: Mind Expanding Books Bot <mindexpandingbooks@gmail.com.github.com>
Co-authored-by: mindexpandingbooksbot <runner@fv-az70-910.gpy01byny0buvbolry2rpgzvkd.bx.internal.cloudapp.net>
Co-authored-by: mindexpandingbooksbot <mindexpandingbooksbot@users.noreply.github.com>
2020-11-30 00:06:31 +05:30
..
2020-11-30 00:06:31 +05:30
2020-10-25 12:43:36 +05:30
2020-10-25 12:43:36 +05:30
2020-08-23 15:34:58 +05:30
2020-08-23 15:34:58 +05:30
2020-08-23 15:34:58 +05:30

utils/ mainly contains scripts for generating app/src/data/books.json file from README.md

In most cases, you don't want to run the scripts in this directory or make changes to it. The only time you want to mess with the scripts is when you want to fetch some extra data from API or want to update the app/src/data/books.json file to include a newly added book or category.

Generating app/src/data/books.json

The website shows name of the book, year, rating, cover, amazon link, etc in book card. Some of the data like name, year, rating etc is present in the main README.md. Other details like cover photo, amazon link etc is fetched from various APIs.

The script that fetches all these extra data lives in utils/update_json_files.py

The script goes through all the books in main README.md and starts fetching the extra details from Goodreads and Google Search API. And the result is stored in utils/books.json and utils/book_name_to_details.json (used for caching only).

Once the script completes the run, the utils/books.json file is copied to app/src/data/books.json manually.

And the website uses the data from app/src/data/books.json for generating the pages.

Install packages for script

cd utils
virtualenv .
source bin/activate
pip install -r requirements.txt

Executing the script

  • Register at goodreads
  • Apply for a developer api here
  • Copy utils/config-sample.py as utils/config.py
  • Fill in the API Key credentials