Added existing project
This commit is contained in:
32
openDrive.py
Normal file
32
openDrive.py
Normal 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")
|
||||
Reference in New Issue
Block a user