mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
Merge from trunk
This commit is contained in:
commit
f051450ba1
@ -9,7 +9,6 @@ __docformat__ = 'restructuredtext en'
|
|||||||
Modified by Tony Stegall
|
Modified by Tony Stegall
|
||||||
on 10/10/10 to include function to grab print version of articles
|
on 10/10/10 to include function to grab print version of articles
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
'''
|
'''
|
||||||
@ -42,9 +41,16 @@ class AdvancedUserRecipe1249039563(BasicNewsRecipe):
|
|||||||
#######################################################################################################
|
#######################################################################################################
|
||||||
temp_files = []
|
temp_files = []
|
||||||
articles_are_obfuscated = True
|
articles_are_obfuscated = True
|
||||||
|
use_javascript_to_login = True
|
||||||
|
|
||||||
|
def javascript_login(self, br, username, password):
|
||||||
|
'Volksrant wants the user to explicitly allow cookies'
|
||||||
|
if not br.visit('http://www.volkskrant.nl'):
|
||||||
|
raise Exception('Failed to connect to volksrant website')
|
||||||
|
br.click('#pop_cookie_text a[onclick]', wait_for_load=True, timeout=120)
|
||||||
|
|
||||||
def get_obfuscated_article(self, url):
|
def get_obfuscated_article(self, url):
|
||||||
br = self.get_browser()
|
br = self.browser.clone_browser()
|
||||||
print 'THE CURRENT URL IS: ', url
|
print 'THE CURRENT URL IS: ', url
|
||||||
br.open(url)
|
br.open(url)
|
||||||
year = date.today().year
|
year = date.today().year
|
||||||
|
@ -35,6 +35,8 @@ class Tag(object):
|
|||||||
self.avg_rating = avg/2.0 if avg is not None else 0
|
self.avg_rating = avg/2.0 if avg is not None else 0
|
||||||
self.sort = sort
|
self.sort = sort
|
||||||
self.use_sort_as_name = use_sort_as_name
|
self.use_sort_as_name = use_sort_as_name
|
||||||
|
if tooltip is None:
|
||||||
|
tooltip = '(%s:%s)'%(category, name)
|
||||||
if self.avg_rating > 0:
|
if self.avg_rating > 0:
|
||||||
if tooltip:
|
if tooltip:
|
||||||
tooltip = tooltip + ': '
|
tooltip = tooltip + ': '
|
||||||
@ -65,7 +67,6 @@ def find_categories(field_metadata):
|
|||||||
def create_tag_class(category, fm, icon_map):
|
def create_tag_class(category, fm, icon_map):
|
||||||
cat = fm[category]
|
cat = fm[category]
|
||||||
icon = None
|
icon = None
|
||||||
tooltip = None if category in {'formats', 'identifiers'} else ('(' + category + ')')
|
|
||||||
label = fm.key_to_label(category)
|
label = fm.key_to_label(category)
|
||||||
if icon_map:
|
if icon_map:
|
||||||
if not fm.is_custom_field(category):
|
if not fm.is_custom_field(category):
|
||||||
@ -87,8 +88,7 @@ def create_tag_class(category, fm, icon_map):
|
|||||||
use_sort_as_name = False
|
use_sort_as_name = False
|
||||||
|
|
||||||
return partial(Tag, use_sort_as_name=use_sort_as_name, icon=icon,
|
return partial(Tag, use_sort_as_name=use_sort_as_name, icon=icon,
|
||||||
tooltip=tooltip, is_editable=is_editable,
|
is_editable=is_editable, category=category)
|
||||||
category=category)
|
|
||||||
|
|
||||||
def clean_user_categories(dbcache):
|
def clean_user_categories(dbcache):
|
||||||
user_cats = dbcache.pref('user_categories', {})
|
user_cats = dbcache.pref('user_categories', {})
|
||||||
|
@ -280,7 +280,7 @@ class SubsetFonts(object):
|
|||||||
return ans
|
return ans
|
||||||
|
|
||||||
def find_usage_in(self, elem, inherited_style):
|
def find_usage_in(self, elem, inherited_style):
|
||||||
style = self.elem_style(elem.get('class', ''), inherited_style)
|
style = self.elem_style(elem.get('class', '') or '', inherited_style)
|
||||||
for child in elem:
|
for child in elem:
|
||||||
self.find_usage_in(child, style)
|
self.find_usage_in(child, style)
|
||||||
font = self.used_font(style)
|
font = self.used_font(style)
|
||||||
|
@ -1935,8 +1935,6 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
|||||||
is_editable = category not in ['news', 'rating', 'languages']
|
is_editable = category not in ['news', 'rating', 'languages']
|
||||||
categories[category] = [tag_class(formatter(r.n), count=r.c, id=r.id,
|
categories[category] = [tag_class(formatter(r.n), count=r.c, id=r.id,
|
||||||
avg=avgr(r), sort=r.s, icon=icon,
|
avg=avgr(r), sort=r.s, icon=icon,
|
||||||
tooltip=u'({0}:{1})'.format(category,
|
|
||||||
formatter(r.n)),
|
|
||||||
category=category,
|
category=category,
|
||||||
id_set=r.id_set, is_editable=is_editable,
|
id_set=r.id_set, is_editable=is_editable,
|
||||||
use_sort_as_name=use_sort_as_name)
|
use_sort_as_name=use_sort_as_name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user