Jump to content

getID3 demo not working properly


michelle88

Recommended Posts

Hello everyone,

 

Let me start by saying that this is my first post on this forum and that I am quite a noob when it comes to scripting. With that said, here is my problem:

 

I am trying to edit a getID3 demo file properly to retrieve metadata from mp4 files. The code below belongs from the demo file.

 

<?php

require_once('../getid3/getid3.php');

$getID3 = new getID3;

$DirectoryToScan = '../container';
$dir = opendir($DirectoryToScan);

echo '<TABLE BORDER="1" CELLSPACING="0" CELLPADDING="3">';
echo '<TR><TH>Filename</TH><TH>Artist</TH><TH>Title</TH><TH>Bitrate</TH><TH>Playtime</TH></TR>';

while (($file = readdir($dir)) !== false) {
$FullFileName = realpath($DirectoryToScan.'/'.$file);
if (is_file($FullFileName)) {
	set_time_limit(30);

	$ThisFileInfo = $getID3->analyze($FullFileName);

	getid3_lib::CopyTagsToComments($ThisFileInfo);

	echo '<TR>';
	echo '<TD>'.$ThisFileInfo['filenamepath'].'</TD>';
	echo '<TD>'.(!empty($ThisFileInfo['comments_html']['artist']) ? implode('<BR>', $ThisFileInfo['comments_html']['artist']) : ' ').'</TD>';
	echo '<TD>'.(!empty($ThisFileInfo['comments_html']['title'])  ? implode('<BR>', $ThisFileInfo['comments_html']['title'])  : ' ').'</TD>';
	echo '<TD ALIGN="RIGHT">'.(!empty($ThisFileInfo['audio']['bitrate'])        ? round($ThisFileInfo['audio']['bitrate'] / 1000).' kbps'   : ' ').'</TD>';
	echo '<TD ALIGN="RIGHT">'.(!empty($ThisFileInfo['playtime_string'])         ? $ThisFileInfo['playtime_string']                          : ' ').'</TD>';
	echo '</TR>';
}
}

?>

 

I have added 2 test files in 'container' for testing only. See this image for the result I am getting. As you can see the code isn't retrieving any data at all. Can anyone help me out with this?

 

Thanks in advance,

 

Melissa

Link to comment
https://forums.phpfreaks.com/topic/212542-getid3-demo-not-working-properly/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.