From b60c4bd540eb0fd98790c10c90a9decf9be5cd89 Mon Sep 17 00:00:00 2001 From: nicolas-meilan Date: Tue, 11 May 2021 20:12:40 -0300 Subject: [PATCH] Fix Opera ffmpeg library - Add script - Add Readme --- README.md | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++-- fix-opera.sh | 36 ++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 fix-opera.sh diff --git a/README.md b/README.md index 67f7832..a69a0af 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,66 @@ -# fix-opera-linux-ffmpeg -Run this script to fix opera for allow html5 media +# Fix Opera Linux ffmpeg + +* Fix Opera html5 media content. +* It script must be execute all times opera will fails on showing html5 media content. + +## Index + +* [Requirements](##Requirements) +* [How use](##How-use) +* [Create an alias](##Create-an-alias) + +### Requirements + +1. **curl** (Is needed for downloading the ffmpeg lib) + ```sudo apt install curl``` + +2. **unzip** (Is needed for unzipping the downloaded file) + ```sudo apt install unzip``` + +### How use + +1. Clone this repo + + ```git clone https://github.com/nicolas-meilan/fix-opera-linux-ffmpeg.git``` + +2. Go to the repo root folder + + ```cd ./fix-opera-linux-ffmpeg``` + +3. Give execute permissions to the script file + + ```chmod +x ./fix-opera.sh``` + +4. Execute the script using sudo (Is needed for put the ffmpeg lib into the opera instalation folder) + + ```sudo ./fix-opera.sh``` + +### Create an alias + +1. Clone this repo + + ```git clone https://github.com/nicolas-meilan/fix-opera-linux-ffmpeg.git``` + +2. Create a **script** folder on your **home** + + ```mkdir ~/.script``` + +3. Copy the script into the **script** folder + + ```cp ./fix-opera-linux-ffmpeg/fix-opera.sh ~/.script``` + +4. Give execute permissions to the script file + + ```chmod +x ~/.script/fix-opera-linux-ffmpeg/fix-opera.sh``` + +5. Create an **alias** on the **.bashrc** file (Remember replace **** for your linux user) + + ```echo "alias fix-opera='sudo /home//.scripts/fix-opera.sh' # Opera fix HTML5 media" >> ~/.bashrc``` + +6. Update **.bashrc** file + + ```source ~/.bashrc``` + +7. Delete the repo + + ```rm -rf ./fix-opera-linux-ffmpeg``` \ No newline at end of file diff --git a/fix-opera.sh b/fix-opera.sh new file mode 100644 index 0000000..5b2ef0d --- /dev/null +++ b/fix-opera.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# Run using sudo +if [[ $(whoami) != "root" ]]; then + printf 'Try to run it with sudo\n' + exit 1 +fi + +readonly TEMP_FOLDER='/tmp/' +readonly OPERA_FOLDER='/usr/lib/x86_64-linux-gnu/opera/' +readonly FILE_NAME='libffmpeg.so' +readonly ZIP_FILE='.zip' +readonly TEMP_FILE="$TEMP_FOLDER$FILE_NAME" +readonly OPERA_FILE="$OPERA_FOLDER$FILE_NAME" + +readonly GIT_API=https://api.github.com/repos/iteufel/nwjs-ffmpeg-prebuilt/releases/latest + +printf '\nGetting Url ...\n' + +readonly OPERA_FFMPEG_URL=$(curl -s $GIT_API | grep browser_download_url | cut -d '"' -f 4 | grep linux-x64) + +printf '\nDownloading ffmpeg ...\n' + +wget $OPERA_FFMPEG_URL -O "$TEMP_FILE$ZIP_FILE" + +printf "\nUnzipping ...\n\n" + +unzip "$TEMP_FILE$ZIP_FILE" -d $TEMP_FILE + +printf "\nMoving file on $OPERA_FILE ...\n" + +mv -f "$TEMP_FILE/$FILE_NAME" $OPERA_FILE + +printf '\nDeleting Temporary files ...\n' + +find $TEMP_FOLDER -name "*$FILE_NAME*" -delete