1 ? 's' : ''); } return $seconds . ' sec' . ($seconds > 1 ? 's' : ''); } function rip_youtube_data($record) { $media = $record['media$group']; $title = $media['media$title']['$t']; $description = substr($media['media$description']['$t'],0,100); $duration = $media['yt$duration']['seconds']; $thumbs = array(); // w:h => array( file, file, file) $largest = array(0,'', 0, 0); $smallest = array(3000*3000,'', 3000, 3000); // Ok, hacky, sosumi foreach($media['media$thumbnail'] as $thumb) { if(!isset($thumbs["{$thumb['width']}x{$thumb['height']}"])) { $thumbs["{$thumb['width']}x{$thumb['height']}"] = array(); if(($thumb['width'] * $thumb['height']) > $largest[0]) $largest = array($thumb['width'] * $thumb['height'], $thumb['width'] . 'x' . $thumb['height'], $thumb['width'] , $thumb['height']); if(($thumb['width'] * $thumb['height']) < $smallest[0]) $smallest = array($thumb['width'] * $thumb['height'], $thumb['width'] . 'x' . $thumb['height'], $thumb['width'] , $thumb['height']); } $thumbs["{$thumb['width']}x{$thumb['height']}"][$thumb['time']] = $thumb['url']; } // Find the main image link $mainImage = $thumbs[$largest[1]]; $mainImage = array_pop($mainImage); // Find the thumb image link $thumbImage = $thumbs[$smallest[1]]; $thumbImage = array_pop($thumbImage); $embed = NULL; foreach($media['media$content'] as $vid) { if($vid['type'] == 'application/x-shockwave-flash') { $embed = $vid['url']; break; } } // Final image to pass to manager (use query param to record the embed url) $combinedImage = $mainImage . '?x-shockwave-flash='.rawurlencode($embed). '&x-tn='.rawurlencode($thumbImage); return array ( 'title' => $title, 'description' => $description, 'duration' => format_duration($duration), 'mainImage' => $mainImage, 'thumbImage' => $thumbImage, 'combinedImage' => $combinedImage, 'smallest' => $smallest, 'largest' => $largest, 'thumbs' => $thumbs, 'embed' => $embed, ); } function drawFiles($list, &$manager) { global $relative; global $IMConfig; //$IMConfig['ViewMode'] = 'thumbs'; switch($IMConfig['ViewMode']) { case 'details': { ?>
TitleDescriptionDuration
<?php echo $title; ?> - <?php echo htmlspecialchars($duration); ?>
No Videos Found
Invalid base directory: config['images_dir']; ?>
YouTube Video List isValidBase() == false) { drawErrorBase($manager); } elseif(count($records)) { ?>