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

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

Notices

Reply
 
Thread Tools Search this Thread
Old 03-30-2011, 08:51 PM   #1
euleralves
Junior Member
euleralves began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Mar 2011
Device: Kindle 3
Lightbulb Windows batch file to test, debug and develop recipes

Drag a recipe file to this Windows batch and you can debug the output of recipe.

This help you to build your recipes.

Code:
@echo off
if not exist "%~dp1%~n1" md "%~dp1%~n1"
if exist "%~dp1%~n1\%~n1.recipe" del /q "%~dp1%~n1\%~n1.recipe"
copy %1 "%~dp1%~n1\%~n1.recipe"
start "Calibre RSS" /wait /b "%ProgramFiles%\Calibre2\ebook-convert.exe" "%~dp1%~n1\%~n1.recipe" "%~dp1%~n1" --test -vv
echo Wait a while even after the message to press enter. The Caliber will start.
pause
Attached Files
File Type: bat Recipe test.bat (358 Bytes, 67 views)
euleralves is offline   Reply With Quote
Old 03-31-2011, 02:56 PM   #2
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by euleralves View Post
Drag a recipe file to this Windows batch and you can debug the output of recipe.
I prefer to redirect error messages to a text file by adding ">recipename.txt" to the command line so I can search and review it.
Starson17 is offline   Reply With Quote
Old 03-31-2011, 03:11 PM   #3
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,259
Karma: 6020309
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Quote:
Originally Posted by Starson17 View Post
I prefer to redirect error messages to a text file by adding ">recipename.txt" to the command line so I can search and review it.
double the >, to >> and it appends to the named file for a 'running' log
theducks is offline   Reply With Quote
Old 03-31-2011, 04:33 PM   #4
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by theducks View Post
double the >, to >> and it appends to the named file for a 'running' log
Yes, but I seldom want a running log. During development, I do a lot of "find all" searches for messages output from the recipe, so I don't want to see the results of earlier tests. I use a standard format for printing messages from the recipe with a standard text string.

print 'The tag, variable or whatever being tracked is: ', variable_name

I search for all occurrences of the string "is: " to find critical junction points in the recipe. I often have the recipe print the entire "soup" of each article page, sometimes multiple times as it is processed, so my output has short messages tracking variables and errors, which are buried in the source code of multiple other pages. Finding the critical messages is hard enough without digging through older junk.

Last edited by Starson17; 03-31-2011 at 04:35 PM.
Starson17 is offline   Reply With Quote
Old 04-01-2011, 03:44 PM   #5
Dereks
Connoisseur
Dereks began at the beginning.
 
Posts: 54
Karma: 10
Join Date: Feb 2010
Device: Sony PRS-T1
good effort, but hardly usable. the recipe I'm trying to modify used login / password. Tried to use the batch file and it stumbled at the first step, since it had to be entered manually.
Dereks is offline   Reply With Quote
Old 04-01-2011, 03:54 PM   #6
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by Dereks View Post
good effort, but hardly usable. the recipe I'm trying to modify used login / password. Tried to use the batch file and it stumbled at the first step, since it had to be entered manually.
All recipes that use login/passwords have to add the password manually or hardcode it into the recipe being tested. I don't think it's fair to call his batch file "hardly usable" just because it won't handle the special case of recipes that require logging in.
Starson17 is offline   Reply With Quote
Old 04-01-2011, 04:55 PM   #7
Dereks
Connoisseur
Dereks began at the beginning.
 
Posts: 54
Karma: 10
Join Date: Feb 2010
Device: Sony PRS-T1
but correct me if I'm wrong: using command line implies that you'd use extra properties extensively. Login / password are just two of them. Since there is no interface for changing it in the command line, i can't see how it can by applied. It's helpful only if you have a basic recipe, which requires only internal editing of the recipe, like stylesheets, fonts, etc.
Dereks is offline   Reply With Quote
Old 04-01-2011, 05:13 PM   #8
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by Dereks View Post
but correct me if I'm wrong: using command line implies that you'd use extra properties extensively. Login / password are just two of them. Since there is no interface for changing it in the command line, i can't see how it can by applied. It's helpful only if you have a basic recipe, which requires only internal editing of the recipe, like stylesheets, fonts, etc.
When running a recipe inside Calibre, there are only two types of recipes - those that need a user/password and those that don't. You can't pass anything to the recipe other than the user/password combo. His batch file works for those that do not need the user/password.

It's true that you can provide some other parameters to the recipe on the command line, but for general purpose testing, the only two I ever use are the same two he's hard-coded into the batch file "-vv" to get the verbose output and "--test" to limit the number of feeds and articles retrieved from each feed.

Basically, his batch file is identical to the one I use on every recipe I test except that he didn't send error output to a file. I use that same batch file even for recipes that need user/password, but I modify the recipe internally during the testing stage with a hardcoded user/password, then remove it before sending it to Kovid. His batch file essentially replicates the recommendation in the user manual here: http://calibre-ebook.com/user_manual...ght=recipe#id9
Starson17 is offline   Reply With Quote
Old 04-01-2011, 05:22 PM   #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: 26,435
Karma: 5383257
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by Starson17 View Post
His batch file essentially replicates the recommendation in the user manual here: http://calibre-ebook.com/user_manual...ght=recipe#id9
That is a little out of date, you should really be using the --debug-pipeline option as well to see the downloaded HTML before the conversion pipeline runs on it. I've updated it.
kovidgoyal is online now   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
Calibre debug file meme Calibre 7 02-01-2011 05:45 PM
Console test recipes that require subscription TonytheBookworm Recipes 2 10-03-2010 05:28 PM
What happened to calibre-debug "--develop-from" option? macr0t0r Calibre 6 12-03-2009 08:22 PM
Crash while batch converting epubs under windows AprilHare Calibre 3 04-26-2009 04:46 AM
New Windows debug tools released TadW Lounge 0 01-11-2006 04:16 AM


All times are GMT -4. The time now is 11:19 PM.


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