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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.