@@ -322,6 +322,7 @@ public function getVideoThumbnailUrl($filePath, $thumbnailOptions, $generate = t
322322 */
323323 public function getAudioUrl ($ filePath , $ audioOptions ): string
324324 {
325+ Craft::info ('testing123 ' , __METHOD__ );
325326 $ result = '' ;
326327 $ settings = Transcoder::$ plugin ->getSettings ();
327328 $ subfolder = '' ;
@@ -389,33 +390,37 @@ public function getAudioUrl($filePath, $audioOptions): string
389390 $ destAudioPath .= $ destAudioFile ;
390391 $ ffmpegCmd .= ' -f '
391392 .$ thisEncoder ['fileFormat ' ]
392- .' -y ' .escapeshellarg ($ destAudioPath )
393- .' 1> ' .$ progressFile .' 2>&1 & echo $! ' ;
394-
393+ .' -y ' .escapeshellarg ($ destAudioPath );
394+ // .' 1> '.$progressFile.' 2>&1 & echo $!';
395+ Craft:: info ( ' laget command ' , __METHOD__ );
395396 // Make sure there isn't a lockfile for this audio file already
396- $ lockFile = sys_get_temp_dir ().DIRECTORY_SEPARATOR .$ destAudioFile .'.lock ' ;
397- $ oldPid = @file_get_contents ($ lockFile );
398- if ($ oldPid !== false ) {
399- exec ("ps $ oldPid " , $ ProcessState );
400- if (\count ($ ProcessState ) >= 2 ) {
401- return $ result ;
402- }
403- // It's finished transcoding, so delete the lockfile and progress file
404- @unlink ($ lockFile );
405- @unlink ($ progressFile );
406- }
397+ // $lockFile = sys_get_temp_dir().DIRECTORY_SEPARATOR.$destAudioFile.'.lock';
398+ // $oldPid = @file_get_contents($lockFile);
399+ // if ($oldPid !== false) {
400+ // exec("ps $oldPid", $ProcessState);
401+ // if (\count($ProcessState) >= 2) {
402+ // return $result;
403+ // }
404+ // // It's finished transcoding, so delete the lockfile and progress file
405+ // @unlink($lockFile);
406+ // @unlink($progressFile);
407+ // }
408+ Craft::info ('lockfile ' , __METHOD__ );
407409
408410 // If the audio file already exists and hasn't been modified, return it. Otherwise, start it transcoding
409411 if (file_exists ($ destAudioPath ) && (@filemtime ($ destAudioPath ) >= @filemtime ($ filePath ))) {
410412 $ url = $ settings ['transcoderUrls ' ]['audio ' ] . $ subfolder ?? $ settings ['transcoderUrls ' ]['default ' ];
411413 $ result = Craft::getAlias ($ url ).$ destAudioFile ;
412414 } else {
413415 // Kick off the transcoding
414- $ pid = $ this ->executeShellCommand ($ ffmpegCmd );
415- Craft::info ($ ffmpegCmd ."\nffmpeg PID: " .$ pid , __METHOD__ );
416+ Craft::info ($ ffmpegCmd , __METHOD__ );
417+ $ this ->executeShellCommand ($ ffmpegCmd );
418+ $ url = $ settings ['transcoderUrls ' ]['audio ' ] . $ subfolder ?? $ settings ['transcoderUrls ' ]['default ' ];
419+ $ result = Craft::getAlias ($ url ).$ destAudioFile ;
420+ Craft::info ($ result , __METHOD__ );
416421
417422 // Create a lockfile in tmp
418- file_put_contents ($ lockFile , $ pid );
423+ // file_put_contents($lockFile, $pid);
419424 }
420425 }
421426
0 commit comments