This is a personal project to learn more Django, to try out Svelte and of course for the love of books!
Make sure to make migrations before starting.
Start django server:
python manage.py runserver
Start Svelte:
npm run dev
Place the CSV-file in /books folder
Change name to your filename in base = str(BASE_DIR) + "/books/booksfile.csv"
in the utils.py file in /books/
When requsting the http://127.0.0.1:8000/
page it will start add the data to the sqlite3 db.
It will only run if there are no books in the database at the moment so to add new books you have to clean the db and then add the new CSV-file.
After that it will start fetching the prices, Read about it the Price component below.
You can view the page at http://localhost:5173/
The start page that loads the other components
Renders the total number of read books, to read books and currently reading books.
Draws a graph of the number of books read in every year. You can configure this to match your data-set better in the /books/models.py years() function.
Make a Pie chart of all the book-shelvs you have on goodreads. You can choose which shelves to be included in /books/models.py category() function
Calculates a bunch of data about all the pages of the books read.
See how many books you read each month every year and compare them. Also see what months in total that most books are read. Change the years to graph in the months() function in /books/models.py
Scrappes Amazon for book prices based on the title of the book. For about every 100th book Amazon will stop the scrapping. Then in /books/utils.py searchBookPrice() function just change opener.addheaders = [('User-agent', 'Mozilla/4.8')]
to another version and reload and it will keep adding more books. Also since it just uses the title of the book for searching you might get some wrong prices, however this is meant only to give an estimate of the total book price
Gets a random book that has a 5 in user-rating and displays it. The Cover page is loaded from the Openlibrary API if it finds any.
I would be grateful for questions or suggestions. If you know any other similar Goodread data-analyzer please contact me.
Feel free to use code in any way, Thanks for reading.