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 09-16-2010, 05:30 PM   #1
timctrahan
Junior Member
timctrahan began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Sep 2010
Device: kindle
Email from Web Browser

I am interested in modifying the web interface to allow the user to initiate emailing to one of the defined users. I have several relatives that are not computer savy in which I would like to maintain a collection of ebooks and allow them to have them sent to their kindle devices straight from the web ui so I can expose that to them.

I am a .Net developer, and I have set up the project and am able to make code changes and see them reflected (i can muddle through python). I am finding it difficult to trace through all of the different modules to find the relevant code to update.

Specifically, i would like to modify the gui.js file to display the defined email's in the connect and share module, have the xml.py module query the defined email addresses and append to the book records so that the gui.js file can make a separate request to send the email.

In any case, i will continue to search through the code, but pointers to where the db.search_getting_ids is declared and an overall approach would be appreciated.

I think this feature would be useful, and would like to see it in the project.

Thanks!
Tim
timctrahan is offline   Reply With Quote
Old 09-16-2010, 05:36 PM   #2
desertgrandma
Enjoying the show....
desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.
 
desertgrandma's Avatar
 
Posts: 14,277
Karma: 8205255
Join Date: Jun 2008
Location: Arizona
Device: A K1, Kindle Paperwhite, an Ipod, IPad2, Iphone, an Ipad Mini & macAir
Welcome to MobileRead, Tim.

Quite a feat you've set for yourself there. Best of luck.

You do realize you'd have to strip the drm before anyone else could read the books, if they are protected, right?
desertgrandma is offline   Reply With Quote
 
Enthusiast
Old 09-16-2010, 05:42 PM   #3
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,422
Karma: 4961459
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
It's an interesting idea. search_getting_ids is defined in library/caches.py

In general when looking for a function definition in python code, I use the following simple grep expression

grep -r "def function_name" src/calibre/*

The email code is in calibre.utils.smtp

And you've already discovered the server code

My only caveat is that you should have the list of email addresses hidden behind a generic "email" link so as not to clutter up the listing. Since the server has jquery available it should be easy to expose the list of addresses when the link is clicked.
kovidgoyal is offline   Reply With Quote
Old 09-16-2010, 05:53 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,422
Karma: 4961459
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Incidentally, you do know that you can browse the calibre content server directly from the Kindle?
kovidgoyal is offline   Reply With Quote
Old 09-16-2010, 06:44 PM   #5
timctrahan
Junior Member
timctrahan began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Sep 2010
Device: kindle
desertgrandma,

Yes, I realize that. Thank you. I have a wife and a mother that if it is at all complicated, they won't want to do it, but both can browse a web site. I would like to have something set up that they can easily pick what's in my library, including the news feed content and have it sent to their kindle. My mother lives 3 hours away and doesn't even have a computer, so this would allow me to support her easily.

kovidgoyal,

Yes, I actually browsed with my Kindle. I didn't look to closely, but I assume it is the mobile.py in the server folder that is rendering for the mobile devices.

As far as the best way to display it, I was thinking of a pop-up like the jquery blockui addon for allowing a user to select who to email, but I have been mainly browsing through the code today, so haven't gotten to how to display it.

The lack of an IDE is really slowing things down! I have set up netbeans, but I am assuming there is no all including project file, so I have just been tinkering here and there to validate the effect in the application.

Thanks,
Tim
timctrahan is offline   Reply With Quote
Old 09-16-2010, 06:52 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: 25,422
Karma: 4961459
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I use a customized build of vim as my IDE, so I doubt that would be helpful. A good beginner IDE is Eclipse+Pydev. No real project file is required, pydev scans the source tree and sets everything up automatically.

And calibre-server --develop

picks up code changes automatically and restarts itself. So hacking on the content server should be a fairly pleasant experience.
kovidgoyal is offline   Reply With Quote
Old 09-16-2010, 07:00 PM   #7
desertgrandma
Enjoying the show....
desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.
 
desertgrandma's Avatar
 
Posts: 14,277
Karma: 8205255
Join Date: Jun 2008
Location: Arizona
Device: A K1, Kindle Paperwhite, an Ipod, IPad2, Iphone, an Ipad Mini & macAir
Quote:
Originally Posted by timctrahan View Post
desertgrandma,

Yes, I realize that. Thank you. I have a wife and a mother that if it is at all complicated, they won't want to do it, but both can browse a web site. I would like to have something set up that they can easily pick what's in my library, including the news feed content and have it sent to their kindle. My mother lives 3 hours away and doesn't even have a computer, so this would allow me to support her easily.
Well then.......I'm looking forward to seeing your "success" post. Between you and Kovid, I'm sure it can be done.
desertgrandma is offline   Reply With Quote
Old 09-17-2010, 01:04 AM   #8
timctrahan
Junior Member
timctrahan began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Sep 2010
Device: kindle
Any guidance you can give me on getting the project to run in eclipse (or aptana studio 3) I created a new pydev project and set the project contents to the c:\calibre directory (where i pulled down everything to) and check the create default src folder and am using python 2.7.

I am getting unresolved import errors allover the project, so apparently I am missing something. Would love to get the project running in an ide so I can set break points and actually query the objects being created so i can understand how to interact with them.

Thanks!
Tim
timctrahan is offline   Reply With Quote
Old 09-17-2010, 11:25 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,422
Karma: 4961459
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I doubt you'll ever be able to get a debugger setup to run with calibre. But then debuggers are highly overrated when it comes to python. I have never once used a debugger in the last 4 years of calibre development

Use the following trick to get to an interactive python prompt

from calibre import ipython
ipython({'myobj'bj})

where the dictionary contains the names and objects that you want to be available in your interactive session.
kovidgoyal is offline   Reply With Quote
Old 09-17-2010, 04:19 PM   #10
timctrahan
Junior Member
timctrahan began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Sep 2010
Device: kindle
Well,

After about 6 hours of poking around, i finally figured out how to access the defined email accounts from the xml.py module...

Sometime 2012 i should have this working.

lol
timctrahan is offline   Reply With Quote
Old 09-18-2010, 02:18 PM   #11
timctrahan
Junior Member
timctrahan began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Sep 2010
Device: kindle
quick question...

Within the device.py file in the gui2 section,

The send_by_mail function accepts a defaulted to true parameter for do_auto_convert. However, if an acceptable format for the device you are about to send the email to does not exist, the function prompts the user to confirm the book should be converted.

Is there a reason the function doesn't just accept the do_auto_convert flag when true and go ahead and convert, or am I missing something in the preceeding logic?

I don't want to just throw in code that overrides something I'm not seeing...
Thanks,
Tim
timctrahan is offline   Reply With Quote
Old 09-18-2010, 02:32 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,422
Karma: 4961459
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
do_auto_convert is an internal parameter (it's used to allow recursive calling). In any case, don't use the GUI functions to do email. Use the functions in calibre.utils.smtp
kovidgoyal is offline   Reply With Quote
Old 09-18-2010, 02:58 PM   #13
timctrahan
Junior Member
timctrahan began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Sep 2010
Device: kindle
Is there a non-gui version of auto_convert_mail and queue_convert_jobs?
timctrahan is offline   Reply With Quote
Old 09-18-2010, 03:04 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,422
Karma: 4961459
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You shouldn't be doing conversion in the server (the server is supposed to be a read only process). As for sending mail, just re-implement _send_mails from gui2.device. You will probably want to put it in its own thread (use the threading module for that).
kovidgoyal is offline   Reply With Quote
Old 09-18-2010, 05:12 PM   #15
timctrahan
Junior Member
timctrahan began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Sep 2010
Device: kindle
Ok, but how would you propose sending of a book in the library that hasn't yet been converted to the proper format for the user's destination device? I can understand the server being for a specific purpose, but one of the core functions of the application is being able to convert between formats, is there a reason not to expose that functionality via the web interface?

Tim
timctrahan 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
Troubleshooting web browser problem kz9726 Amazon Kindle 2 09-14-2010 02:01 AM
iPad A1 Perfect Web Browser scottjl Apple Devices 23 06-06-2010 04:56 PM
Web browser for DR1000S dixon iRex 43 11-09-2009 06:22 PM
Kindle DX as a web browser Daithi Amazon Kindle 7 05-06-2009 09:08 PM
Web2Mail Lite: Email retrieval through the Web Alexander Turcic Lounge 3 01-26-2004 08:21 AM


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


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