You are here

function asset_youtube_save_asset in Asset 5

Same name and namespace in other branches
  1. 6 asset_youtube/asset_youtube.module \asset_youtube_save_asset()
1 call to asset_youtube_save_asset()
asset_youtube_sync in asset_youtube/asset_youtube.module

File

asset_youtube/asset_youtube.module, line 277

Code

function asset_youtube_save_asset($video, $dir) {
  $filename = $video->id[0]->tagData . '.youtube';
  $asset = asset_load(array(
    'dirname' => $dir,
    'filename' => $filename,
  ));
  if (!$asset) {
    $asset = new stdClass();
    $asset->filepath = $dir . '/' . $filename;
    $asset->filesize = 0;
    $asset->title = $video->title[0]->tagData;
    $asset->description = $video->description[0]->tagData;
    $asset->author = $video->author[0]->tagData;
    $asset->type = 'youtube';
    asset_save($asset);
  }
}