function video_google_v_validate in Video 6.2
Same name and namespace in other branches
- 5 types/video_google/video_google.module \video_google_v_validate()
- 6 types/video_google/video_google.module \video_google_v_validate()
implementation of hook_v_validate
File
- types/
video_google/ video_google.module, line 77 - Enable Google Video support for video module.
Code
function video_google_v_validate($node) {
// TODO: use youtube REST or XML-RPC to query youtube: check video available and embeddable
if (!preg_match("/^http:\\/\\/video\\.google\\.com\\/videoplay\\?docid=/", $node->vidfile)) {
form_set_error('vidfile', t('The Google Video URL field must be similar to <em>http://video.google.com/videoplay?docid=1806507480014945777</em>'));
}
else {
//get the video id
$id = _video_google_get_id($node->vidfile);
$response = _video_apiclient_google_request($id);
if (count($response) == 0) {
// google video wasn't able to find the video
form_set_error('vidfile', t('The system was not able to find this video on Google Video. Please check the URL of your Google video.'));
}
}
}