summaryrefslogtreecommitdiff
path: root/app/Console/Kernel.php
blob: 5a533fcab8523b438f1bd90cc9c41a7b6572bb7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

use App\Libraries\AnimeSeason;
use App\Libraries\Helper;
use App\Libraries\Background;

use App\Anime;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        //
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        // $schedule->command('inspire')
        //          ->hourly();

	$schedule->call( function(){
		$background = new Background();
		$background->saveAnimeStats();
	})->everyThirtyMinutes()->name('saveStats')->withoutOverlapping();
	#})->everyThirtyMinutes()->name('saveStats5')->withoutOverlapping();
	#})->everyMinute()->name('saveStats3')->withoutOverlapping();
	#})->everyMinute()->name('saveStats5')->withoutOverlapping();

	$schedule->call( function(){
		$background = new Background();
		echo "SaveSeason(): \n";
		$background->saveSeason();
		sleep(10);
		echo "\ncheckIfIsAiring(): \n";
		$background->checkIfIsAiring();
		sleep(10);
		echo "\nsaveAiringForAll(): \n";
		$background->saveAiringForAll();
	})->dailyAt('18:30');
	#})->everyMinute();

	$schedule->call( function(){
		$helper = new Helper();
		#$helper->createUser( 'll-' );
		echo "setIsWatchingForAll(): \n";
		$helper->setIsWatchingForAll();
		echo "\nsetCalendarForAll(): \n";
		$helper->setCalendarForAll();
	})->twiceDaily(7, 19);
	#})->everyMinute();

	$schedule->call( function(){
		$background = new Background();
		echo "saveTopAnime()\n";
		$background->saveTopAnime();
		echo "saveTopAnimeByPopularity()\n";
		$background->saveTopAnimeByPopularity();
		echo"saveEnhancementForAll()\n";
		$background->saveEnhancementForAll();
		echo "addSeasonToAllAnime()\n";
		$background->addSeasonToAllAnime();
	})->weeklyOn(1, '15:30')->name('saveTopAnime')->withoutOverlapping();

	$schedule->call( function(){
		$background = new Background();
		echo "checkImage()\n";
		$background->checkImage();
	})->weeklyOn(3, '18:00')->name('checkForBrokenThings')->withoutOverlapping();
	#})->everyMinute();

	/*
	$schedule->call( function(){
		$background = new Background();
		#$background->checkIfIsAiring();
		#$background->saveSeason();
		#$background->saveEnhancementForAll();
		#$background->addSeasonToAllAnime();
		#$anime = Anime::where('mal_id', 40591)->get()->first();
		#$background->saveAiring( $anime );
	})->everyMinute()->name("enhance6")->withoutOverlapping();
	#})->twiceDaily(9, 23);
	*/

	/*
	$schedule->call( function(){
		$background = new Background();
		#$background->checkIfIsAiring();
		#$background->checkImage();
		#$background->saveTopAnimeByPopularity();
		#$anime = Anime::where('mal_id', 40591)->get()->first();
		#$background->saveAiring( $anime );
		#echo"saveEnhancementForAll()\n";
		#$background->saveEnhancementForAll();
	})->everyMinute()->name('c4')->withoutOverlapping();
	#})->dailyAt('3:00')->name('saveTopAnimeByPopularity')->withoutOverlapping();
	#})->everyMinute()->name('saveTopAnimeByPopularity2')->withoutOverlapping();
	*/
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}