Beispiel #1
0
 private function _calculateTotalResultCount()
 {
     $total = $this->_arrayReader->getAsInteger($this->_feedAsArray, 'total', -1);
     /*
      * Whew!
      */
     if ($total !== -1) {
         if ($this->_shouldLog) {
             $this->_logDebug(sprintf('Total result count was reported by Dailymotion to be <code>%s</code>', $total));
         }
         return $total;
     }
     /*
      * Dailymotion doesn't return the total result count, which sucks because that means we'll need to
      * "manually" calculate it in order to show pagination.
      *
      * The maximum page that can be fetched is 100, and the max results per page is 100. This means that there
      * can be no more than 10K (100 * 100) total videos in any single source from Dailymotion. This is good because
      * it actually gives us a change to calculate the total result count with about 6 network requests with a binary
      * search.
      */
     if ($this->_shouldLog) {
         $this->_logDebug('Total result count was not reported by Dailymotion. We will perform a binary search');
     }
     return $this->_findMaxResults(1, 100);
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 public function getTotalResultCount()
 {
     $query = sprintf('%s.%s', tubepress_youtube3_impl_ApiUtility::RESPONSE_PAGEINFO, tubepress_youtube3_impl_ApiUtility::RESPONSE_PAGEINFO_TOTALRESULTS);
     $totalResults = $this->_arrayReader->getAsInteger($this->_feedAsArray, $query, 0);
     $totalResults = intval($totalResults);
     return $totalResults - $this->_skippedVideoCount;
 }