Example #1
0
 /**
  * Fetch xxx info for the movie.
  *
  * @param $xxxmovie
  *
  * @return bool
  */
 public function updateXXXInfo($xxxmovie)
 {
     $res = false;
     $this->whichclass = '';
     $iafd = new IAFD();
     $iafd->searchTerm = $xxxmovie;
     if ($iafd->findme() !== false) {
         switch ($iafd->classUsed) {
             case "ade":
                 $mov = new ADE();
                 $mov->directLink = (string) $iafd->directUrl;
                 $res = $mov->getDirect();
                 $res['title'] = $iafd->title;
                 $res['directurl'] = (string) $iafd->directUrl;
                 $this->whichclass = $iafd->classUsed;
                 $this->pdo->log->doEcho($this->pdo->log->primary("Fetching XXX info from IAFD -> Adult DVD Empire"));
                 break;
         }
     }
     if ($res === false) {
         $this->whichclass = "aebn";
         $mov = new AEBN();
         $mov->cookie = $this->cookie;
         $mov->searchTerm = $xxxmovie;
         $res = $mov->search();
         if ($res === false) {
             $this->whichclass = "ade";
             $mov = new ADE();
             $mov->searchTerm = $xxxmovie;
             $res = $mov->search();
         }
         if ($res === false) {
             $this->whichclass = "pop";
             $mov = new Popporn();
             $mov->cookie = $this->cookie;
             $mov->searchTerm = $xxxmovie;
             $res = $mov->search();
         }
         // Last in list as it doesn't have trailers
         if ($res === false) {
             $this->whichclass = "adm";
             $mov = new ADM();
             $mov->cookie = $this->cookie;
             $mov->searchTerm = $xxxmovie;
             $res = $mov->search();
         }
         // If a result is true getAll information.
         if ($res !== false) {
             if ($this->echooutput) {
                 switch ($this->whichclass) {
                     case "aebn":
                         $fromstr = "Adult Entertainment Broadcast Network";
                         break;
                     case "ade":
                         $fromstr = "Adult DVD Empire";
                         break;
                     case "pop":
                         $fromstr = "PopPorn";
                         break;
                     case "adm":
                         $fromstr = "Adult DVD Marketplace";
                         break;
                     default:
                         $fromstr = null;
                 }
                 $this->pdo->log->doEcho($this->pdo->log->primary("Fetching XXX info from: " . $fromstr));
             }
             $res = $mov->getAll();
         } else {
             // Nothing was found, go ahead and set to -2
             return -2;
         }
     }
     $mov = [];
     $mov['trailers'] = isset($res['trailers']) ? serialize($res['trailers']) : '';
     $mov['extras'] = isset($res['extras']) ? serialize($res['extras']) : '';
     $mov['productinfo'] = isset($res['productinfo']) ? serialize($res['productinfo']) : '';
     $mov['backdrop'] = isset($res['backcover']) ? $res['backcover'] : 0;
     $mov['cover'] = isset($res['boxcover']) ? $res['boxcover'] : 0;
     $res['cast'] = isset($res['cast']) ? join(",", $res['cast']) : '';
     $res['genres'] = isset($res['genres']) ? $this->getgenreid($res['genres']) : '';
     $mov['title'] = html_entity_decode($res['title'], ENT_QUOTES, 'UTF-8');
     $mov['plot'] = isset($res['sypnosis']) ? html_entity_decode($res['sypnosis'], ENT_QUOTES, 'UTF-8') : '';
     $mov['tagline'] = isset($res['tagline']) ? html_entity_decode($res['tagline'], ENT_QUOTES, 'UTF-8') : '';
     $mov['genre'] = html_entity_decode($res['genres'], ENT_QUOTES, 'UTF-8');
     $mov['director'] = isset($res['director']) ? html_entity_decode($res['director'], ENT_QUOTES, 'UTF-8') : '';
     $mov['actors'] = html_entity_decode($res['cast'], ENT_QUOTES, 'UTF-8');
     $mov['directurl'] = html_entity_decode($res['directurl'], ENT_QUOTES, 'UTF-8');
     $mov['classused'] = $this->whichclass;
     $check = $this->pdo->queryOneRow(sprintf('SELECT id FROM xxxinfo WHERE title = %s', $this->pdo->escapeString($mov['title'])));
     $xxxID = 0;
     if (isset($check['id'])) {
         $xxxID = $check['id'];
     }
     if ($check === false || $xxxID > 0) {
         // Update Current XXX Information - getXXXCovers.php
         if ($xxxID > 0) {
             $this->update($check['id'], $mov['title'], $mov['tagline'], $mov['plot'], $mov['genre'], $mov['director'], $mov['actors'], $mov['extras'], $mov['productinfo'], $mov['trailers'], $mov['directurl'], $mov['classused']);
             $xxxID = $check['id'];
         }
         // Insert New XXX Information
         if ($check === false) {
             $xxxID = $this->pdo->queryInsert(sprintf("\n\t\t\t\t\tINSERT INTO xxxinfo\n\t\t\t\t\t\t(title, tagline, plot, genre, director, actors, extras, productinfo, trailers, directurl, classused, cover, backdrop, createddate, updateddate)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t(%s, %s, COMPRESS(%s), %s, %s, %s, %s, %s, %s, %s, %s, 0, 0, NOW(), NOW())", $this->pdo->escapeString($mov['title']), $this->pdo->escapeString($mov['tagline']), $this->pdo->escapeString($mov['plot']), $this->pdo->escapeString(substr($mov['genre'], 0, 64)), $this->pdo->escapeString($mov['director']), $this->pdo->escapeString($mov['actors']), $this->pdo->escapeString($mov['extras']), $this->pdo->escapeString($mov['productinfo']), $this->pdo->escapeString($mov['trailers']), $this->pdo->escapeString($mov['directurl']), $this->pdo->escapeString($mov['classused'])));
         }
         if ($xxxID > 0) {
             // BoxCover.
             if (isset($mov['cover'])) {
                 $mov['cover'] = $this->releaseImage->saveImage($xxxID . '-cover', $mov['cover'], $this->imgSavePath);
             }
             // BackCover.
             if (isset($mov['backdrop'])) {
                 $mov['backdrop'] = $this->releaseImage->saveImage($xxxID . '-backdrop', $mov['backdrop'], $this->imgSavePath, 1920, 1024);
             }
             $this->pdo->queryExec(sprintf('UPDATE xxxinfo SET cover = %d, backdrop = %d  WHERE id = %d', $mov['cover'], $mov['backdrop'], $xxxID));
         } else {
             $xxxID = -2;
         }
     }
     if ($this->echooutput) {
         $this->pdo->log->doEcho($this->pdo->log->headerOver($xxxID !== false ? 'Added/updated XXX movie: ' : 'Nothing to update for XXX movie: ') . $this->pdo->log->primary($mov['title']));
     }
     return $xxxID;
 }
Example #2
0
 /**
  * Test method for the <code>#toJSON()</code> function.
  */
 public function testToJSON()
 {
     $array = ADM::create()->setBanner('http://example.com/banner.png')->setCustomIcon('http://example.com/image.png')->setHeader('Header')->setIcon('icon')->setRootParams(array('key' => 'value'))->setSound('push.mp3')->setTtl(3600)->toJSON();
     $this->assertCount(7, $array);
     $this->assertEquals('http://example.com/banner.png', $array['adm_banner']);
     $this->assertEquals('http://example.com/image.png', $array['adm_custom_icon']);
     $this->assertEquals('Header', $array['adm_header']);
     $this->assertEquals('icon', $array['adm_icon']);
     $this->assertEquals(array('key' => 'value'), $array['adm_root_params']);
     $this->assertEquals('push.mp3', $array['adm_sound']);
     $this->assertEquals(3600, $array['adm_ttl']);
 }