<?php

class EWRmedio_Services_GameSpot extends XenForo_Model
{
	public static function dumpMedia($service, $matches)
	{
		$client = new Zend_Http_Client('http://www.gamespot.com/videos/video/2300-'.$matches['sval1'].'/');
		$feed = $client->request()->getBody();
		$meta = array();
		
		preg_match_all('#<meta\s+(name|property)="([^"]+)"\s+content="([^"]*)"#i', $feed, $props);
		foreach ($props[2] as $key => $value)
		{
			if (!empty($meta[$value])) { continue; }
			$meta[$value] = $props[3][$key];
		}
		
		$media = array(
			'media_value1' => $matches['sval1'],
			'media_value2' => '',
			'media_thumb' => $meta['og:image'],
			'media_title' => $meta['og:title'],
			'media_description' => $meta['og:description'],
			'media_duration' => 0,
			'media_keywords' => '',
		);
		
		return $media;
	}
}