Skip to main content

Ralsina.Me — Roberto Alsina's website

Quick Hack to Catalog your Books

If you have ac­tu­al, pa­per books and want to cat­a­log their in­fo quick­ly, this book­da­ta.py script may be handy:

import sys
import time
import gdata.books.service
import json

def get_book_info(isbn):
    print "Looking for ISBN:", isbn
    google_books = gdata.books.service.BookService()
    result = google_books.search('ISBN %s '%isbn)
    data = [x.to_dict() for x in result.entry]
    if not data:
        print "No results"
        return
    title = data[0]['title']
    with open(title+'.json','w') as f:
        f.write(json.dumps(data))
    print "Guardada info de '%s' en '%s.json'" %(isbn, title)

if __name__ == "__main__":
    while True:
        isbn = sys.stdin.readline().strip()
        if isbn:
            get_book_info(isbn)
        time.sleep(1)

What does it do? It reads IS­BN num­bers from stan­dard in­put and saves the book's in­fo in a ti­tle.j­son file for lat­er pro­cess­ing and for­mat­ting.

If you want to ed­it that in­for­ma­tion, you can just do it or you can try do­ing a lit­tle script us­ing json­wid­get like this:

python -c 'import jsonwidget; jsonwidget.run_editor("abook.json", schemafile="gbooks.schema")'

Where abook.j­son is a file gen­er­at­ed by the pre­vi­ous script and gbook­s.schema is this file.

Oh, and if your books have bar­codes, you can just do:

zbarcam --raw | python bookdata.py

Show your com­put­er your books and let it do the rest :-)

PS: I would love if some­one gath­ered all this and made a nice per­son­al book cat­a­logu­ing thing.

The Arrows of Outrageous Fortune

You know how I know we live in a uni­code world now? Of the 300+ uni­code ar­rows, all dis­play cor­rect­ly by de­fault on Win­dows, Mac and Ubun­tu, ex­cept maybe ~25.

← → ↑ ↓ ↔ ↕ ↖ ↗ ↘ ↙ ↮ ⇦ ⇨ ⇧ ⇩ ⬄ ⇳ ⬀ ⬁ ⬂ ⬃ ⬅ ➡ ⬆ ⬇ ⬈ ⬉ ⬊ ⬋ ⬌ ⬍ ⇐ ⇒ ⇑ ⇓ ⇔ ⇕ ⇖ ⇗ ⇘ ⇙ ⇍ ⇏ ⇎ ⟸ ⟹ ⟺ ↤ ↦ ↥ ↧ ⇤ ⇥ ⤒ ⤓ ↨ ⇆ ⇄ ⇅ ⇵ ⇈ ⇊ ⇇ ⇉ ⇠ ⇢ ⇡ ⇣ ⇚ ⇛ ⤊ ⤋ ⭅ ⭆ ⟰ ⟱ ↩ ↪ ↫ ↬ ↞ ↟ ↠ ↡ ↚ ↛ ↜ ↝ ↢ ↣ ↰ ↱ ↲ ↳ ⬐ ⬎ ⬑ ⬏ ↴ ↵ ↺ ↻ ⥀ ⥁ ⟲ ⟳ ↶ ↷ ⤾ ⤿ ⤸ ⤹ ⤺ ⤻ ↼ ⇀ ↿ ↾ ↽ ⇁ ⇂ ⇃ ⇋ ⇌ ⇜ ⇝ ⇽ ⇾ ⇿ ⟻ ⟼ ⟵ ⟶ ⟷ ⬳ ⟿ ⬱ ⇶ ⥊ ⥋ ⥌ ⥍ ⥎ ⥏ ⥐ ⥑ ⥒ ⥓ ⥔ ⥕ ⥖ ⥗ ⥘ ⥙ ⥚ ⥛ ⥜ ⥝ ⥞ ⥟ ⥠ ⥡ ⥢ ⥣ ⥤ ⥥ ⥦ ⥨ ⥧ ⥩ ⥮ ⥯ ⥪ ⥫ ⥬ ⥭ ⇷ ⇸ ⤉ ⤈ ⇹ ⇺ ⇻ ⇞ ⇟ ⇼ ⬴ ⤀ ⬵ ⤁ ⬹ ⤔ ⬺ ⤕ ⤂ ⤃ ⤄ ⬶ ⤅ ⬻ ⤖ ⬼ ⤗ ⬽ ⤘ ⤆ ⤇ ⤌ ⤍ ⤎ ⤏ ⤙ ⤚ ⤛ ⤜ ⤝ ⤞ ⤟ ⤠ ⤡ ⤢ ⤣ ⤤ ⤥ ⤦ ⤪ ⤨ ⤧ ⤩ ⤭ ⤮ ⤯ ⤰ ⤱ ⤲ ⤫ ⤬ ⥼ ⥽ ⥾ ⥿ ⤶ ⤷ ⤴ ⤵ ⤼ ⤽ ⥂ ⥃ ⥄ ⭀ ⥱ ⥶ ⥸ ⭂ ⭈ ⭊ ⥵ ⭁ ⭇ ⭉ ⥲ ⭋ ⭌ ⥳ ⥴ ⥆ ⥅ ⬷ ⤐ ⬸ ⤑ ⬿ ⤳ ⥹ ⥻ ⬰ ⇴ ⥈ ⬾ ⥇ ⬲ ⟴ ⥷ ⭃ ⥺ ⭄ ⇱ ⇲ ↸ ↹ ↯ ↭ ⥉ ⥰ ☚ ☛ ☜ ☝ ☞ ☟ ◄ ► ⇪ ⇫ ⇬ ⇭ ⇮ ⇯ ⇰ ➔ ➘ ➙ ➚ ➛ ➜ ➝ ➞ ➟ ➠ ➡ ➢ ➣ ➤ ➥ ➦ ➧ ➨ ➩ ➪ ➫ ➬ ➭ ➮ ➯ ➱ ➲ ➳ ➴ ➵ ➶ ➷ ➸ ➹ ➺ ➻ ➼ ➽ ➾

A few years ago, many apps and fonts were con­fused by sim­ple let­ters with di­a­crit­ics like á. So, yes, re­al progress hap­pen­s.


Contents © 2000-2024 Roberto Alsina