mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Cleanup previous PR
This commit is contained in:
parent
081c039ecc
commit
c741ec7035
@ -10,6 +10,7 @@ import os
|
||||
import re
|
||||
import subprocess
|
||||
from contextlib import suppress
|
||||
|
||||
from calibre.constants import isfreebsd
|
||||
|
||||
|
||||
@ -91,14 +92,6 @@ class UDisks:
|
||||
|
||||
def find_device_vols_by_serial(self, serial):
|
||||
from jeepney import DBusAddress, new_method_call
|
||||
|
||||
def decodePath(encoded):
|
||||
ret = ''
|
||||
for c in encoded:
|
||||
if (c != 0):
|
||||
ret += str(c)
|
||||
return ret
|
||||
|
||||
drives = []
|
||||
blocks = []
|
||||
vols = []
|
||||
@ -182,6 +175,7 @@ class UDisks:
|
||||
},))
|
||||
self.send(msg)
|
||||
|
||||
|
||||
def get_udisks():
|
||||
return UDisks()
|
||||
|
||||
@ -200,14 +194,17 @@ def umount(node_path):
|
||||
with get_udisks() as u:
|
||||
u.unmount(node_path)
|
||||
|
||||
|
||||
def rescan(node_path):
|
||||
with get_udisks() as u:
|
||||
u.rescan(node_path)
|
||||
|
||||
|
||||
def find_device_vols_by_serial(serial):
|
||||
with get_udisks() as u:
|
||||
return u.find_device_vols_by_serial(serial)
|
||||
|
||||
|
||||
def test_udisks():
|
||||
import sys
|
||||
dev = sys.argv[1]
|
||||
|
@ -20,7 +20,7 @@ from contextlib import suppress
|
||||
from itertools import repeat
|
||||
|
||||
from calibre import prints
|
||||
from calibre.constants import DEBUG, is_debugging, isfreebsd, islinux, ismacos, iswindows
|
||||
from calibre.constants import is_debugging, isfreebsd, islinux, ismacos, iswindows
|
||||
from calibre.devices.errors import DeviceError
|
||||
from calibre.devices.interface import FAKE_DEVICE_SERIAL, DevicePlugin, ModelMetadata
|
||||
from calibre.devices.usbms.deviceconfig import DeviceConfig
|
||||
@ -737,7 +737,7 @@ class Device(DeviceConfig, DevicePlugin):
|
||||
try:
|
||||
mp = mount(node)
|
||||
break
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
if i < 5:
|
||||
rescan(node)
|
||||
time.sleep(1)
|
||||
@ -758,7 +758,7 @@ class Device(DeviceConfig, DevicePlugin):
|
||||
for vol in vols:
|
||||
try:
|
||||
mp = fmount(vol['Device'])
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
print('Failed to mount: ' + vol['Device'])
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
@ -768,6 +768,7 @@ class Device(DeviceConfig, DevicePlugin):
|
||||
|
||||
# Mount Point becomes Mount Path
|
||||
mp += '/'
|
||||
DEBUG = is_debugging()
|
||||
if DEBUG:
|
||||
print('FBSD:\tmounted', vol['Device'], 'on', mp)
|
||||
if mtd == 0:
|
||||
|
Loading…
x
Reference in New Issue
Block a user