function _video_update_6_get_vtype in Video 5
1 call to _video_update_6_get_vtype()
- video_update_6 in ./
video.install - Set vtype for all the videos
File
- ./
video.install, line 187
Code
function _video_update_6_get_vtype($node) {
$file_type = '';
$vidfile = $node->vidfile;
//If the filename doesn't contain a ".", "/", or "\" and is exactly 11 characters then consider it a youtube video ID.
if (!strpos($vidfile, '.') and !strpos($vidfile, '/') and !strpos($vidfile, '\\') and strlen($vidfile) == 11) {
$file_type = 'youtube';
}
else {
if (strpos($vidfile, 'google:') === 0) {
$file_type = 'google';
}
else {
if (db_result(db_query("SELECT count(fid) FROM {files} WHERE nid=%d", $node->nid)) > 0) {
$file_type = 'upload';
}
else {
if ($vidfile != '') {
// enable absolute urls and relative paths
$file_type = 'url';
}
else {
drupal_set_message(t('Could not determine video type of node %nid', array(
'%nid' => $node->nid,
)), 'error');
}
}
}
}
return $file_type;
}