![]() |
#1 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Sep 2010
Device: Kindle 3
|
How to transfer only previously unretrieved RSS posts?
I posted a similar question to this on the main Calibre forum yesterday, and dwanthny kindly pointed out that it would be better addressed to the recipes forum, so here goes.
I purchased a Kindle 3 last week and I've configured Calibre to download some RSS feeds and email them to my Kindle via he free.kindle.com address. But I would prefer each transfer to contain only the posts I've not yet seen, rather than a rolling cycle of the last n days or n posts. Of course, that requires the datetime of the last retrieved post in each feed to be stored and used as the starting point for the next tranche. So my question is: can Calibre do this, ie does it have access to persistent storage. If it can, are there any example recipes I could look at (I know .NET languages but not Python)? And if I have to preprocess the feeds myself before Calibre retrieves them, can I still hook into the 'retrieve - convert - email' pipeline using the Calibre command line? Thanks for any advice. Chris |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,164
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Sure you can do it. Just re-implement the parse_feeds function in your recipe. AS for storage, use this
from calibre.utils.config import dynamic history = create dict of times dynamic['recipe_name_last_downloaded_dates'] = history |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Sep 2010
Device: Kindle 3
|
Re: How to transfer only previously unretrieved RSS posts?
Quote:
In the UK Amazon is doing a BIG push on Kindle 3. The ads are everywhere. My guess is that a lot of people will want this functionality (already I see someone has replied to my original post in the Calibre forum expressing interest). If doing that development appeals to anyone, please say! My alternative is to implement an intelligent feed filter/aggregator using .NET & DotNetNuke and have Calibre read from that. |
|
![]() |
![]() |
![]() |
#4 |
Enthusiast
![]() Posts: 31
Karma: 10
Join Date: Jun 2008
Device: Sony PRS-500
|
Been staring at this problem for a little while. My conclusion is that this is not really well supported.
I'm about to embark on writing a Perl script cron job that will import the scheduler.xml file, open the recipe for each scheduled feed, check the RSS URLs for any updates since the last pull, and execute ebook-convert for any newly updated feeds. Along the way it'll have to use sqlite3 to pull the custom recipes. While all this seems it would be easier to write in a plugin using the existing APIs, I don't like Python and it would take me more time to code it up that way, and it sounds prone to breakage in new versions of calibre. Here is where I'm hoping someone more proficient with Python already accomplished all or most of the above! Desires: 1) only generate a new book if there is an update in the RSS feed (I have a couple rarely-updated blogs I'd love to follow) 2) not have to update every single recipe I'm interested in with code to make it work (aforementioned parse_feed solution) 3) keep each feed in separate books (meaning I'm not interested in the aggregated google reader solution) 3) automate w/ cron and command line tools to avoid using the gui 4) bonus: trigger a sync to the device when plugged in, without gui (udev trickery?) |
![]() |
![]() |
![]() |
#5 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
If any of this has been done already, it hasn't been reported here. If it's of any help, I took Kovid's comments and had no trouble using persistent storage in several test recipes. If all you want is to not fetch previously fetched article URLs, or exit if the first article URL is unchanged it should be pretty easy. If you want to avoid the gui or avoid changing each recipe, you'll have to do something like you've suggested.
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Addict
![]() Posts: 264
Karma: 62
Join Date: May 2010
Device: kindle 2, kindle 3, Kindle fire
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#7 |
Zealot
![]() Posts: 122
Karma: 10
Join Date: Jul 2010
Device: nook
|
i am not sure this can be adapted easly
but there is a short sticky called reusable code. check that out.
|
![]() |
![]() |
![]() |
#8 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Oct 2010
Device: Kindle 3
|
This would be very useful indeed!
Also, for sites which are quite fast moving and only have a small number of RSS items, it would be useful to be pulling down the RSS regularly (every 30 mins, say) but only generate the ebook once - in the morning for instance. Cheers, M. |
![]() |
![]() |
![]() |
#9 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
All I've done in my testing is save and retrieve data of interest (time, first article url, etc.) to/from a recipe between multiple runs. I haven't tried anything sophisticated with what I do with that data. In fact, I saw that you used exit code in a recipe and thought I might adapt that to abort the recipe when the first feed hadn't changed. I did this sort of thing in my tests: Code:
now = #set current time in desired format using datetime first_url = # set current first_url previous_download_time = dynamic['recipe_name']['download_time'] previous_first_url = dynamic['recipe_name']['first_url'] dynamic['recipe_name']['download_time'] = now dynamic['recipe_name']['first_url'] = first_url |
|
![]() |
![]() |
![]() |
#10 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
remove_empty_feeds = True ? I vaguely recall that you get an abort if all feeds are empty. |
|
![]() |
![]() |
![]() |
#11 |
Addict
![]() Posts: 264
Karma: 62
Join Date: May 2010
Device: kindle 2, kindle 3, Kindle fire
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
RSS feeds - new posts only | lymeswold | Calibre | 25 | 11-17-2010 06:06 PM |
iPad Why I decided to reserve an iPad when I previously had no interest.... | DougFNJ | Apple Devices | 36 | 04-02-2010 11:32 PM |
Libprs500- error with adding previously converted books | bluesnews | Calibre | 4 | 04-08-2008 11:06 PM |
Question on previously purchased content | sana | Workshop | 7 | 03-09-2008 07:19 AM |