$tmpDir = $sessDir;
if (!is_writable($tmpDir)) {
    die("ERROR: " . $tmpDir . " is not writable\n");
} else {
    $log .= "borrando tmp dir\n";
    exec("rm -rf " . $tmpDir . "/*");
}
if (!is_writable(ZIP_DIR)) {
    die("ERROR: " . ZIP_DIR . " is not writable\n");
}
$xmlContent = '<?xml version="1.0" encoding="utf-8" standalone="yes"?>' . "\n";
$xmlContent .= '<asset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' . "\n";
foreach ($listaIds as $contentId) {
    $contentId = trim($contentId);
    $log .= "\tprocessando {$contentId}\n";
    $fulltrack = new druttFulltrack($dbc, $debug);
    try {
        $fulltrack->loadContent($contentId);
    } catch (Exception $e) {
        $log .= "loadContent: " . $e->getMessage() . "\n";
    }
    try {
        $content_download = FALSE;
        $fulltrack->setTag($catdrutt);
        // descargo contenido por FTP
        $log .= "\tdescargando contenido...\n";
        $ftpCon = new Ftp();
        $conectado = $ftpCon->login();
        if ($conectado !== TRUE) {
            $conectado = $ftpCon->login();
        }
$tmpDir = $sessDir;
if (!is_writable($tmpDir)) {
    die("ERROR: " . $tmpDir . " is not writable\n");
} else {
    $log .= "borrando tmp dir\n";
    exec("rm -rf " . $tmpDir . "/*");
}
if (!is_writable(ZIP_DIR)) {
    die("ERROR: " . ZIP_DIR . " is not writable\n");
}
$xmlContent = '<?xml version="1.0" encoding="utf-8" standalone="yes"?>' . "\n";
$xmlContent .= '<asset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' . "\n";
foreach ($listaIds as $contentId) {
    $contentId = trim($contentId);
    $log .= "\tprocessando {$contentId}\n";
    $fulltrack = new druttFulltrack($dbc, $debug, $marca, $festivo);
    try {
        $fulltrack->loadContent($contentId);
    } catch (Exception $e) {
        $log .= "loadContent: " . $e->getMessage() . "\n";
    }
    try {
        $content_download = FALSE;
        $fulltrack->setTag($catdrutt);
        $fulltrack->setLangs(array_keys($paises_elegidos));
        // descargo contenido por FTP
        $log .= "\tdescargando contenido...\n";
        $ftpCon = new Ftp();
        $conectado = $ftpCon->login();
        if ($conectado !== TRUE) {
            $conectado = $ftpCon->login();