Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 10-25-2008, 07:07 PM   #1
RoninTech
Groupie
RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.
 
RoninTech's Avatar
 
Posts: 152
Karma: 1000036
Join Date: Oct 2008
Location: Calgary, Alberta
Device: iPod Touch, Nook Colour, Kobo Touch, Kobo Glo, Nexus 7, Nexus 5
Script to Generate Stanza Online Catalog for your Iphone/Touch

This perl script lets you generate an atom feed from your Calibre library. If you use Stanza on an iPhone or iPod Touch it lets you access/transfer all of your epub books over wifi without having to use the Stanza desktop. At some point I'm sure Kovid can add this functionality into Calibre so you can just press a button rather than having to run this script. Right now it uses the calibredb command line utility to grab all of the info to generate the feed.

The resulting atom feed XML file is placed at the root of the calibre library. If you mount or copy your calibre library directory into your webserver's directory tree you can then access all the epubs in your library over wifi.

On your iphone/touch you just need to go under Settings->Stanza->Advanced and change "Primary Online Catalog" to point to the generated xml file on your webserver. I have a stanza.xml that includes all the original libraries plus a new entry that references the generated feed for my calibre library. So now all I have to do is add my books into Calibre, convert them to epub and run this script. I originally tried to include the Comment meta field in the content info but couldn't get it to output without column formatting that matched the line-spacing arg I was passing to calibredb. Its tested on Windows but should work on Linux and Mac as well as long as you have a Perl interpreter. On windows you can use the free Cygwin or Activestate Perl implementations.

All the info needed came from these places:

http://www.lexcycle.com/developer
http://diveintomark.org/archives/200.../howto-atom-id
http://validator.w3.org/feed/#validate_by_input

Hope it might help any other iPhone/Touch Stanza users looking to manage their book library with Calibre.

Cheers,
Crazy
Attached Files
File Type: zip calibre2stanzaatom.zip (2.9 KB, 638 views)
RoninTech is offline   Reply With Quote
Old 10-25-2008, 07:50 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: 25,987
Karma: 5036765
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Cool, consider adding this tip to http://calibre.kovidgoyal.net/wiki/TipsAndTricks
kovidgoyal is online now   Reply With Quote
Old 10-25-2008, 08:32 PM   #3
RoninTech
Groupie
RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.
 
RoninTech's Avatar
 
Posts: 152
Karma: 1000036
Join Date: Oct 2008
Location: Calgary, Alberta
Device: iPod Touch, Nook Colour, Kobo Touch, Kobo Glo, Nexus 7, Nexus 5
Will do. I'm gonna do some tweaking to it so it creates a hierarchy of feeds rather than one complete listing. For big libraries it'd probably take a long time to list all of them on the iphone/touch so it'd probably be more efficient to have one feed with a list of authors and each author having their own feed along with some other breakdowns. Kinda look like this:

Top Level Feed:

My Library
Free Feedbooks
Newspapers and Magazines
Books from Munseys
etc.
My Library Feed:

By Title
By Authors
By Genres
By Title Feed:
Alphabetic listing of all books
By Authors Feed:
Author 1
Author 2
etc.
By Genres Feed:
Sci Fi
Fantasy
Thriller
Classics
etc.
SciFi Feed
Alphabetic listing of all scifi books
Fantasy Feed
Alphabetic listing of all fantasy books
You kinda get the idea

Since the basics are working it shouldn't be too hard to create these breakdowns.

Cheers,
Crazy
RoninTech is offline   Reply With Quote
Old 10-25-2008, 08:35 PM   #4
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: 25,987
Karma: 5036765
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Hmm you really should consider learning enough python to do this within calibre, it will be much easier both for you and for the users.

EDIT: I'll be happy to help you get started, you can find me via IRC in #calibre on freenode

Last edited by kovidgoyal; 10-25-2008 at 08:40 PM.
kovidgoyal is online now   Reply With Quote
Old 10-25-2008, 10:15 PM   #5
whatwhat
Junior Member
whatwhat began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Oct 2008
Device: iPod Touch
Great tool! But changing "Advanced" settings isn't needed

On your iphone/touch you just need to go under Settings->Stanza->Advanced and change "Primary Online Catalog" to point to the generated xml file on your webserver.
This is a super tool! Note, though, that you don't need to change the Primary Online Catalog as of Stanza 1.5 to add your new catalog. You can just add it as a custom catalog by tapping the "+" button on the catalog screen.

Also, according to http://www.lexcycle.com/developer, you can post a link to your catalog in the form "stanzacatalog://somehost.com/mycatalog.xml", which will cause Stanza to be launched and the catalog to be added to Stanza when it is clicked on the iPhone.
whatwhat is offline   Reply With Quote
Old 10-26-2008, 01:53 PM   #6
RoninTech
Groupie
RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.
 
RoninTech's Avatar
 
Posts: 152
Karma: 1000036
Join Date: Oct 2008
Location: Calgary, Alberta
Device: iPod Touch, Nook Colour, Kobo Touch, Kobo Glo, Nexus 7, Nexus 5
Quote:
Originally Posted by kovidgoyal View Post
Hmm you really should consider learning enough python to do this within calibre, it will be much easier both for you and for the users.

EDIT: I'll be happy to help you get started, you can find me via IRC in #calibre on freenode
I'll have a look see and have a go at this.

Cheers,
Crazy
RoninTech is offline   Reply With Quote
Old 10-27-2008, 12:05 AM   #7
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: 25,987
Karma: 5036765
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
The next release will have
Code:
calibredb list --output-format stanza --prefix 'http://whatever'
Should make your life easy
kovidgoyal is online now   Reply With Quote
Old 10-27-2008, 12:14 AM   #8
RoninTech
Groupie
RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.
 
RoninTech's Avatar
 
Posts: 152
Karma: 1000036
Join Date: Oct 2008
Location: Calgary, Alberta
Device: iPod Touch, Nook Colour, Kobo Touch, Kobo Glo, Nexus 7, Nexus 5
Beautiful, thanks Kovid. In the meantime, I'm now dangerous in Python.

I converted my perl script to my first python one and it actually worked! See attached.

Cheers,
Crazy
Attached Files
File Type: zip calibre2stanzaatom.zip (2.0 KB, 440 views)
RoninTech is offline   Reply With Quote
Old 10-27-2008, 01:10 AM   #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: 25,987
Karma: 5036765
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
cool, you should have a look at the stanza feed calibre generates, it will probably need some tweaking as I did it in a rush.
kovidgoyal is online now   Reply With Quote
Old 10-31-2008, 11:37 PM   #10
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: 25,987
Karma: 5036765
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I just committed a content server for calibre into bazaar. So now calibre has its own http server (you can always proxy it behind your primary webserver)

Code:
calibre-server --hostname myserver.mydomain.net --port 8080
And to get the stanza feed
Code:
wget -O- http://myserver.mydomain.net:8080/stanza
kovidgoyal is online now   Reply With Quote
Old 11-01-2008, 12:22 PM   #11
RoninTech
Groupie
RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.
 
RoninTech's Avatar
 
Posts: 152
Karma: 1000036
Join Date: Oct 2008
Location: Calgary, Alberta
Device: iPod Touch, Nook Colour, Kobo Touch, Kobo Glo, Nexus 7, Nexus 5
Hey kovid, I just tried the list stanza output and thought I'd give you some feedback. This is well on the way to generating a valid stanza feed! If you paste the output into this validator:

http://validator.w3.org/feed/#validate_by_input

it highlights the following issues:

- The first Using library at... line is invalid XML
- The spaces in the URL's must be converted to %20's
- The updated timestamps are invalid
- The feed entry needs an updated field
- The entry content sections need a div to be valid

If you take a look at the python version of the script I posted it has all of this in there. I also added more information into the content section which you can also see in my python script

Thanks for making this happen!

Cheers,
Crazy

P.S. Great news on the web server! I think this i sa great progression for your app. In theory we should be able to access our calibre libraries from anywhere now as long as we have net access.
RoninTech is offline   Reply With Quote
Old 11-01-2008, 01:10 PM   #12
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: 25,987
Karma: 5036765
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
All those bugs are now fixed and yeah the idea is to have web based access to your books from anywere. All that remains is to write an AJAX frontend.
kovidgoyal is online now   Reply With Quote
Old 11-09-2008, 07:30 PM   #13
RoninTech
Groupie
RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.
 
RoninTech's Avatar
 
Posts: 152
Karma: 1000036
Join Date: Oct 2008
Location: Calgary, Alberta
Device: iPod Touch, Nook Colour, Kobo Touch, Kobo Glo, Nexus 7, Nexus 5
Quote:
Originally Posted by kovidgoyal View Post
And to get the stanza feed
Code:
wget -O- http://myserver.mydomain.net:8080/stanza
When I try this I get the following error with 103. Also is there a way to get the path to the library? "calibredb list" no longer prints this out as the first line by default.

Cheers,
Crazy
Attached Thumbnails
Click image for larger version

Name:	stanza_server_error.png
Views:	397
Size:	11.1 KB
ID:	17709  
RoninTech is offline   Reply With Quote
Old 11-09-2008, 09:27 PM   #14
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: 25,987
Karma: 5036765
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by CrazyIvan View Post
When I try this I get the following error with 103. Also is there a way to get the path to the library? "calibredb list" no longer prints this out as the first line by default.

Cheers,
Crazy
Oops will be fixed in next release. You can get the libraty path with
Code:
calibre-debug -c "from calibre.utils.config import prefs; print prefs['library_path']"
kovidgoyal is online now   Reply With Quote
Old 11-09-2008, 11:48 PM   #15
RoninTech
Groupie
RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.RoninTech ought to be getting tired of karma fortunes by now.
 
RoninTech's Avatar
 
Posts: 152
Karma: 1000036
Join Date: Oct 2008
Location: Calgary, Alberta
Device: iPod Touch, Nook Colour, Kobo Touch, Kobo Glo, Nexus 7, Nexus 5
Perfect. Thanks!
RoninTech is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Covers in Stanza on iPhone/iPod Touch pietvo Calibre 3 07-25-2011 05:28 AM
iPhone Get your Ebooks off your iPhone/Touch Stanza Library RoninTech Apple Devices 15 03-25-2010 09:17 AM
Creating an online Stanza catalog wdonne News 6 02-25-2010 03:33 PM
Still can't generate a Mobi catalog Sydney's Mom Library Management 11 02-02-2010 08:55 AM
Loading Stanza on jailbroken iPhone/iPod Touch? Robotech_Master Apple Devices 1 08-12-2009 04:57 PM


All times are GMT -4. The time now is 02:19 PM.


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