Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Book Submissions #114

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Book Submissions #114

wants to merge 8 commits into from

Conversation

znedw
Copy link
Collaborator

@znedw znedw commented Oct 20, 2020

  • Goodreads & Google Books integration working
  • Description generation working
  • Upload form untested

image

@znedw znedw force-pushed the feature/books branch 4 times, most recently from 1d8468e to 91aedde Compare October 20, 2020 07:29
@znedw
Copy link
Collaborator Author

znedw commented Oct 20, 2020

Okay squashed, tested (working) and ready to review, thoughts please @mueslo?

Things I don't like:

  • pycountry package just to workout the book language from a 3 letter code, we really only need an iso-639 lookup list
    Goodreads gives us 'eng' and Google Books gives me 'en'. I'd rather the full-name of the language, so that's why it's here
  • Goodreads description has HTML in it, right now it's regex'd out, but we could do some html2bbcode to preserve formatting (which would be nice)
  • calibre dependency for ebook-meta, the less-nice way is to just fail gracefully and let the user input the isbn manually (which they're able to do now)
  • no Edition Note, not sure how to do this based on what Goodreads is giving me
  • tags are not so great, might need another source, there's no specific flag anywhere for fiction or non-fic and it's only sometimes in the Google Books categories
  • cover art from Google Books (as Goodreads can't/won't distribute cover art) is tiny
  • no tests

Resolves #91

@znedw znedw changed the title WIP - DO NOT MERGE Feature: eBook uploads Book Submissions Oct 20, 2020
@mueslo mueslo added the enhancement New feature or request label Oct 20, 2020
@mueslo mueslo linked an issue Oct 20, 2020 that may be closed by this pull request
@mueslo
Copy link
Owner

mueslo commented Oct 20, 2020

Awesome work! I will try to look over it as soon as possible.

pythonbits/bb.py Outdated Show resolved Hide resolved
@mueslo
Copy link
Owner

mueslo commented Oct 20, 2020

Any chance to add some sort of automatic subcategorisation logic like is present for video/audio?

for _, path in sorted(files, reverse=True):
mime_guess, _ = guess_type(path)
if mime_guess:
mime_guess = mime_guess.split('/')
if mime_guess[0] == 'video':
return VideoSubmission
elif mime_guess[0] == 'audio':
return AudioSubmission

@znedw
Copy link
Collaborator Author

znedw commented Oct 20, 2020

Any chance to add some sort of automatic subcategorisation logic like is present for video/audio?

for _, path in sorted(files, reverse=True):
mime_guess, _ = guess_type(path)
if mime_guess:
mime_guess = mime_guess.split('/')
if mime_guess[0] == 'video':
return VideoSubmission
elif mime_guess[0] == 'audio':
return AudioSubmission

Interesting, let me try and see what I can do!

Comment on lines +19 to +22
EXCLUDED_WORDS = ['read', 'favorites', 'book',
'own', 'series', 'novel', 'kindle', 'shelf'
'library', 'buy', 'abandoned',
'audible', 'audio', 'finish', 'wish']
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh i think it would be a better idea to have a whitelist instead, if there are so many shitty tags

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not too bad, I think an allow-list would be too hard as there's lots and lots of genres...

This is what comes back for Dune:

<popular_shelves>
<shelf name="to-read" count="498223"/>
<shelf name="currently-reading" count="54844"/>
<shelf name="science-fiction" count="13384"/>
<shelf name="sci-fi" count="12220"/>
<shelf name="favorites" count="8088"/>
<shelf name="fiction" count="6904"/>
<shelf name="fantasy" count="4244"/>
<shelf name="classics" count="3383"/>
<shelf name="scifi" count="2661"/>
<shelf name="owned" count="2454"/>
<shelf name="sci-fi-fantasy" count="1304"/>
<shelf name="books-i-own" count="974"/>
<shelf name="sf" count="937"/>
<shelf name="classic" count="789"/>
<shelf name="series" count="729"/>
<shelf name="audiobook" count="687"/>
<shelf name="dune" count="659"/>
<shelf name="scifi-fantasy" count="531"/>
<shelf name="space-opera" count="528"/>
<shelf name="fantasy-sci-fi" count="528"/>
<shelf name="audiobooks" count="505"/>
<shelf name="favourites" count="489"/>
<shelf name="novels" count="479"/>
<shelf name="kindle" count="468"/>
<shelf name="library" count="454"/>
<shelf name="default" count="443"/>
<shelf name="owned-books" count="395"/>
<shelf name="adventure" count="377"/>
<shelf name="to-buy" count="363"/>
<shelf name="dnf" count="344"/>
<shelf name="book-club" count="334"/>
<shelf name="science-fiction-fantasy" count="333"/>
<shelf name="abandoned" count="324"/>
<shelf name="audible" count="320"/>
<shelf name="adult" count="307"/>
<shelf name="audio" count="281"/>
<shelf name="speculative-fiction" count="273"/>
<shelf name="re-read" count="271"/>
<shelf name="space" count="264"/>
<shelf name="novel" count="252"/>
<shelf name="ebook" count="243"/>
<shelf name="did-not-finish" count="243"/>
<shelf name="my-library" count="237"/>
<shelf name="tbr" count="236"/>
<shelf name="literature" count="233"/>
<shelf name="epic" count="228"/>
<shelf name="great-american-read" count="219"/>
<shelf name="my-books" count="214"/>
<shelf name="sci-fi-and-fantasy" count="210"/>
<shelf name="books" count="207"/>
<shelf name="frank-herbert" count="207"/>
<shelf name="fantasy-scifi" count="206"/>
<shelf name="all-time-favorites" count="203"/>
<shelf name="unfinished" count="203"/>
<shelf name="science" count="196"/>
<shelf name="american" count="187"/>
<shelf name="on-hold" count="180"/>
<shelf name="20th-century" count="171"/>
<shelf name="english" count="160"/>
<shelf name="read-in-2020" count="158"/>
<shelf name="sff" count="158"/>
<shelf name="hugo-award" count="154"/>
<shelf name="favorite" count="154"/>
<shelf name="hugo" count="153"/>
<shelf name="sf-fantasy" count="153"/>
<shelf name="wish-list" count="152"/>
<shelf name="adult-fiction" count="146"/>
<shelf name="ebooks" count="144"/>
<shelf name="recommended" count="141"/>
<shelf name="dystopian" count="141"/>
<shelf name="reread" count="138"/>
<shelf name="favorite-books" count="138"/>
<shelf name="bookshelf" count="134"/>
<shelf name="fantascienza" count="132"/>
<shelf name="ciencia-ficción" count="130"/>
<shelf name="dystopia" count="129"/>
<shelf name="audio-books" count="127"/>
<shelf name="maybe" count="125"/>
<shelf name="religion" count="124"/>
<shelf name="read-2020" count="123"/>
<shelf name="i-own" count="123"/>
<shelf name="to-read-fiction" count="123"/>
<shelf name="must-read" count="118"/>
<shelf name="audio-book" count="115"/>
<shelf name="the-great-american-read" count="114"/>
<shelf name="to-re-read" count="112"/>
<shelf name="ciencia-ficcion" count="110"/>
<shelf name="nebula-award" count="110"/>
<shelf name="own-it" count="107"/>
<shelf name="to-reread" count="106"/>
<shelf name="owned-tbr" count="104"/>
<shelf name="hugo-winners" count="104"/>
<shelf name="home-library" count="103"/>
<shelf name="science-fiction-and-fantasy" count="103"/>
<shelf name="nebula" count="101"/>
<shelf name="physical-tbr" count="99"/>
<shelf name="paperback" count="99"/>
<shelf name="politics" count="99"/>
<shelf name="war" count="99"/>
<shelf name="sf-masterworks" count="98"/>
</popular_shelves>

@znedw
Copy link
Collaborator Author

znedw commented Dec 13, 2020

Goodreads API is now dead
https://www.goodreads.com/api
https://joealcorn.co.uk/blog/2020/goodreads-retiring-API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Books
2 participants