Saturday, October 23, 2010

Media Behaviour - OGG not detected correctly

Ok, my problem is that OGG files are put in the generic category,
instead of audio. I think i've more or less isolated the problem, in
the transfer behavior, the "transferTo" method invokes
"Mime_Type::guessName"

transfer.php, line 345: $name = Mime_Type::guessName($mimeType ?
$mimeType : $file);


and passes the name of the file. "Mime_Type::guessName" will then
invoke "self::guessType" in order to find out the mime type.

Type.php, line 235: $mimeType = self::guessType($file,
array('experimental' => false));


Then the "guessType" method invokes "self::$glob->analyze",

Type.php, line 175: $globMatch = (array) self::$glob->analyze($name);


and now comes the problem, it doesn't return a single match, instead
it returns multiple types (application/ogg, audio/x-vorbis+ogg, audio/
x-flac+ogg, etc), and so the following check:

Type.php, line 177: if (count($globMatch) === 1) {


results in false, the script continues, and reaches the check whether
the "$file" parameter is a file or a resource,

Type.php, line 182: if (is_resource($file)) {
Type.php, line 184: } elseif (is_file($file)) {


since it's neither of those it ends up at

Type.php, line 187: } else {
return;
}


and so it doesn't return the correct mime type, and
"Mime_Type::guessName" returns "generic":

Type.php, line 242: return 'generic';


So, now i'm wondering what i could do to make it work. Should i remove
the duplicate mime types in the glob.db file? Or is this behaviour
maybe a bug?

Regards

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: