Beispiel #1
0
 public function download()
 {
     $id = $this->route()->getSegment(0);
     $watcher = $this->_watchers->get($id);
     $this->result = null;
     if ($watcher != null) {
         $season_id = $this->route()->getSegment(1);
         $episode_id = $this->route()->getSegment(2);
         $watcher->load();
         $ep = null;
         foreach ($watcher->series()->seasons as $season) {
             if ($season->num == $season_id) {
                 foreach ($season->episodes as $episode) {
                     if ($episode->num == $episode_id) {
                         $ep = $episode;
                         break;
                     }
                 }
                 break;
             }
         }
         $this->episode = $ep;
         $newzbin = new Newzbin();
         $results = $newzbin->rawSearch("{$watcher->name} {$ep->identifier()} " . $watcher->toNewzbinParams(), $watcher);
         if ($results != null && is_array($results) && sizeof($results) > 0) {
             $this->result = $watcher->findSuitableReport($results);
             $sabnzbd = new SABnzbd(nzbVR::instance()->settings->sabnzbd_address, nzbVR::instance()->settings->sabnzbd_apikey);
             $sabnzbd->send(array($this->result));
             $this->episode->downloaded = true;
             $this->episode->downloaded_at = time();
             $watcher->save();
         }
     }
 }
Beispiel #2
0
 public function __construct()
 {
     $this->_address = nzbVR::instance()->settings->xbmc_address;
     $u = base64_decode(nzbVR::instance()->settings->xbmc_username);
     $p = base64_decode(nzbVR::instance()->settings->xbmc_password);
     $this->_authentication = "{$u}:{$p}";
 }
Beispiel #3
0
 public function save()
 {
     nzbVR::instance()->settings->set("base_url", $this->params()->get("base_url"));
     nzbVR::instance()->settings->set("main_skin", $this->params()->get("main_skin"));
     nzbVR::instance()->settings->set("mobile_skin", $this->params()->get("mobile_skin"));
     nzbVR::instance()->settings->set("newzbin_username", base64_encode($this->params()->get("newzbin_username")));
     nzbVR::instance()->settings->set("newzbin_password", base64_encode($this->params()->get("newzbin_password")));
     nzbVR::instance()->settings->set("sabnzbd_address", $this->params()->get("sabnzbd_address"));
     nzbVR::instance()->settings->set("sabnzbd_apikey", base64_encode($this->params()->get("sabnzbd_apikey")));
     nzbVR::instance()->settings->set("sabnzbd_username", base64_encode($this->params()->get("sabnzbd_username")));
     nzbVR::instance()->settings->set("sabnzbd_password", base64_encode($this->params()->get("sabnzbd_password")));
     nzbVR::instance()->settings->set("xbmc_address", $this->params()->get("xbmc_address"));
     nzbVR::instance()->settings->set("xbmc_username", base64_encode($this->params()->get("xbmc_username")));
     nzbVR::instance()->settings->set("xbmc_password", base64_encode($this->params()->get("xbmc_password")));
     nzbVR::instance()->settings->set("prowl_apikey", base64_encode($this->params()->get("prowl_apikey")));
     nzbVR::instance()->settings->set("growl_password", base64_encode($this->params()->get("growl_password")));
     if ($this->params()->get("growl_address") != nzbVR::instance()->settings->growl_address) {
         nzbVR::instance()->settings->set("growl_address", $this->params()->get("growl_address"));
         if (nzbVR::instance()->settings->growl_address != "") {
             $growl = new Growl();
             $growl->addNotification("Report found for watcher", true);
             $growl->register();
         }
     }
     nzbVR::instance()->settings->save();
     //$this->notification("Settings saved successfully", "success");
     $this->redirect("index");
 }
Beispiel #4
0
 public function __construct()
 {
     $this->appName = utf8_encode("nzbVR");
     $this->address = nzbVR::instance()->settings->growl_address;
     $this->notifications = array();
     $this->password = base64_decode(nzbVR::instance()->settings->growl_password);
     $this->port = 9887;
 }
Beispiel #5
0
 public function setSkinMode($mode, $setSession = true)
 {
     nzbVR::instance()->setSkinMode($mode);
     if ($setSession) {
         $_SESSION["nzbvr-skin-mode"] = $mode;
     }
     $this->view()->useTemplateFolder(ROOT_PATH . "skins/" . nzbVR::instance()->skin() . "/views");
 }
Beispiel #6
0
 public function __construct()
 {
     self::$__instance = $this;
     $this->settings = new Settings();
     $this->settings->load();
     $path = ROOT_PATH . "config.php";
     if (file_exists($path)) {
         $this->settings->loadFile($path);
     }
     $this->localStore = new LocalStore();
 }
Beispiel #7
0
 public function __construct()
 {
     if (nzbVR::instance()->settings->xbmc_address != '') {
         //$this->_notifiers[] = new XBMC();
     }
     if (nzbVR::instance()->settings->prowl_apikey != '') {
         //$this->_notifiers[] = new Prowl();
     }
     if (nzbVR::instance()->settings->growl_address != '') {
         //$this->_notifiers[] = new Growl();
     }
 }
Beispiel #8
0
 public function request($cmd)
 {
     $url = "http://{$this->_address}/api/{$cmd}";
     $username = base64_decode(nzbVR::instance()->settings->sabnzbd_username);
     $password = base64_decode(nzbVR::instance()->settings->sabnzbd_password);
     if ($username != null && $password != null) {
         $url .= "&ma_username={$username}&ma_password={$password}";
     }
     $curl = new NetworkRequest();
     $curl->set($url, array(CURLOPT_RETURNTRANSFER => 1));
     $result = $curl->execute();
     $curl->close();
 }
Beispiel #9
0
 public function check()
 {
     $this->results = array();
     $type = $this->params()->get("type");
     $id = null;
     if (sizeof($this->route()->segments()) == 1) {
         $id = $this->route()->getSegment(0);
     }
     $this->_watchers->last_benchmark = new WatcherBenchmark();
     $this->_watchers->last_benchmark->mark("start");
     foreach ($this->_watchers->watchers as $watcher) {
         if ($watcher != null && ($type == null || $type == "movies" && $watcher instanceof MovieWatcher || $type == "series" && $watcher instanceof SeriesWatcher || $type == "search" && $watcher instanceof SearchWatcher) && ($id == null || $watcher->id == $id)) {
             $this->checkWatcher($watcher);
         }
     }
     if ($this->results != null && sizeof($this->results) > 0) {
         $sabnzbd = new SABnzbd(nzbVR::instance()->settings->sabnzbd_address, nzbVR::instance()->settings->sabnzbd_apikey);
         $sabnzbd->send($this->results);
     }
     //$notifiers = new Notifiers();
     //foreach ($this->results as $result) {
     //	$notifiers->notification("Sent '{$result->name}' report to SABnzbd+", "Report found");
     //}
     $notifiers = null;
     $this->_watchers->last_benchmark->downloads = sizeof($this->results);
     $this->_watchers->last_benchmark->mark("end");
     $this->_watchers->save();
     if ($this->picnic()->router()->outputType() == "html") {
         //$this->redirect("index");
     }
 }
Beispiel #10
0
 public function fanartUrl()
 {
     return nzbVR::instance()->localStore->getImageURL("http://thetvdb.com/banners/{$this->fanart}");
 }
Beispiel #11
0
 public function __construct()
 {
     $username = base64_decode(nzbVR::instance()->settings->newzbin_username);
     $password = base64_decode(nzbVR::instance()->settings->newzbin_password);
     $this->_authentication = "{$username}:{$password}";
 }
Beispiel #12
0
 public function update()
 {
     if ($this->moviedb_id == 0) {
         $this->findMovieDB();
     }
     if ($this->moviedb_id != 0) {
         $moviedb = new MovieDB();
         $moviedb->update($this);
     }
     if ($this->poster != null) {
         $localStore = nzbVR::instance()->localStore;
         $localStore->storeImage("movies/poster", $this->poster);
         $localStore->save();
     }
 }
Beispiel #13
0
 public function __construct()
 {
     $this->_apikey = base64_decode(nzbVR::instance()->settings->prowl_apikey);
 }
Beispiel #14
0
 public static function assetLink($url)
 {
     return self::link("skins/" . nzbVR::instance()->skin() . "/assets/" . $url, true);
 }