public function updateScraper()
 {
     return $this->execute(function () {
         if (Input::has('anime_id')) {
             $url = ScrapeUrl::firstOrNew(array('anime_id' => Input::get('anime_id')));
             if (Input::has('suffix_animerush')) {
                 $url->suffix_animerush = Input::get('suffix_animerush');
             }
             if (Input::has('suffix_rawranime')) {
                 $url->suffix_rawranime = Input::get('suffix_rawranime');
             }
             if (Input::has('othername')) {
                 $url->othername = Input::get('othername');
             }
             $url->save();
             return View::make('mod_panel')->nest('update_msg', 'child.alerts', array('msg_type' => 'success', 'msg' => 'You succesfully added a new scraper URL(s): ' . var_dump($url)));
         }
         return View::make('mod_panel')->nest('update_msg', 'child.alerts', array('msg_type' => 'warning', 'msg' => 'Please fill in the anime id.'));
     });
 }
Exemplo n.º 2
0
 public function get($episode = 1, $anime_platform = AnimePlatform::all, $endep = -1)
 {
     $this->mirrors = array();
     $anime = Anime::find($this->anime_id);
     if (empty($anime)) {
         return null;
     }
     $urls = ScrapeUrl::find($this->anime_id);
     if (empty($urls)) {
         return $this->scrape_ar($this->getUrlSuffix($anime->name), $episode, $endep);
     } else {
         if ($anime_platform == AnimePlatform::all) {
             if (empty($urls->suffix_animerush)) {
                 $this->scrape_ar($this->getUrlSuffix($anime->name), $episode, $endep);
             } else {
                 $this->scrape_ar($urls->suffix_animerush, $episode, $endep);
             }
             if (!empty($urls->suffix_rawranime)) {
                 $this->scrape_ra($urls->suffix_rawranime, $episode, $endep);
             }
             return $this->mirrors;
         } else {
             if ($anime_platform == AnimePlatform::animerush) {
                 if (empty($urls->suffix_animerush)) {
                     return $this->scrape_ar($this->getUrlSuffix($anime->name), $episode, $endep);
                 }
                 return $this->scrape_ar($urls->suffix_animerush, $episode, $endep);
             } else {
                 if ($anime_platform == AnimePlatform::rawranime) {
                     if (!empty($urls->suffix_rawranime)) {
                         return $this->scrape_ra($urls->suffx_rawranime, $episode, $endep);
                     }
                     return null;
                 }
             }
         }
     }
     return null;
 }