if (count($announce_list) > 0) {
$torrent = new Torrent($path_edit, $announce_list[0][0], $piece_size, $callback_log, $callback_err);
if ($trackersCount > 1) {
$torrent->announce_list($announce_list);
}
} else {
$torrent = new Torrent($path_edit, array(), $piece_size, $callback_log, $callback_err);
}
if (isset($request['comment'])) {
$comment = trim($request['comment']);
if (strlen($comment)) {
$torrent->comment($comment);
}
}
if ($request['private']) {
$torrent->is_private(true);
}
$fname = rTask::formatPath($taskNo) . '/result.torrent';
$torrent->save($fname);
if ($request['start_seeding']) {
$fname = getUniqueUploadedFilename($torrent->info['name'] . '.torrent');
$path_edit = trim($request['path_edit']);
if (is_dir($path_edit)) {
$path_edit = addslash($path_edit);
}
if (rTorrentSettings::get()->correctDirectory($path_edit)) {
$path_edit = dirname($path_edit);
if ($resumed = rTorrent::fastResume($torrent, $path_edit)) {
$torrent = $resumed;
}
$torrent->save($fname);