View Single Post
Old 07-12-2012, 11:07 AM   #564
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.
 
JimmXinu's Avatar
 
Posts: 7,031
Karma: 4604637
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
@ilovejedd - That would be a bit of a hefty feature to add just for playing with.

I think iatheia's advice is better. And I would add:

It's much easier to try different things and work on the code in command line than it is in the plugin. In command line, every edit you save is used immediately the next time you run it. In plugin, you have to create the updated plugin zip, install it and restart calibre for every single change.

There's a command line interface(CLI) version of FFDL available. If you don't want to install Python separately, after getting and unzipping the CLI version you can use "calibre-debug -e download.py" to run it using calibre's built-in python.

When debugging plugins, when I want to see what the HTML from the site looks like before any processing, I find the fetch call (typically "data = self._fetchUrl(url)") and then add a "print(data)" call. Consider that your first step in learning python.

Then run the CLI downloader and redirect it's output to a file. Something like this:

Code:
c:\Python27\python.exe downloader.py "http://test1.com?sid=4" > output
Editing downloader.py and changing where it says "logging.basicConfig(level=logging.INFO,..." to "logging.basicConfig(level=logging.DEBUG,..." is also useful.

When testing FFDL output or settings, you can use the dummy site test1.com with story URLs like test1.com?sid=123 That will generate output, but not waste time and bandwidth going out to a real site.
JimmXinu is online now