mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Sync to trunk.
This commit is contained in:
commit
a74210802b
@ -35,7 +35,6 @@ def freeze():
|
||||
'/usr/lib/libpodofo.so.0.6.99',
|
||||
'/lib/libz.so.1',
|
||||
'/lib/libbz2.so.1',
|
||||
'/lib/libbz2.so.1',
|
||||
'/usr/lib/libpoppler.so.4',
|
||||
'/usr/lib/libxml2.so.2',
|
||||
'/usr/lib/libdbus-1.so.3',
|
||||
|
@ -355,7 +355,7 @@ from calibre.devices.kindle.driver import KINDLE, KINDLE2, KINDLE_DX
|
||||
from calibre.devices.prs500.driver import PRS500
|
||||
from calibre.devices.prs505.driver import PRS505
|
||||
from calibre.devices.prs700.driver import PRS700
|
||||
|
||||
from calibre.devices.android.driver import ANDROID
|
||||
|
||||
plugins = [HTML2ZIP]
|
||||
plugins += [
|
||||
@ -402,6 +402,7 @@ plugins += [
|
||||
PRS500,
|
||||
PRS505,
|
||||
PRS700,
|
||||
ANDROID,
|
||||
]
|
||||
plugins += [x for x in list(locals().values()) if isinstance(x, type) and \
|
||||
x.__name__.endswith('MetadataReader')]
|
||||
|
10
src/calibre/devices/android/__init__.py
Normal file
10
src/calibre/devices/android/__init__.py
Normal file
@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
from __future__ import with_statement
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
|
38
src/calibre/devices/android/driver.py
Normal file
38
src/calibre/devices/android/driver.py
Normal file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env python
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
from __future__ import with_statement
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
from calibre.devices.usbms.driver import USBMS
|
||||
|
||||
class ANDROID(USBMS):
|
||||
name = 'Android driver'
|
||||
description = _('Communicate with Android phones.')
|
||||
author = 'Kovid Goyal'
|
||||
supported_platforms = ['windows', 'osx', 'linux']
|
||||
|
||||
|
||||
# Ordered list of supported formats
|
||||
FORMATS = ['epub']
|
||||
|
||||
VENDOR_ID = [
|
||||
0x0bb4,
|
||||
]
|
||||
PRODUCT_ID = [0x0c02]
|
||||
BCD = [0x100]
|
||||
EBOOK_DIR_MAIN = 'wordplayer/calibre'
|
||||
|
||||
VENDOR_NAME = 'HTC'
|
||||
WINDOWS_MAIN_MEM = 'ANDROID_PHONE'
|
||||
|
||||
OSX_MAIN_MEM = 'HTC Android Phone Media'
|
||||
|
||||
MAIN_MEMORY_VOLUME_LABEL = 'Android Internal Memory'
|
||||
|
||||
SUPPORTS_SUB_DIRS = True
|
||||
|
||||
|
@ -12,7 +12,7 @@ from calibre.devices.usbms.driver import USBMS
|
||||
class BEBOOK(USBMS):
|
||||
name = 'BeBook driver'
|
||||
description = _('Communicate with the BeBook eBook reader.')
|
||||
author = _('Tijmen Ruizendaal')
|
||||
author = 'Tijmen Ruizendaal'
|
||||
supported_platforms = ['windows', 'osx', 'linux']
|
||||
|
||||
|
||||
|
@ -113,6 +113,13 @@ class iPhone(Device):
|
||||
manufacturer = 'Apple'
|
||||
id = 'iphone'
|
||||
|
||||
class Android(Device):
|
||||
|
||||
name = 'Adroid phone + WordPlayer'
|
||||
output_format = 'EPUB'
|
||||
manufacturer = 'Google/HTC'
|
||||
id = 'android'
|
||||
|
||||
class Hanlin(Device):
|
||||
|
||||
name = 'Hanlin V3'
|
||||
@ -263,7 +270,21 @@ class StanzaPage(QWizardPage, StanzaUI):
|
||||
except:
|
||||
continue
|
||||
|
||||
class WordPlayerPage(StanzaPage):
|
||||
|
||||
ID = 6
|
||||
|
||||
def __init__(self):
|
||||
StanzaPage.__init__(self)
|
||||
self.label.setText('<p>'+_('If you use the WordPlayer e-book app on '
|
||||
'your Android phone, you can access your calibre book collection '
|
||||
'directly on the device. To do this you have to turn on the '
|
||||
'content server.'))
|
||||
self.instructions.setText('<p>'+_('Remember to leave calibre running '
|
||||
'as the server only runs as long as calibre is running.')+'<br><br>'
|
||||
+ _('You have to add the URL http://myhostname:8080 as your '
|
||||
'calibre library in WordPlayer. Here myhostname should be the fully '
|
||||
'qualified hostname or the IP address of the computer calibre is running on.'))
|
||||
|
||||
|
||||
class DevicePage(QWizardPage, DeviceUI):
|
||||
@ -324,6 +345,8 @@ class DevicePage(QWizardPage, DeviceUI):
|
||||
return KindlePage.ID
|
||||
if dev is iPhone:
|
||||
return StanzaPage.ID
|
||||
if dev is Android:
|
||||
return WordPlayerPage.ID
|
||||
return FinishPage.ID
|
||||
|
||||
class MoveMonitor(QObject):
|
||||
@ -493,11 +516,13 @@ class Wizard(QWizard):
|
||||
self.finish_page.finish_text.setText(t%bt)
|
||||
self.kindle_page = KindlePage()
|
||||
self.stanza_page = StanzaPage()
|
||||
self.word_player_page = WordPlayerPage()
|
||||
self.setPage(self.library_page.ID, self.library_page)
|
||||
self.setPage(self.device_page.ID, self.device_page)
|
||||
self.setPage(self.finish_page.ID, self.finish_page)
|
||||
self.setPage(self.kindle_page.ID, self.kindle_page)
|
||||
self.setPage(self.stanza_page.ID, self.stanza_page)
|
||||
self.setPage(self.word_player_page.ID, self.word_player_page)
|
||||
|
||||
self.device_extra_page = None
|
||||
nh, nw = min_available_height()-75, available_width()-30
|
||||
|
@ -10,13 +10,14 @@ import os, cPickle, time, tempfile
|
||||
from math import ceil
|
||||
from threading import Thread, RLock
|
||||
from Queue import Queue, Empty
|
||||
from multiprocessing.connection import Listener
|
||||
from multiprocessing.connection import Listener, arbitrary_address
|
||||
from collections import deque
|
||||
from binascii import hexlify
|
||||
|
||||
from calibre.utils.ipc.launch import Worker
|
||||
from calibre.utils.ipc.worker import PARALLEL_FUNCS
|
||||
from calibre import detect_ncpus as cpu_count
|
||||
from calibre.constants import iswindows
|
||||
|
||||
_counter = 0
|
||||
|
||||
@ -91,7 +92,11 @@ class Server(Thread):
|
||||
self.pool_size = cpu_count() if pool_size is None else pool_size
|
||||
self.notify_on_job_done = notify_on_job_done
|
||||
self.auth_key = os.urandom(32)
|
||||
self.listener = Listener(authkey=self.auth_key, backlog=4)
|
||||
self.address = arbitrary_address('AF_PIPE' if iswindows else 'AF_UNIX')
|
||||
if iswindows and self.address[1] == ':':
|
||||
self.address = self.address[2:]
|
||||
self.listener = Listener(address=self.address,
|
||||
authkey=self.auth_key, backlog=4)
|
||||
self.add_jobs_queue, self.changed_jobs_queue = Queue(), Queue()
|
||||
self.kill_queue = Queue()
|
||||
self.waiting_jobs, self.processing_jobs = deque(), deque()
|
||||
|
Loading…
x
Reference in New Issue
Block a user