From a85ac159de69ea2923f54c5da1c7e6f843e1832a Mon Sep 17 00:00:00 2001 From: salam Date: Mon, 3 Aug 2026 09:32:32 +0200 Subject: [PATCH] wip --- app/Console/Commands/Grapper/Sofascore.php | 9 ++--- .../Commands/Grapper/Sofascore/MakeExcel.php | 21 ++++------- grapper.sh | 37 ++++++++++--------- 3 files changed, 31 insertions(+), 36 deletions(-) diff --git a/app/Console/Commands/Grapper/Sofascore.php b/app/Console/Commands/Grapper/Sofascore.php index 204679d3..8e9203d3 100644 --- a/app/Console/Commands/Grapper/Sofascore.php +++ b/app/Console/Commands/Grapper/Sofascore.php @@ -26,7 +26,7 @@ class Sofascore public static string $zipfile; - public static string $excel_name; + public static string $folder; public static string $useragent = '4'; @@ -101,8 +101,8 @@ class Sofascore switch ($task->id) { case 1: - self::$storage = $sofascore_data . $storage_name . '/' . Carbon::now()->subDays(3)->format('Y-m-d'); - self::$zipfile = $sofascore_data . $storage_name . '/' . Carbon::now()->subDays(3)->format('Y-m-d') . '.zip'; + self::$storage = $sofascore_data . $storage_name; + self::$folder = Carbon::now()->subDays(3)->format('Y-m-d'); break; case 2: self::$storage = $sofascore_data . $storage_name . '/' . $task->day_from; @@ -122,8 +122,5 @@ class Sofascore self::$zipfile = $sofascore_data . $storage_name . '/archive.zip'; break; } - - if ($debug) - Notice::note("\nStore:\t" . Sofascore::$storage . "\nZip:\t" . Sofascore::$zipfile, 'c'); } } diff --git a/app/Console/Commands/Grapper/Sofascore/MakeExcel.php b/app/Console/Commands/Grapper/Sofascore/MakeExcel.php index 6a6196d8..24ed6c74 100644 --- a/app/Console/Commands/Grapper/Sofascore/MakeExcel.php +++ b/app/Console/Commands/Grapper/Sofascore/MakeExcel.php @@ -6,13 +6,13 @@ use App\Console\Commands\Grapper\Sofascore; use App\Console\Commands\Grapper\Sofascore\Helper\ZipFolder; use App\Console\Commands\Nuh; use App\Utilities\Notice; +use Illuminate\Support\Carbon; use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\Spreadsheet; class MakeExcel { - public static $FOLDER = 'Season-25-26-Major-Leagues'; - public static $MAXCOLUMNS = 1000; + public static $max = 1000; public static function create() { @@ -21,21 +21,17 @@ class MakeExcel $debug = Nuh::$options['d'] ?? 0; if ($debug) { - Notice::note("Make Excel", 'bb'); - } - - if ($debug) { - Notice::note("Folder to Import: " . self::$FOLDER . "\nMaximum in Excel: " . self::$MAXCOLUMNS, 'b'); + Notice::note("Make Excel folder to import: " . Sofascore::$folder . "\nmaximum files in excel: " . self::$max, 'b'); } $files = self::load_files(); foreach ($files as $key => $value) { - $from = $key * self::$MAXCOLUMNS + 1; + $from = $key * self::$max + 1; $key++; - $to = $key * self::$MAXCOLUMNS; - $filename = self::$FOLDER . '-' . $from . '-' . $to . '.xlsx'; + $to = $key * self::$max; + $filename = Sofascore::$folder . '-' . $from . '-' . $to . '.xlsx'; $spreadsheet = new Spreadsheet; $spreadsheet->getProperties()->setTitle($filename); @@ -65,7 +61,7 @@ class MakeExcel public static function load_files() { - $files = ZipFolder::get_tree(Sofascore::$storage . '/' . self::$FOLDER); + $files = ZipFolder::get_tree(Sofascore::$storage . '/' . Sofascore::$folder); $filtered = []; foreach ($files as $file) { @@ -74,7 +70,6 @@ class MakeExcel $filtered[] = $file; } } - - return array_chunk($filtered, self::$MAXCOLUMNS); + return array_chunk($filtered, self::$max); } } diff --git a/grapper.sh b/grapper.sh index 44cff7b0..4ce67f7b 100755 --- a/grapper.sh +++ b/grapper.sh @@ -10,28 +10,31 @@ case "$1" in echo "\n--------------------------" echo "5 sec to stop" echo "--------------------------" - sleep 5 + # sleep 5 - echo "\n⚽ close all vpn" - killall ssh + # echo "\n⚽ close all vpn" + # killall ssh - echo "\n⚽ open vpn" - ssh -f -N -L 13306:127.0.0.1:3306 -p 58371 root@162.55.242.190 + # echo "\n⚽ open vpn" + # ssh -f -N -L 13306:127.0.0.1:3306 -p 58371 root@162.55.242.190 - echo "\n⚽ Settings To Local" - php artisan nuh --d --f 67 --fun=2 --task=0 + # echo "\n⚽ Settings To Local" + # php artisan nuh --d --f 67 --fun=2 --task=0 - echo "\n⚽ close vpn" - killall ssh + # echo "\n⚽ close vpn" + # killall ssh - echo "\n⚽ Grapper" - php artisan nuh --d --f --ff 67 --fun=3 --task=1 + # echo "\n⚽ Grapper" + # php artisan nuh --d --f --ff 67 --fun=3 --task=1 - echo "\n⚽ CreateZip" - php artisan nuh --d --f 67 --fun=4 --task=1 + # echo "\n⚽ Create Zip" + # php artisan nuh --d --f 67 --fun=4 --task=1 - echo "\n⚽ SendMail" - php artisan nuh --d --f 67 --fun=5 --task=1 + echo "\n⚽ Excel Import" + php artisan nuh --d --f 67 --fun=8 --task=1 + + # echo "\n⚽ SendMail" + # php artisan nuh --d --f 67 --fun=5 --task=1 echo "\n😎 task done :)" echo "" @@ -108,7 +111,7 @@ case "$1" in echo "" echo "\033[1;35m"; echo "--------------------------" - echo "Task: 5 ⚽ Rooster" + echo "Task: 5 ⚽ Roster" echo "--------------------------" echo "\033[0;0m"; @@ -192,7 +195,7 @@ case "$1" in echo "\033[1;34m"; echo "Task: 4 ⚽ Tornament" echo "\033[1;35m"; - echo "Task: 5 ⚽ Rooster" + echo "Task: 5 ⚽ Roster" echo "\033[1;36m"; echo "Task: 6 ⚽ Copy to DEV" echo "\033[1;36m";