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 10-04-2010, 10:06 AM   #1
ajnorman
Junior Member
ajnorman began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Oct 2010
Device: Kindle 3
The Guardian, modified

A couple of modifications to the standard recipe for the Guardian:

1. On Sundays, the recipe will download the Observer main section (the Observer being effectively the "Sunday Guardian"). This allows you to set up Calibre to download and send every day, without getting a second copy of the Saturday Guardian on Sunday morning.

2. There is a variable "ignore_sections" which skips sections you don't want to see (I have absolutely no interest in seeing the Sport section, for example).
Attached Files
File Type: gz guardian.recipe.gz (1.5 KB, 298 views)
ajnorman is offline   Reply With Quote
Old 10-04-2010, 10:09 AM   #2
desertgrandma
Enjoying the show....
desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.desertgrandma ought to be getting tired of karma fortunes by now.
 
desertgrandma's Avatar
 
Posts: 14,277
Karma: 8205207
Join Date: Jun 2008
Location: Arizona
Device: A K1, Kindle Paperwhite, an Ipod, IPad2, Iphone, an Ipad Mini & macAir
Welcome to MobileRead, ajnorman
desertgrandma is offline   Reply With Quote
Old 10-04-2010, 12:20 PM   #3
neilmarr
neilmarr
neilmarr ought to be getting tired of karma fortunes by now.neilmarr ought to be getting tired of karma fortunes by now.neilmarr ought to be getting tired of karma fortunes by now.neilmarr ought to be getting tired of karma fortunes by now.neilmarr ought to be getting tired of karma fortunes by now.neilmarr ought to be getting tired of karma fortunes by now.neilmarr ought to be getting tired of karma fortunes by now.neilmarr ought to be getting tired of karma fortunes by now.neilmarr ought to be getting tired of karma fortunes by now.neilmarr ought to be getting tired of karma fortunes by now.neilmarr ought to be getting tired of karma fortunes by now.
 
neilmarr's Avatar
 
Posts: 7,230
Karma: 6000059
Join Date: Apr 2009
Location: Monaco-Menton, France
Device: sony
Yeah -- hi Anjorman. Good to hagve your company. And with interesting opening advice to boot. Best wishes. Neil
neilmarr is offline   Reply With Quote
Old 10-04-2010, 06:48 PM   #4
TonytheBookworm
Addict
TonytheBookworm is on a distinguished road
 
TonytheBookworm's Avatar
 
Posts: 264
Karma: 62
Join Date: May 2010
Device: kindle 2, kindle 3, Kindle fire

I like how you implemented the the weekday check in your recipe. I have one question for you or anyone else that might know the answer.

Is there a command that can be used to abort the entire execution of a script?
Because there are several recipes I have made that I would like to include a date check so It doesn't download the feed on the weekends or only downloads it on tues and Thursdays or something like that.

so could someone please share with me the abort command ?


Nevermind, I figured it out. This will fix the issue I was wanting to be added to caibre for a weekend or weekday only feature.
Spoiler:

Code:
from datetime import date
from sys import exit

class MyLittleRecipe(BasicNewsRecipe):
   #################################################################################
   #Changelog: 
   # - added date check to terminate script in the event it is a weekend
   #################################################################################
    
    if date.today().weekday() > 4:
        print 'TERMINATED BECAUSE NOT A WEEKDAY'
        exit('terminated')

Last edited by TonytheBookworm; 10-04-2010 at 07:08 PM.
TonytheBookworm is offline   Reply With Quote
Old 10-05-2010, 12:12 PM   #5
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 TonytheBookworm View Post
Nevermind, I figured it out. This will fix the issue I was wanting to be added to caibre for a weekend or weekday only feature.
Nice one, Tony.

I've been jammed with work recently, but did you notice the code Kovid posted for storing/retrieving data from a recipe? It could be useful in controlling the feeds/articles to prevent duplication from one recipe run to another, etc.
Starson17 is offline   Reply With Quote
Old 10-05-2010, 02:09 PM   #6
TonytheBookworm
Addict
TonytheBookworm is on a distinguished road
 
TonytheBookworm's Avatar
 
Posts: 264
Karma: 62
Join Date: May 2010
Device: kindle 2, kindle 3, Kindle fire
Quote:
Originally Posted by Starson17 View Post
Nice one, Tony.

I've been jammed with work recently, but did you notice the code Kovid posted for storing/retrieving data from a recipe? It could be useful in controlling the feeds/articles to prevent duplication from one recipe run to another, etc.
Yeah, work has picked up a lot for me too. That's a good thing i guess. As for Kovid's code I hadn't looked at it but I will.
TonytheBookworm is offline   Reply With Quote
Old 10-05-2010, 02:14 PM   #7
TonytheBookworm
Addict
TonytheBookworm is on a distinguished road
 
TonytheBookworm's Avatar
 
Posts: 264
Karma: 62
Join Date: May 2010
Device: kindle 2, kindle 3, Kindle fire
Have you implemented anything using that storage feature yet? I see the code is pseudo in a sense. I would like to see it in action so I could understand better how it works.
TonytheBookworm is offline   Reply With Quote
Old 10-05-2010, 03:07 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 TonytheBookworm View Post
Have you implemented anything using that storage feature yet? I see the code is pseudo in a sense. I would like to see it in action so I could understand better how it works.
No, I haven't implemented it in any recipes yet. However, it's similar to the first code I ever wrote for Calibre (and the first ... and last ... thing I showed Charles how to do) where I stored an option set in the GUI, then later retrieved that option setting for use on a subsequent run of Calibre. Until Kovid posted, I hadn't really thought of using it for recipes.
Starson17 is offline   Reply With Quote
Old 10-07-2010, 08:13 AM   #9
harold1066
Member
harold1066 began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Oct 2010
Device: Kindle 3
Quote:
Originally Posted by ajnorman View Post

2. There is a variable "ignore_sections" which skips sections you don't want to see (I have absolutely no interest in seeing the Sport section, for example).
I new to all this, so how would I go about adding ignore sections to the download, I don't really want the business section and would like to ignore this.

TIA

H
harold1066 is offline   Reply With Quote
Old 10-08-2010, 02:52 AM   #10
hilsea
Junior Member
hilsea began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Oct 2010
Device: kindle
I have been downloading the custom Guardian News feature to my kindle for the past 2 weeks, however this week as a result of this change i believe i am now no longer getting any images, was this done on purpose or was it just missed in the tweak of the recipe. I personally would prefer to receive the images, the file was only around 2.5mb now its gone down to .4mb. Is there an easy way for me to go back to how it used to be?
hilsea is offline   Reply With Quote
Old 10-08-2010, 05:01 AM   #11
ajnorman
Junior Member
ajnorman began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Oct 2010
Device: Kindle 3
Oh yes, I should have remembered that my custom recipe also removes images (which I usually don't want - the Guardian has some excellent photography but too many mugshots of columnists and pictures used for decoration rather than information). This is the offending code:

Code:
    remove_tags = [
                        dict(name='div', attrs={'class':["video-content","videos-third-column"]}),
                        dict(name='div', attrs={'id':["article-toolbox","subscribe-feeds",]}),
                        dict(name='ul', attrs={'class':["pagination"]}),
                        dict(name='ul', attrs={'id':["content-actions"]}),
                        dict(name='img'),
                        ]
Just remove the line
Code:
dict(name='img'),
to restore image downloads. To add a section to the list of modules to be ignored, change this line:

Code:
    ignore_sections = ("Sport")
to

Code:
    ignore_sections = ("Sport", "Business")
ajnorman is offline   Reply With Quote
Old 10-14-2010, 09:17 AM   #12
Marts
Junior Member
Marts began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Oct 2010
Device: Kindle 3
Good work on the modification :-)

I wonder if it would be possible to remove the Mugshots (which I agree are annoying) but still keep the regular photographs?

So does this mean I don't need to use the Observer recipe at all now (or I guess I could wait till Sunday and find out :-) )

M.
Marts is offline   Reply With Quote
Old 10-20-2010, 06:16 PM   #13
storkozos
Junior Member
storkozos began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Oct 2010
Device: Kindle 3
Smashing. Very useful.

adam
storkozos is offline   Reply With Quote
Old 10-28-2010, 05:15 AM   #14
rupertbear
Junior Member
rupertbear began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Oct 2010
Device: kindle
I have had my Kindle for a few days only and I have to say that the ability to use it to read the Guardian every day is an unexpected and very welcome bonus. Thank you.

I have not edited the script at all but

ignore_sections = ("Sport")

doesn't work, I get all sections every day. Any idea where I might be going wrong?

I also get all images, which is not as important to me but might be a clue.

Thanks
rupertbear is offline   Reply With Quote
Old 10-29-2010, 02:23 AM   #15
storkozos
Junior Member
storkozos began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Oct 2010
Device: Kindle 3
Hmm. Mine is fine. In fact I turned images back on...s
ounds like you haven't loaded the recipe correctly and that you're using the old Guardian recipe.

Just a thought. I'm no expert.
storkozos 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
Last Modified Date jjansen Calibre 1 09-12-2010 10:16 PM
Modified Cover Mickey330 PocketBook 11 06-18-2010 05:49 AM
Can a contract agreement be modified? ficbot Writers' Corner 5 05-21-2010 05:10 AM
Where are modified tags stored Giuseppe Chillem Calibre 12 05-18-2010 03:33 PM
jbl modified dictionary jeff862 Ectaco jetBook 1 02-25-2010 09:31 PM


All times are GMT -4. The time now is 10:12 AM.


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