|
|
Thread Tools | Search this Thread |
11-05-2010, 06:22 PM | #1 |
Zealot
Posts: 115
Karma: 20
Join Date: Jul 2010
Device: Kindle3 3G, Kindle Paperwhite 2
|
Passing parameters to recipe from "Schedule News Download" Window (e.g. for filtering
Hi,
I would love to pass some parameters (filter options) to a custom recipe from the "Schedule News Download" Window. I do not want to have to edit the recipe every time I would like to change my article filtering options. Are you aware of any possibilities for doing that? There are the undocumented Advanced Features like "Extra Tags". Can I do anything with that? Then of course I could program a popup gui window in python to select the parameters directy in the running recipe. But that would involve quite some programming. Thanks, Jens |
11-05-2010, 09:44 PM | #2 | |||
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
Quote:
Quote:
Pass in via the username password, or a file that your recipe reads are options. |
|||
Advert | |
|
11-06-2010, 04:36 PM | #3 |
Zealot
Posts: 115
Karma: 20
Join Date: Jul 2010
Device: Kindle3 3G, Kindle Paperwhite 2
|
I have come up with a solution that I find quite elegant:
I just open up dialog popups to poll the parameter from the recipe itself. This is how I did it: 1. Add the following lines to the top of the recipe to load pyqt4 (the qt implementation for python) Code:
import sys from PyQt4 import QtGui from PyQt4 import QtCore Code:
##################### # dialog to get parameters ##################### #create gui application for dialog (I think you do not need it it's a leftover) app = QtGui.QApplication(sys.argv) #get widget widget = QtGui.QWidget() #open dialog to input integer variables tmp_no_feeds, ok=QtGui.QInputDialog.getInteger(widget, 'Input Dialog - Number of Feeds', 'Number of feeds:',8) #this would be the text input dialog #no_feeds, ok=QtGui.QInputDialog.getText(widget, 'Input Dialog - Text example', 'Enter text:',QtGui.QLineEdit.Normal,'default text') #take value if ok was pressed otherwise use default value if ok: no_feeds=tmp_no_feeds else: #default no_feeds=8 #you may now use the variable no_feeds self.log('\t\tno_feeds=',no_feeds) ########################### # end dialog ########################### http://zetcode.com/tutorials/pyqt4/ I used a procedural style to open the dialogs since I find it simpler to integrate into a recipe. Hope this helps some people having the same problems. Cheers, Jens P.S.: This approach is of course problematic if you would like to automatically schedule your recipes in the middle of the night since it will not run if you do not respond to the dialog boxes ... Last edited by oecherprinte; 11-06-2010 at 05:00 PM. |
05-13-2011, 12:55 AM | #4 |
Junior Member
Posts: 4
Karma: 10
Join Date: Nov 2010
Device: Kindle 3
|
Thanks, Jens! Just what I was looking for!
|
05-13-2011, 10:12 AM | #5 |
Junior Member
Posts: 4
Karma: 10
Join Date: Nov 2010
Device: Kindle 3
|
I'm setting recipe_disabled to a non empty string to abort the recipe when user click on cancel button. The recipe stops with a error dialog window.
Is there any other way to cancel a recipe? |
Advert | |
|
05-13-2011, 10:17 AM | #6 |
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
|
05-13-2011, 11:38 AM | #7 |
Junior Member
Posts: 4
Karma: 10
Join Date: Nov 2010
Device: Kindle 3
|
No, I'm using to download back issues of Brazilian magazine Piauí (great magazine if you read Portuguese)... they provide full version of back issues on their site. The dialog window is used to ask which issue to download.
I'm writing a scheduled version too, without the dialog window, to be used in monthly basis to download the last full back issue available. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calibre recipe for daily Portuguese newspaper "Correio da Manhã" | jmst | Recipes | 2 | 11-01-2010 01:01 PM |
"Fetch News" download time? | oilcan | Calibre | 1 | 09-26-2010 01:29 PM |
Schedule news, but manual download | MightyMauz | Calibre | 3 | 09-04-2010 07:54 AM |
Call "print newspapers" as "snailpapers" because they arrive with news is 12 hrs old | taglines | Lounge | 4 | 02-05-2010 10:01 AM |
Schedule news download | AprilHare | Calibre | 31 | 02-11-2009 04:20 AM |