|
Posted by lawrence k on 10/19/07 00:38
I've got a client that is a music studio and they've several thousand
mp3s that tend to have file names like this:
Adrian Orange - Bitches Is Lord - 13 - Don't Get Used To It.mp3
The quote mark in that file name is giving me trouble.
The music studio asked me to write a script that could read all the
metadata out of their mp3s and then store the info in a database.
Using the getID3 library, I've had an easy time with all the files
that don't have quote marks in their names:
require_once('../getid3/getid3/getid3.php');
$getID3 = new getID3;
for ($i=0; $i < count($formInputs); $i++) {
$originalFileName = $formInputs[$i];
$fileNameWithSlashesAdded = stripslashes($originalFileName);
$fileNameWithSlashesAdded = addslashes($fileNameWithSlashesAdded);
$filePath = "../site_specific_files/".$fileNameWithSlashesAdded;
if (! @ file_exists($filePath)) {
$controller->addToResults("We were not able to import '$filePath'.
Usually this means the software stumbled over an unusual character in
the file name.");
return false;
}
// Analyze file and store returned data in $ThisFileInfo
$ThisFileInfo = $getID3->analyze($filePath);
This works fine, except when there is a quote mark in the file name.
I've tried using addslashes, and I've tried not using addslashes, and
I've tried using addslashes twice.
No dice. Nothing works.
This is on a server running RedHat Linux.
Suggestions?
Navigation:
[Reply to this message]
|