# HG changeset patch # User Matti Hamalainen # Date 1417243114 -7200 # Node ID c71afc1a3a855e15b4f3ea1a35cf6de7689705a4 # Parent 62c90ec5edcec52d09f449227105c974cc67bc85 Moar work. diff -r 62c90ec5edce -r c71afc1a3a85 faptool.php --- a/faptool.php Sat Nov 29 03:59:46 2014 +0200 +++ b/faptool.php Sat Nov 29 08:38:34 2014 +0200 @@ -177,7 +177,12 @@ case "RAR": $exe = "/usr/bin/rar"; - $args = "x ".escapeshellarg($filename); + $args = "x -w".escapeshellarg($path)." ".escapeshellarg($filename); + break; + + case "7ZIP": + $exe = "/usr/bin/7z"; + $args = "x -o".escapeshellarg($path)." ".escapeshellarg($filename); break; default: @@ -487,6 +492,22 @@ } +function wtPrintCompoHeader($compo) +{ + global $setTermWidth; + printf("==%'=-".($setTermWidth-2)."s\n", + sprintf("[ #%03d - %s ]", $compo["id"], substr($compo["name"], 0, 40)) + ); +} + + +function wtPrintDivider($chr = "-") +{ + global $setTermWidth; + echo str_repeat($chr, $setTermWidth)."\n"; +} + + function wtShowHelp() { global $argv; @@ -631,11 +652,8 @@ foreach (stExecSQL("SELECT * FROM compos WHERE cpath <> '' AND cpath IS NOT NULL") as $compo) if (stFetchSQLColumn("SELECT COUNT(*) FROM entries WHERE compo_id=".$compo["id"]) > 0) { - printf( - "==%'=-".($setTermWidth-2)."s\n", - sprintf("[ #%03d - %s ]", $compo["id"], substr($compo["name"], 0, 40)) - ); - echo str_repeat("-", $setTermWidth)."\n"; + wtPrintCompoHeader($compo); + wtPrintDivider(); foreach (stExecSQL("SELECT * FROM entries WHERE compo_id=".$compo["id"]) as $entry) { @@ -648,7 +666,7 @@ } } echo "\n"; - echo str_repeat("-", $setTermWidth)."\n"; + wtPrintDivider(); } break; @@ -665,16 +683,13 @@ foreach (stExecSQL("SELECT * FROM compos WHERE cpath <> '' AND cpath IS NOT NULL".$sql) as $compo) if (stFetchSQLColumn("SELECT COUNT(*) FROM entries WHERE compo_id=".$compo["id"]) > 0) { - printf( - "==%'=-".($setTermWidth-2)."s\n". - sprintf("[ #%03d - %s ]", $compo["id"], substr($compo["name"], 0, 40)) - ); - echo str_repeat("-", $setTermWidth)."\n"; + wtPrintCompoHeader($compo); + wtPrintDivider(); foreach (stExecSQL("SELECT * FROM entries WHERE compo_id=".$compo["id"]) as $entry) wtHandleEntry($compo, $entry, $mode); - echo str_repeat("-", $setTermWidth)."\n"; + wtPrintDivider(); } break; @@ -720,24 +735,27 @@ foreach (stExecSQL("SELECT * FROM compos WHERE cpath <> '' AND cpath IS NOT NULL".$sql) as $compo) if (stFetchSQLColumn("SELECT COUNT(*) FROM entries WHERE compo_id=".$compo["id"]) > 0) { + wtPrintCompoHeader($compo); printf( - "==%'=-".($setTermWidth-2)."s\n". "PrevType : %s\n", - sprintf("[ #%03d - %s ]", $compo["id"], substr($compo["name"], 0, 40)), $previewTypeList[$compo["preview_type"]][0]); - if ($mode == "sta") + if ($mode == "sta" || $mode == "lis") { printf(" %-3s | %-3s | %-40s |\n", - "#ID", "FLG", "Entry name/author"); + "#ID", "EPV", "Entry name/author"); } - echo str_repeat("-", $setTermWidth)."\n"; + wtPrintDivider("-"); foreach (stExecSQL("SELECT * FROM entries WHERE compo_id=".$compo["id"]) as $entry) wtHandleEntryPreview($compo, $entry, $mode); - echo str_repeat("=", $setTermWidth)."\n\n"; + wtPrintDivider("="); + } + if ($mode == "sta" || $mode == "lis") + { + echo "Flags: E = Entry has file, P = Has preview file, V = Generated previews are up to date.\n"; } break;