mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Recipe download no longer requires X server on linux
This commit is contained in:
parent
8830ee4456
commit
50c1e51b2b
@ -58,8 +58,8 @@ class DeviceScanner(object):
|
|||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
if isosx and osx_scanner is None:
|
if isosx and osx_scanner is None:
|
||||||
raise RuntimeError('The Python extension usbobserver must be available on OS X.')
|
raise RuntimeError('The Python extension usbobserver must be available on OS X.')
|
||||||
if not (isosx or iswindows) and not os.access(_DEVICES, os.R_OK):
|
if not (isosx or iswindows) and (not os.access(_DEVICES, os.R_OK) and not libusb.has_library):
|
||||||
raise RuntimeError('DeviceScanner requires %s to work.'%_DEVICES)
|
raise RuntimeError('DeviceScanner requires %s or libusb to work.'%_DEVICES)
|
||||||
self.scanner = win_scanner if iswindows else osx_scanner if isosx else linux_scanner
|
self.scanner = win_scanner if iswindows else osx_scanner if isosx else linux_scanner
|
||||||
self.devices = []
|
self.devices = []
|
||||||
|
|
||||||
|
@ -808,6 +808,9 @@ class BasicNewsRecipe(Recipe):
|
|||||||
'''
|
'''
|
||||||
Create a generic cover for recipes that dont have a cover
|
Create a generic cover for recipes that dont have a cover
|
||||||
'''
|
'''
|
||||||
|
from calibre.gui2 import is_ok_to_use_qt
|
||||||
|
if not is_ok_to_use_qt():
|
||||||
|
return False
|
||||||
from calibre.gui2 import images_rc # Needed for access to logo
|
from calibre.gui2 import images_rc # Needed for access to logo
|
||||||
images_rc
|
images_rc
|
||||||
if QApplication.instance() is None: QApplication([])
|
if QApplication.instance() is None: QApplication([])
|
||||||
@ -868,6 +871,7 @@ class BasicNewsRecipe(Recipe):
|
|||||||
else:
|
else:
|
||||||
cover_file.write(renderer.data)
|
cover_file.write(renderer.data)
|
||||||
cover_file.flush()
|
cover_file.flush()
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def create_opf(self, feeds, dir=None):
|
def create_opf(self, feeds, dir=None):
|
||||||
@ -892,8 +896,8 @@ class BasicNewsRecipe(Recipe):
|
|||||||
cpath = getattr(self, 'cover_path', None)
|
cpath = getattr(self, 'cover_path', None)
|
||||||
if cpath is None:
|
if cpath is None:
|
||||||
pf = open(os.path.join(dir, 'cover.jpg'), 'wb')
|
pf = open(os.path.join(dir, 'cover.jpg'), 'wb')
|
||||||
self.default_cover(pf)
|
if self.default_cover(pf):
|
||||||
cpath = pf.name
|
cpath = pf.name
|
||||||
if cpath is not None and os.access(cpath, os.R_OK):
|
if cpath is not None and os.access(cpath, os.R_OK):
|
||||||
opf.cover = cpath
|
opf.cover = cpath
|
||||||
manifest.append(cpath)
|
manifest.append(cpath)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user