From 1452e1717104565b1eaabafe662c2f8043596925 Mon Sep 17 00:00:00 2001 From: Ld-Hagen Date: Thu, 16 Sep 2021 15:01:54 +0300 Subject: [PATCH] No need for installed Chrome to fix Widevine --- README.md | 2 +- fix-opera.sh | 31 +++++++++++++++++++++---------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index c48a750..d17abd0 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ * Fix Opera html5 media content. * It script must be execute all times opera will fails on showing html5 media content. -* Now it also fixes WidevineCdm support for DRM video. You can try it on Vevo youtube channel for example. (Requires Chrome installation in /opt/google/chrome) +* Now it also fixes WidevineCdm support for DRM video. You can try it on Vevo youtube channel for example. ## Index diff --git a/fix-opera.sh b/fix-opera.sh index 194a006..3b833c0 100644 --- a/fix-opera.sh +++ b/fix-opera.sh @@ -12,7 +12,8 @@ readonly FILE_NAME='libffmpeg.so' readonly ZIP_FILE='.zip' readonly TEMP_FILE="$TEMP_FOLDER$FILE_NAME" readonly OPERA_FILE="$OPERA_FOLDER$FILE_NAME" -readonly WIDEVINE_FOLDER='/opt/google/chrome/WidevineCdm' +readonly FIX_WIDEVINE=true +readonly CHROME_DL_LINK="https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" readonly GIT_API=https://api.github.com/repos/iteufel/nwjs-ffmpeg-prebuilt/releases @@ -36,13 +37,23 @@ printf '\nDeleting Temporary files ...\n' find $TEMP_FOLDER -name "*$FILE_NAME*" -delete -if test -d $WIDEVINE_FOLDER - then - printf "\nInstalling WidevineCdm ...\n" - rm -rf "$OPERA_FOLDER/lib_extra" - mkdir "$OPERA_FOLDER/lib_extra" - cp -R $WIDEVINE_FOLDER "$OPERA_FOLDER/lib_extra/" - printf "[\n {\n \"preload\": \"$OPERA_FOLDER/lib_extra/WidevineCdm\"\n }\n]\n" > "$OPERA_FOLDER/resources/widevine_config.json" - else - printf "\nThere should be Google Chrome installed to /opt/google/chrome to use its WidevineCdm\n" +if $FIX_WIDEVINE + then + rm -rf "$OPERA_FOLDER/lib_extra" + mkdir "$OPERA_FOLDER/lib_extra" + printf "\nDownloading Google Chrome ...\n" + wget -P "$TEMP_FOLDER" "$CHROME_DL_LINK" + + printf "\nExtracting Chrome to temporary folder ...\n" + CHROME_PKG_NAME=`basename $CHROME_DL_LINK` + dpkg -x "$TEMP_FOLDER/$CHROME_PKG_NAME" "$TEMP_FOLDER/chrome" + + printf "\nInstalling WidevineCdm ...\n" + cp -R "$TEMP_FOLDER/chrome/opt/google/chrome/WidevineCdm" "$OPERA_FOLDER/lib_extra/" + printf "[\n {\n \"preload\": \"$OPERA_FOLDER/lib_extra/WidevineCdm\"\n }\n]\n" > "$OPERA_FOLDER/resources/widevine_config.json" + + printd "\nDeleting temprorary files ...\n" + rm -rf "$TEMP_FOLDER/chrome" + else + printf "\nInstalling WidevineCdm skipped\n" fi