From 51428ec6027fe1674fa289f8850518f003d3607d Mon Sep 17 00:00:00 2001 From: Can Soylu Date: Thu, 13 Jan 2022 12:17:01 +0100 Subject: [PATCH] Eject drive after init --- localscripts/EjectDrive.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 localscripts/EjectDrive.py diff --git a/localscripts/EjectDrive.py b/localscripts/EjectDrive.py new file mode 100644 index 0000000..9fc9518 --- /dev/null +++ b/localscripts/EjectDrive.py @@ -0,0 +1,10 @@ +import os +import shutil +import ctypes + +def remove_drive(): + drive_letter = os.popen('wmic logicaldisk where VolumeName="config-2" get Caption | findstr /I ":"').read() + if drive_letter: + LOG.debug('Eject metadata drive: %s', str(drive_letter).rstrip()) + ctypes.windll.WINMM.mciSendStringW(u"open " + str(drive_letter).rstrip() + " type cdaudio alias d_drive", None, 0, None) + ctypes.windll.WINMM.mciSendStringW(u"set d_drive door open", None, 0, None) \ No newline at end of file