Porting from OS X to Windows

The place for "I can't figure out how to..." questions.
Post Reply
argosquirrel
User
Posts: 5
Joined: Thu Aug 31, 2006 11:50 pm

Porting from OS X to Windows

Post by argosquirrel » Thu Aug 31, 2006 11:56 pm

I am attempting to move my database over from mysql on OS X to MS SQL on windows. I have gotten most things with the DB ported, but my code that gets a remote mp3 and reads it's ID3 info is now broken for some reason.

The code in question:

Code: Select all

// Copy remote file locally to scan with getID3()
$remotefilename = $_POST['url'];
if ($fp_remote = fopen($remotefilename, 'rb')) {
    $localtempfilename = tempnam('/tmp', 'getID3');
    if ($fp_local = fopen($localtempfilename, 'wb')) {
        while ($buffer = fread($fp_remote, 8192)) {
            fwrite($fp_local, $buffer);
        }
        fclose($fp_local);
	  require_once('getid3/getid3.php');
		// Initialize getID3 engine
		$getID3 = new getID3;

		$ThisFileInfo = $getID3->analyze($localtempfilename);
		getid3_lib::CopyTagsToComments($ThisFileInfo);
        // Delete temporary file
        unlink($localtempfilename);
		    }
    fclose($fp_remote);
...
I'm getting the values using:

Code: Select all

$ThisFileInfo['comments_html']['title'][0]
Thanks for the great script. Worked splendidly up until now...

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:

Post by James Heinrich » Fri Sep 01, 2006 2:25 am

Broken in what sense? And what version of PHP are you using on the broken version? I know PHP v4.4.2 had a serious problem with remote fopen() calls, for example...

argosquirrel
User
Posts: 5
Joined: Thu Aug 31, 2006 11:50 pm

Post by argosquirrel » Fri Sep 01, 2006 2:35 am

James Heinrich wrote:Broken in what sense? And what version of PHP are you using on the broken version? I know PHP v4.4.2 had a serious problem with remote fopen() calls, for example...
The version on OS X was 5.1.2 and on XP is 5.1.4. By broken I mean that a file is found and returned but that no id3 information can be found. It just returns NULL values.

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:

Post by James Heinrich » Fri Sep 01, 2006 2:48 am

Try some debug tracing, with echo statements for example, to see whether it gets past the if statements for the fopen calls. If it does, check the filesize($localtempfilename) before the call to $getID3->analyze, etc. This sounds like a PHP issue, not getID3-related per se.

argosquirrel
User
Posts: 5
Joined: Thu Aug 31, 2006 11:50 pm

Post by argosquirrel » Fri Sep 01, 2006 2:54 am

James Heinrich wrote:Try some debug tracing, with echo statements for example, to see whether it gets past the if statements for the fopen calls. If it does, check the filesize($localtempfilename) before the call to $getID3->analyze, etc. This sounds like a PHP issue, not getID3-related per se.
"found remote. found local. local filesize: 3026759"

looks like it's working fine.

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:

Post by James Heinrich » Fri Sep 01, 2006 3:02 am

And if you do a print_r($ThisFileInfo) (or var_dump($ThisFileInfo) if you prefer), what do you get?

argosquirrel
User
Posts: 5
Joined: Thu Aug 31, 2006 11:50 pm

Post by argosquirrel » Fri Sep 01, 2006 3:11 am

Array ( [error] => Array ( [0] => "C:\wamp\www\getid3\..\helperapps" cannot be defined as GETID3_HELPERAPPSDIR because it does not exist ) )

hmm, thought i set this right. let me try to set the directly correctly and i'll get back to you.

argosquirrel
User
Posts: 5
Joined: Thu Aug 31, 2006 11:50 pm

Post by argosquirrel » Fri Sep 01, 2006 3:15 am

Ok great, that was it.

I wasn't anticipating the .. in there so i just overlooked it and was a directory back.

Thanks so much for the help.

Post Reply