- This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
So I am trying to write a script where it browses a folder and gets all the mp3 id3 data for all the mp3’s in the folder.
$musicfile = $fullpath;
fopen($fullpath, ‘r’);
fseek($musicfile, -128, SEEK_END);
$tag = fread($musicfile, 3);
if($tag == “TAG”)
{
$data[“song”] = trim(fread($musicfile, 30));
$data[“artist”] = trim(fread($musicfile, 30));
$data[“album”] = trim(fread($musicfile, 30));
}
else
die(“MP3 file does not have any ID3 tag!”);
fclose($musicfile);
while(list($key, $value) = each($data))
{
print(“$key: $value
rn”);
}
}
}
}
?>
Its not working. I get this error:
Warning: fseek(): supplied argument is not a valid stream resource in /[my_server_path]/public_html/new/wp-content/themes/default/functions.php on line 1039
Warning: fread(): supplied argument is not a valid stream resource in /[my_server_path]/public_html/new/wp-content/themes/default/functions.php on line 1041
MP3 file does not have any ID3 tag!
Any help?
Thanks.
Ok so I changed it to this:
?>
and its returning this:
MP3 file does not have any ID3 tag!
Warning: Variable passed to each() is not an array or object in /[my_server_path]/public_html/new/wp-content/themes/default/functions.php on line 1053
song: X&Y
artist: Coldplay
album: X&Y
So oddly enough it only retrieves the second songs id3 data.
Any ideas?