- Timestamp:
- 19.10.2005 18:38:25 (3 years ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
File/Bittorrent/Decode.php (modified) (2 diffs)
-
torrentinfo.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/File/Bittorrent/Decode.php
r42 r47 189 189 $this->_source_length = strlen($this->_source); 190 190 $decoded = $this->_bdecode(); 191 if (!is_array($decoded)) { 192 PEAR::raiseError('File_Bittorrent_Decode::decode() - Corrupted bencoded data.', null, null, "Failed to decode data from file '$file'."); 193 return false; 194 } 191 195 192 196 // Compute info_hash … … 224 228 ); 225 229 } 230 // In case the torrent contains only on file 231 } elseif(isset($decoded['info']['name'])) { 232 $this->files[] = array( 233 'filename' => $decoded['info']['name'], 234 'size' => $decoded['info']['length'], 235 ); 226 236 } 227 237 // If the the info->length field is present we are dealing with -
trunk/torrentinfo.php
r42 r47 37 37 require_once 'Console/Getargs.php'; 38 38 39 // Set error handling 40 PEAR::setErrorHandling(PEAR_ERROR_PRINT); 41 39 42 // Get filename from command line 40 43 $args_config = array( … … 64 67 switch($key) { 65 68 case 'files': 66 echo "\n"; 69 $n = 1; 70 $files_n = count($val); 71 $n_length = strlen($files_n); 72 echo '(' . $files_n . ")\n"; 67 73 foreach ($val as $file) { 68 echo str_repeat(' ', 20) . '- ' . $file['filename'] . "\n"; 74 echo str_repeat(' ', 20) . '' . str_pad($n, $n_length, ' ', PAD_LEFT) . ': ' . $file['filename'] . "\n"; 75 $n++; 69 76 } 70 77 break;