|
Lines 256-269
Link Here
|
| 256 |
end in |
256 |
end in |
| 257 |
print_first_tracker file.file_trackers; |
257 |
print_first_tracker file.file_trackers; |
| 258 |
|
258 |
|
|
|
259 |
let check_magic file = |
| 260 |
match Magic.M.magic_fileinfo file false with |
| 261 |
None -> None |
| 262 |
| Some s -> Some (HashMagic.merge CommonGlobals.files_magic s) |
| 263 |
in |
| 259 |
let cntr = ref 0 in |
264 |
let cntr = ref 0 in |
| 260 |
List.iter (fun (filename, size, magic) -> |
265 |
List.iter (fun (filename, size, _) -> |
| 261 |
Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-%d\\\"\\>" (html_mods_cntr ()); |
266 |
Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-%d\\\"\\>" (html_mods_cntr ()); |
| 262 |
let fs = Printf.sprintf "File %d" !cntr in |
267 |
let fs = Printf.sprintf "File %d" !cntr in |
| 263 |
let magic_string = |
268 |
let magic_string = |
| 264 |
match magic with |
269 |
if !Autoconf.magic_works then |
|
|
270 |
begin |
| 271 |
let subfile = Filename.concat (file_disk_name file) filename in |
| 272 |
match check_magic subfile with |
| 265 |
None -> "" |
273 |
None -> "" |
| 266 |
| Some magic -> Printf.sprintf " / %s" magic |
274 |
| Some magic -> Printf.sprintf " / %s" magic |
|
|
275 |
end |
| 276 |
else "" |
| 267 |
in |
277 |
in |
| 268 |
html_mods_td buf [ |
278 |
html_mods_td buf [ |
| 269 |
(fs, "sr br", fs); |
279 |
(fs, "sr br", fs); |
|
Lines 623-654
Link Here
|
| 623 |
lprintf_nl "ft_retry: exception %s" (Printexc2.to_string e) |
633 |
lprintf_nl "ft_retry: exception %s" (Printexc2.to_string e) |
| 624 |
) ft_by_num |
634 |
) ft_by_num |
| 625 |
|
635 |
|
| 626 |
let file_magic_check () = |
|
|
| 627 |
if !Autoconf.magic_works then begin |
| 628 |
if !verbose then lprintf_nl "computing sub_file magic values"; |
| 629 |
let check_magic file = |
| 630 |
match Magic.M.magic_fileinfo file false with |
| 631 |
None -> None |
| 632 |
| Some s -> Some (HashMagic.merge CommonGlobals.files_magic s) |
| 633 |
in |
| 634 |
Hashtbl.iter (fun _ file -> |
| 635 |
let updated = ref false in |
| 636 |
let new_file_files = ref [] in |
| 637 |
List.iter (fun (filename, size, magic) -> |
| 638 |
let subfile = Filename.concat (file_disk_name file) filename in |
| 639 |
let new_magic = |
| 640 |
match magic with |
| 641 |
None -> check_magic subfile |
| 642 |
| Some magic when magic = "data" || magic = "empty" -> check_magic subfile |
| 643 |
| _ -> magic |
| 644 |
in |
| 645 |
if new_magic <> magic then updated := true; |
| 646 |
new_file_files := (filename, size, new_magic) :: !new_file_files |
| 647 |
) file.file_files; |
| 648 |
if !updated then file.file_files <- !new_file_files |
| 649 |
) files_by_uid |
| 650 |
end |
| 651 |
|
| 652 |
let load_torrent_from_web r ft = |
636 |
let load_torrent_from_web r ft = |
| 653 |
if !verbose then |
637 |
if !verbose then |
| 654 |
lprintf_nl "Loading torrent from web"; |
638 |
lprintf_nl "Loading torrent from web"; |