diff options
Diffstat (limited to 'www/insert.php')
-rwxr-xr-x | www/insert.php | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/www/insert.php b/www/insert.php index 4fa8e59..28c9c28 100755 --- a/www/insert.php +++ b/www/insert.php @@ -89,14 +89,8 @@ try { if (isset($t->getRootData()["source"]["v"])) $odjemalec = $t->getRootData()["source"]["v"]; $s->execute(); - function p ($k, $v, $p) { - global $c, $zgoščena_vrednost; - // if (preg_match("/padding.file/i", $k)) - // return; - if (is_array($v)) { - foreach ($v as $ke => $va) - p($ke, $va, $p . $k . "/"); - } else { + try { + foreach ($t->getFileList() as $datoteka) { $s = $c->prepare("INSERT INTO datoteke ( torrent, pot, @@ -109,16 +103,12 @@ try { $s->bindParam(":torrent", $zgoščena_vrednost); $s->bindParam(":pot", $pot); $s->bindParam(":velikost", $velikost); - $pot = $p . $k; + $pot = $datoteka["path"]; + $velikost = $datoteka["size"]; if (strlen($pot) > 4096) echo "$argv[4] pot $pot daljša od 4096"; - $velikost = $v; $s->execute(); } - } - try { - foreach ($t->getFileTree() as $k => $v) - p($k, $v, ""); } catch (ParseException $e) { echo "neveljaven metainfo $argv[4]: " . $e->getMessage() . PHP_EOL; exit(5); |