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

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

Notices

Reply
 
Thread Tools Search this Thread
Old 01-09-2012, 03:23 PM   #1
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 667
Karma: 436517
Join Date: Jul 2010
Location: UK
Device: PRS-300 (R.I.P.), PW2, Nexus7
Reverse Engineering Built-In Plugins

Is there any way to find the Python source code associated with a built-in plugin. I want to use this as a way of improving my knowledge so that I can write my own plugins.

For example, in the File Type plugins there is one called "TXT to TXTZ". How do I find where the code for this resides on my Windows installation of calibre?
Agama is offline   Reply With Quote
Old 01-09-2012, 10:56 PM   #2
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
Posts: 1,818
Karma: 510215
Join Date: Dec 2011
Location: Midwest USA
Device: Nook STR w/Glowlight, Kindle 3g, Droid
The install uses compiled python files now instead of source, but the source is available:

http://code.google.com/p/calibre-ebook/downloads/list

Finding particular code can sometimes be challenging, though.

Plugins, on the other hand, are still just zipped python source. I've been learning a lot from kiwidude's plugins.

Jim
JimmXinu is offline   Reply With Quote
Old 01-09-2012, 11:20 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: 26,433
Karma: 5383257
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
grep -r "TXT to TXTZ"

on the calibre source code
kovidgoyal is offline   Reply With Quote
Old 01-10-2012, 08:31 AM   #4
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 667
Karma: 436517
Join Date: Jul 2010
Location: UK
Device: PRS-300 (R.I.P.), PW2, Nexus7
Thanks for the help, I got there eventually.

Just in case anyone else want to do the same, here are my steps:

I followed the link and downloaded: calibre-0.8.34.tar.xz, then used Zip7 to extract this to: calibre-0.8.34.tar.xz, then extracted it again which gave a folder structure. I didn't know what to do with the "grep" command, but in this extracted folder structure I found:

C:\TEMP\calibre\src\calibre\customize\built-ins.py

which appears to contain all the source code for the built-in plugins, including TXT2TXTZ.
Agama is offline   Reply With Quote
Old 01-10-2012, 09:11 AM   #5
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,433
Karma: 5383257
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
grep is a tool that searches for the specified string (really a regex) over all files and subdirectories. I dont know what the equivalent on windows is, but I'm sure there is one.

And note that the actual source code for the vast majority of plugins is not in builtins.py, most of the stuff in builtins.py are stubs used to load the actual code. The exception is the builtin file type plugins like txt2txtz.
kovidgoyal is offline   Reply With Quote
Old 01-10-2012, 10:01 AM   #6
theducks
Grand Sorcerer
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 15,235
Karma: 6020307
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by kovidgoyal View Post
grep is a tool that searches for the specified string (really a regex) over all files and subdirectories. I dont know what the equivalent on windows is, but I'm sure there is one.

And note that the actual source code for the vast majority of plugins is not in builtins.py, most of the stuff in builtins.py are stubs used to load the actual code. The exception is the builtin file type plugins like txt2txtz.
"Search" (Advanced) on the Start button
the command "Find" is weak
theducks is offline   Reply With Quote
Old 01-10-2012, 06:35 PM   #7
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 667
Karma: 436517
Join Date: Jul 2010
Location: UK
Device: PRS-300 (R.I.P.), PW2, Nexus7
Thanks for the extra infos. I was just lucky with txt2txtz!

I don't have a Search (Advanced) on the Windows Start Button, but I can use the Find-in-Files (+subdirectories) of Notepad++ to do this searching.
Agama 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
KDK Reverse Engineering - For Those who Cannot wait... DairyKnight Kindle Developer's Corner 0 05-14-2010 01:29 AM
Reverse-engineering the .IMP format nrapallo IMP 23 02-12-2009 02:44 PM
Reverse engineering the Cybook hard-/software srml Gen3 Developer's Corner 8 07-07-2008 05:27 PM
PRS-500 reverse engineering the Reader USB protocol kovidgoyal Sony Reader Dev Corner 195 06-29-2007 12:05 PM
Introduction to Reverse Engineering Software Colin Dunstan Deals, Freebies, and Resources (No Self-Promotion) 0 05-25-2004 12:31 PM


All times are GMT -4. The time now is 06:33 PM.


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