mirror of
https://github.com/fergalmoran/picard.git
synced 2026-03-06 13:34:05 +00:00
Merge pull request #2175 from rdswift/handle_missing_cdtoc_module
PICARD-2591: Accessing CD Lookup crashes Picard if there is no cdtoc module loaded
This commit is contained in:
@@ -134,7 +134,11 @@ from picard.util import (
|
||||
versions,
|
||||
webbrowser2,
|
||||
)
|
||||
from picard.util.cdrom import get_cdrom_drives
|
||||
from picard.util.cdrom import (
|
||||
DISCID_NOT_LOADED_MESSAGE,
|
||||
discid as _discid,
|
||||
get_cdrom_drives,
|
||||
)
|
||||
from picard.util.checkupdate import UpdateCheckManager
|
||||
from picard.webservice import WebService
|
||||
from picard.webservice.api_helpers import (
|
||||
@@ -573,6 +577,9 @@ class Tagger(QtWidgets.QApplication):
|
||||
log.error("Invalid LOOKUP command argument: '%s'", argstring)
|
||||
|
||||
def handle_command_lookup_cd(self, argstring):
|
||||
if not _discid:
|
||||
log.error(DISCID_NOT_LOADED_MESSAGE)
|
||||
return
|
||||
disc = Disc()
|
||||
devices = get_cdrom_drives()
|
||||
|
||||
|
||||
@@ -99,6 +99,7 @@ from picard.util import (
|
||||
webbrowser2,
|
||||
)
|
||||
from picard.util.cdrom import (
|
||||
DISCID_NOT_LOADED_MESSAGE,
|
||||
discid,
|
||||
get_cdrom_drives,
|
||||
)
|
||||
@@ -913,7 +914,7 @@ class MainWindow(QtWidgets.QMainWindow, PreserveGeometry):
|
||||
self.cd_lookup_menu.clear()
|
||||
self.cd_lookup_action.setEnabled(discid is not None)
|
||||
if not drives:
|
||||
log.warning("CDROM: No CD-ROM drives found - Lookup CD functionality disabled")
|
||||
log.warning(DISCID_NOT_LOADED_MESSAGE)
|
||||
else:
|
||||
config = get_config()
|
||||
shortcut_drive = config.setting["cd_lookup_device"].split(",")[0] if len(drives) > 1 else ""
|
||||
|
||||
@@ -47,6 +47,7 @@ except ImportError:
|
||||
except (ImportError, OSError):
|
||||
discid = None
|
||||
|
||||
DISCID_NOT_LOADED_MESSAGE = "CDROM: discid library not found - Lookup CD functionality disabled"
|
||||
|
||||
DEFAULT_DRIVES = []
|
||||
if discid is not None:
|
||||
|
||||
Reference in New Issue
Block a user