"video/x-flv", "guid" => $url, "post_parent" => $post_id, ); if (preg_match($youtube_pattern, $url, $match)) { $youtube_api = get_youtube_meta_data($match[1]); if ($youtube_api) { $attachment["post_title"] = $youtube_api["title"]; $attachment["post_content"] = $youtube_api["description"]; } } else { $file_info = wp_check_filetype($url); if ($file_info["type"] != null) { $attachment["post_mime_type"] = $file_info["type"]; $attachment["post_content"]=""; $attachment["post_title"]=""; } } $id = wp_insert_attachment($attachment, $url, $post_id); if ($youtube_api) { update_post_meta($id, LONGTAIL_KEY . "thumbnail_url", $youtube_api["thumbnail_url"]); update_post_meta($id, LONGTAIL_KEY . "creator", $youtube_api["author"]); } else if (strstr($url, "rtmp://")) { update_post_meta($id, LONGTAIL_KEY . "streamer", str_replace(basename($url), "", $url)); update_post_meta($id, LONGTAIL_KEY . "file", basename($url)); update_post_meta($id, LONGTAIL_KEY . "rtmp", true); } update_post_meta($id, LONGTAIL_KEY . "external", true); wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $url)); } ?>
author->name; $youtube_media = $youtube_xml->children("http://search.yahoo.com/mrss/"); $youtube_meta["title"] = $youtube_media->group->title; $youtube_meta["description"] = $youtube_media->group->description; $thumbnails = $youtube_xml->xpath("media:group/media:thumbnail"); $youtube_meta["thumbnail_url"] = (string) $thumbnails[0]["url"]; unlink($youtube_file); return $youtube_meta; } ?>