Added existing project

This commit is contained in:
2025-08-13 20:02:21 +01:00
parent 49395ee846
commit 87d7e31449
3 changed files with 200 additions and 0 deletions

32
openDrive.py Normal file
View File

@@ -0,0 +1,32 @@
from platform import system as platform_name
from os import system
platforms_dictionary = {
"Windows": { #
"open" : 'ctypes.windll.WINMM.mciSendStringW(u"open L: type CDAudio alias L_drive", None, 0, None); ctypes.windll.WINMM.mciSendStringW(u"set L_drive door open", None, 0, None)',
"close": 'ctypes.windll.WINMM.mciSendStringW(u"open L: type CDAudio alias L_drive", None, 0, None); ctypes.windll.WINMM.mciSendStringW(u"set L_drive door closed", None, 0, None)'
},
"Darwin": {
"open" : 'system("drutil tray open")',
"close": 'system("drutil tray closed")'
},
"Linux": {
"open" : 'system("eject cdrom")',
"close": 'system("eject -t cdrom")'
},
"NetBSD": {
"open" : 'system("eject cd")',
"close": 'system("eject -t cd")'
},
"FreeBSD": {
"open" : 'system("sudo cdcontrol eject")',
"close": 'system("sudo cdcontrol close")'
}
}
def open():
if platform_name() in platforms_dictionary:
exec(platforms_dictionary[platform_name()]["open"])
else:
print("OS not supported")