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'
|
||||
description = _('Communicate with the Sanda Bambook eBook reader.')
|
||||
author = _('Li Fanxi')
|
||||
supported_platforms = ['windows', 'linux']
|
||||
supported_platforms = ['windows', 'linux', 'osx']
|
||||
log_packets = False
|
||||
|
||||
booklist_class = BookList
|
||||
|
@ -8,19 +8,35 @@ __docformat__ = 'restructuredtext en'
|
||||
Sanda library wrapper
|
||||
'''
|
||||
|
||||
import ctypes, uuid, hashlib
|
||||
import ctypes, uuid, hashlib, os, sys
|
||||
from threading import Event, Lock
|
||||
from calibre.constants import iswindows, islinux
|
||||
|
||||
from calibre.constants import iswindows, islinux, isosx
|
||||
from calibre import load_library
|
||||
|
||||
try:
|
||||
_lib_name = 'libBambookCore'
|
||||
cdll = ctypes.cdll
|
||||
if iswindows:
|
||||
text_encoding = 'mbcs'
|
||||
lib_handle = ctypes.cdll.BambookCore
|
||||
elif islinux:
|
||||
text_encoding = 'utf-8'
|
||||
lib_handle = ctypes.CDLL('libBambookCore.so')
|
||||
_lib_name = 'BambookCore'
|
||||
cdll = ctypes.windll
|
||||
else:
|
||||
if hasattr(sys, 'frozen') and iswindows:
|
||||
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:
|
||||
lib_handle = None
|
||||
|
||||
if iswindows:
|
||||
text_encoding = 'mbcs'
|
||||
elif islinux:
|
||||
text_encoding = 'utf-8'
|
||||
elif isosx:
|
||||
text_encoding = 'utf-8'
|
||||
|
||||
# Constant
|
||||
DEFAULT_BAMBOOK_IP = '192.168.250.2'
|
||||
|
Loading…
x
Reference in New Issue
Block a user