Python Forum
How to get a removable disc type in drive
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get a removable disc type in drive
#5
(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.
Reply


Messages In This Thread
RE: How to get a removable disc type in drive - by Daring_T - Feb-07-2024, 03:34 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  open python files in other drive akbarza 1 742 Aug-24-2023, 01:23 PM
Last Post: deanhystad
  Integrating Google Drive in App Lahearle 0 492 Jul-19-2023, 05:51 PM
Last Post: Lahearle
  code to send attachments contained on the drive. stefanoste78 1 915 Oct-12-2022, 02:16 AM
Last Post: Larz60+
  access is denied error 5 for network drive mapping ? ahmedbarbary 2 1,839 Aug-17-2022, 10:09 PM
Last Post: ahmedbarbary
  Cant Access D: Drive kucingkembar 4 1,422 Jul-28-2022, 04:53 PM
Last Post: kucingkembar
  Calling exe on network drive GrahamL 4 2,640 Jan-21-2022, 12:01 PM
Last Post: GrahamL
  Failing to copy file from a network to a local drive tester_V 4 7,232 Jan-20-2021, 07:40 AM
Last Post: tester_V
  Type hinting - return type based on parameter micseydel 2 2,530 Jan-14-2020, 01:20 AM
Last Post: micseydel
  Nested Subdirectory within current sub on shared network drive Agregware 1 1,974 Jun-19-2019, 10:07 PM
Last Post: Gribouillis
  trouble with os.listdir on a network drive lconner 10 19,262 Jun-04-2019, 07:16 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020