Ejemplo n.º 1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $filename = "all.arff";
     $handle = fopen($filename, 'w+');
     $text = "@relation 'price'\n@attribute y {-1,1}\n@attribute x0 numeric\n@attribute x1 numeric\n@attribute x3 numeric\n@attribute x4 numeric\n@attribute x5 numeric\n@attribute x6 numeric\n@attribute x7 numeric\n@attribute x8 numeric\n@attribute x9 numeric\n@attribute x10 numeric\n@attribute x11 numeric\n@data\n\n";
     $array = array(array());
     foreach (\MkmScraper\Card::where("rarity", "Mythic")->get() as $card) {
         foreach ($card->graphPrices as $key => $price) {
             $row = array();
             $row[] = $price->priceClass();
             $row[] = $price->card->set->daysFromReleaseDate($price->date);
             $row[] = $price->card->set->daysFromRotationDate($price->date);
             $row[] = $price->tournamentDiffWeek();
             $row[] = $price->tournamentDiffTwoWeek();
             $row[] = $price->articlesDiffLastWeek();
             $row[] = $price->articlesDiffLastTwoWeek();
             $row[] = $price->otherCardMovementDay();
             $row[] = $price->otherCardMovementWeek();
             $row[] = $price->boostersOpen();
             $array[] = $row;
         }
     }
     foreach ($array as $row) {
         foreach ($row as $item) {
             $text .= $item . ",";
         }
         $text .= "\n";
     }
     file_put_contents($filename, $text);
 }
Ejemplo n.º 2
0
 public function processAll()
 {
     $client = new \Goutte\Client();
     foreach (\MkmScraper\Event::all() as $event) {
         $crawler = $client->request('GET', $event->link);
         $i = 1;
         $link = $crawler->filter("td>div>div a")->each(function ($node) use($client, $event, &$i) {
             if (strpos($node->attr('href'), "event") !== false) {
                 $dlcrawler = $client->request('GET', $node->attr('href'));
                 $link = $dlcrawler->filter("table table td .chosen_tr,table table td .hover_tr")->each(function ($node) use($event, $i) {
                     $split = explode(" ", $node->text(), 2);
                     $card = \MkmScraper\Card::where("name", "LIKE", $split[1] . "%")->first();
                     if ($card) {
                         \MkmScraper\DecklistAppearance::create(array("id_card" => $card->id, "number" => $split[0], "place" => $i, "id_event" => $event->id));
                         //print $card->id." - ".$node->text()."<br/>";
                     }
                 });
                 $i = $i + 1;
             }
         });
     }
 }
Ejemplo n.º 3
0
 public function exportAllNew()
 {
     $filename = "export.arff";
     $handle = fopen($filename, 'w+');
     $text = "@relation 'price'\n@attribute y {-1,1}\n@attribute x0 numeric\n@data\n\n";
     $array = array(array());
     foreach (\MkmScraper\Card::where("rarity", "Mythic")->get() as $card) {
         $date = "2015-09-03";
         while ($date < "2015-12-10") {
             $row = array();
             //$objects['sell'][]=array($dateexp[0], $dateexp[1],$dateexp[2],\MkmScraper\GraphPrice::getPriceWeek($date,$this));
             //$objects['art'][]=array($dateexp[0], $dateexp[1],$dateexp[2],\MkmScraper\Article::getArticlesWeek($date,$this));
             $articles = \MkmScraper\Article::getDiffWeek(date("Y-m-d", strtotime($date) + 21 * 24 * 60 * 60), $card);
             if ($articles > 0) {
                 $row[] = \MkmScraper\DecklistAppearance::tournamentDiffLastWeek($date, $card);
                 $row[] = \MkmScraper\GraphPrice::getPriceDiffWeekBoolean($date, $card);
                 $row[] = $articles;
                 $array[] = $row;
             }
             //$objects['art'][]=array($dateexp[0], $dateexp[1],$dateexp[2],\MkmScraper\Article::getDiffWeek($date,$this));
             $date = date("Y-m-d", strtotime($date) + 7 * 24 * 60 * 60);
         }
     }
     foreach ($array as $row) {
         foreach ($row as $item) {
             $text .= $item . ",";
         }
         $text .= "\n";
     }
     file_put_contents($filename, $text);
     return \Response::download($filename, 'export.arff', array('Content-Type' => 'text/aarf'));
 }
Ejemplo n.º 4
0
 public function showSet($id)
 {
     $data['set'] = \MkmScraper\Set::find($id);
     $data['cards'] = \MkmScraper\Card::where("id_set", $id)->where("rarity", "Mythic")->get();
     return view("set", $data);
 }