Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 03-23-2015, 02:09 PM   #1
goge
Member
goge began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Mar 2015
Device: android phone
mobile add from isbn

Hello,

There must be many that have a large collection of paper books they would like to manage with calibre, I know I do.

I'm was hoping I could use my phone as an isbn scanner and scan the books in right from the bookshelves, but it seems I would need to bring the books to a computer and type them in by hand or buy a usb scanner.

I looked into the REST api but it only has endpoints to get content out.
I then looked into the smart device driver. I cannot seem to find a message to add from isbn, only create / upload from a file.

The plan is to make a very simple web app that uses https://github.com/EddieLa/JOB to get the isbn and send it through to Calibre.

To do that the best option would be a RESTful endpoint to send the isbn number to, if that's not possible a tcp connection could be used as well. I am willing to build out both the app and endpoint I just don't know where to look for the "Add from isbn" code and what the community would rather have in terms of a restful endpoint or adding to the smart device driver.

Thanks!
goge is offline   Reply With Quote
Old 03-23-2015, 02:24 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
calibre is not a webapp so I dont understand what you mean by a restful endpoint. If you want to add a list of ISBNs as book records to calibre you can do so by right clicking the add books button in the calibre GUI or using the calibredb command line interface.
kovidgoyal is offline   Reply With Quote
Advert
Old 03-23-2015, 02:35 PM   #3
goge
Member
goge began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Mar 2015
Device: android phone
Thanks for the quick reply.

I'll try to clarify.

I'm looking at creating a mobile web app to add books to calibre by scanning isbn barcodes on my phone.

Right not I'm using calibre through the web content server started with calibre-server. If I understand correctly the content server is a cherry-py server. The content server has the rest endpoints

I did not know of the calibredb command line interface so this is great news if I can add books using an ISBN through it. If that's the case I could exec the command through the cherry-py server or make a new server to do the same. I can then add the rest endpoint to the cherry-py server and have my mobile app consume it.

Once again Thanks!
goge is offline   Reply With Quote
Old 03-23-2015, 03:21 PM   #4
goge
Member
goge began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Mar 2015
Device: android phone
So I tried out the calibredb method using
Code:
calibredb add --isbn "9780747595823" --empty
This adds an entry for a book with the ISBN but doesn't scrape any of the other information. For instance it doesn't populate the author, title, category, tags...

Am I mistaken in believing that "right clicking the add books button in the calibre GUI" populates the rest of the metadata?

Is there a way I can get calibre to populate the metadata for a new book added by an ISBN?
goge is offline   Reply With Quote
Old 03-23-2015, 04:25 PM   #5
goge
Member
goge began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Mar 2015
Device: android phone
I've found the xISDN class and the sources/identify class that consumes the metadata. However this does not actually add the data to the library. I could make the call to xISDN and then an explicitly call an Add with that meta data but I would like to see how this is currently done in the GUI before doing this.

Could someone help point me to where the meta data returned is saved to the library when the gui action is called?

Thanks!
goge is offline   Reply With Quote
Advert
Old 03-23-2015, 06:52 PM   #6
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Try it out with a sample ISBN in the GUI -- it adds the books with no metadata and offers to schedule a Metadata Download.

Check src/calibre/gui2/actions/add.py to see how it is handled, specifically, follow the functions genesis() --> add_from_isbn() --> add_isbns() --> do_one_isbn_add()

Last edited by eschwartz; 03-23-2015 at 06:57 PM.
eschwartz is offline   Reply With Quote
Old 03-23-2015, 06:58 PM   #7
goge
Member
goge began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Mar 2015
Device: android phone
Many thanks!

I'm mobile now but I'll look into when I get to a machine.
goge is offline   Reply With Quote
Old 03-23-2015, 08:35 PM   #8
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
You might want to look at the Import List plugin. It can import a list of books from a CSV file or from a lot of web sites. Plus you can define your own formats or sites to match.
davidfor is offline   Reply With Quote
Old 03-23-2015, 10:07 PM   #9
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
If you want to download metadata from the command line when adding, you can do so, just chain the appropriate commands, in your case fetch-ebook-metadata --opf and calibredb add and calibredb set_metadata --from-opf
kovidgoyal is offline   Reply With Quote
Old 03-24-2015, 09:52 AM   #10
goge
Member
goge began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Mar 2015
Device: android phone
That's great! I have the flow of console commands working. Currently it's a simple console app I pass an isbn to and it goes through the flow.

I no longer think adding this to a devices driver or the content server ajax endpoints is the right option. Creating a separate web app to run beside Calibre is probably too much to ask as well. I'm thinking it may be best to create a plugin with the companion scanning app. Has any other plugin been developed to start a simple web server or do tcp communication that I can use as a guide?

Thanks again!
goge is offline   Reply With Quote
Old 03-24-2015, 11:12 AM   #11
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Not that I know of, but as there are ~ 100 plugins I cant be definitive.
kovidgoyal is offline   Reply With Quote
Old 03-26-2015, 10:10 AM   #12
goge
Member
goge began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Mar 2015
Device: android phone
I'm having problems spinning up cherrypy inside the plugin. I was able to create a plugin using kovid's template (thanks kovid!). Since I'm running inside the plugin I think I can follow the same process used in add.py.

Is it alright if I use the thread as a sort of dev blog?

So I'm stuck on two parts, I've never worked in cherrypy and only have theoretical knowledge of python.
1: When I try to use the cherrypy's cherrypy.dispatch.MethodDispatcher to create the REST endpoints I get
Code:
Traceback (most recent call last):
  File "site-packages/calibre/gui2/ui.py", line 226, in initialize
  File "site-packages/calibre/gui2/actions/__init__.py", line 143, in do_genesis
  File "calibre_plugins.mobile_isbn_scanner.ui", line 59, in genesis
  File "site-packages/cherrypy/__init__.py", line 160, in quickstart
  File "site-packages/cherrypy/process/wspbus.py", line 250, in start
ChannelFailures: TypeError('character mapping must return integer, None or unicode',)
2: I can successfully spin up a simple hello world cherrypy server but it blocks the thread stopping Calibre from loading. So I'm going to need to run cherrypy on another thread which is going to take some research.

Thanks!
goge is offline   Reply With Quote
Old 04-06-2015, 08:14 AM   #13
goge
Member
goge began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Mar 2015
Device: android phone
I'm still on this. Some increased work / home life meant I didn't have time to move forward on it but the books can't come out of the boxes until this plugin / feature is functional so I'll continue to work in it and keep with thread updated
goge is offline   Reply With Quote
Old 04-07-2015, 08:51 AM   #14
goge
Member
goge began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Mar 2015
Device: android phone
Sooo... did some work last night. I'm going to have to scrap the plugin idea. It seems I can only access the db in a graphical window... I'm only running the content server on my system. It seems the content server is a wholly separate app.

So I'm going to add the functionality to the LibraryServer. Should I extend the AjaxServer and ContentServer or should I create a new ISBNServer? Does the LibraryServer have a maintainer I should talk to about conventions and best practices?

Thanks!
goge is offline   Reply With Quote
Old 04-07-2015, 08:53 AM   #15
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
The content server most definitely has access to the db, how else would it show you your collection?
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add from the Mobile Read Library? danwdoo Calibre 8 12-03-2014 06:03 PM
3 suggestions: merge on add, cleanup on add, sorting changeling Calibre 5 08-24-2013 06:35 AM
ASIAN, ISBN and ISBN-13 jbcohen General Discussions 2 04-02-2013 02:27 PM
Problem with add books from isbn Arutha Library Management 3 01-17-2012 08:56 PM
Stupid Question: ISBN-10 and ISBN-13 Tegan Library Management 4 03-11-2011 01:20 AM


All times are GMT -4. The time now is 11:39 PM.


MobileRead.com is a privately owned, operated and funded community.