mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add profile for SONY 900/300. Re-organize drivers for Hanlin based devices. Fix #4293 (Italics in conversions to ereader PDB don't convert properly)
This commit is contained in:
commit
5e1a8b17f2
@ -400,7 +400,7 @@ from calibre.ebooks.txt.output import TXTOutput
|
||||
from calibre.customize.profiles import input_profiles, output_profiles
|
||||
|
||||
|
||||
from calibre.devices.bebook.driver import BEBOOK, BEBOOK_MINI
|
||||
from calibre.devices.hanlin.driver import HANLINV3, HANLINV5, BOOX
|
||||
from calibre.devices.blackberry.driver import BLACKBERRY
|
||||
from calibre.devices.cybookg3.driver import CYBOOKG3, CYBOOK_OPUS
|
||||
from calibre.devices.eb600.driver import EB600, COOL_ER, SHINEBOOK, \
|
||||
@ -417,7 +417,6 @@ from calibre.devices.nokia.driver import N770, N810
|
||||
from calibre.devices.eslick.driver import ESLICK
|
||||
from calibre.devices.nuut2.driver import NUUT2
|
||||
from calibre.devices.iriver.driver import IRIVER_STORY
|
||||
from calibre.devices.boox.driver import BOOX
|
||||
|
||||
from calibre.ebooks.metadata.fetch import GoogleBooks, ISBNDB, Amazon
|
||||
plugins = [HTML2ZIP, PML2PMLZ, GoogleBooks, ISBNDB, Amazon]
|
||||
@ -455,8 +454,8 @@ plugins += [
|
||||
TXTOutput,
|
||||
]
|
||||
plugins += [
|
||||
BEBOOK,
|
||||
BEBOOK_MINI,
|
||||
HANLINV3,
|
||||
HANLINV5,
|
||||
BLACKBERRY,
|
||||
CYBOOKG3,
|
||||
ILIAD,
|
||||
|
@ -54,13 +54,29 @@ class SonyReaderInput(InputProfile):
|
||||
name = 'Sony Reader'
|
||||
short_name = 'sony'
|
||||
description = _('This profile is intended for the SONY PRS line. '
|
||||
'The 500/505/700 etc.')
|
||||
'The 500/505/600/700 etc.')
|
||||
|
||||
screen_size = (584, 754)
|
||||
dpi = 168.451
|
||||
fbase = 12
|
||||
fsizes = [7.5, 9, 10, 12, 15.5, 20, 22, 24]
|
||||
|
||||
class SonyReader300Input(SonyReaderInput):
|
||||
|
||||
name = 'Sony Reader 300'
|
||||
short_name = 'sony300'
|
||||
description = _('This profile is intended for the SONY PRS 300.')
|
||||
|
||||
dpi = 200
|
||||
|
||||
class SonyReader900Input(SonyReaderInput):
|
||||
|
||||
author = 'John Schember'
|
||||
name = 'Sony Reader 900'
|
||||
short_name = 'sony900'
|
||||
description = _('This profile is intended for the SONY PRS-900.')
|
||||
|
||||
screen_size = (584, 978)
|
||||
|
||||
class MSReaderInput(InputProfile):
|
||||
|
||||
@ -88,9 +104,9 @@ class MobipocketInput(InputProfile):
|
||||
|
||||
class HanlinV3Input(InputProfile):
|
||||
|
||||
name = 'Hanlin V3/V5'
|
||||
name = 'Hanlin V3'
|
||||
short_name = 'hanlinv3'
|
||||
description = _('This profile is intended for the Hanlin V3/V5 and its clones.')
|
||||
description = _('This profile is intended for the Hanlin V3 and its clones.')
|
||||
|
||||
# Screen size is a best guess
|
||||
screen_size = (584, 754)
|
||||
@ -98,6 +114,16 @@ class HanlinV3Input(InputProfile):
|
||||
fbase = 16
|
||||
fsizes = [12, 12, 14, 16, 18, 20, 22, 24]
|
||||
|
||||
class HanlinV5Input(HanlinV3Input):
|
||||
|
||||
name = 'Hanlin V5'
|
||||
short_name = 'hanlinv5'
|
||||
description = _('This profile is intended for the Hanlin V5 and its clones.')
|
||||
|
||||
# Screen size is a best guess
|
||||
screen_size = (584, 754)
|
||||
dpi = 200
|
||||
|
||||
class CybookG3Input(InputProfile):
|
||||
|
||||
name = 'Cybook G3'
|
||||
@ -173,9 +199,10 @@ class NookInput(InputProfile):
|
||||
fbase = 16
|
||||
fsizes = [12, 12, 14, 16, 18, 20, 22, 24]
|
||||
|
||||
input_profiles = [InputProfile, SonyReaderInput, MSReaderInput,
|
||||
MobipocketInput, HanlinV3Input, CybookG3Input, CybookOpusInput, KindleInput,
|
||||
IlliadInput, IRexDR1000Input, NookInput]
|
||||
input_profiles = [InputProfile, SonyReaderInput, SonyReader300Input,
|
||||
SonyReader900Input, MSReaderInput, MobipocketInput, HanlinV3Input,
|
||||
HanlinV5Input, CybookG3Input, CybookOpusInput, KindleInput, IlliadInput,
|
||||
IRexDR1000Input, NookInput]
|
||||
|
||||
|
||||
class OutputProfile(Plugin):
|
||||
@ -206,13 +233,32 @@ class SonyReaderOutput(OutputProfile):
|
||||
name = 'Sony Reader'
|
||||
short_name = 'sony'
|
||||
description = _('This profile is intended for the SONY PRS line. '
|
||||
'The 500/505/700 etc.')
|
||||
'The 500/505/600/700 etc.')
|
||||
|
||||
screen_size = (600, 775)
|
||||
dpi = 168.451
|
||||
fbase = 12
|
||||
fsizes = [7.5, 9, 10, 12, 15.5, 20, 22, 24]
|
||||
|
||||
class SonyReader300Output(SonyReaderOutput):
|
||||
|
||||
author = 'John Schember'
|
||||
name = 'Sony Reader 300'
|
||||
short_name = 'sony300'
|
||||
description = _('This profile is intended for the SONY PRS-300.')
|
||||
|
||||
dpi = 200
|
||||
|
||||
class SonyReader900Output(SonyReaderOutput):
|
||||
|
||||
author = 'John Schember'
|
||||
name = 'Sony Reader 900'
|
||||
short_name = 'sony900'
|
||||
description = _('This profile is intended for the SONY PRS-900.')
|
||||
|
||||
screen_size = (600, 999)
|
||||
comic_screen_size = screen_size
|
||||
|
||||
class JetBook5Output(OutputProfile):
|
||||
|
||||
name = 'JetBook 5-inch'
|
||||
@ -222,8 +268,6 @@ class JetBook5Output(OutputProfile):
|
||||
screen_size = (480, 640)
|
||||
dpi = 168.451
|
||||
|
||||
|
||||
|
||||
class SonyReaderLandscapeOutput(SonyReaderOutput):
|
||||
|
||||
name = 'Sony Reader Landscape'
|
||||
@ -262,9 +306,9 @@ class MobipocketOutput(OutputProfile):
|
||||
|
||||
class HanlinV3Output(OutputProfile):
|
||||
|
||||
name = 'Hanlin V3/V5'
|
||||
name = 'Hanlin V3'
|
||||
short_name = 'hanlinv3'
|
||||
description = _('This profile is intended for the Hanlin V3/V5 and its clones.')
|
||||
description = _('This profile is intended for the Hanlin V3 and its clones.')
|
||||
|
||||
# Screen size is a best guess
|
||||
screen_size = (584, 754)
|
||||
@ -272,6 +316,14 @@ class HanlinV3Output(OutputProfile):
|
||||
fbase = 16
|
||||
fsizes = [12, 12, 14, 16, 18, 20, 22, 24]
|
||||
|
||||
class HanlinV5Output(HanlinV3Output):
|
||||
|
||||
name = 'Hanlin V5'
|
||||
short_name = 'hanlinv5'
|
||||
description = _('This profile is intended for the Hanlin V5 and its clones.')
|
||||
|
||||
dpi = 200
|
||||
|
||||
class CybookG3Output(OutputProfile):
|
||||
|
||||
name = 'Cybook G3'
|
||||
@ -368,7 +420,8 @@ class NookOutput(OutputProfile):
|
||||
fbase = 16
|
||||
fsizes = [12, 12, 14, 16, 18, 20, 22, 24]
|
||||
|
||||
output_profiles = [OutputProfile, SonyReaderOutput, MSReaderOutput,
|
||||
MobipocketOutput, HanlinV3Output, CybookG3Output, CybookOpusOutput,
|
||||
KindleOutput, SonyReaderLandscapeOutput, KindleDXOutput, IlliadOutput,
|
||||
output_profiles = [OutputProfile, SonyReaderOutput, SonyReader300Output,
|
||||
SonyReader900Output, MSReaderOutput, MobipocketOutput, HanlinV3Output,
|
||||
HanlinV5Output, CybookG3Output, CybookOpusOutput, KindleOutput,
|
||||
SonyReaderLandscapeOutput, KindleDXOutput, IlliadOutput,
|
||||
IRexDR1000Output, JetBook5Output, NookOutput]
|
||||
|
@ -1,87 +0,0 @@
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Jesus Manuel Marinho Valcarce <jjjesss at gmail.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
'''
|
||||
Device driver for BOOX
|
||||
'''
|
||||
|
||||
import re
|
||||
|
||||
from calibre.devices.usbms.driver import USBMS
|
||||
|
||||
class BOOX(USBMS):
|
||||
|
||||
name = 'BOOX driver'
|
||||
gui_name = 'BOOX'
|
||||
description = _('Communicate with the BOOX eBook reader.')
|
||||
author = 'Jesus Manuel Marinho Valcarce'
|
||||
supported_platforms = ['windows', 'osx', 'linux']
|
||||
|
||||
# Ordered list of supported formats
|
||||
FORMATS = ['ebub', 'pdf', 'html', 'txt', 'rtf', 'mobi', 'prc', 'chm']
|
||||
|
||||
VENDOR_ID = [0x0525]
|
||||
PRODUCT_ID = [0xa4a5]
|
||||
BCD = [0x322]
|
||||
|
||||
VENDOR_NAME = 'Linux 2.6.26-466-ga04670e with fsl-usb2-udc'
|
||||
WINDOWS_MAIN_MEM = 'FILE-STOR_GADGET'
|
||||
WINDOWS_CARD_A_MEM = 'FILE-STOR_GADGET'
|
||||
|
||||
OSX_MAIN_MEM = 'Linux File-Stor Gadget Media'
|
||||
OSX_CARD_A_MEM = 'Linux File-Stor Gadget Media'
|
||||
|
||||
MAIN_MEMORY_VOLUME_LABEL = 'BOOX Internal Memory'
|
||||
STORAGE_CARD_VOLUME_LABEL = 'BOOX Storage Card'
|
||||
|
||||
EBOOK_DIR_MAIN = 'MyBooks'
|
||||
EBOOK_DIR_CARD_A = 'MyBooks'
|
||||
SUPPORTS_SUB_DIRS = True
|
||||
|
||||
def windows_sort_drives(self, drives):
|
||||
main = drives.get('main', None)
|
||||
card = drives.get('carda', None)
|
||||
if card and main and card > main:
|
||||
drives['main'] = card
|
||||
drives['carda'] = main
|
||||
|
||||
if card and not main:
|
||||
drives['main'] = card
|
||||
drives['carda'] = None
|
||||
|
||||
return drives
|
||||
|
||||
def osx_sort_names(self, names):
|
||||
main = names.get('main', None)
|
||||
card = names.get('carda', None)
|
||||
|
||||
try:
|
||||
main_num = int(re.findall('\d+', main)[0]) if main else None
|
||||
except:
|
||||
main_num = None
|
||||
try:
|
||||
card_num = int(re.findall('\d+', card)[0]) if card else None
|
||||
except:
|
||||
card_num = None
|
||||
|
||||
if card_num is not None and main_num is not None and card_num > main_num:
|
||||
names['main'] = card
|
||||
names['carda'] = main
|
||||
|
||||
if card and not main:
|
||||
names['main'] = card
|
||||
names['carda'] = None
|
||||
|
||||
return names
|
||||
|
||||
def linux_swap_drives(self, drives):
|
||||
if len(drives) < 2: return drives
|
||||
drives = list(drives)
|
||||
t = drives[0]
|
||||
drives[0] = drives[1]
|
||||
drives[1] = t
|
||||
return tuple(drives)
|
||||
|
||||
|
||||
|
@ -5,23 +5,23 @@ __copyright__ = '2009, Tijmen Ruizendaal <tijmen at mybebook.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
'''
|
||||
Device driver for BeBook
|
||||
Device driver for Hanlin
|
||||
'''
|
||||
|
||||
import re
|
||||
|
||||
from calibre.devices.usbms.driver import USBMS
|
||||
|
||||
class BEBOOK(USBMS):
|
||||
class HANLINV3(USBMS):
|
||||
|
||||
name = 'BeBook driver'
|
||||
gui_name = 'BeBook'
|
||||
description = _('Communicate with the BeBook eBook reader.')
|
||||
name = 'Hanlin V3 driver'
|
||||
gui_name = 'Hanlin V3'
|
||||
description = _('Communicate with Hanlin V3 eBook readers.')
|
||||
author = 'Tijmen Ruizendaal'
|
||||
supported_platforms = ['windows', 'osx', 'linux']
|
||||
|
||||
# Ordered list of supported formats
|
||||
FORMATS = ['mobi', 'epub', 'fb2', 'lit', 'prc', 'pdf', 'rtf', 'txt']
|
||||
FORMATS = ['epub', 'mobi', 'fb2', 'lit', 'prc', 'pdf', 'rtf', 'txt']
|
||||
|
||||
VENDOR_ID = [0x0525]
|
||||
PRODUCT_ID = [0x8803, 0x6803]
|
||||
@ -34,8 +34,8 @@ class BEBOOK(USBMS):
|
||||
OSX_MAIN_MEM = 'Linux File-Stor Gadget Media'
|
||||
OSX_CARD_A_MEM = 'Linux File-Stor Gadget Media'
|
||||
|
||||
MAIN_MEMORY_VOLUME_LABEL = 'BeBook Internal Memory'
|
||||
STORAGE_CARD_VOLUME_LABEL = 'BeBook Storage Card'
|
||||
MAIN_MEMORY_VOLUME_LABEL = 'Hanlin V3 Internal Memory'
|
||||
STORAGE_CARD_VOLUME_LABEL = 'Hanlin V3 Storage Card'
|
||||
|
||||
SUPPORTS_SUB_DIRS = True
|
||||
|
||||
@ -89,18 +89,40 @@ class BEBOOK(USBMS):
|
||||
return tuple(drives)
|
||||
|
||||
|
||||
class BEBOOK_MINI(BEBOOK):
|
||||
name = 'BeBook Mini driver'
|
||||
gui_name = 'BeBook Mini'
|
||||
description = _('Communicate with the BeBook Mini eBook reader.')
|
||||
class HANLINV5(HANLINV3):
|
||||
name = 'Hanlin V5 driver'
|
||||
gui_name = 'Hanlin V5'
|
||||
description = _('Communicate with Hanlin V5 eBook readers.')
|
||||
|
||||
|
||||
VENDOR_ID = [0x0492]
|
||||
PRODUCT_ID = [0x8813]
|
||||
BCD = [0x319]
|
||||
|
||||
OSX_MAIN_MEM = 'BeBook Mini Internal Memory'
|
||||
OSX_CARD_MEM = 'BeBook Mini Storage Card'
|
||||
OSX_MAIN_MEM = 'Hanlin V5 Internal Memory'
|
||||
OSX_CARD_MEM = 'Hanlin V5 Storage Card'
|
||||
|
||||
MAIN_MEMORY_VOLUME_LABEL = 'BeBook Mini Internal Memory'
|
||||
STORAGE_CARD_VOLUME_LABEL = 'BeBook Mini Storage Card'
|
||||
MAIN_MEMORY_VOLUME_LABEL = 'Hanlin V5 Internal Memory'
|
||||
STORAGE_CARD_VOLUME_LABEL = 'Hanlin V5 Storage Card'
|
||||
|
||||
|
||||
class BOOX(HANLINV3):
|
||||
|
||||
name = 'BOOX driver'
|
||||
gui_name = 'BOOX'
|
||||
description = _('Communicate with the BOOX eBook reader.')
|
||||
author = 'Jesus Manuel Marinho Valcarce'
|
||||
supported_platforms = ['windows', 'osx', 'linux']
|
||||
|
||||
# Ordered list of supported formats
|
||||
FORMATS = ['ebub', 'pdf', 'html', 'txt', 'rtf', 'mobi', 'prc', 'chm']
|
||||
|
||||
VENDOR_ID = [0x0525]
|
||||
PRODUCT_ID = [0xa4a5]
|
||||
BCD = [0x322]
|
||||
|
||||
MAIN_MEMORY_VOLUME_LABEL = 'BOOX Internal Memory'
|
||||
STORAGE_CARD_VOLUME_LABEL = 'BOOX Storage Card'
|
||||
|
||||
EBOOK_DIR_MAIN = 'MyBooks'
|
||||
EBOOK_DIR_CARD_A = 'MyBooks'
|
@ -18,7 +18,7 @@ from calibre.ebooks.pml import unipmlcode
|
||||
TAG_MAP = {
|
||||
'b' : 'B',
|
||||
'strong' : 'B',
|
||||
'i' : 'I',
|
||||
'i' : 'i',
|
||||
'small' : 'k',
|
||||
'sub' : 'Sb',
|
||||
'sup' : 'Sp',
|
||||
@ -35,7 +35,7 @@ TAG_MAP = {
|
||||
|
||||
STYLES = [
|
||||
('font-weight', {'bold' : 'B', 'bolder' : 'B'}),
|
||||
('font-style', {'italic' : 'I'}),
|
||||
('font-style', {'italic' : 'i'}),
|
||||
('text-decoration', {'underline' : 'u'}),
|
||||
('text-align', {'right' : 'r', 'center' : 'c'}),
|
||||
]
|
||||
|
@ -92,6 +92,12 @@ class Sony505(Sony500):
|
||||
name = 'SONY Reader Pocket/Touch Edition'
|
||||
id = 'prs505'
|
||||
|
||||
class Sony900(Sony505):
|
||||
|
||||
name = 'SONY Reader Daily Edition'
|
||||
id = 'prs900'
|
||||
output_profile = 'sony900'
|
||||
|
||||
class Nook(Sony505):
|
||||
id = 'nook'
|
||||
name = 'Nook'
|
||||
|
Loading…
x
Reference in New Issue
Block a user