commit:     fd7f05d1f1a3cbc396a26148360f707a5f9ea180
Author:     Nicola Smaniotto <smaniotto.nicola <AT> gmail <DOT> com>
AuthorDate: Wed Jan 11 14:58:51 2023 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Wed Jan 11 18:21:13 2023 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=fd7f05d1

mpv-plugin/mpv_thumbnail_script: add multiple thumbnailer threads

Signed-off-by: Nicola Smaniotto <smaniotto.nicola <AT> gmail.com>

 .../mpv_thumbnail_script-0.5.1.ebuild              | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/mpv-plugin/mpv_thumbnail_script/mpv_thumbnail_script-0.5.1.ebuild 
b/mpv-plugin/mpv_thumbnail_script/mpv_thumbnail_script-0.5.1.ebuild
index fda47afa1..c07571d62 100644
--- a/mpv-plugin/mpv_thumbnail_script/mpv_thumbnail_script-0.5.1.ebuild
+++ b/mpv-plugin/mpv_thumbnail_script/mpv_thumbnail_script-0.5.1.ebuild
@@ -28,3 +28,27 @@ src_compile() {
        ${EPYTHON} concat_files.py -r "cat_osc.json" || die
        ${EPYTHON} concat_files.py -r "cat_server.json" || die
 }
+
+src_install() {
+       mpv-plugin_src_install
+
+       # add multiple threads
+       THUMBNAIL_SERVER_THREADS="${THUMBNAIL_SERVER_THREADS:-1}"
+
+       if [[ "${THUMBNAIL_SERVER_THREADS}" -gt 1 ]]; then
+               i=1
+               while [[ ${i} -lt ${THUMBNAIL_SERVER_THREADS} ]]; do
+                       dosym -r 
"/etc/mpv/scripts/mpv_thumbnail_script_server.lua" \
+                               
"/etc/mpv/scripts/mpv_thumbnail_script_server_${i}.lua" || die
+                       (( i++ ))
+               done
+       fi
+}
+
+pkg_postinst(){
+       if [[ "${THUMBNAIL_SERVER_THREADS}" -gt 1 ]]; then
+               elog "Created a total of ${THUMBNAIL_SERVER_THREADS} server 
threads. Setting this too high is not recommended"
+       else
+               elog "You can create multiple thumbnailing threads by setting 
THUMBNAIL_SERVER_THREADS"
+       fi
+}

Reply via email to