wip pp filter

This commit is contained in:
salam committed 2026-10-15 16:29:48 +02:00
1 parent fc1e1b2832
commit 55f31acf2a
23 files changed
+1127 -329

No files matched your search

+19 -4
View File
@@ -10,6 +10,7 @@ use App\Utilities\Notice;
use Illuminate\Support\Facades\File;
use function Laravel\Prompts\select;
use function Laravel\Prompts\text;
trait GrappingTeams
{
@@ -26,6 +27,8 @@ trait GrappingTeams
// ENG1, ESP1, ITA1, ITA2, FRA1 e GER1
$major = [8, 17, 23, 34, 35, 53];
$this->speed = $this->ask_speed();
$what = $this->select_what_to_grap();
if ($this->restart) {
@@ -37,10 +40,13 @@ trait GrappingTeams
case 'major':
$tournaments = SofaScoreTournament::where('enabled', 1)->whereIn('tournament_id', $major)->pluck('tournament_id')->toArray();
break;
default:
case 'others':
$tournaments = SofaScoreTournament::where('enabled', 1)->whereNotIn('tournament_id', $major)->pluck('tournament_id')->toArray();
break;
default:
$tmp = self::load_tornament_ids();
$tournaments = explode(',', $tmp);
break;
}
$tmp = SofaScoreRosaTournament::whereIn('ss_tournament_id', $tournaments)->pluck('ss_team_id')->toArray();
@@ -58,7 +64,7 @@ trait GrappingTeams
echo "\n$key/$count\n";
}
$url = $this->base_url . "api/v1/team/$value->ss_team_id/players";
$url = $this->base_url."api/v1/team/$value->ss_team_id/players";
if ($this->debug) {
Notice::note($url, 'b');
@@ -74,7 +80,7 @@ trait GrappingTeams
* add team to folder
*********************************/
File::put($this->data_dir . '/' . $this->clean_string($value->ss_team_name) . '.json', json_encode($data));
File::put($this->data_dir.'/'.$this->clean_string($value->ss_team_name).'.json', json_encode($data));
SofaScoreRosa::where('id', $value->id)->update(['grapped' => 1]);
@@ -95,7 +101,16 @@ trait GrappingTeams
options: [
'major' => 'Major Leagues',
'others' => 'Others Leagues',
'manual' => 'Enter team_ids (sofa_score_rosas)',
]
);
}
protected function load_tornament_ids(): string
{
return text(
label: 'Enter CSV Team Id (from table sofa_score_rosas)',
default: '',
);
}
}