wip pp filter
This commit is contained in:
1 parent
fc1e1b2832
commit
55f31acf2a
23 files changed
+1127
-329
No files matched your search
@@ -141,7 +141,7 @@ trait GrappingSofascore
|
||||
|
||||
$daily_way = $this->select_daily_days();
|
||||
|
||||
if ($this->ask_settings_download()) {
|
||||
if ($this->ask_settings_download() == 'yes') {
|
||||
$this->settings_to_local();
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ trait GrappingSofascore
|
||||
/**
|
||||
* day 1
|
||||
*/
|
||||
if (in_array($daily_way, [1, 3])) {
|
||||
if (in_array($daily_way, [1, 2])) {
|
||||
$day = Carbon::now()->subDay()->format('Y-m-d');
|
||||
|
||||
$this->grapped_files = $this->get_tree($this->data_dir.'/'.$day);
|
||||
@@ -178,7 +178,7 @@ trait GrappingSofascore
|
||||
/**
|
||||
* day 5
|
||||
*/
|
||||
if (in_array($daily_way, [2, 3])) {
|
||||
if (in_array($daily_way, [1, 3])) {
|
||||
$day = Carbon::now()->subDays(5)->format('Y-m-d');
|
||||
|
||||
$this->grapped_files = $this->get_tree($this->data_dir.'/'.$day);
|
||||
@@ -345,13 +345,17 @@ trait GrappingSofascore
|
||||
|
||||
protected function select_daily_days(): string
|
||||
{
|
||||
$yesterday = Carbon::yesterday()->format('Y-m-d');
|
||||
$moredays = Carbon::now()->subDays(5)->format('Y-m-d');
|
||||
|
||||
return select(
|
||||
label: 'What days should be grapped?',
|
||||
scroll: 10,
|
||||
default: 1,
|
||||
options: [
|
||||
1 => 'Day 1',
|
||||
2 => 'Day 2',
|
||||
3 => 'Day 1 & 2',
|
||||
1 => "$yesterday & $moredays",
|
||||
2 => $yesterday,
|
||||
3 => $moredays,
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -407,10 +411,10 @@ trait GrappingSofascore
|
||||
{
|
||||
return select(
|
||||
label: 'Download setting?',
|
||||
default: 0,
|
||||
default: 'no',
|
||||
options: [
|
||||
0 => 'No',
|
||||
1 => 'Yes',
|
||||
'no' => 'No',
|
||||
'yes' => 'Yes',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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: '',
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user