mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
429096bb54
commit
41d2c59022
@ -7,8 +7,17 @@ __license__ = 'GPL v3'
|
|||||||
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
|
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
|
from functools import wraps
|
||||||
|
|
||||||
from calibre.devices.interface import DevicePlugin
|
from calibre.devices.interface import DevicePlugin
|
||||||
|
|
||||||
|
def synchronous(func):
|
||||||
|
@wraps(func)
|
||||||
|
def synchronizer(self, *args, **kwargs):
|
||||||
|
with self.lock:
|
||||||
|
return func(self, *args, **kwargs)
|
||||||
|
return synchronizer
|
||||||
|
|
||||||
class MTPDeviceBase(DevicePlugin):
|
class MTPDeviceBase(DevicePlugin):
|
||||||
name = 'SmartDevice App Interface'
|
name = 'SmartDevice App Interface'
|
||||||
gui_name = _('MTP Device')
|
gui_name = _('MTP Device')
|
||||||
|
@ -9,23 +9,15 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
import time, operator
|
import time, operator
|
||||||
from threading import RLock
|
from threading import RLock
|
||||||
from functools import wraps
|
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from collections import deque, OrderedDict
|
from collections import deque, OrderedDict
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
from calibre import prints
|
from calibre import prints
|
||||||
from calibre.devices.errors import OpenFailed
|
from calibre.devices.errors import OpenFailed
|
||||||
from calibre.devices.mtp.base import MTPDeviceBase
|
from calibre.devices.mtp.base import MTPDeviceBase, synchronous
|
||||||
from calibre.devices.mtp.unix.detect import MTPDetect
|
from calibre.devices.mtp.unix.detect import MTPDetect
|
||||||
|
|
||||||
def synchronous(func):
|
|
||||||
@wraps(func)
|
|
||||||
def synchronizer(self, *args, **kwargs):
|
|
||||||
with self.lock:
|
|
||||||
return func(self, *args, **kwargs)
|
|
||||||
return synchronizer
|
|
||||||
|
|
||||||
class FilesystemCache(object):
|
class FilesystemCache(object):
|
||||||
|
|
||||||
def __init__(self, files, folders):
|
def __init__(self, files, folders):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user