![]() |
#1 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: 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? |
![]() |
![]() |
![]() |
#2 |
Plugin Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,815
Karma: 4604429
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
|
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 |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,144
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
grep -r "TXT to TXTZ"
on the calibre source code ![]() |
![]() |
![]() |
![]() |
#4 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: 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. |
![]() |
![]() |
![]() |
#5 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,144
Karma: 27110894
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. |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,880
Karma: 59840450
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
the command "Find" is weak ![]() |
|
![]() |
![]() |
![]() |
#7 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: 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. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
PRS-500 reverse engineering the Reader USB protocol | kovidgoyal | Sony Reader Dev Corner | 196 | 10-31-2016 02:35 PM |
KDK Reverse Engineering - For Those who Cannot wait... | DairyKnight | Kindle Developer's Corner | 0 | 05-14-2010 12:29 AM |
Reverse-engineering the .IMP format | nrapallo | IMP | 23 | 02-12-2009 01:44 PM |
Reverse engineering the Cybook hard-/software | srml | Gen3 Developer's Corner | 8 | 07-07-2008 04:27 PM |
Introduction to Reverse Engineering Software | Colin Dunstan | Deals and Resources (No Self-Promotion or Affiliate Links) | 0 | 05-25-2004 11:31 AM |