original_string: private function generateThumbs($episode, $cache_asset)
      {
          $uri = $this->asset_helper->getAbsoluteUrl($episode->getVideo());
          $path = $this->asset_helper->getPath($cache_asset, true);
          $cmd = sprintf(
              "ffmpeg -i %s -s %sx%s -vf fps=1/%s %s 2>&1",
              $uri,
              $this->sprite_width,
              $this->sprite_height,
              $this->sprite_interval,
              $path
          );
          // open (ffmpeg) process, read stdout to get duration if unknown to this point.
          $fp = popen($cmd, "r");
          while(!feof($fp)) {
              // read outputstream of ffmpeg
              $chunk = fread($fp, 1024);
  
              // try to get the duration information at the beginning of the ffmpeg output.
              if (!$episode->getDuration()) {
                  preg_match("/Duration: (.*?), start:/", $chunk, $matches);
                  if (array_key_exists(1, $matches)) {
                      list($hours,$minutes,$seconds) = explode(":",$matches[1]);
                      // calculate the duration in seconds. Used to calculate overall progress in percent.
                      $episode->setDuration((($hours * 3600) + ($minutes * 60) + $seconds));
                  }
              }
              // flush the content to the browser
              flush();
          }
          fclose($fp);
      }
code: private function generateThumbs($episode, $cache_asset)
      {
          $uri = $this->asset_helper->getAbsoluteUrl($episode->getVideo());
          $path = $this->asset_helper->getPath($cache_asset, true);
          $cmd = sprintf(
              "ffmpeg -i %s -s %sx%s -vf fps=1/%s %s 2>&1",
              $uri,
              $this->sprite_width,
              $this->sprite_height,
              $this->sprite_interval,
              $path
          );
          // open (ffmpeg) process, read stdout to get duration if unknown to this point.
          $fp = popen($cmd, "r");
          while(!feof($fp)) {
              // read outputstream of ffmpeg
              $chunk = fread($fp, 1024);
  
              // try to get the duration information at the beginning of the ffmpeg output.
              if (!$episode->getDuration()) {
                  preg_match("/Duration: (.*?), start:/", $chunk, $matches);
                  if (array_key_exists(1, $matches)) {
                      list($hours,$minutes,$seconds) = explode(":",$matches[1]);
                      // calculate the duration in seconds. Used to calculate overall progress in percent.
                      $episode->setDuration((($hours * 3600) + ($minutes * 60) + $seconds));
                  }
              }
              // flush the content to the browser
              flush();
          }
          fclose($fp);
      }
code_tokens: private function generateThumbs ( $ episode , $ cache_asset ) { $ uri = $ this -> asset_helper -> getAbsoluteUrl ( $ episode -> getVideo ( ) ) ; $ path = $ this -> asset_helper -> getPath ( $ cache_asset , true ) ; $ cmd = sprintf ( "ffmpeg -i %s -s %sx%s -vf fps=1/%s %s 2>&1" , $ uri , $ this -> sprite_width , $ this -> sprite_height , $ this -> sprite_interval , $ path ) ; // open (ffmpeg) process, read stdout to get duration if unknown to this point. $ fp = popen ( $ cmd , "r" ) ; while ( ! feof ( $ fp ) ) { // read outputstream of ffmpeg $ chunk = fread ( $ fp , 1024 ) ; // try to get the duration information at the beginning of the ffmpeg output. if ( ! $ episode -> getDuration ( ) ) { preg_match ( "/Duration: (.*?), start:/" , $ chunk , $ matches ) ; if ( array_key_exists ( 1 , $ matches ) ) { list ( $ hours , $ minutes , $ seconds ) = explode ( ":" , $ matches [ 1 ] ) ; // calculate the duration in seconds. Used to calculate overall progress in percent. $ episode -> setDuration ( ( ( $ hours * 3600 ) + ( $ minutes * 60 ) + $ seconds ) ) ; } } // flush the content to the browser flush ( ) ; } fclose ( $ fp ) ; }
docstring: takes episode and creates thumbnails in given width and height
docstring_tokens: takes episode and creates thumbnails in given width and height