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-13-2010, 04:15 PM   #1
trott3r
Member
trott3r began at the beginning.
 
trott3r's Avatar
 
Posts: 22
Karma: 10
Join Date: Sep 2010
Device: Kindle 3 and Sony PRS-505
http://www.morphzone.org request please

http://www.morphzone.org/modules/lastposts/

Just wondering if anyone could come up with a recipe for that morphos forum.

thanks for your time

Martin
trott3r is offline   Reply With Quote
Old 10-14-2010, 12:01 AM   #2
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
here:
Spoiler:

Code:
#!/usr/bin/env  python
__license__   = 'GPL v3'
__author__    = 'Tony Stegall' 
__copyright__ = '2010, Tony Stegall or Tonythebookworm on mobiread.com'
__version__   = '1'
__date__      = '13, October 2010'
__docformat__ = 'English'
'''
http://www.morphzone.org/modules/news/
'''


from calibre.web.feeds.news import BasicNewsRecipe
from calibre.ebooks.BeautifulSoup import BeautifulSoup
class Morphzone(BasicNewsRecipe):
    title      = 'MorphZone'
    __author__ = 'Tonythebookworm'
    description = 'Forum of the Morph'
    language = 'en'
    no_stylesheets = True
    publisher           = 'Tonythebookworm'
    category            = 'forum'
    use_embedded_content= False
    no_stylesheets      = True
    oldest_article      = 24
    remove_javascript   = True
    remove_empty_feeds  = True
    #masthead_url        = ''
    
    
    max_articles_per_feed = 10
    conversion_options = {'linearize_tables' : True}
    
    
    def parse_index(self):
        feeds = []
        for title, url in [
                            (u"Forum", u"http://www.morphzone.org/modules/lastposts/"),
                            
                            
                             ]:
            articles = self.make_links(url)
            if articles:
                feeds.append((title, articles))
        return feeds
        
    def make_links(self, url):
        title = 'Temp'
        current_articles = []
        soup = self.index_to_soup(url)
        for item in soup.findAll('table', attrs = {'class': 'bg2'}):
         for tr  in item.findAll('tr',    attrs = {'class': 'bg1'}):
          print 'tr is: ', tr
          for td in tr.findAll('td')[1]:
            print 'td is: ', td
            link = td.find('a')
            print 'the link is: ', td
            if td:
                url         = td['href']
                title       = self.tag_to_string(td)
                print 'the title is: ', title
                print 'the url is: ', url
                print 'the title is: ', title
                current_articles.append({'title': title, 'url': url, 'description':'', 'date':''}) # append all this
        return current_articles
      
      
    def print_version(self, url):
        
        #original is: http://www.morphzone.org/modules/newbb_plus/viewtopic.php?topic_id=7418&forum=11
        #need this to be print_url:
        #http://www.morphzone.org/modules/newbb_plus/print.php?forum=11&topic_id=7418         
         
        print_url = url.replace('viewtopic.php','print.php')
        print 'THIS URL WILL PRINT: ', print_url # this is a test string to see what the url is it will return
        return print_url

    def preprocess_html(self, soup):
        for item in soup.findAll(attrs={'style':True}):
            del item['style']
        return soup
TonytheBookworm is offline   Reply With Quote
 
Enthusiast
Old 10-14-2010, 10:08 AM   #3
trott3r
Member
trott3r began at the beginning.
 
trott3r's Avatar
 
Posts: 22
Karma: 10
Join Date: Sep 2010
Device: Kindle 3 and Sony PRS-505
ERROR: Invalid input: <p>Could not create recipe. Error:<br>invalid syntax (recipe9.py, line 68)


Thats what i get when i copy n paste it into calibre v0.7.20

Thanks for helping
Martin
trott3r is offline   Reply With Quote
Old 10-14-2010, 11:06 AM   #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 trott3r View Post
ERROR: Invalid input: <p>Could not create recipe. Error:<br>invalid syntax (recipe9.py, line 68)


Thats what i get when i copy n paste it into calibre v0.7.20

Thanks for helping
Martin
You probably made a mistake copying it over. Try again. It works for me. Most likely you lost a space in an indent.
Starson17 is offline   Reply With Quote
Old 10-14-2010, 11:18 AM   #5
trott3r
Member
trott3r began at the beginning.
 
trott3r's Avatar
 
Posts: 22
Karma: 10
Join Date: Sep 2010
Device: Kindle 3 and Sony PRS-505
Ooops that embarassing,
Thanks for the pointer starson works fine now

Martin
trott3r is offline   Reply With Quote
Old 10-14-2010, 02:05 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 trott3r View Post
Ooops that embarassing,
Thanks for the pointer starson works fine now
You're welcome. It's an easy mistake to make, and I've made it myself. The recipe writer can post a zip file, which can be directly imported into the recipe system. That avoids problems like this, but at the expense of making it hard to look at the recipe in this thread. I prefer being able to look at it, even if copying errors sometimes occur.
Starson17 is offline   Reply With Quote
Old 10-14-2010, 07:28 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
FINISHED CODE READY FOR SUBMIT

recipe for morphzone forum ready for submission.
Attached Files
File Type: rar morph.rar (2.2 KB, 91 views)
TonytheBookworm is offline   Reply With Quote
Old 10-14-2010, 08:00 PM   #8
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: 25,916
Karma: 5035037
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I dont think a recipe that dowloands a forum belongs with the builtin recipes.
kovidgoyal is offline   Reply With Quote
Old 10-14-2010, 08:17 PM   #9
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 kovidgoyal View Post
I dont think a recipe that dowloands a forum belongs with the builtin recipes.
I agree, just submitted it just in case
TonytheBookworm is offline   Reply With Quote
Old 10-14-2010, 08:19 PM   #10
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 kovidgoyal View Post
I dont think a recipe that dowloands a forum belongs with the builtin recipes.
I wondered about that when I read this request. It's certainly not the type of recipe I'd use (although I note that there is a Slashdot recipe). Tony - why don't you start a thread specifically for recipes that don't make it into the builtins. Forums and online books that don't change strike me as two that fit that category. If we get enough candidates, maybe it will be worth making it a sticky.
Starson17 is offline   Reply With Quote
Old 10-15-2010, 09:48 AM   #11
trott3r
Member
trott3r began at the beginning.
 
trott3r's Avatar
 
Posts: 22
Karma: 10
Join Date: Sep 2010
Device: Kindle 3 and Sony PRS-505
The more reading material for an ebook the better.
So i think they should be collected somewhere if its not to be included with calibre.

Martin
trott3r is offline   Reply With Quote
Old 10-15-2010, 02:20 PM   #12
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 trott3r View Post
The more reading material for an ebook the better.
So i think they should be collected somewhere if its not to be included with calibre.
I definitely think there's a place for these "odd" recipes, but I agree with Kovid it's not in Calibre's builtins. Putting it in the builtins adds to the download time for tens of thousands of users. I'll start a thread, and let's see if it gets used.
Starson17 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
http://www.freeliterature.org marcdh News 32 07-20-2010 11:06 PM
http://www.ebooks.com/? J-Man27 Sony Reader 3 05-20-2010 12:08 PM
xmlns="http://www.w3.org/1999/xhtml paulpeer Sigil 2 03-21-2010 07:57 AM
http://www.ebooksforfree.org/ vorapotwong Deals, Freebies, and Resources (No Self-Promotion) 1 10-17-2008 08:21 AM


All times are GMT -4. The time now is 07:53 AM.


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