/** * Return directory contents for the silo path * * @param string $path The path to retrieve the contents of * @return array An array of MediaAssets describing the contents of the directory */ public function silo_dir($path) { $props = array(); $props['filetype'] = 'youtube'; $username = User::identify()->info->youtube__username; $results = array(); $section = strtok($path, '/'); switch ($section) { case 'videos': $videos = YouTube::playlist($username); foreach ($videos as $video) { $results[] = new MediaAsset(self::SILO_NAME . '/videos/' . $video['id'], false, array_merge($props, $video)); } break; case 'subscriptions': break; case 'favorites': $videos = YouTube::favorites($username); foreach ($videos as $video) { $results[] = new MediaAsset(self::SILO_NAME . '/videos/' . $video['id'], false, array_merge($props, $video)); } break; case '': $results[] = new MediaAsset(self::SILO_NAME . '/videos', true, array('title' => 'Videos')); /* TODO These never worked anyway. $results[] = new MediaAsset( self::SILO_NAME . '/tags', true, array('title' => 'Tags') ); */ $results[] = new MediaAsset(self::SILO_NAME . '/favorites', true, array('title' => 'Favorites')); break; } return $results; }