예제 #1
0
 public function createMovieHashFromMovieFile(Movie $movie)
 {
     // block size which is required for the API call
     $READ_SIZE = 64 * 1024;
     // open file handle
     $handle = fopen($movie->getFilename(), 'r');
     // read first part
     $data = fread($handle, $READ_SIZE);
     // move the file pointer ahead, because we only need the first and the last
     // 64KB of the video file
     fseek($handle, -$READ_SIZE, SEEK_END);
     // read the last part and concat
     $data .= fread($handle, $READ_SIZE);
     // close the handle
     fclose($handle);
     return md5($data);
 }
예제 #2
0
 public function testMovieWithoutSubtitleWillBeDetected()
 {
     $fakeMovieWithoutSubtitle = vfsStream::url('testDir') . DIRECTORY_SEPARATOR . 'movies' . DIRECTORY_SEPARATOR . 'Die Hard.mkv';
     $movie = new Movie($fakeMovieWithoutSubtitle);
     $this->assertTrue($movie->hasNoSubtitle());
 }