mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-30 23:00:21 -04:00
0.8.4
This commit is contained in:
commit
90286d6e84
@ -19,6 +19,74 @@
|
||||
# new recipes:
|
||||
# - title:
|
||||
|
||||
- version: 0.8.4
|
||||
date: 2011-06-03
|
||||
|
||||
new features:
|
||||
- title: "New and much simpler interface for specifying column coloring via Preferences->Look & Feel->Column Coloring"
|
||||
|
||||
- title: "Driver for Trekstor eBook Player 5M, Samsung Galaxy SII I9100, Motorola Defy and miBuk GAMMA 6.2"
|
||||
tickets: [792091, 791216]
|
||||
|
||||
- title: "Get Books: Add EpubBud, WH Smits and E-book Shoppe stores"
|
||||
|
||||
- title: "When deleting 'all formats except ...', do not delete if it leaves a book with no formats"
|
||||
|
||||
- title: "Change default toolbar to make it a little more new user friendly. The icons have been re-arranged and now the text is always visiblke by default. You can change that in Preferences->Look & Feeel and Preferences->Toolbar"
|
||||
|
||||
- title: "Windows installer: Remember and use previous settings for installing desktop icons, adding to path, etc. This makes the installer a little slower, complaints should go to Microsoft."
|
||||
|
||||
- title: "Template language: Add str_in_list and on_device formatter functions. Make debugging templates a little easier"
|
||||
|
||||
- title: "Allow the user to specify formatting for number type custom columns"
|
||||
|
||||
bug fixes:
|
||||
- title: "Fix typo in NOOK TSR driver that prevented it from working on windows"
|
||||
|
||||
- title: "Fix quotes in identifiers causing Tag Browser to be blank."
|
||||
tickets: [791044]
|
||||
|
||||
- title: "Speedup auto complete when there are lots of items (>2500) the downside being that non ASCII characters are not sorted correctly. The threshold can be controlled via Preferences->Tweaks"
|
||||
tickets: [792191]
|
||||
|
||||
- title: "RTF Output: Fix handling of curly brackets"
|
||||
tickets: [791805]
|
||||
|
||||
- title: "Fix searching in Get Books not working with non ASCII characters"
|
||||
tickets: [791788]
|
||||
|
||||
- title: "Fix excessive memory consumption when moving very large files during a metadata change"
|
||||
tickets: [791806]
|
||||
|
||||
- title: "Fix series index being overwritten even when series is turned off in bulk metadata download"
|
||||
tickets: [789990]
|
||||
|
||||
- title: "Fix regression in templates where id and other non standard fields no longer worked."
|
||||
|
||||
- title: "EPUB Output: Fix crash caused by ids with non-ascii characters in them"
|
||||
|
||||
- title: "Try to preserve the timestamps of files in a ZIP container"
|
||||
|
||||
- title: "After adding books always select the most recently added book."
|
||||
tickets: [789343]
|
||||
|
||||
improved recipes:
|
||||
- bild.de
|
||||
- CNN
|
||||
- BBC News (fast)
|
||||
- Dilema Veche
|
||||
|
||||
new recipes:
|
||||
- title: Metro UK
|
||||
author: Dave Asbury
|
||||
|
||||
- title: Alt om Herning and Version2.dk
|
||||
author: Rasmus Lauritsen
|
||||
|
||||
- title: Observatorul cultural
|
||||
author: song2
|
||||
|
||||
|
||||
- version: 0.8.3
|
||||
date: 2011-05-27
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||
class AdvancedUserRecipe1303841067(BasicNewsRecipe):
|
||||
|
||||
title = u'Bild.de'
|
||||
__author__ = 'schuster'
|
||||
oldest_article = 1
|
||||
max_articles_per_feed = 50
|
||||
max_articles_per_feed = 100
|
||||
no_stylesheets = True
|
||||
use_embedded_content = False
|
||||
language = 'de'
|
||||
@ -12,11 +13,25 @@ class AdvancedUserRecipe1303841067(BasicNewsRecipe):
|
||||
|
||||
# get cover from myspace
|
||||
cover_url = 'http://a3.l3-images.myspacecdn.com/images02/56/0232f842170b4d349779f8379c27e073/l.jpg'
|
||||
masthead_url = 'http://a3.l3-images.myspacecdn.com/images02/56/0232f842170b4d349779f8379c27e073/l.jpg'
|
||||
|
||||
# set what to fetch on the site
|
||||
remove_tags_before = dict(name = 'h2', attrs={'id':'cover'})
|
||||
remove_tags_after = dict(name ='div', attrs={'class':'back'})
|
||||
|
||||
|
||||
# remove things on the site that we don't want
|
||||
remove_tags = [dict(name='div', attrs={'class':'credit'}),
|
||||
dict(name='div', attrs={'class':'index'}),
|
||||
dict(name='div', attrs={'id':'zstart31'}),
|
||||
dict(name='div', attrs={'class':'hentry'}),
|
||||
dict(name='div', attrs={'class':'back'}),
|
||||
dict(name='div', attrs={'class':'pagination'}),
|
||||
dict(name='div', attrs={'class':'header'}),
|
||||
dict(name='div', attrs={'class':'element floatL'}),
|
||||
dict(name='div', attrs={'class':'stWrap'})
|
||||
]
|
||||
|
||||
# thanx to kiklop74 for code (see sticky thread -> Recipes - Re-usable code)
|
||||
# this one removes a lot of direct-link's
|
||||
def preprocess_html(self, soup):
|
||||
@ -42,5 +57,18 @@ class AdvancedUserRecipe1303841067(BasicNewsRecipe):
|
||||
(u'Unterhaltung', u'http://rss.bild.de/bild-unterhaltung.xml'),
|
||||
(u'Sport', u'http://rss.bild.de/bild-sport.xml'),
|
||||
(u'Lifestyle', u'http://rss.bild.de/bild-lifestyle.xml'),
|
||||
(u'Ratgeber', u'http://rss.bild.de/bild-ratgeber.xml')
|
||||
(u'Ratgeber', u'http://rss.bild.de/bild-ratgeber.xml'),
|
||||
(u'Reg. - Berlin', u'http://rss.bild.de/bild-berlin.xml'),
|
||||
(u'Reg. - Bremen', u'http://rss.bild.de/bild-bremen.xml'),
|
||||
(u'Reg. - Dresden', u'http://rss.bild.de/bild-dresden.xml'),
|
||||
(u'Reg. - Düsseldorf', u'http://rss.bild.de/bild-duesseldorf.xml'),
|
||||
(u'Reg. - Frankfurt-Main', u'http://rss.bild.de/bild-frankfurt-main.xml'),
|
||||
(u'Reg. - Hamburg', u'http://rss.bild.de/bild-hamburg.xml'),
|
||||
(u'Reg. - Hannover', u'http://rss.bild.de/bild-hannover.xml'),
|
||||
(u'Reg. - Köln', u'http://rss.bild.de/bild-koeln.xml'),
|
||||
(u'Reg. - Leipzig', u'http://rss.bild.de/bild-leipzig.xml'),
|
||||
(u'Reg. - München', u'http://rss.bild.de/bild-muenchen.xml'),
|
||||
(u'Reg. - Ruhrgebiet', u'http://rss.bild.de/bild-ruhrgebiet.xml'),
|
||||
(u'Reg. - Stuttgart', u'http://rss.bild.de/bild-stuttgart.xml')
|
||||
]
|
||||
|
||||
|
@ -28,7 +28,7 @@ class Guardian(BasicNewsRecipe):
|
||||
# List of section titles to ignore
|
||||
# For example: ['Sport']
|
||||
ignore_sections = []
|
||||
|
||||
|
||||
timefmt = ' [%a, %d %b %Y]'
|
||||
keep_only_tags = [
|
||||
dict(name='div', attrs={'id':["content","article_header","main-article-info",]}),
|
||||
@ -87,8 +87,14 @@ class Guardian(BasicNewsRecipe):
|
||||
idx = soup.find('div', id='book-index')
|
||||
for s in idx.findAll('strong', attrs={'class':'book'}):
|
||||
a = s.find('a', href=True)
|
||||
yield (self.tag_to_string(a), a['href'])
|
||||
|
||||
section_title = self.tag_to_string(a)
|
||||
if not section_title in self.ignore_sections:
|
||||
prefix = ''
|
||||
if section_title != 'Main section':
|
||||
prefix = section_title + ': '
|
||||
for subsection in s.parent.findAll('a', attrs={'class':'book-section'}):
|
||||
yield (prefix + self.tag_to_string(subsection), subsection['href'])
|
||||
|
||||
def find_articles(self, url):
|
||||
soup = self.index_to_soup(url)
|
||||
div = soup.find('div', attrs={'class':'book-index'})
|
||||
@ -109,15 +115,12 @@ class Guardian(BasicNewsRecipe):
|
||||
'title': title, 'url':url, 'description':desc,
|
||||
'date' : strftime('%a, %d %b'),
|
||||
}
|
||||
|
||||
|
||||
def parse_index(self):
|
||||
try:
|
||||
feeds = []
|
||||
for title, href in self.find_sections():
|
||||
if not title in self.ignore_sections:
|
||||
feeds.append((title, list(self.find_articles(href))))
|
||||
feeds.append((title, list(self.find_articles(href))))
|
||||
return feeds
|
||||
except:
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
|
@ -49,6 +49,7 @@ class TelegraphUK(BasicNewsRecipe):
|
||||
(u'UK News' , u'http://www.telegraph.co.uk/news/uknews/rss' )
|
||||
,(u'World News' , u'http://www.telegraph.co.uk/news/worldnews/rss' )
|
||||
,(u'Politics' , u'http://www.telegraph.co.uk/news/newstopics/politics/rss' )
|
||||
,(u'Finance' , u'http://www.telegraph.co.uk/finance/rss' )
|
||||
,(u'Technology News', u'http://www.telegraph.co.uk/scienceandtechnology/technology/technologynews/rss' )
|
||||
,(u'UK News' , u'http://www.telegraph.co.uk/scienceandtechnology/technology/technologyreviews/rss')
|
||||
,(u'Science News' , u'http://www.telegraph.co.uk/scienceandtechnology/science/sciencenews/rss' )
|
||||
|
@ -10,8 +10,8 @@ import re
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
class Time(BasicNewsRecipe):
|
||||
recipe_disabled = ('This recipe has been disabled as TIME no longer'
|
||||
' publish complete articles on the web.')
|
||||
#recipe_disabled = ('This recipe has been disabled as TIME no longer'
|
||||
# ' publish complete articles on the web.')
|
||||
title = u'Time'
|
||||
__author__ = 'Kovid Goyal and Sujata Raman'
|
||||
description = 'Weekly magazine'
|
||||
|
@ -82,7 +82,7 @@ class ZAOBAO(BasicNewsRecipe):
|
||||
return soup
|
||||
|
||||
def parse_feeds(self):
|
||||
self.log_debug(_('ZAOBAO overrided parse_feeds()'))
|
||||
self.log(_('ZAOBAO overrided parse_feeds()'))
|
||||
parsed_feeds = BasicNewsRecipe.parse_feeds(self)
|
||||
|
||||
for id, obj in enumerate(self.INDEXES):
|
||||
@ -99,7 +99,7 @@ class ZAOBAO(BasicNewsRecipe):
|
||||
a_title = self.tag_to_string(a)
|
||||
date = ''
|
||||
description = ''
|
||||
self.log_debug(_('adding %s at %s')%(a_title,a_url))
|
||||
self.log(_('adding %s at %s')%(a_title,a_url))
|
||||
articles.append({
|
||||
'title':a_title,
|
||||
'date':date,
|
||||
@ -110,23 +110,23 @@ class ZAOBAO(BasicNewsRecipe):
|
||||
pfeeds = feeds_from_index([(title, articles)], oldest_article=self.oldest_article,
|
||||
max_articles_per_feed=self.max_articles_per_feed)
|
||||
|
||||
self.log_debug(_('adding %s to feed')%(title))
|
||||
self.log(_('adding %s to feed')%(title))
|
||||
for feed in pfeeds:
|
||||
self.log_debug(_('adding feed: %s')%(feed.title))
|
||||
self.log(_('adding feed: %s')%(feed.title))
|
||||
feed.description = self.DESC_SENSE
|
||||
parsed_feeds.append(feed)
|
||||
for a, article in enumerate(feed):
|
||||
self.log_debug(_('added article %s from %s')%(article.title, article.url))
|
||||
self.log_debug(_('added feed %s')%(feed.title))
|
||||
self.log(_('added article %s from %s')%(article.title, article.url))
|
||||
self.log(_('added feed %s')%(feed.title))
|
||||
|
||||
for i, feed in enumerate(parsed_feeds):
|
||||
# workaorund a strange problem: Somethimes the xml encoding is not apllied correctly by parse()
|
||||
weired_encoding_detected = False
|
||||
if not isinstance(feed.description, unicode) and self.encoding and feed.description:
|
||||
self.log_debug(_('Feed %s is not encoded correctly, manually replace it')%(feed.title))
|
||||
self.log(_('Feed %s is not encoded correctly, manually replace it')%(feed.title))
|
||||
feed.description = feed.description.decode(self.encoding, 'replace')
|
||||
elif feed.description.find(self.DESC_SENSE) == -1 and self.encoding and feed.description:
|
||||
self.log_debug(_('Feed %s is weired encoded, manually redo all')%(feed.title))
|
||||
self.log(_('Feed %s is weired encoded, manually redo all')%(feed.title))
|
||||
feed.description = feed.description.encode('cp1252', 'replace').decode(self.encoding, 'replace')
|
||||
weired_encoding_detected = True
|
||||
|
||||
@ -148,7 +148,7 @@ class ZAOBAO(BasicNewsRecipe):
|
||||
article.text_summary = article.text_summary.encode('cp1252', 'replace').decode(self.encoding, 'replace')
|
||||
|
||||
if article.title == "Untitled article":
|
||||
self.log_debug(_('Removing empty article %s from %s')%(article.title, article.url))
|
||||
self.log(_('Removing empty article %s from %s')%(article.title, article.url))
|
||||
# remove the article
|
||||
feed.articles[a:a+1] = []
|
||||
return parsed_feeds
|
||||
|
@ -37,7 +37,6 @@ series_index_auto_increment = 'next'
|
||||
# Can be either True or False
|
||||
authors_completer_append_separator = False
|
||||
|
||||
|
||||
#: Author sort name algorithm
|
||||
# The algorithm used to copy author to author_sort
|
||||
# Possible values are:
|
||||
@ -71,6 +70,15 @@ author_name_suffixes = ('Jr', 'Sr', 'Inc', 'Ph.D', 'Phd',
|
||||
# categories_use_field_for_author_name = 'author_sort'
|
||||
categories_use_field_for_author_name = 'author'
|
||||
|
||||
#: Completion sort order: choose when to change from lexicographic to ASCII-like
|
||||
# Calibre normally uses locale-dependent lexicographic ordering when showing
|
||||
# completion values. This means that the sort order is correct for the user's
|
||||
# language. However, this can be slow. Performance is improved by switching to
|
||||
# ascii ordering. This tweak controls when that switch happens. Set it to zero
|
||||
# to always use ascii ordering. Set it to something larger than zero to switch
|
||||
# to ascii ordering for performance reasons.
|
||||
completion_change_to_ascii_sorting = 2500
|
||||
|
||||
#: Control partitioning of Tag Browser
|
||||
# When partitioning the tags browser, the format of the subcategory label is
|
||||
# controlled by a template: categories_collapsed_name_template if sorting by
|
||||
@ -93,7 +101,6 @@ categories_collapsed_name_template = r'{first.sort:shorten(4,,0)} - {last.sort:s
|
||||
categories_collapsed_rating_template = r'{first.avg_rating:4.2f:ifempty(0)} - {last.avg_rating:4.2f:ifempty(0)}'
|
||||
categories_collapsed_popularity_template = r'{first.count:d} - {last.count:d}'
|
||||
|
||||
|
||||
#: Specify columns to sort the booklist by on startup
|
||||
# Provide a set of columns to be sorted on when calibre starts
|
||||
# The argument is None if saved sort history is to be used
|
||||
@ -244,17 +251,14 @@ sony_collection_name_template='{value}{category:| (|)}'
|
||||
# Default: empty (no rules), so no collection attributes are named.
|
||||
sony_collection_sorting_rules = []
|
||||
|
||||
|
||||
#: Control how tags are applied when copying books to another library
|
||||
# Set this to True to ensure that tags in 'Tags to add when adding
|
||||
# a book' are added when copying books to another library
|
||||
add_new_book_tags_when_importing_books = False
|
||||
|
||||
|
||||
#: Set the maximum number of tags to show per book in the content server
|
||||
max_content_server_tags_shown=5
|
||||
|
||||
|
||||
#: Set custom metadata fields that the content server will or will not display.
|
||||
# content_server_will_display is a list of custom fields to be displayed.
|
||||
# content_server_wont_display is a list of custom fields not to be displayed.
|
||||
@ -296,7 +300,6 @@ generate_cover_foot_font = None
|
||||
# Example: doubleclick_on_library_view = 'do_nothing'
|
||||
doubleclick_on_library_view = 'open_viewer'
|
||||
|
||||
|
||||
#: Language to use when sorting.
|
||||
# Setting this tweak will force sorting to use the
|
||||
# collating order for the specified language. This might be useful if you run
|
||||
|
@ -5,7 +5,7 @@
|
||||
"uppercase": "def evaluate(self, formatter, kwargs, mi, locals, val):\n return val.upper()\n",
|
||||
"strcat": "def evaluate(self, formatter, kwargs, mi, locals, *args):\n i = 0\n res = ''\n for i in range(0, len(args)):\n res += args[i]\n return res\n",
|
||||
"in_list": "def evaluate(self, formatter, kwargs, mi, locals, val, sep, pat, fv, nfv):\n l = [v.strip() for v in val.split(sep) if v.strip()]\n if l:\n for v in l:\n if re.search(pat, v, flags=re.I):\n return fv\n return nfv\n",
|
||||
"multiply": "def evaluate(self, formatter, kwargs, mi, locals, x, y):\n x = float(x if x else 0)\n y = float(y if y else 0)\n return unicode(x * y)\n",
|
||||
"not": "def evaluate(self, formatter, kwargs, mi, locals, *args):\n i = 0\n while i < len(args):\n if args[i]:\n return '1'\n i += 1\n return ''\n",
|
||||
"ifempty": "def evaluate(self, formatter, kwargs, mi, locals, val, value_if_empty):\n if val:\n return val\n else:\n return value_if_empty\n",
|
||||
"booksize": "def evaluate(self, formatter, kwargs, mi, locals):\n if mi.book_size is not None:\n try:\n return str(mi.book_size)\n except:\n pass\n return ''\n",
|
||||
"select": "def evaluate(self, formatter, kwargs, mi, locals, val, key):\n if not val:\n return ''\n vals = [v.strip() for v in val.split(',')]\n for v in vals:\n if v.startswith(key+':'):\n return v[len(key)+1:]\n return ''\n",
|
||||
@ -27,9 +27,10 @@
|
||||
"sublist": "def evaluate(self, formatter, kwargs, mi, locals, val, start_index, end_index, sep):\n if not val:\n return ''\n si = int(start_index)\n ei = int(end_index)\n val = val.split(sep)\n try:\n if ei == 0:\n return sep.join(val[si:])\n else:\n return sep.join(val[si:ei])\n except:\n return ''\n",
|
||||
"test": "def evaluate(self, formatter, kwargs, mi, locals, val, value_if_set, value_not_set):\n if val:\n return value_if_set\n else:\n return value_not_set\n",
|
||||
"eval": "def evaluate(self, formatter, kwargs, mi, locals, template):\n from formatter import eval_formatter\n template = template.replace('[[', '{').replace(']]', '}')\n return eval_formatter.safe_format(template, locals, 'EVAL', None)\n",
|
||||
"not": "def evaluate(self, formatter, kwargs, mi, locals, *args):\n i = 0\n while i < len(args):\n if args[i]:\n return '1'\n i += 1\n return ''\n",
|
||||
"format_date": "def evaluate(self, formatter, kwargs, mi, locals, val, format_string):\n if not val:\n return ''\n try:\n dt = parse_date(val)\n s = format_date(dt, format_string)\n except:\n s = 'BAD DATE'\n return s\n",
|
||||
"multiply": "def evaluate(self, formatter, kwargs, mi, locals, x, y):\n x = float(x if x else 0)\n y = float(y if y else 0)\n return unicode(x * y)\n",
|
||||
"format_date": "def evaluate(self, formatter, kwargs, mi, locals, val, format_string):\n if not val or val == 'None':\n return ''\n try:\n dt = parse_date(val)\n s = format_date(dt, format_string)\n except:\n s = 'BAD DATE'\n return s\n",
|
||||
"capitalize": "def evaluate(self, formatter, kwargs, mi, locals, val):\n return capitalize(val)\n",
|
||||
"identifier_in_list": "def evaluate(self, formatter, kwargs, mi, locals, val, ident, fv, nfv):\n l = [v.strip() for v in val.split(',') if v.strip()]\n (id, _, regexp) = ident.partition(':')\n if not id:\n return nfv\n id += ':'\n if l:\n for v in l:\n if v.startswith(id):\n if not regexp or re.search(regexp, v[len(id):], flags=re.I):\n return fv\n return nfv\n",
|
||||
"count": "def evaluate(self, formatter, kwargs, mi, locals, val, sep):\n return unicode(len(val.split(sep)))\n",
|
||||
"lowercase": "def evaluate(self, formatter, kwargs, mi, locals, val):\n return val.lower()\n",
|
||||
"substr": "def evaluate(self, formatter, kwargs, mi, locals, str_, start_, end_):\n return str_[int(start_): len(str_) if int(end_) == 0 else int(end_)]\n",
|
||||
@ -38,5 +39,5 @@
|
||||
"ondevice": "def evaluate(self, formatter, kwargs, mi, locals):\n if mi.ondevice_col:\n return _('Yes')\n return ''\n",
|
||||
"assign": "def evaluate(self, formatter, kwargs, mi, locals, target, value):\n locals[target] = value\n return value\n",
|
||||
"raw_field": "def evaluate(self, formatter, kwargs, mi, locals, name):\n return unicode(getattr(mi, name, None))\n",
|
||||
"cmp": "def evaluate(self, formatter, kwargs, mi, locals, x, y, lt, eq, gt):\n x = float(x if x else 0)\n y = float(y if y else 0)\n if x < y:\n return lt\n if x == y:\n return eq\n return gt\n"
|
||||
"cmp": "def evaluate(self, formatter, kwargs, mi, locals, x, y, lt, eq, gt):\n x = float(x if x and x != 'None' else 0)\n y = float(y if y and y != 'None' else 0)\n if x < y:\n return lt\n if x == y:\n return eq\n return gt\n"
|
||||
}
|
@ -187,7 +187,6 @@ msgstr ""
|
||||
|
||||
'''%dict(appname=__appname__, version=version, year=time.strftime('%Y'))
|
||||
|
||||
|
||||
def usage(code, msg=''):
|
||||
print >> sys.stderr, __doc__ % globals()
|
||||
if msg:
|
||||
|
@ -4,7 +4,7 @@ __license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
__appname__ = u'calibre'
|
||||
numeric_version = (0, 8, 3)
|
||||
numeric_version = (0, 8, 4)
|
||||
__version__ = u'.'.join(map(unicode, numeric_version))
|
||||
__author__ = u"Kovid Goyal <kovid@kovidgoyal.net>"
|
||||
|
||||
|
@ -2395,6 +2395,7 @@ class ITUNES(DriverBase):
|
||||
try:
|
||||
# Pre-emptive test to confirm functional iTunes automation interface
|
||||
foo = self.iTunes.Version
|
||||
foo
|
||||
except:
|
||||
self.iTunes = None
|
||||
raise OpenFeedback('Unable to connect to iTunes.\n' +
|
||||
|
@ -224,13 +224,16 @@ class TREKSTOR(USBMS):
|
||||
FORMATS = ['epub', 'txt', 'pdf']
|
||||
|
||||
VENDOR_ID = [0x1e68]
|
||||
PRODUCT_ID = [0x0041, 0x0042]
|
||||
PRODUCT_ID = [0x0041, 0x0042,
|
||||
0x003e # This is for the EBOOK_PLAYER_5M https://bugs.launchpad.net/bugs/792091
|
||||
]
|
||||
BCD = [0x0002]
|
||||
|
||||
EBOOK_DIR_MAIN = 'Ebooks'
|
||||
|
||||
VENDOR_NAME = 'TREKSTOR'
|
||||
WINDOWS_MAIN_MEM = WINDOWS_CARD_A_MEM = 'EBOOK_PLAYER_7'
|
||||
WINDOWS_MAIN_MEM = WINDOWS_CARD_A_MEM = ['EBOOK_PLAYER_7',
|
||||
'EBOOK_PLAYER_5M']
|
||||
|
||||
class EEEREADER(USBMS):
|
||||
|
||||
|
@ -12,16 +12,23 @@ from PyQt4.Qt import QLineEdit, QAbstractListModel, Qt, \
|
||||
from calibre.utils.icu import sort_key, lower
|
||||
from calibre.gui2 import NONE
|
||||
from calibre.gui2.widgets import EnComboBox, LineEditECM
|
||||
from calibre.utils.config_base import tweaks
|
||||
|
||||
class CompleteModel(QAbstractListModel):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QAbstractListModel.__init__(self, parent)
|
||||
self.items = []
|
||||
self.sorting = QCompleter.UnsortedModel
|
||||
|
||||
def set_items(self, items):
|
||||
items = [unicode(x.strip()) for x in items]
|
||||
self.items = list(sorted(items, key=lambda x: sort_key(x)))
|
||||
if len(items) < tweaks['completion_change_to_ascii_sorting']:
|
||||
self.items = sorted(items, key=lambda x: sort_key(x))
|
||||
self.sorting = QCompleter.UnsortedModel
|
||||
else:
|
||||
self.items = sorted(items, key=lambda x:x.lower())
|
||||
self.sorting = QCompleter.CaseInsensitivelySortedModel
|
||||
self.lowered_items = [lower(x) for x in self.items]
|
||||
self.reset()
|
||||
|
||||
@ -62,7 +69,7 @@ class MultiCompleteLineEdit(QLineEdit, LineEditECM):
|
||||
c.setWidget(self)
|
||||
c.setCompletionMode(QCompleter.PopupCompletion)
|
||||
c.setCaseSensitivity(Qt.CaseInsensitive)
|
||||
c.setModelSorting(QCompleter.UnsortedModel)
|
||||
c.setModelSorting(self._model.sorting)
|
||||
c.setCompletionRole(Qt.DisplayRole)
|
||||
p = c.popup()
|
||||
p.setMouseTracking(True)
|
||||
@ -146,6 +153,7 @@ class MultiCompleteLineEdit(QLineEdit, LineEditECM):
|
||||
return self._model.items
|
||||
def fset(self, items):
|
||||
self._model.set_items(items)
|
||||
self._completer.setModelSorting(self._model.sorting)
|
||||
return property(fget=fget, fset=fset)
|
||||
|
||||
class MultiCompleteComboBox(EnComboBox):
|
||||
|
@ -33,7 +33,7 @@ class Matches(QAbstractItemModel):
|
||||
|
||||
total_changed = pyqtSignal(int)
|
||||
|
||||
HEADERS = [_('Cover'), _('Title'), _('Price'), _('DRM'), _('Store'), _('')]
|
||||
HEADERS = [_('Cover'), _('Title'), _('Price'), _('DRM'), _('Store'), '']
|
||||
HTML_COLS = (1, 4)
|
||||
|
||||
def __init__(self, cover_thread_count=2, detail_thread_count=4):
|
||||
@ -58,7 +58,7 @@ class Matches(QAbstractItemModel):
|
||||
self.search_filter = SearchFilter()
|
||||
self.cover_pool = CoverThreadPool(cover_thread_count)
|
||||
self.details_pool = DetailsThreadPool(detail_thread_count)
|
||||
|
||||
|
||||
self.filter_results_dispatcher = FunctionDispatcher(self.filter_results)
|
||||
self.got_result_details_dispatcher = FunctionDispatcher(self.got_result_details)
|
||||
|
||||
|
@ -595,7 +595,8 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
||||
if f is None:
|
||||
continue
|
||||
with tempfile.SpooledTemporaryFile(max_size=100*(1024**2)) as stream:
|
||||
shutil.copyfileobj(f, stream)
|
||||
with f:
|
||||
shutil.copyfileobj(f, stream)
|
||||
stream.seek(0)
|
||||
self.add_format(id, format, stream, index_is_id=True,
|
||||
path=tpath, notify=False)
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
16897
src/calibre/translations/br.po
Normal file
16897
src/calibre/translations/br.po
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,7 @@ __docformat__ = 'restructuredtext en'
|
||||
'''
|
||||
Manage application-wide preferences.
|
||||
'''
|
||||
import os, re, cPickle, base64, datetime, json, plistlib
|
||||
import os, cPickle, base64, datetime, json, plistlib
|
||||
from copy import deepcopy
|
||||
from optparse import OptionParser as _OptionParser
|
||||
from optparse import IndentedHelpFormatter
|
||||
@ -22,7 +22,7 @@ if False:
|
||||
# Make pyflakes happy
|
||||
Config, ConfigProxy, Option, OptionValues, StringConfig
|
||||
OptionSet, ConfigInterface, read_tweaks, write_tweaks
|
||||
read_raw_tweaks, tweaks, plugin_dir
|
||||
read_raw_tweaks, tweaks, plugin_dir, prefs
|
||||
|
||||
def check_config_write_access():
|
||||
return os.access(config_dir, os.W_OK) and os.access(config_dir, os.X_OK)
|
||||
@ -353,71 +353,4 @@ class JSONConfig(XMLConfig):
|
||||
|
||||
|
||||
|
||||
def migrate():
|
||||
if hasattr(os, 'geteuid') and os.geteuid() == 0:
|
||||
return
|
||||
p = prefs
|
||||
if p.get('migrated'):
|
||||
return
|
||||
|
||||
from PyQt4.QtCore import QSettings, QVariant
|
||||
class Settings(QSettings):
|
||||
|
||||
def __init__(self, name='calibre2'):
|
||||
QSettings.__init__(self, QSettings.IniFormat, QSettings.UserScope,
|
||||
'kovidgoyal.net', name)
|
||||
|
||||
def get(self, key, default=None):
|
||||
try:
|
||||
key = str(key)
|
||||
if not self.contains(key):
|
||||
return default
|
||||
val = str(self.value(key, QVariant()).toByteArray())
|
||||
if not val:
|
||||
return None
|
||||
return cPickle.loads(val)
|
||||
except:
|
||||
return default
|
||||
|
||||
s, migrated = Settings(), set([])
|
||||
all_keys = set(map(unicode, s.allKeys()))
|
||||
from calibre.gui2 import config, dynamic
|
||||
def _migrate(key, safe=None, from_qvariant=None, p=config):
|
||||
try:
|
||||
if key not in all_keys:
|
||||
return
|
||||
if safe is None:
|
||||
safe = re.sub(r'[^0-9a-zA-Z]', '_', key)
|
||||
val = s.get(key)
|
||||
if from_qvariant is not None:
|
||||
val = getattr(s.value(key), from_qvariant)()
|
||||
p.set(safe, val)
|
||||
except:
|
||||
pass
|
||||
finally:
|
||||
migrated.add(key)
|
||||
|
||||
|
||||
_migrate('database path', p=prefs)
|
||||
_migrate('filename pattern', p=prefs)
|
||||
_migrate('network timeout', p=prefs)
|
||||
_migrate('isbndb.com key', p=prefs)
|
||||
|
||||
_migrate('frequently used directories')
|
||||
_migrate('send to device by default')
|
||||
_migrate('save to disk single format')
|
||||
_migrate('confirm delete')
|
||||
_migrate('show text in toolbar')
|
||||
_migrate('new version notification')
|
||||
_migrate('use roman numerals for series number')
|
||||
_migrate('cover flow queue length')
|
||||
_migrate('LRF conversion defaults')
|
||||
_migrate('LRF ebook viewer options')
|
||||
|
||||
for key in all_keys - migrated:
|
||||
if key.endswith(': un') or key.endswith(': pw'):
|
||||
_migrate(key, p=dynamic)
|
||||
p.set('migrated', True)
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user