Halfway through the Wordpress plug....
Sortie.... Here is some more code that pulls more then just FLVs and puts movies in arrays.
Code:
foreach ($contents->entries as $entry) {
$flvthumb_url = array();
$flv_url = array();
$flv_length = array();
$flv_title = array();
$mpgthumb_url = array();
$mpg_url = array();
$mpg_length = array();
$mpg_title = array();
$flv_cnt = 0;
$mpg_cnt = 0;
$twotwofiveseven = '';
$sponsor_url = '';
$sponsor_title = '';
$buy_url = '';
$video_id = md5($entry->id);
$title = $entry->title[1];
$description = $entry->content[1];
foreach ($entry->links as $link) {
// 2257
if ($link['title'] == "2257") {
$twotwofiveseven_url = $link['href'];
// MPEGs
} else if ($link['type'] == "video/mpeg" && $link['rel']=="enclosure") {
$mpg_length[$mpg_cnt] = $link['length'];
$mpg_length[$mpg_cnt] = sec2time($video_length);
if ($mpg_length[$mpg_cnt]["minutes"]>0) {
$mpg_length[$mpg_cnt] = $video_length["minutes"]."m ".$video_length["seconds"]."s";
} else {
$mpg_length[$mpg_cnt] = $video_length["seconds"]."s";
}
$mpg_url[$mpg_cnt] = $link['href'];
$mpg_title[$mpg_cnt] = $link['title'];
$mpgthumb_url[$x] = '';
$mpg_cnt++;
// FLVs
} else if ($link['type'] == "video/x-flv" && $link['rel']=="enclosure") {
$flv_length[$flv_cnt] = $link['length'];
$flv_length[$flv_cnt] = sec2time($video_length);
if ($flv_length[$flv_cnt]["minutes"]>0) {
$flv_length[$flv_cnt] = $video_length["minutes"]."m ".$video_length["seconds"]."s";
} else {
$flv_length[$flv_cnt] = $video_length["seconds"]."s";
}
$flv_url[$flv_cnt] = $link['href'];
$flv_title[$flv_cnt] = $link['title'];
$flvthumb_url[$x] = '';
$flv_cnt++;
// Sponsor Link
} else if ($link['type'] == "text/html" && $link['rel']=="alternate") {
$sponsor_url = $link['href'];
$sponsor_title = $link['title'];
// Buy DVD Link
} else if (preg_match('/Buy DVD/i',$link['title']) && $buy_url=='' && $link['type'] == "text/html" && $link['rel']=="related") {
$buy_url = $link['href'];
}
}
// Match Images to Links
foreach ($entry->links as $link) {
for ($x=0;$x<$flv_cnt;$x++) {
if ('image['.$flv_title[$x].']' == $link['title'] && $link['type'] == "image/jpeg" && $link['rel']=="related") {
$flvthumb_url[$x] = $link['href'];
}
}
for ($x=0;$x<$mpg_cnt;$x++) {
if ('image['.$mpg_title[$x].']' == $link['title'] && $link['type'] == "image/jpeg" && $link['rel']=="related") {
$mpgthumb_url[$x] = $link['href'];
}
}
}
if ($title!='') {
echo "<HR><BR><BR>\n\n";
echo "title: " . $title . "<BR>\n";
echo "description: " . $description . "<BR>\n";
echo "date_uploaded: " . $date_uploaded . "<BR>\n";
echo "2257: " . $location_recorded . "<BR>\n";
echo "sponsor_title: " . $sponsor_title . "<BR>\n";
echo "sponsor_url: " . $sponsor_url . "<BR>\n";
echo "buy_url: " . $buy_url . "<BR>\n";
if (count($flv_title)>0) {
echo "<BR>FLVs<BR>\n";
for ($x=0;$x<count($flv_title);$x++) {
echo "Title: " . $flv_title[$x] . "<BR>\n";
echo "Thumb: " . $flvthumb_url[$x] . "<BR>\n";
echo "URL: " . $flv_url[$x] . "<BR>\n";
echo "Length: " . $flv_length[$x] . "<BR>\n";
}
}
if (count($mpg_title)>0){
echo "<BR>MPEGs<BR>\n";
for ($x=0;$x<count($mpg_title);$x++) {
echo "Title: " . $mpg_title[$x] . "<BR>\n";
echo "Thumb: " . $mpgthumb_url[$x] . "<BR>\n";
echo "URL: " . $mpg_url[$x] . "<BR>\n";
echo "Length: " . $mpg_length[$x] . "<BR>\n";
}
}
}
}
-Ben
__________________
Cyberwurx Hosting
After trying 5 different hosts, I found the best.
Since 1997 I've had 2 hours of downtime.
Fast support, great techs, no hype, no gimmicks.
<- I in no way endorse whatever just got stuck on the left of my post.