1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lychee_ynh.git synced 2024-09-03 19:36:36 +02:00

Create app-00-add-ffprobe-path.patch (#31)

* Create app-00-add-ffprobe-path.patch
This commit is contained in:
Éric Gaspar 2021-06-25 18:24:15 +02:00 committed by GitHub
parent 3197477262
commit dbd4929643
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 3 deletions

13
conf/ffprobe.patch Normal file
View file

@ -0,0 +1,13 @@
diff --git a/vendor/lychee-org/php-exif/lib/PHPExif/Adapter/FFprobe.php b/vendor/lychee-org/php-exif/lib/PHPExif/Adapter/FFprobe.php
index 9ececfe..106eadd 100644
--- a/vendor/lychee-org/php-exif/lib/PHPExif/Adapter/FFprobe.php
+++ b/vendor/lychee-org/php-exif/lib/PHPExif/Adapter/FFprobe.php
@@ -33,7 +33,7 @@ class FFprobe extends AdapterAbstract
*
* @var string
*/
- protected $toolPath;
+ protected $toolPath = '/usr/bin/ffprobe';
/**
* @var string-e

View file

@ -136,11 +136,17 @@ pushd $final_path
php$phpversion artisan migrate -n --force
php$phpversion artisan config:clear -n
php$phpversion artisan config:cache -n
patch -p1 < "$YNH_CWD/../conf/ffprobe.patch"
popd
# Setup custom user.css file
ynh_add_config --template="../conf/user.css.example" --destination="$final_path/public/dist/user.css"
ynh_replace_string --match_string="\$ffmpeg = FFMpeg::create();" --replace_string="\$ffmpeg = FFMpeg::create(array(\
'ffmpeg.binaries' => '/usr/bin/ffmpeg',\
'ffprobe.binaries' => '/usr/bin/ffprobe',\
));" --target_file="$final_path/app/Actions/Photo/Extensions/VideoEditing.php"
#=================================================
# SETUP SSOWAT
#=================================================

View file

@ -144,6 +144,11 @@ ynh_add_config --template="../conf/.env.example" --destination="$final_path/.env
ynh_add_config --template="../conf/user.css.example" --destination="$final_path/public/dist/user.css"
ynh_replace_string --match_string="\$ffmpeg = FFMpeg::create();" --replace_string="\$ffmpeg = FFMpeg::create(array(\
'ffmpeg.binaries' => '/usr/bin/ffmpeg',\
'ffprobe.binaries' => '/usr/bin/ffprobe',\
));" --target_file="$final_path/app/Actions/Photo/Extensions/VideoEditing.php"
#=================================================
# INSTALL AND INITIALIZE COMPOSER
#=================================================
@ -151,9 +156,11 @@ ynh_script_progression --message="Upgrading $app source files..." --weight=4
ynh_exec_warn_less ynh_composer_exec --commands=\"dump-autoload\"
( cd $final_path && php$phpversion artisan migrate -n --force )
( cd $final_path && php$phpversion artisan config:clear -n )
( cd $final_path && php$phpversion artisan config:cache -n )
pushd $final_path
php$phpversion artisan migrate -n --force
php$phpversion artisan config:clear -n
php$phpversion artisan config:cache -n
popd
#=================================================
# RELOAD NGINX

View file

@ -0,0 +1,16 @@
diff --git a/app/Actions/Photo/Extensions/VideoEditing.php b/app/Actions/Photo/Extensions/VideoEditing.php
index 1a96769..5842606 100644
--- a/app/Actions/Photo/Extensions/VideoEditing.php
+++ b/app/Actions/Photo/Extensions/VideoEditing.php
@@ -45,7 +45,10 @@ trait VideoEditing
/**
* ! check if we can use path instead of this ugly thing.
*/
- $ffmpeg = FFMpeg::create();
+ $ffmpeg = FFMpeg::create(array(
+ 'ffmpeg.binaries' => '/usr/bin/ffmpeg',
+ 'ffprobe.binaries' => '/usr/bin/ffprobe',
+ ));
/** @var Video */
$video = $ffmpeg->open(Storage::path('big/' . $photo->url));
if (!($tmp = tempnam(sys_get_temp_dir(), 'lychee')) ||