diff --git a/README.md b/README.md
index e594965..599b5ba 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly in the web browser, using WebTorrent.
-**Shipped version:** 4.0.0~ynh1
+**Shipped version:** 4.0.0~ynh2
**Demo:** http://peertube.cpy.re
diff --git a/README_fr.md b/README_fr.md
index 1a603bf..ebc54c4 100644
--- a/README_fr.md
+++ b/README_fr.md
@@ -14,7 +14,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
Plateforme de streaming vidéo fédérée (ActivityPub) utilisant P2P (BitTorrent) directement dans le navigateur Web, en utilisant WebTorrent
-**Version incluse :** 4.0.0~ynh1
+**Version incluse :** 4.0.0~ynh2
**Démo :** http://peertube.cpy.re
diff --git a/check_process b/check_process
index c56db6a..08c4b32 100644
--- a/check_process
+++ b/check_process
@@ -22,6 +22,8 @@
upgrade=1 from_commit=ed59a268e93910f8b35b0f87399f91b8cad9ede0
# 3.4.0~ynh1
upgrade=1 from_commit=83a06ca4c96ccd941b49647b3698db2c6b771b79
+ # 4.0.0~ynh1
+ upgrade=1 from_commit=7c2bb0bb6a91b6b957b734f684aa3d64da892f4c
backup_restore=1
multi_instance=0
port_already_use=0
@@ -40,3 +42,5 @@ Notification=yes
name=3.3.0~ynh3
; commit=83a06ca4c96ccd941b49647b3698db2c6b771b79
name=3.4.0~ynh1
+ ; commit=7c2bb0bb6a91b6b957b734f684aa3d64da892f4c
+ name=4.0.0~ynh1
diff --git a/conf/production.yaml b/conf/production.yaml
index 5a7aa27..275c91f 100644
--- a/conf/production.yaml
+++ b/conf/production.yaml
@@ -433,7 +433,9 @@ import:
# youtube-dl binary name
# yt-dlp is also supported
- name: 'youtube-dl'
+ name: 'yt-dlp'
+ # Path to the python binary to execute for youtube-dl or yt-dlp
+ python_path: '/usr/bin/python3'
# IPv6 is very strongly rate-limited on most sites supported by youtube-dl
force_ipv4: false
diff --git a/manifest.json b/manifest.json
index 448108f..7235cae 100644
--- a/manifest.json
+++ b/manifest.json
@@ -6,7 +6,7 @@
"en": "Video streaming platform using P2P directly in the web browser, connected to a federated network",
"fr": "Plateforme de diffusion vidéo par P2P directement dans le navigateur, et connectée à un réseau fédéralisé"
},
- "version": "4.0.0~ynh1",
+ "version": "4.0.0~ynh2",
"url": "https://github.com/Chocobozzz/PeerTube",
"upstream": {
"license": "AGPL-3.0-only",
diff --git a/scripts/install b/scripts/install
index 873cf48..0bd23d1 100644
--- a/scripts/install
+++ b/scripts/install
@@ -70,7 +70,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port
# PeerTube Live port
rtmp_port=1935
-ynh_port_available --port=$rtmp_port || ynh_die "Port $rtmp_port is needs to be available for this app"
+ynh_port_available --port=$rtmp_port || ynh_die --message="Port $rtmp_port is needs to be available for this app"
ynh_app_setting_set --app=$app --key=rtmp_port --value=$rtmp_port
# Open the port
@@ -130,6 +130,7 @@ ynh_script_progression --message="Setting up source files..."
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
+[ -d "../sources/patches-$(ynh_app_upstream_version)" ] && cp -a "../sources/patches-$(ynh_app_upstream_version)" "../sources/patches"
ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path"
@@ -164,7 +165,7 @@ ynh_script_progression --message="Building Yarn dependencies..."
pushd "$final_path"
ynh_use_nodejs
- ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --production --pure-lockfile
+ ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --production --pure-lockfile
popd
#=================================================
diff --git a/scripts/upgrade b/scripts/upgrade
index 2fd4bfd..6c956f8 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -119,7 +119,7 @@ ynh_delete_file_checksum --file="../conf/msg_install"
if [ -z "$rtmp_port" ];
then
rtmp_port=1935
- ynh_port_available --port=$rtmp_port || ynh_die "Port $rtmp_port is needs to be available for this app"
+ ynh_port_available --port=$rtmp_port || ynh_die --message="Port $rtmp_port is needs to be available for this app"
ynh_app_setting_set --app=$app --key=rtmp_port --value=$rtmp_port
# Open the port
@@ -169,6 +169,7 @@ then
ynh_secure_remove --file="$final_path"
# Download, check integrity, uncompress and patch the source from app.src
+ [ -d "../sources/patches-$(ynh_app_upstream_version)" ] && cp -a "../sources/patches-$(ynh_app_upstream_version)" "../sources/patches"
ynh_setup_source --dest_dir="$final_path"
#Copy the admin saved settings from tmp directory to final path
diff --git a/sources/patches-4.0.0/app-python-in-config.patch b/sources/patches-4.0.0/app-python-in-config.patch
new file mode 100644
index 0000000..6a2633c
--- /dev/null
+++ b/sources/patches-4.0.0/app-python-in-config.patch
@@ -0,0 +1,26 @@
+diff '--color=auto' -ru ./dist/server/helpers/youtube-dl/youtube-dl-cli.js ./dist/server/helpers/youtube-dl/youtube-dl-cli.js
+--- ./dist/server/helpers/youtube-dl/youtube-dl-cli.js 2021-12-13 09:22:44.000000000 +0100
++++ ./dist/server/helpers/youtube-dl/youtube-dl-cli.js 2022-01-11 22:35:52.992330841 +0100
+@@ -104,7 +104,8 @@
+ let completeArgs = this.wrapWithProxyOptions(args);
+ completeArgs = this.wrapWithIPOptions(completeArgs);
+ completeArgs = this.wrapWithFFmpegOptions(completeArgs);
+- const output = yield (0, execa_1.default)('python', [youtubeDLBinaryPath, ...completeArgs, url], processOptions);
++ const { PYTHON_PATH } = config_1.CONFIG.IMPORT.VIDEOS.HTTP.YOUTUBE_DL_RELEASE;
++ const output = yield (0, execa_1.default)(PYTHON_PATH, [youtubeDLBinaryPath, ...completeArgs, url], processOptions);
+ logger_1.logger.debug('Runned youtube-dl command.', Object.assign({ command: output.command }, lTags()));
+ return output.stdout
+ ? output.stdout.trim().split(/\r?\n/)
+diff '--color=auto' -ru ./dist/server/initializers/config.js ./dist/server/initializers/config.js
+--- ./dist/server/initializers/config.js 2021-12-13 09:22:43.000000000 +0100
++++ ./dist/server/initializers/config.js 2022-01-11 22:35:51.812344562 +0100
+@@ -295,7 +295,8 @@
+ get ENABLED() { return config.get('import.videos.http.enabled'); },
+ YOUTUBE_DL_RELEASE: {
+ get URL() { return config.get('import.videos.http.youtube_dl_release.url'); },
+- get NAME() { return config.get('import.videos.http.youtube_dl_release.name'); }
++ get NAME() { return config.get('import.videos.http.youtube_dl_release.name'); },
++ get PYTHON_PATH() { return config.get('import.videos.http.youtube_dl_release.python_path'); }
+ },
+ get FORCE_IPV4() { return config.get('import.videos.http.force_ipv4'); }
+ },