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-10-2011, 09:39 AM   #1
Sabkor
Junior Member
Sabkor began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Mar 2011
Device: PocketBook Pro 902
RSS feed with PDFs

I have an RSS feed that is a list of 3 PDF magazines (the last three issues). It's my understanding that I cannot embed a PDF into a ePUB file, so I think somehow I'd have to download each link in the RSS feed separately and create 3 separate books from each RSS feed. Is this possible using a recipe?

Little bit about my background:

- New to ebooks, just got my first reader a couple of days ago. Have been using Sigil to create a couple of my own ebooks just to see how the ePUB format works.
- Never programmed in Python before, although I have used other non-compiled scripting languages like VBScript and PHP. If pointed in the right direction, I may be able to figure this out.

Thanks in advance for any help that you guys can provide!
Sabkor is offline   Reply With Quote
Old 03-10-2011, 10:10 AM   #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 Sabkor View Post
I have an RSS feed that is a list of 3 PDF magazines (the last three issues). It's my understanding that I cannot embed a PDF into a ePUB file, so I think somehow I'd have to download each link in the RSS feed separately and create 3 separate books from each RSS feed. Is this possible using a recipe?
Short answer: No.

More info: It's been done with links to EPUBs, but only because of how similar the EPUB structure is to an intermediate stage of recipe processing.

Long answer: Yes, it's probably possible, but you'd either have to override almost everything in the recipe system or use some outside pdf to html conversion. I haven't seen it done.
Starson17 is offline   Reply With Quote
 
Enthusiast
Old 03-10-2011, 11:22 AM   #3
Sabkor
Junior Member
Sabkor began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Mar 2011
Device: PocketBook Pro 902
Well, thanks for the quick answer anyways, even if it's bad news!

I'll probably just use an external RSS reader, then feed them into Calibre from there.
Sabkor is offline   Reply With Quote
Old 12-07-2011, 04:04 PM   #4
mlt
Junior Member
mlt began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Dec 2011
Device: Kindle DX graphite
Question non-html news feeds?

Quote:
Originally Posted by Starson17 View Post
Long answer: Yes, it's probably possible, but you'd either have to override almost everything in the recipe system
What is the good starting point for that?

In my case, feeds have a link to html page with links to actual content in several formats. ODT and PDF are among them. So instead of fetching just a summary, i'd like to pull either ODT and process it to MOBI or fetch PDF as is.

I thought I can just override print_version method, then I can get proper url using BeautifulSoup. However calibre tries to parse whatever it is fetching from proper url I return as if html
mlt is offline   Reply With Quote
Old 12-08-2011, 01:50 AM   #5
mlt
Junior Member
mlt began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Dec 2011
Device: Kindle DX graphite
Question

I was looking at a sample code. However I still don't get it how to fetch things if I don't have epub among other formats in the first place?

I ended up writing standalone python code that fetches all I want and calls `calibredb add`. I'd appreciate if someone can suggest as how to convert it into a recipe.
Spoiler:
Code:
#!/usr/bin/python
# vim: set fileencoding=utf-8 :

import feedparser, urllib2, tempfile, os
from BeautifulSoup import BeautifulSoup

feed_url = "http://dotu.ru/feed"
feed = feedparser.parse(feed_url)

for item in feed["items"]:
    title = item["title"]
    print """Fetching "%s" """ % title
    summary = urllib2.urlopen(item["link"])
    soup = BeautifulSoup(summary)
    downloadText = soup.find(text=u"Скачать fb2")
    if None != downloadText:
        a = downloadText.findParent(name='a')
        file = tempfile.NamedTemporaryFile(suffix='.fb2')
        url = a["href"]
        try:
            response = urllib2.urlopen(url)
            file.write(response.read())
            file.flush()
            cmd = u"calibredb add %s" % file.name
            cmd2 = cmd.encode('utf-8')
            os.system(cmd2)
            file.close()
        except:
            print "Failed to download %s" % url
mlt 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
Books through an RSS feed Canadiancynic Calibre 1 02-06-2011 06:13 AM
RSS Feed timezone Feedback 8 01-02-2010 06:55 PM
RSS Feed Question PGP_Protector Sony Reader 1 01-26-2009 12:12 AM
Newsimages.com RSS Feed Alexander Turcic Lounge 0 08-27-2004 03:25 PM


All times are GMT -4. The time now is 03:01 AM.


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