<?php
require_once 'class.hashcheck.php';
require_once 'utils.php';
// Check for correct argument count
if ($argc < 3) {
printConsole ( "Usage: {$argv[0]} <torrent_file> <path> [output_file]", true );
}
$output_file = '';
$msgbuffer = '';
if (!file_exists($argv[2])) {
printConsole("Torrent data path specified '{$argv[2]}' does not exist. Please choose another one", true);
}
if (!empty($argv[3])) {
if (file_exists($argv[3])) {
printConsole("Filename '{$argv[3]}' exists. Please remove it or use another filename", true);
} else {
$output_file = $argv[3];
}
}
// Create the hash check object. $argv[1] = torrent file metadata path, $argv[2] = torrent data target path
$hash_check = new HashCheck($argv[1], $argv[2]);
// Check hashes and report results
$hash_check->doCheck();
if (!empty($output_file)) {
file_put_contents($output_file, $msgbuffer);
}
?>
|