Last active
May 1, 2023 04:06
-
-
Save EncodeTheCode/483fcc6c135e616a4c3d9a10ea53ebb1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pycdlib | |
# Open the CD/DVD drive | |
try: | |
cd = pycdlib.PyCdlib() | |
cd.open('/dev/cdrom') | |
except IOError: | |
print('No CD/DVD in tray.') | |
exit() | |
# Get the disc information | |
disc_info = cd.get_disc_info() | |
# Print the disc properties to the console and file | |
with open('disc_info.txt','w') as f: | |
for key, value in disc_info.items(): | |
f.write(key+': '+str(value)+'\n') | |
print(key+':',value) | |
# Close the CD/DVD drive | |
cd.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment