Merge from trunk

This commit is contained in:
Charles Haley 2012-09-20 08:27:17 +02:00
commit 9b3899266c
8 changed files with 208 additions and 49 deletions

View File

@ -1,15 +1,15 @@
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>' __copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
''' '''
lrb.co.uk lrb.co.uk
''' '''
import re
from calibre import strftime from calibre import strftime
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
class LondonReviewOfBooksPayed(BasicNewsRecipe): class LondonReviewOfBooksPayed(BasicNewsRecipe):
title = 'London Review of Books' title = 'London Review of Books'
__author__ = 'Darko Miletic' __author__ = 'Rich Shang, Darko Miletic'
description = 'Subscription content. Literary review publishing essay-length book reviews and topical articles on politics, literature, history, philosophy, science and the arts by leading writers and thinkers' description = 'Subscription content. Literary review publishing essay-length book reviews and topical articles on politics, literature, history, philosophy, science and the arts by leading writers and thinkers'
category = 'news, literature, UK' category = 'news, literature, UK'
publisher = 'LRB Ltd.' publisher = 'LRB Ltd.'
@ -41,9 +41,12 @@ class LondonReviewOfBooksPayed(BasicNewsRecipe):
articles = [] articles = []
soup = self.index_to_soup(self.INDEX) soup = self.index_to_soup(self.INDEX)
cover_item = soup.find('p',attrs={'class':'cover'}) cover_item = soup.find('p',attrs={'class':'cover'})
dates = str(soup.find('span', attrs={'class':'coverdate'}))
newdates = re.sub('\<.*\>','',re.split('<br />',dates)[1])
self.timefmt = ' [%s]'%newdates
lrbtitle = self.title lrbtitle = self.title
if cover_item: if cover_item:
self.cover_url = self.INDEX + cover_item.a.img['src'] self.cover_url = re.sub('/m/','/l/',cover_item.a.img['src'])
content = self.INDEX + cover_item.a['href'] content = self.INDEX + cover_item.a['href']
soup2 = self.index_to_soup(content) soup2 = self.index_to_soup(content)
sitem = soup2.find(attrs={'class':'article-list'}) sitem = soup2.find(attrs={'class':'article-list'})
@ -54,7 +57,14 @@ class LondonReviewOfBooksPayed(BasicNewsRecipe):
feed_link = item feed_link = item
if feed_link.has_key('href'): if feed_link.has_key('href'):
url = self.INDEX + feed_link['href'] url = self.INDEX + feed_link['href']
title_link = re.split('<br />',str(feed_link))
if len (title_link) > 1:
title = title_prefix + re.sub('\<.*\>','',title_link[0]) + ' - ' + re.sub('\<.*\>','',title_link[1])
else:
title = title_prefix + self.tag_to_string(feed_link) title = title_prefix + self.tag_to_string(feed_link)
desc = item.findNext('li')
if desc is not None and desc.find('cite') is not None and desc.find('ul') is None:
description=self.tag_to_string(desc)
date = strftime(self.timefmt) date = strftime(self.timefmt)
articles.append({ articles.append({
'title' :title 'title' :title

View File

@ -0,0 +1,25 @@
from calibre.web.feeds.news import BasicNewsRecipe
class AdvancedUserRecipe1348063712(BasicNewsRecipe):
title = u'Portfolio.hu - English Edition'
__author__ = 'laca'
oldest_article = 7
language = 'en_HUN'
masthead_url = 'http://www.portfolio.hu/img/sit/angolfejlec2010.jpg'
use_embedded_content = False
auto_cleanup = True
encoding = 'cp1252'
author = 'laca'
simultaneous_downloads= 1
max_articles_per_feed = 50
no_stylesheets = True
feeds = [(u'Equity news', u'http://www.portfolio.hu/en/rss/cikk/equity.xml'),
(u'Economy news', u'http://www.portfolio.hu/en/rss/cikkek/economy.xml'),
(u'FX&Fixed Income news', u'http://www.portfolio.hu/en/rss/cikkek/fx.xml'),
(u'Tax news', u'http://www.portfolio.hu/en/rss/cikkek/tax.xml'),
(u'Energy news', u'http://www.portfolio.hu/en/rss/cikkek/energy.xml'),
(u'Corpfin news', u'http://www.portfolio.hu/en/rss/cikkek/corpfin.xml'),
(u'MNB news', u'http://www.portfolio.hu/en/rss/cikkek/mnb.xml')]

33
recipes/xpatloop.recipe Normal file
View File

@ -0,0 +1,33 @@
from calibre.web.feeds.news import BasicNewsRecipe
class AdvancedUserRecipe1347997197(BasicNewsRecipe):
title = u'XpatLoop.com'
__author__ = 'laca'
oldest_article = 7
language = 'en_HUN'
auto_cleanup = True
masthead_url = 'http://www.xpatloop.com/images/cms/xs_logo.gif'
use_embedded_content = False
author = 'laca'
simultaneous_downloads= 1
max_articles_per_feed = 50
no_stylesheets = True
feeds = [(u'Current Affairs', u'http://www.xpatloop.com/current_affairs.rss'),
(u'Community & Culture', u'http://www.xpatloop.com/community.rss'),
(u'Business & Finance', u'http://www.xpatloop.com/business.rss'),
(u'Entertainment', u'http://www.xpatloop.com/entertainment.rss'),
(u'Dining Guide', u'http://www.xpatloop.com/dining_guide.rss'),
(u'Getting Around', u'http://www.xpatloop.com/getting_around.rss'),
(u'Movies', u'http://www.xpatloop.com/movies.rss'),
(u'Shopping', u'http://www.xpatloop.com/shopping_channel.rss'),
(u'Travel', u'http://www.xpatloop.com/travel.rss'),
(u'Sport and Fitness', u'http://www.xpatloop.com/sport_and_fitness.rss'),
(u'Health and Wellness', u'http://www.xpatloop.com/health_and_wellness.rss'),
(u'Infotech & Telco', u'http://www.xpatloop.com/infotech_telco.rss'),
(u'Real Estate', u'http://www.xpatloop.com/property_real_estate.rss'),
(u'Specials', u'http://www.xpatloop.com/specials.rss'),
(u'Video Channel', u'http://www.xpatloop.com/video.rss'),
(u'Events', u'http://www.xpatloop.com/events.rss')]

View File

@ -11,6 +11,9 @@
const calibre_device_entry_t calibre_mtp_device_table[] = { const calibre_device_entry_t calibre_mtp_device_table[] = {
#include "upstream/music-players.h" #include "upstream/music-players.h"
// Amazon Kindle Fire HD
, { "Amazon", 0x1949, "Fire HD", 0x0007, DEVICE_FLAGS_ANDROID_BUGS}
, { NULL, 0xffff, NULL, 0xffff, DEVICE_FLAG_NONE } , { NULL, 0xffff, NULL, 0xffff, DEVICE_FLAG_NONE }
}; };

View File

@ -6,6 +6,7 @@
* Copyright (C) 2005-2012 Linus Walleij <triad@df.lth.se> * Copyright (C) 2005-2012 Linus Walleij <triad@df.lth.se>
* Copyright (C) 2006-2007 Marcus Meissner * Copyright (C) 2006-2007 Marcus Meissner
* Copyright (C) 2007 Ted Bullock * Copyright (C) 2007 Ted Bullock
* Copyright (C) 2012 Sony Mobile Communications AB
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -1357,6 +1358,9 @@
// Reported by Toni Burgarello // Reported by Toni Burgarello
{ "Sony", 0x054c, "Walkman NWZ-S754", 0x04cc, { "Sony", 0x054c, "Walkman NWZ-S754", 0x04cc,
DEVICE_FLAGS_SONY_NWZ_BUGS }, DEVICE_FLAGS_SONY_NWZ_BUGS },
// Reported by Hideki Yamane <henrich@debian.org>
{ "Sony", 0x054c, "Sony Tablet P1", 0x04d1,
DEVICE_FLAGS_ANDROID_BUGS },
// Reported by dmiceman // Reported by dmiceman
{ "Sony", 0x054c, "NWZ-B163F", 0x059a, { "Sony", 0x054c, "NWZ-B163F", 0x059a,
DEVICE_FLAGS_SONY_NWZ_BUGS }, DEVICE_FLAGS_SONY_NWZ_BUGS },
@ -1463,7 +1467,8 @@
* 0x6nnn = UMS + ADB * 0x6nnn = UMS + ADB
* 0x7nnn = MTP + CDC * 0x7nnn = MTP + CDC
* 0x8nnn = MTP + CDC + ADB * 0x8nnn = MTP + CDC + ADB
* 0xannn = MTP + UMS + ? * 0xannn = MTP + UMS (MTP for eMMC and UMS for external SD card)
* 0xbnnn = MTP + UMS + ADB
* 0xennn = UMS only * 0xennn = UMS only
* *
* The SonyEricsson and SONY devices have (at least) two deployed MTP * The SonyEricsson and SONY devices have (at least) two deployed MTP
@ -1476,6 +1481,7 @@
* That is why DEVICE_FLAG_NONE is used for these devices. * That is why DEVICE_FLAG_NONE is used for these devices.
* *
* Devices reported by: * Devices reported by:
* Sony Mobile Communications (via Toby Collett)
* Jonas Salling * Jonas Salling
* Eamonn Webster <eweb@users.sourceforge.net> * Eamonn Webster <eweb@users.sourceforge.net>
* Alejandro DC <Alejandro_DC@users.sourceforge.ne> * Alejandro DC <Alejandro_DC@users.sourceforge.ne>
@ -1491,87 +1497,161 @@
* Eduard Bloch <blade@debian.org> * Eduard Bloch <blade@debian.org>
* Ah Hong <hongster@users.sourceforge.net> * Ah Hong <hongster@users.sourceforge.net>
*/ */
{ "SonyEricsson", 0x0fce, "LT15i (Xperia arc S)", 0x014f, { "SonyEricsson", 0x0fce, "LT15i Xperia arc S MTP", 0x014f,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SonyEricsson", 0x0fce, "MT11i Xperia Neo", 0x0156, { "SonyEricsson", 0x0fce, "MT11i Xperia Neo MTP", 0x0156,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SonyEricsson", 0x0fce, "MK16i Xperia", 0x015a, { "SonyEricsson", 0x0fce, "MK16i Xperia MTP", 0x015a,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SonyEricsson", 0x0fce, "ST18a Xperia Ray", 0x0161, { "SonyEricsson", 0x0fce, "ST18a Xperia Ray MTP", 0x0161,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SonyEricsson", 0x0fce, "SK17i Xperia Mini Pro", 0x0166, { "SonyEricsson", 0x0fce, "SK17i Xperia Mini Pro MTP", 0x0166,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SonyEricsson", 0x0fce, "ST15i Xperia Mini", 0x0167, { "SonyEricsson", 0x0fce, "ST15i Xperia Mini MTP", 0x0167,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SonyEricsson", 0x0fce, "ST17i Xperia Active", 0x0168, { "SonyEricsson", 0x0fce, "ST17i Xperia Active MTP", 0x0168,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT26i Xperia S", 0x0169, { "SONY", 0x0fce, "LT26i Xperia S MTP", 0x0169,
DEVICE_FLAG_NO_ZERO_READS }, DEVICE_FLAG_NO_ZERO_READS },
{ "SONY", 0x0fce, "WT19i Live Walkman", 0x016d, { "SONY", 0x0fce, "WT19i Live Walkman MTP", 0x016d,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "ST21i Xperia Tipo", 0x0170, { "SONY", 0x0fce, "ST21i Xperia Tipo MTP", 0x0170,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "ST15i Xperia U", 0x0171, { "SONY", 0x0fce, "ST15i Xperia U MTP", 0x0171,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT22i Xperia P", 0x0172, { "SONY", 0x0fce, "LT22i Xperia P MTP", 0x0172,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT26w Xperia Acro S", 0x0176, { "SONY", 0x0fce, "MT27i Xperia Sola MTP", 0x0173,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT26w Xperia Acro HD IS12S MTP", 0x0175,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT26w Xperia Acro HD SO-03D MTP", 0x0176,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT28at Xperia Ion MTP", 0x0177,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT29i Xperia GX MTP", 0x0178,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "ST27i/ST27a Xperia go MTP", 0x017e,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "SO-05D Xperia SX MTP", 0x0181,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT30p Xperia T MTP", 0x0182,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT25i Xperia V MTP", 0x0186,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
/* /*
* MTP+UMS personalities of MTP devices (see above) * MTP+UMS personalities of MTP devices (see above)
*/ */
{ "SonyEricsson", 0x0fce, "ST17i Xperia Active (MTP+UMS mode)", 0x4168, { "SonyEricsson", 0x0fce, "ST17i Xperia Active MTP+CDROM", 0x4168,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT26i Xperia S (MTP+UMS mode)", 0x4169, { "SONY", 0x0fce, "LT26i Xperia S MTP+CDROM", 0x4169,
DEVICE_FLAG_NO_ZERO_READS }, DEVICE_FLAG_NO_ZERO_READS },
{ "SONY", 0x0fce, "ST21i Xperia Tipo (MTP+UMS mode)", 0x4170, { "SONY", 0x0fce, "ST21i Xperia Tipo MTP+CDROM", 0x4170,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "ST25i Xperia U (MTP+UMS mode)", 0x4171, { "SONY", 0x0fce, "ST25i Xperia U MTP+CDROM", 0x4171,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT22i Xperia P (MTP+UMS mode)", 0x4172, { "SONY", 0x0fce, "LT22i Xperia P MTP+CDROM", 0x4172,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT26w Xperia Acro S (MTP+UMS mode)", 0x4176, { "SONY", 0x0fce, "MT27i Xperia Sola MTP+CDROM", 0x4173,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT26w Xperia Acro HD IS12S MTP+CDROM", 0x4175,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT26w Xperia Acro HD SO-03D MTP+CDROM", 0x4176,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT28at Xperia Ion MTP+CDROM", 0x4177,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT29i Xperia GX MTP+CDROM", 0x4178,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "ST27i/ST27a Xperia go MTP+CDROM", 0x417e,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "SO-05D Xperia SX MTP+CDROM", 0x4181,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT30p Xperia T MTP+CDROM", 0x4182,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT25i Xperia V MTP+CDROM", 0x4186,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
/* /*
* MTP+ADB personalities of MTP devices (see above) * MTP+ADB personalities of MTP devices (see above)
*/ */
{ "SonyEricsson", 0x0fce, "LT15i Xperia Arc (MTP+ADB mode)", 0x514f, { "SonyEricsson", 0x0fce, "LT15i Xperia Arc MTP+ADB", 0x514f,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SonyEricsson", 0x0fce, "MT11i Xperia Neo (MTP+ADB mode)", 0x5156, { "SonyEricsson", 0x0fce, "MT11i Xperia Neo MTP+ADB", 0x5156,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SonyEricsson", 0x0fce, "ST17i Xperia Active (MTP+ADB mode)", 0x5168, { "SonyEricsson", 0x0fce, "ST17i Xperia Active MTP+ADB", 0x5168,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT26i Xperia S (MTP+ADB mode)", 0x5169, { "SONY", 0x0fce, "LT26i Xperia S MTP+ADB", 0x5169,
DEVICE_FLAG_NO_ZERO_READS }, DEVICE_FLAG_NO_ZERO_READS },
{ "SonyEricsson", 0x0fce, "MK16i Xperia (MTP+ADB mode)", 0x515a, { "SonyEricsson", 0x0fce, "MK16i Xperia MTP+ADB", 0x515a,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SonyEricsson", 0x0fce, "ST18i Xperia Ray (MTP+ADB mode)", 0x5161, { "SonyEricsson", 0x0fce, "ST18i Xperia Ray MTP+ADB", 0x5161,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SonyEricsson", 0x0fce, "SK17i Xperia Mini Pro (MTP+ADB mode)", 0x5166, { "SonyEricsson", 0x0fce, "SK17i Xperia Mini Pro MTP+ADB", 0x5166,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SonyEricsson", 0x0fce, "ST15i Xperia Mini (MTP+ADB mode)", 0x5167, { "SonyEricsson", 0x0fce, "ST15i Xperia Mini MTP+ADB", 0x5167,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SonyEricsson", 0x0fce, "SK17i Xperia Mini Pro (MTP+ADB mode)", 0x516d, { "SonyEricsson", 0x0fce, "LT26i Xperia S MTP+ADB", 0x5169,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "ST21i Xperia Tipo (MTP+ADB mode)", 0x5170, { "SonyEricsson", 0x0fce, "SK17i Xperia Mini Pro MTP+ADB", 0x516d,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "ST25i Xperia U (MTP+ADB mode)", 0x5171, { "SONY", 0x0fce, "ST21i Xperia Tipo MTP+ADB", 0x5170,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT22i Xperia P (MTP+ADB mode)", 0x5172, { "SONY", 0x0fce, "ST25i Xperia U MTP+ADB", 0x5171,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT26w Xperia Acro S (MTP+ADB mode)", 0x5176, { "SONY", 0x0fce, "LT22i Xperia P MTP+ADB", 0x5172,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "MT27i Xperia Sola MTP+ADB", 0x5173,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "IS12S Xperia Acro HD MTP+ADB", 0x5175,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "SO-03D Xperia Acro HD MTP+ADB", 0x5176,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT28at Xperia Ion MTP+ADB", 0x5177,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT29i Xperia GX MTP+ADB", 0x5178,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "ST27i/ST27a Xperia go MTP+ADB", 0x517e,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "SO-05D Xperia SX MTP+ADB", 0x5181,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT30p Xperia T MTP+ADB", 0x5182,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT25i Xperia V MTP+ADB", 0x5186,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
/* /*
* MTP+UMS+? modes * MTP+UMS modes
* No reports on other personalities on these devices. * This mode is for using MTP on the internal storage (eMMC)
* and using UMS (Mass Storage Device Class) on the external
* SD card
*/ */
{ "SONY", 0x0fce, "MT27i Xperia Sola (MTP+UMS+? mode)", 0xa173, { "SONY", 0x0fce, "MT27i Xperia Sola MTP+UMS", 0xa173,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "ST27i Xperia Go (MTP+UMS+? mode)", 0xa17e, { "SONY", 0x0fce, "IS12S Xperia Acro HD MTP+UMS", 0xa175,
DEVICE_FLAG_NONE }, DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "SO-03D Xperia Acro HD MTP+UMS", 0xa176,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT28at Xperia Ion MTP+UMS", 0xa177,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "ST27i/ST27a Xperia go MTP+UMS", 0xa17e,
DEVICE_FLAG_NONE },
/*
* MTP+UMS+ADB modes
* Like the above, but also ADB
*/
{ "SONY", 0x0fce, "MT27i Xperia Sola MTP+UMS+ADB", 0xb173,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "IS12S Xperia Acro MTP+UMS+ADB", 0xb175,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "SO-03D Xperia Acro MTP+UMS+ADB", 0xb176,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "LT28at Xperia Ion MTP+UMS+ADB", 0xb177,
DEVICE_FLAG_NONE },
{ "SONY", 0x0fce, "ST27i/ST27a Xperia go MTP+UMS+ADB", 0xb17e,
DEVICE_FLAG_NONE },
/* /*
* Motorola * Motorola

View File

@ -481,7 +481,7 @@ def write_font_record(data, obfuscate=True, compress=True):
if compress: if compress:
flags |= 0b1 flags |= 0b1
data = zlib.compress(data, 9) data = zlib.compress(data, 9)
if obfuscate: if obfuscate and len(data) >= 1040:
flags |= 0b10 flags |= 0b10
xor_key = os.urandom(key_len) xor_key = os.urandom(key_len)
key = bytearray(xor_key) key = bytearray(xor_key)

View File

@ -9,7 +9,7 @@ import sys
from PyQt4.Qt import (Qt, QApplication, QStyle, QIcon, QDoubleSpinBox, from PyQt4.Qt import (Qt, QApplication, QStyle, QIcon, QDoubleSpinBox,
QVariant, QSpinBox, QStyledItemDelegate, QComboBox, QTextDocument, QVariant, QSpinBox, QStyledItemDelegate, QComboBox, QTextDocument,
QAbstractTextDocumentLayout, QFont, QFontInfo) QAbstractTextDocumentLayout, QFont, QFontInfo, QDate)
from calibre.gui2 import UNDEFINED_QDATETIME, error_dialog, rating_font from calibre.gui2 import UNDEFINED_QDATETIME, error_dialog, rating_font
from calibre.constants import iswindows from calibre.constants import iswindows
@ -83,6 +83,7 @@ class DateDelegate(QStyledItemDelegate): # {{{
qde.setSpecialValueText(_('Undefined')) qde.setSpecialValueText(_('Undefined'))
qde.setCalendarPopup(True) qde.setCalendarPopup(True)
return qde return qde
# }}} # }}}
class PubDateDelegate(QStyledItemDelegate): # {{{ class PubDateDelegate(QStyledItemDelegate): # {{{
@ -104,6 +105,12 @@ class PubDateDelegate(QStyledItemDelegate): # {{{
qde.setCalendarPopup(True) qde.setCalendarPopup(True)
return qde return qde
def setEditorData(self, editor, index):
val = index.data(Qt.EditRole).toDate()
if val == UNDEFINED_QDATETIME.date():
val = QDate(2000, 1, 1)
editor.setDate(val)
# }}} # }}}
class TextDelegate(QStyledItemDelegate): # {{{ class TextDelegate(QStyledItemDelegate): # {{{

View File

@ -161,6 +161,7 @@ _extra_lang_codes = {
'en_PK' : _('English (Pakistan)'), 'en_PK' : _('English (Pakistan)'),
'en_HR' : _('English (Croatia)'), 'en_HR' : _('English (Croatia)'),
'en_HK' : _('English (Hong Kong)'), 'en_HK' : _('English (Hong Kong)'),
'en_HU' : _('English (Hungary)'),
'en_ID' : _('English (Indonesia)'), 'en_ID' : _('English (Indonesia)'),
'en_IL' : _('English (Israel)'), 'en_IL' : _('English (Israel)'),
'en_RU' : _('English (Russia)'), 'en_RU' : _('English (Russia)'),