mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge from trunk
This commit is contained in:
commit
df542b63a7
BIN
resources/images/news/popscience.png
Normal file
BIN
resources/images/news/popscience.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 737 B |
59
resources/recipes/popscience.recipe
Normal file
59
resources/recipes/popscience.recipe
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
import re
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class AdvancedUserRecipe1282101454(BasicNewsRecipe):
|
||||||
|
title = 'Popular Science'
|
||||||
|
language = 'en'
|
||||||
|
__author__ = 'TonytheBookworm'
|
||||||
|
description = 'Popular Science'
|
||||||
|
publisher = 'Popular Science'
|
||||||
|
category = 'gadgets,science'
|
||||||
|
oldest_article = 7 # change this if you want more current articles. I like to go a week in
|
||||||
|
max_articles_per_feed = 100
|
||||||
|
no_stylesheets = True
|
||||||
|
remove_javascript = True
|
||||||
|
|
||||||
|
masthead_url = 'http://www.raytheon.com/newsroom/rtnwcm/groups/Public/documents/masthead/rtn08_popscidec_masthead.jpg'
|
||||||
|
|
||||||
|
remove_tags = [dict(name='div', attrs={'id':['toolbar','main_supplements']}),
|
||||||
|
dict(name='span', attrs={'class':['comments']}),
|
||||||
|
dict(name='div', attrs={'class':['relatedinfo related-right','node_navigation','content2']}),
|
||||||
|
dict(name='ul', attrs={'class':['item-list clear-block']})]
|
||||||
|
feeds = [
|
||||||
|
|
||||||
|
('Gadgets', 'http://www.popsci.com/full-feed/gadgets'),
|
||||||
|
('Cars', 'http://www.popsci.com/full-feed/cars'),
|
||||||
|
('Science', 'http://www.popsci.com/full-feed/science'),
|
||||||
|
('Technology', 'http://www.popsci.com/full-feed/technology'),
|
||||||
|
('DIY', 'http://www.popsci.com/full-feed/diy'),
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
#The following will get read of the Gallery: links when found
|
||||||
|
|
||||||
|
def preprocess_html(self, soup) :
|
||||||
|
print 'SOUP IS: ', soup
|
||||||
|
weblinks = soup.findAll(['head','h2'])
|
||||||
|
if weblinks is not None:
|
||||||
|
for link in weblinks:
|
||||||
|
if re.search('(Gallery)(:)',str(link)):
|
||||||
|
|
||||||
|
link.parent.extract()
|
||||||
|
return soup
|
||||||
|
#-----------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -176,6 +176,7 @@ def get_metadata(stream, extract_cover=True):
|
|||||||
except:
|
except:
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
mi.timestamp = None
|
||||||
return mi
|
return mi
|
||||||
|
|
||||||
def get_quick_metadata(stream):
|
def get_quick_metadata(stream):
|
||||||
|
@ -707,6 +707,10 @@ class DeviceMixin(object): # {{{
|
|||||||
'''
|
'''
|
||||||
Called when a device is connected to the computer.
|
Called when a device is connected to the computer.
|
||||||
'''
|
'''
|
||||||
|
# This can happen as this function is called in a queued connection and
|
||||||
|
# the user could have yanked the device in the meantime
|
||||||
|
if connected and not self.device_manager.is_device_connected:
|
||||||
|
connected = False
|
||||||
self.set_device_menu_items_state(connected)
|
self.set_device_menu_items_state(connected)
|
||||||
if connected:
|
if connected:
|
||||||
self.device_manager.get_device_information(\
|
self.device_manager.get_device_information(\
|
||||||
|
@ -38,6 +38,7 @@ from calibre.gui2.init import LibraryViewMixin, LayoutMixin
|
|||||||
from calibre.gui2.search_box import SearchBoxMixin, SavedSearchBoxMixin
|
from calibre.gui2.search_box import SearchBoxMixin, SavedSearchBoxMixin
|
||||||
from calibre.gui2.search_restriction_mixin import SearchRestrictionMixin
|
from calibre.gui2.search_restriction_mixin import SearchRestrictionMixin
|
||||||
from calibre.gui2.tag_view import TagBrowserMixin
|
from calibre.gui2.tag_view import TagBrowserMixin
|
||||||
|
from calibre.utils.ordered_dict import OrderedDict
|
||||||
|
|
||||||
|
|
||||||
class Listener(Thread): # {{{
|
class Listener(Thread): # {{{
|
||||||
@ -97,7 +98,7 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, # {{{
|
|||||||
MainWindow.__init__(self, opts, parent)
|
MainWindow.__init__(self, opts, parent)
|
||||||
self.opts = opts
|
self.opts = opts
|
||||||
self.device_connected = None
|
self.device_connected = None
|
||||||
acmap = {}
|
acmap = OrderedDict()
|
||||||
for action in interface_actions():
|
for action in interface_actions():
|
||||||
mod, cls = action.actual_plugin.split(':')
|
mod, cls = action.actual_plugin.split(':')
|
||||||
ac = getattr(__import__(mod, fromlist=['1'], level=0), cls)(self,
|
ac = getattr(__import__(mod, fromlist=['1'], level=0), cls)(self,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user