10-25-2008, 07:07 PM | #1 |
Groupie
Posts: 168
Karma: 1000036
Join Date: Oct 2008
Location: Citizen of the World
Device: iPod Touch, Nook Colour, Kobo Touch, Kobo Glo, Nexus 7, Nexus 5, Pixel
|
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 |
10-25-2008, 07:50 PM | #2 |
creator of calibre
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Cool, consider adding this tip to http://calibre.kovidgoyal.net/wiki/TipsAndTricks
|
Advert | |
|
10-25-2008, 08:32 PM | #3 |
Groupie
Posts: 168
Karma: 1000036
Join Date: Oct 2008
Location: Citizen of the World
Device: iPod Touch, Nook Colour, Kobo Touch, Kobo Glo, Nexus 7, Nexus 5, Pixel
|
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: You kinda get the idea By Title By Authors By Genres By Title Feed: Alphabetic listing of all books By Authors Feed:Author 1 By Genres Feed:Author 2 etc. Sci Fi Fantasy Thriller Classics etc. SciFi Feed Alphabetic listing of all scifi books Fantasy Feed Alphabetic listing of all fantasy books Since the basics are working it shouldn't be too hard to create these breakdowns. Cheers, Crazy |
10-25-2008, 08:35 PM | #4 |
creator of calibre
Posts: 43,858
Karma: 22666666
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. |
10-25-2008, 10:15 PM | #5 |
Junior Member
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. |
Advert | |
|
10-26-2008, 01:53 PM | #6 | |
Groupie
Posts: 168
Karma: 1000036
Join Date: Oct 2008
Location: Citizen of the World
Device: iPod Touch, Nook Colour, Kobo Touch, Kobo Glo, Nexus 7, Nexus 5, Pixel
|
Quote:
Cheers, Crazy |
|
10-27-2008, 12:05 AM | #7 |
creator of calibre
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The next release will have
Code:
calibredb list --output-format stanza --prefix 'http://whatever' |
10-27-2008, 12:14 AM | #8 |
Groupie
Posts: 168
Karma: 1000036
Join Date: Oct 2008
Location: Citizen of the World
Device: iPod Touch, Nook Colour, Kobo Touch, Kobo Glo, Nexus 7, Nexus 5, Pixel
|
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 |
10-27-2008, 01:10 AM | #9 |
creator of calibre
Posts: 43,858
Karma: 22666666
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.
|
10-31-2008, 11:37 PM | #10 |
creator of calibre
Posts: 43,858
Karma: 22666666
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 Code:
wget -O- http://myserver.mydomain.net:8080/stanza |
11-01-2008, 12:22 PM | #11 |
Groupie
Posts: 168
Karma: 1000036
Join Date: Oct 2008
Location: Citizen of the World
Device: iPod Touch, Nook Colour, Kobo Touch, Kobo Glo, Nexus 7, Nexus 5, Pixel
|
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. |
11-01-2008, 01:10 PM | #12 |
creator of calibre
Posts: 43,858
Karma: 22666666
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.
|
11-09-2008, 07:30 PM | #13 | |
Groupie
Posts: 168
Karma: 1000036
Join Date: Oct 2008
Location: Citizen of the World
Device: iPod Touch, Nook Colour, Kobo Touch, Kobo Glo, Nexus 7, Nexus 5, Pixel
|
Quote:
Cheers, Crazy |
|
11-09-2008, 09:27 PM | #14 | |
creator of calibre
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Quote:
Code:
calibre-debug -c "from calibre.utils.config import prefs; print prefs['library_path']" |
|
11-09-2008, 11:48 PM | #15 |
Groupie
Posts: 168
Karma: 1000036
Join Date: Oct 2008
Location: Citizen of the World
Device: iPod Touch, Nook Colour, Kobo Touch, Kobo Glo, Nexus 7, Nexus 5, Pixel
|
Perfect. Thanks!
|
|
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 |