This commit is contained in:
salam committed 2026-07-18 17:23:55 +02:00
1 parent 9e6f7e1c06
commit 88205b7aa1
8 files changed
+16 -51

No files matched your search

+2 -10
View File
@@ -2,10 +2,8 @@
namespace App\Console\Commands\Grapper;
use App\Console\Commands\Grapper\Sofascore\DaysTournament;
use App\Console\Commands\Grapper\Sofascore\Grapper;
use App\Console\Commands\Grapper\Sofascore\Helper\Strings;
use App\Console\Commands\Grapper\Sofascore\Helper\TaskConfig;
use App\Console\Commands\Grapper\Sofascore\PlayerPerSeason;
use App\Console\Commands\Grapper\Sofascore\SendMail;
use App\Console\Commands\Grapper\Sofascore\SettingsToLocal;
@@ -35,20 +33,16 @@ class Sofascore
break;
case 3:
DaysTournament::run();
break;
case 4:
self::setStorage();
Grapper::load();
break;
case 5:
case 4:
self::setStorage();
ZipFolder::create(self::$storage);
break;
case 6:
case 5:
self::setStorage();
SendMail::run();
break;
@@ -63,7 +57,5 @@ class Sofascore
$task = Nuh::$options['task'];
self::$storage = storage_path('sofascore_data') . '/' . Strings::clean(SofaScoreTask::where('id', $task)->value('name'));
dd(self::$storage);
}
}
@@ -24,25 +24,23 @@ class DaysTournament
* Spa La Liga 15-08-2025 - 24-05-2026
* Fra Liggue 15-08-2025 - 17-05-2026
*/
public static function run()
public static function get(array $d)
{
$debug = Nuh::$options['d'] ?? 0;
$days = LoadDays::load();
$tournaments_counter = 0;
foreach ($days as $d) {
$sport_id = $d['sport_id'];
$day = $d['day'];
$slug = $d['slug'];
$has = SofaScoreDayTournament::where('day', $day)->where('sport_id', $sport_id)->first();
if ($has) {
if ($debug) {
Notice::note("All tournament for $day have been allready grapped", 'g');
Notice::note("Tournaments $day for " . strtoupper($slug) . " allready grapped", 'bb');
}
} else {
@@ -173,7 +171,6 @@ class DaysTournament
}
}
}
}
if ($debug) {
Notice::note('days tournament done', 'g');
}
@@ -16,19 +16,10 @@ use Illuminate\Support\Facades\File;
class Grapper
{
/**
* last 3 days = task 1
*
* nuh --d --f 67 --fun=6 --task=1
*/
public static function load()
{
$debug = Nuh::$options['d'] ?? 0;
$force = Nuh::$options['f'] ?? 0;
$task_id = Nuh::$options['task'] ?? 0;
$days = LoadDays::load();
@@ -47,7 +38,11 @@ class Grapper
if ($debug)
Notice::note('Truncate SofaScoreEventGrapped', 'b');
SofaScoreEventGrapped::query()->truncate();
SofaScoreEventGrapped::where('grapper_id', $task_id)->delete();
foreach ($days as $d) {
DaysTournament::get($d);
foreach ($active_tournaments as $tournament) {
@@ -55,7 +50,6 @@ class Grapper
Notice::note($tournament->tournament->name, 'bg');
}
foreach ($days as $d) {
$day = $d['day'];
@@ -95,12 +89,12 @@ class Grapper
}
$grapped = SofaScoreEventGrapped::firstOrNew(['id' => $event['id']]);
$grapped->grapper_id = $task_id;
$grapped->day = $day;
$grapped->liga = $event['tournament']['name'];
$grapped->name = $event['homeTeam']['name'] . ' vs ' . $event['awayTeam']['name'];
$grapped->url = $url;
$grapped->starttime = $starttime->toDateTimeString();
$grapped->in_current_grapper = true;
$folder = Sofascore::$storage . '/' . $day . '/' . $event['tournament']['slug'] . '/' . $event['slug'];
@@ -37,18 +37,6 @@ class LoadDays
'sport_id' => $task->sport_id,
'run_repeatedly' => $task->run_repeatedly,
];
// $dates[] = [
// 'day' => Carbon::now()->subDays(2)->format('Y-m-d'),
// 'slug' => $task->sport->ss_slug,
// 'sport_id' => $task->sport_id,
// 'run_repeatedly' => $task->run_repeatedly,
// ];
// $dates[] = [
// 'day' => Carbon::now()->subDays(3)->format('Y-m-d'),
// 'slug' => $task->sport->ss_slug,
// 'sport_id' => $task->sport_id,
// 'run_repeatedly' => $task->run_repeatedly,
// ];
break;
case 2:
@@ -2,11 +2,9 @@
namespace App\Filament\Clusters\StaticData\Resources\SofaScoreTasks\Tables;
use App\Models\SofaScoreTask;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\ToggleColumn;
use Filament\Tables\Table;
class SofaScoreTasksTable
-1
View File
@@ -2,7 +2,6 @@
namespace App\Utilities;
use App\Console\Commands\Grapper\Sofascore;
use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;
use ZipArchive;
@@ -13,12 +13,12 @@ return new class extends Migration
{
Schema::create('sofa_score_event_grappeds', function (Blueprint $table) {
$table->id();
$table->integer('grapper_id');
$table->date('day')->nullable();
$table->string('liga')->nullable();
$table->string('name')->nullable();
$table->dateTime('starttime')->nullable();
$table->string('url')->nullable();
$table->boolean('in_current_grapper')->default(false);
$table->boolean('got_statistics')->default(false);
$table->boolean('got_lineups')->default(false);
$table->boolean('got_odds')->default(false);
+3 -6
View File
@@ -29,17 +29,14 @@ case "$1" in
# echo "\n⚽ close vpn"
# killall ssh
# echo "\n⚽ Days Tournament"
# php artisan nuh --d --f 67 --fun=3 --task=$1
# echo "\n⚽ Grapper"
# php artisan nuh --d --f 67 --fun=4 --task=$1
php artisan nuh --d --f 67 --fun=3 --task=$1
# echo "\n⚽ CreateZip"
# php artisan nuh --d --f 67 --fun=5 --task=$1
# php artisan nuh --d --f 67 --fun=4 --task=$1
# echo "\n⚽ SendMail"
# php artisan nuh --d --f 67 --fun=6 --task=$1
# php artisan nuh --d --f 67 --fun=5 --task=$1
echo "\n😎 done :)"
;;