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

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

Notices

Reply
 
Thread Tools Search this Thread
Old 08-04-2011, 04:30 AM   #1
DezmondFinney
Member
DezmondFinney began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Aug 2011
Location: Atlanta, Ga
Device: kindle
Hacking the front-end

I am a web designer who is interested in hacking about with the content server front end. What do I need in order to have my resources served up instead of the default ones?

By the way, I just want to thank you all for an awesome piece of software that does so much.

Last edited by DezmondFinney; 08-04-2011 at 04:31 AM. Reason: Adding thanks
DezmondFinney is offline   Reply With Quote
Old 08-04-2011, 05:58 AM   #2
Manichean
Wizard
Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!Manichean My eyes! My eyes! The light is just too bright!
 
Manichean's Avatar
 
Posts: 3,130
Karma: 80520
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
I believe the pages are generated dynamically during runtime. You'll probably need to setup a development enviroment.
Manichean is offline   Reply With Quote
Old 08-04-2011, 11:44 AM   #3
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,460
Karma: 986493
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
CherryPy is used to serve pages.
user_none is offline   Reply With Quote
Old 08-04-2011, 11:58 AM   #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: 26,129
Karma: 5381911
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Code is in src/calibre/library/server/browse

HTML/javascript in

resources/content_server/browse
kovidgoyal is offline   Reply With Quote
Old 08-04-2011, 12:06 PM   #5
DezmondFinney
Member
DezmondFinney began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Aug 2011
Location: Atlanta, Ga
Device: kindle
Thanks for such a quick reply.

Have found the resources but I am not able to get any of my changes to load. Am I correct in assuming that I must run the server with the flag --develop ?

I don't know python I decided to learn ruby and while close it's a bit much when all I want to do is create a new ajax front end from the servers XML opds.

BTW, I am developing on a Linux machine so I am using the binary install to do this. Do I need the source? I've downloaded it anyway to poke around in the src/calibre/library/server/browse to see the python. Damn you white space!

Last edited by DezmondFinney; 08-04-2011 at 12:11 PM. Reason: list my dev environment
DezmondFinney is offline   Reply With Quote
Old 08-04-2011, 12:12 PM   #6
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: 26,129
Karma: 5381911
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You either make the changes to the resources file in the calibre installation directory itself, or setup a development environment and make changes there. In either case, after a restart the server will use the new resources.

And yes, when hacking on the server you should use --develop.
kovidgoyal is offline   Reply With Quote
Old 08-04-2011, 06:15 PM   #7
DezmondFinney
Member
DezmondFinney began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Aug 2011
Location: Atlanta, Ga
Device: kindle
I've got things working now and am rolling forward.

Just so you can have an idea of what I'm doing, I am using the opds xml to create a new ajax style front end that is fresh and has what I hope is a better ui. It will be responsive so that mobile will be automatic.

I did a mock up using calibre2opds but I like the structure of the included server.

The video is on youtube

Edit: sorry about the quality it clears up 12 seconds in. You miss the file download but you get the idea. There is a better version at vimeo

I would like to perhaps add on the fly conversion to the web app for the times people like me would like to read on the phone via epub when the kindle is my main device.

Please let me know if this is something you would like to have in calibre itself because I can do it hacky-style just for me or do it "right" for integration.

Thanks again for the help..

Last edited by DezmondFinney; 08-04-2011 at 06:19 PM. Reason: Video Apology
DezmondFinney is offline   Reply With Quote
Old 08-04-2011, 07:30 PM   #8
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: 26,129
Karma: 5381911
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Your mockup looks cool I'm fine with integrating it into trunk. But there are some constraints you should be aware of:

1) The new interface must expose at least as much functionality as the current one. Sacrificing functionality for eye candy is not acceptable

2) Currently it is not possible to allow write operations on the library via the content server (the library backend is being refactored to make this possible, but it will be a while before it is done).

Looking at your mockup, with regards to 1), there is one problem, the number of top level categories is not fixed. Users can create custom categories/columns. So you will probably need a lower scrollable row with custom categories/columns in it, if any.

While hacking on the interface, I suggest you create a few custom columns to keep this in mind.

Also you have to remember that the content server is often used on very small screens like mobile phones, so your design needs to degrade gracefully. Since you seem to be using standard jquery widgets, that should mostly happen automatically, but it's something to keep in mind
kovidgoyal is offline   Reply With Quote
Old 08-04-2011, 07:34 PM   #9
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,460
Karma: 986493
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
Quote:
Originally Posted by kovidgoyal View Post
Also you have to remember that the content server is often used on very small screens like mobile phones, so your design needs to degrade gracefully. Since you seem to be using standard jquery widgets, that should mostly happen automatically, but it's something to keep in mind
There is always the possibility of falling back to the current design when a mobile device is detected. Or a completely separate mobile interface.
user_none is offline   Reply With Quote
Old 08-04-2011, 07:50 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: 26,129
Karma: 5381911
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Since your motivation for this seems to be primarily to have a cover based view, it may be easier if you just implement a toggle that switches between the cover view and current default list view (store it in a cookie so that its state is persistent)
kovidgoyal is offline   Reply With Quote
Old 08-04-2011, 08:01 PM   #11
DezmondFinney
Member
DezmondFinney began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Aug 2011
Location: Atlanta, Ga
Device: kindle
I agree, sacrificing usability is the antithesis of good design. What I want is an interface that exposes functionality without becoming cluttered, that is intuitive and flexible. If I do those things properly it will most likely be beautiful anyway.

I am using media queries to have a responsive design and the entire container is flexible. That means even with this mockup (which is by no means complete) elements can be added and removed from the interface dynamically without breaking anything.

That said I know elements like search and sort are missing along with other things are m.i.a. so I have some things to keep in mind. Is there anything on the back end concerning those things that I should be aware of? I've looked through the code but I am not a python guy. Specifically functionality that is provided through python and html that is not exposed through opds.

One thing I want to add is a way for a tag (custom or standard) to be chosen as a default display. Perhaps a 'want to read' or 'new news' or 'goodreads bookself' books. The choice will be saved (cookie or html5 storage?) so that the home page will have a list of the books most likely to be wanted by the user. I think that would be especially helpful on smaller mobile devices were navigation can be a pain.
DezmondFinney is offline   Reply With Quote
Old 08-04-2011, 09:24 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: 26,129
Karma: 5381911
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
The current server design uses AJAX queries to JSON returning end points on the server. If you want to refactor the entire interface you'll find that OPDS is insufficient/inefficient, you will have to use the endpoints that the current interface uses.

Look at the add_routes() method in browse.py that defines all the JSON and HTML endpoints. The JSON endpoints should be sufficient for your interface, if not just let me know and I can easily add new ones.

The HTML endpoints all use templates so you should just be able to get away with changing the templates with minimal or no need for code changes.
kovidgoyal is offline   Reply With Quote
Old 08-04-2011, 10:08 PM   #13
DezmondFinney
Member
DezmondFinney began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Aug 2011
Location: Atlanta, Ga
Device: kindle
How do the python templates work? Say, the {prefix} tag, can I use those anywhere?
DezmondFinney is offline   Reply With Quote
Old 08-04-2011, 10:12 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: 26,129
Karma: 5381911
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
It's a really simple template language.

Basically, anything that looks like {somename} will be replaced in the rendered version. There are more tricks you can use, but you shouldn't need them: http://docs.python.org/library/strin...#formatstrings
kovidgoyal is offline   Reply With Quote
Old 08-04-2011, 10:14 PM   #15
ldolse
Wizard
ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.ldolse is an accomplished Snipe hunter.
 
Posts: 1,337
Karma: 123455
Join Date: Apr 2009
Location: Malaysia
Device: PRS-650, iPhone
For his on the fly conversion question, wouldn't it be possible for the short term to have the content server to initiate a one-off conversion that's not added to the library, just stored in some temp directory? For the use case he's requesting that would probably be sufficient.
ldolse is offline   Reply With Quote
Reply

Tags
content-server, html, user interface

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
soPDF GUI Front-End Nathan Campos PDF 37 11-04-2011 07:45 PM
GuteBook - the Project Gutenberg eBook Maker/Front-end nrapallo Workshop 67 03-27-2011 04:46 PM
Front Page..... tnronin Sony Reader 0 02-25-2010 12:11 PM
hacking in? omro Astak EZReader 5 12-09-2009 05:59 PM


All times are GMT -4. The time now is 10:40 AM.


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