mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
[Device] Add Mac OS support
This commit is contained in:
parent
345cd48a5b
commit
e87a34d32e
@ -22,7 +22,7 @@ class BAMBOOK(DeviceConfig, DevicePlugin):
|
|||||||
name = 'Bambook Device Interface'
|
name = 'Bambook Device Interface'
|
||||||
description = _('Communicate with the Sanda Bambook eBook reader.')
|
description = _('Communicate with the Sanda Bambook eBook reader.')
|
||||||
author = _('Li Fanxi')
|
author = _('Li Fanxi')
|
||||||
supported_platforms = ['windows', 'linux']
|
supported_platforms = ['windows', 'linux', 'osx']
|
||||||
log_packets = False
|
log_packets = False
|
||||||
|
|
||||||
booklist_class = BookList
|
booklist_class = BookList
|
||||||
|
@ -8,19 +8,35 @@ __docformat__ = 'restructuredtext en'
|
|||||||
Sanda library wrapper
|
Sanda library wrapper
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import ctypes, uuid, hashlib
|
import ctypes, uuid, hashlib, os, sys
|
||||||
from threading import Event, Lock
|
from threading import Event, Lock
|
||||||
from calibre.constants import iswindows, islinux
|
from calibre.constants import iswindows, islinux, isosx
|
||||||
|
from calibre import load_library
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
_lib_name = 'libBambookCore'
|
||||||
|
cdll = ctypes.cdll
|
||||||
if iswindows:
|
if iswindows:
|
||||||
text_encoding = 'mbcs'
|
_lib_name = 'BambookCore'
|
||||||
lib_handle = ctypes.cdll.BambookCore
|
cdll = ctypes.windll
|
||||||
elif islinux:
|
else:
|
||||||
text_encoding = 'utf-8'
|
if hasattr(sys, 'frozen') and iswindows:
|
||||||
lib_handle = ctypes.CDLL('libBambookCore.so')
|
lp = os.path.join(os.path.dirname(sys.executable), 'DLLs', 'BambookCore.dll')
|
||||||
|
lib_handle = cdll.LoadLibrary(lp)
|
||||||
|
elif hasattr(sys, 'frozen_path'):
|
||||||
|
lp = os.path.join(sys.frozen_path, 'lib', 'libBambookCore.so')
|
||||||
|
lib_handle = cdll.LoadLibrary(lp)
|
||||||
|
else:
|
||||||
|
lib_handle = load_library(_lib_name, cdll)
|
||||||
except:
|
except:
|
||||||
lib_handle = None
|
lib_handle = None
|
||||||
|
|
||||||
|
if iswindows:
|
||||||
|
text_encoding = 'mbcs'
|
||||||
|
elif islinux:
|
||||||
|
text_encoding = 'utf-8'
|
||||||
|
elif isosx:
|
||||||
|
text_encoding = 'utf-8'
|
||||||
|
|
||||||
# Constant
|
# Constant
|
||||||
DEFAULT_BAMBOOK_IP = '192.168.250.2'
|
DEFAULT_BAMBOOK_IP = '192.168.250.2'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user