home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / Calibre / calibre-0.8.18.msi / file_280 / mac_video.recipe < prev    next >
Text File  |  2011-09-09  |  5KB  |  83 lines

  1. #!/usr/bin/env  python
  2. __license__     = 'GPL v3'
  3. __author__      = 'Lorenzo Vigentini'
  4. __copyright__   = '2009, Lorenzo Vigentini <l.vigentini at gmail.com>'
  5. __version__     = 'v1.01'
  6. __date__        = '14, January 2010'
  7. __description__ = 'MacVideo is an independent journal not affiliated with Apple Computer, It is a publication of IDG Communication focusing on video production and editing.'
  8.  
  9. '''
  10. http://www.macvideo.tv/
  11. '''
  12.  
  13. from calibre.web.feeds.news import BasicNewsRecipe
  14. from calibre.ptempfile import PersistentTemporaryFile
  15.  
  16. temp_files = []
  17. articles_are_obfuscated = True
  18.  
  19. class macVideo(BasicNewsRecipe):
  20.     __author__    = 'Lorenzo Vigentini'
  21.     description   = 'MacVideo is an independent journal not affiliated with Apple Computer, It is a publication of IDG Communication focusing on video production and editing.'
  22.     cover_url     = 'http://www.macvideo.tv/images/shared/macvideo-logo.jpg'
  23.  
  24.     title          = 'MacVideo '
  25.     publisher      = 'IDG Communication'
  26.     category       = 'Apple, Mac, video, computing, product reviews, editing, cameras, production'
  27.  
  28.     language       = 'en'
  29.     encoding       = 'cp1252'
  30.     timefmt        = '[%a, %d %b, %Y]'
  31.  
  32.     oldest_article        = 30
  33.     max_articles_per_feed = 25
  34.     use_embedded_content  = False
  35.     recursion             = 10
  36.  
  37.     remove_javascript     = True
  38.     no_stylesheets        = True
  39.  
  40.     def get_obfuscated_article(self, url):
  41.         br = self.get_browser()
  42.         br.open(url+'&print')
  43.  
  44.         response = br.follow_link(url, nr = 0)
  45.         html = response.read()
  46.  
  47.         self.temp_files.append(PersistentTemporaryFile('_fa.html'))
  48.         self.temp_files[-1].write(html)
  49.         self.temp_files[-1].close()
  50.         return self.temp_files[-1].name
  51.  
  52.     keep_only_tags     = [
  53.                             dict(name='div', attrs={'id':'mainContent'})
  54.                         ]
  55.  
  56.     remove_tags        = [
  57.                             dict(name='div', attrs={'class':['submissionBar','mpuContainer']}),
  58.                             dict(name='p', attrs={'class':'articlePag'}),
  59.                             dict(name='ul', attrs={'id':'articleIconsList'})
  60.                         ]
  61.  
  62.     feeds          = [
  63.                        (u'News', u'http://www.macvideo.tv/rss/feeds/macvideo-news.xml'),
  64.                        (u'Reviews', u'http://www.macvideo.tv/rss/feeds/macvideo-reviews.xml'),
  65.                        (u'Interviews', u'http://www.macvideo.tv/rss/feeds/macvideo-features-interviews.xml'),
  66.                        (u'Features', u'http://www.macvideo.tv/rss/feeds/macvideo-features-features.xml'),
  67.                        (u'Rick Young', u'http://www.macvideo.tv/rss/feeds/blog100140.xml'),
  68.                        (u'Matt Davis', u'http://www.macvideo.tv/rss/feeds/blog101658.xml'),
  69.                        (u'Adrian Miskelly', u'http://www.macvideo.tv/rss/feeds/blog101750.xml')
  70.                      ]
  71.  
  72.     extra_css = '''
  73.                 h1 {font-family:"Trebuchet MS",Arial,Helvetica,sans-serif; font-size:20px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:18px;}
  74.                 h2 {font-family:"Trebuchet MS",Arial,Helvetica,sans-serif; font-size:18px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:16px; }
  75.                 h3 {color:#333333;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif; font-size:16px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:14px;}
  76.                 h4 {color:#333333; font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:16px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:14px; }
  77.                 h5 {color:#333333; font-family:"Trebuchet MS",Arial,Helvetica,sans-serif; font-size:12px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:14px; text-transform:uppercase;}
  78.                 .newsdate {color:#333333;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:10px; font-size-adjust:none; font-stretch:normal; font-style:italic; font-variant:normal; font-weight:bold; line-height:10px; text-decoration:none;}
  79.                 .author {color:#333333;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:10px; font-size-adjust:none; font-stretch:normal; font-style:bold; font-variant:normal; font-weight:bold; line-height:10px; text-decoration:none;}
  80.                 p {font-family:Arial,Helvetica,sans-serif; font-size:10px;}
  81.                 img {align:left;}
  82.                 '''
  83.