Feb-07-2024, 03:34 AM
(Feb-06-2024, 11:15 AM)Danishhafeez Wrote:(Feb-06-2024, 05:45 AM)Daring_T Wrote: I am currently working on a program to automate ripping and backing my collection of CDs, DVDs and Blue-rays. I am currently running into an issue where I need to be able to find the type of disc in the drive but I have been unable to located a library that can do so. Has anymore ran into this issue before and if so what was your solution? The only janky way I'm seeing is by looking at Blue-rays and DVDs file structure. For DVD its TS_Video and or TS_Audio. For Blue-ray its AACS, BDMV and CERTIFICATE and go by that and for CD I have an bash command like abcde and catch if it fails or succeeds . Also if this help's I am writing this under Linux. If you have any suggestions or another way of looking at this please let me know.
Thanks,
Daring_T
It seems like you're on the right track with your approach, but there might be a more straightforward way to determine the type of disc in the drive programmatically, especially under Linux.
One common method is to use the blkid command, which is typically used to locate/block device attributes like UUIDs or filesystem types. When a disc is inserted into the drive, it should register as a block device, and blkid can provide information about it.
$blkid
This command should list all block devices, including optical drives and their respective filesystems. By parsing the output of this command, you can determine the type of disc inserted.
Best Regard
Danish Hafeez | QA Assistant
ictinnovations.com
So blkid was my first thought but the main problem with both blkid and lsblk is they show DVD, Blu-ray and Audio CD as only as "rom" or "unknown". If this was differing between hard drive and SSD that would be easy but unfortunately I am not seeing a way to see the disc's type.