Advanced Disk Information

Locked
eLucy
User
Posts: 8
Joined: Wed Nov 08, 2006 5:46 pm

Advanced Disk Information

Post by eLucy » Fri Nov 10, 2006 1:41 pm

Hello James,

first of all i want to thank you for beeing able to use getid3. It helped me a great deal in the challenge of getting some structured view on the growing datastock of my personal video and movie collection on CD and DVD when writing the data retrieved by getid3 to my database.

Now, something that is a mayor issue for me is to create a unique identifier for the disks wich could also help me to get them ino a representative order. Therefor it would be great to have the disks burning date on hand. Unfortunately i wasn't able yet to find a solution on how to obtain this value with the help of php, but i'm quite sure, that if this functionality was implemented in getid3 it would help a great amount of people.

Now thanks again for your great work and kind regards from Frankfurt/Germany

James Heinrich
getID3() v1 developer
Posts: 1476
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: Advanced Disk Information

Post by James Heinrich » Sun Nov 28, 2010 10:26 pm

Not really a getID3-related issue. getID3 works on specific files, not caring what storage device the file exists on. But if you can get the value you seek from the command line, you should be able to write a small PHP function to extract the info you need, for example this sample function that gets the volume label and serial number from a Windows drive:

Code: Select all

function DiskInfoWindows($driveletter) {
	if (!preg_match('#^[A-Z]$#i', $driveletter)) {
		return false;
	}
	$diskinfo = array('label'=>'', 'serial'=>'');
	$commandline = 'dir '.escapeshellarg(strtoupper($driveletter).':\\');
	$outputlines = explode("\n", `$commandline`);
	foreach ($outputlines as $line) {
		$line = trim($line);
		if (preg_match('#^Volume in drive [A-Z] is (.*)#i', $line, $matches)) {
			$diskinfo['label'] = $matches[1];
		}
		if (preg_match('#^Volume Serial Number is (.*)#i', $line, $matches)) {
			$diskinfo['serial'] = $matches[1];
		}
		if ($diskinfo['serial'] && $diskinfo['label']) {
			break;
		}
	}
	return $diskinfo;
}

Locked