Skip to content

Commit

Permalink
organize code
Browse files Browse the repository at this point in the history
  • Loading branch information
racacax committed Aug 24, 2024
1 parent a88983f commit 0c52b00
Show file tree
Hide file tree
Showing 9 changed files with 153 additions and 138 deletions.
7 changes: 5 additions & 2 deletions example/script_all.php → commands/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@
);
$generator = $configurator->getGenerator();
date_default_timezone_set('Europe/Paris');
if(!isset($argv[1]) || $argv[1] !== "skip-generate") {
$params = array_slice($argv, 2);
if(!in_array("--skip-generation", $params)) {
$generator->generateEpg();
}
$generator->exportEpg($configurator->getOutputPath());
$generator->clearCache($configurator->getCacheMaxDays());
if(!in_array('--keep-cache', $params)) {
$generator->clearCache($configurator->getCacheMaxDays());
}

//Logger::clearLog();
11 changes: 11 additions & 0 deletions commands/help.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
$commands = [
"help" => "Aide à propos du programme",
"export" => "Générer le XMLTV.\n\tParamètres :
\t --skip-generation : Réaliser l'export sans génération (utilise uniquement le cache)
\t --keep-cache: Garde le cache même si expiré"
];
echo "\033[1mListe des commandes\n\n";
foreach ($commands as $command => $desc) {
echo "\033[1m".$command." : \033[0m".$desc."\n\n";
}
2 changes: 1 addition & 1 deletion integrity.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1602e83d7e1822c4d4db5788dbc7d2a7a44b8a9484a19196b3482c0e7f9c66c1
0337cf7623d8eb89fce78ebf051afc8c8c4eeed2db49aa013f9a215d74a28427
7 changes: 7 additions & 0 deletions manager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
$commands = ["export", "help"];
if(in_array($argv[1], $commands)) {
include "commands/".$argv[1].".php";
} else {
echo "La commande $argv[1] n'existe pas";
}
Loading

0 comments on commit 0c52b00

Please sign in to comment.