Improvements (#83)

* General Improvements

* Remove symlink in CodecPack/target/bin

* Fix size of /tmp growing and add issue-report tool

* Update issue template instructions

* Add issue-report.sh script

* Add preuninstall script

* Add shell linter
pull/84/head 2.1
Alex 3 years ago committed by GitHub
parent 4113a01f2d
commit 7ccdaceabf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -13,50 +13,15 @@ assignees: ''
- Re-install VideoStation (it should also ask to install Advanced Media Extensions)
- Run the patch
**System details**
- Synology model: [Synology NAS model]
- DSM version: [version]
- SynoCommunity FFMPEG Version: [version]
- VideoStation version: [version]
- Advanced Media Extensions version: [version / "none" if you don't have it installed]
**Describe the bug**
A clear and concise description of what the bug is.
**Provide Log files**
**Provide System Details**
- Start the video on VideoStation, wait for the video to play and put the browser in background (keep the video playing)
- Connect through SSH ([help](https://www.synology.com/en-global/knowledgebase/DSM/tutorial/General_Setup/How_to_login_to_DSM_with_root_permission_via_SSH_Telnet))
- Switch to root user: `sudo -i`
- Run the report tool: `curl https://raw.githubusercontent.com/AlexPresso/VideoStation-FFMPEG-Patcher/main/issue-report.sh | bash`
- Copy-paste the output to a new [gist](https://gist.github.com/) and put the link here
## `ffmpeg.log` (containing the ffmpeg-wrapper execution logs)
- Go to the temporary directory: `cd /tmp`
- Type `ls -al | grep ffmpeg` to list all files containing "ffmpeg" and check you have one named `ffmpeg.log`
- Type `tail -200 ffmpeg.log` to print the last 200 lines to the console
- Copy paste those lines in a new [gist](https://gist.github.com/)
- Add the gist link to the issue
## `ffmpeg-xxxx.stderr` (containing chunks transcoding operations)
- When you ran `ls -al | grep ffmpeg` you should have seen another file that looks like `ffmpeg-xxxx.stderr` in case of error, the file may not be there, in that specific case, you can ignore these steps.
- Type `tail -100 ffmpeg-xxxx.stderr` (replacing the filename by the correct one)
- Copy paste those lines in a new [gist](https://gist.github.com/)
- Type `head -300 ffmpeg-xxxx.stderr` (replacing the filename by the correct one)
- Copy paste those lines in another new [gist](https://gist.github.com/)
- Copy paste all the gists links in the issue
## `gstreamer.log` (containing the ffmpeg-wrapper execution logs)
- Go to the temporary directory: `cd /tmp`
- Type `ls -al | grep gst` to list all files containing "ffmpeg" and check you have one named `gstreamer.log`
- Type `tail -200 gstreamer.log` to print the last 200 lines to the console
- Copy paste those lines in a new [gist](https://gist.github.com/)
- Add the gist link to the issue
## `gstlaunch-xxxx.stderr` (containing chunks transcoding operations)
- When you ran `ls -al | grep gst` you should have seen another file that looks like `gstreamer-xxxx.stderr` in case of error, the file may not be there, in that specific case, you can ignore these steps.
- Type `tail -100 gstlaunch-xxxx.stderr` (replacing the filename by the correct one)
- Copy paste those lines in a new [gist](https://gist.github.com/)
- Type `head -300 gstlaunch-xxxx.stderr` (replacing the filename by the correct one)
- Copy paste those lines in another new [gist](https://gist.github.com/)
- Copy paste all the gists links in the issue
**Describe the bug**
A clear and concise description of what the bug is.
**Additional context**
Add any other context about the problem here.

@ -0,0 +1,14 @@
name: Lint shell scripts
on: push
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Run ShellCheck
uses: azohra/shell-linter@latest
with:
exclude-paths: ".github/workflows/mock"

@ -0,0 +1,14 @@
majorversion="7"
minorversion="2"
major="7"
minor="2"
micro="0"
buildphase="GM"
buildnumber="64570"
smallfixnumber="1"
nano="1"
base="64570"
productversion="7.2"
os_name="DSM"
builddate="2023/06/13"
buildtime="21:31:56"

@ -23,7 +23,7 @@ Huge thanks to [Benjamin Poncet](https://github.com/BenjaminPoncet), [Vincent Fo
## Instructions
- Check that you meet the required [dependencies](https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher#dependencies)
- Install SynoCommunity ffmpeg ([help](https://synocommunity.com/#easy-install))
- If you plan to play HEVC / AAC videos, install Advanced Media Extensions (and configure the license)
- If you plan to play HEVC / AAC videos, install Advanced Media Extensions and license it using your Synology account inside the app
- Connect to your NAS using SSH (admin user required) ([help](https://www.synology.com/en-global/knowledgebase/DSM/tutorial/General_Setup/How_to_login_to_DSM_with_root_permission_via_SSH_Telnet))
- Use the command `sudo -i` to switch to root user
- Use the [following](https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher#usage) command (Basic command) to execute the patch

@ -0,0 +1,60 @@
#!/bin/bash
###############################
# VARS
###############################
# shellcheck source=/.github/workflows/mock/VERSION
source "/etc/VERSION"
dsm_version="$productversion $buildnumber-$smallfixnumber"
vs_path=/var/packages/VideoStation
cp_path=/var/packages/CodecPack
###############################
# UTILS
###############################
function root_check() {
if [[ "$EUID" -ne 0 ]]; then
echo "This tool needs root access (please run 'sudo -i' before proceeding)."
exit 1
fi
}
################################
# ENTRYPOINT
################################
root_check
echo "
================ ISSUE REPORT TOOL ================
System Details.....................................
DSM Version: $dsm_version
Arch details: $(uname -a)
Package Details....................................
VideoStation version: $(synopkg version VideoStation || echo "Not installed")
FFMPEG version: $(synopkg version ffmpeg || echo "Not installed")
CodecPack version: $(synopkg version CodecPack || echo "Not installed")
Patch Details......................................
Is patched ? $([ -f "$vs_path/target/lib/libsynovte.so.orig" ] && echo "yes" || echo "no")
Has gstreamer ? $([ -f "$vs_path/target/bin/gst-launch-1.0" ] && echo "yes" || echo "no")
"
echo " CodecPack target/bin content:"
ls -l "$cp_path/target/bin"
echo ""
echo " CodecPack target/pack/bin content:"
ls -l "$cp_path/target/pack/bin"
echo ""
echo "Gstreamer last stderr logs........................."
tail -22 /tmp/gstreamer*.stderr
echo ""
echo "FFMPEG last stderr logs............................"
tail -22 /tmp/ffmpeg*.stderr

@ -4,6 +4,7 @@
# VARS
###############################
# shellcheck source=/.github/workflows/mock/VERSION
source "/etc/VERSION"
dsm_version="$productversion $buildnumber-$smallfixnumber"
repo_base_url="https://raw.githubusercontent.com/AlexPresso/VideoStation-FFMPEG-Patcher"
@ -20,10 +21,10 @@ wrappers=(
vs_base_path=/var/packages/VideoStation
vs_path="$vs_base_path/target"
libsynovte_path="$vs_path/lib/libsynovte.so"
vs_scripts=("preuninst")
cp_base_path=/var/packages/CodecPack
cp_path="$cp_base_path/target"
cp_bin_path="$cp_path/bin"
cp_pack_path=false
cp_to_patch=(
"ffmpeg41:ffmpeg"
"ffmpeg27:ffmpeg"
@ -135,6 +136,16 @@ function restart_packages() {
synopkg restart VideoStation
}
function clean() {
info "Cleaning orphan files..."
rm -f /tmp/tmp.wget
rm -f /tmp/ffmpeg.log
rm -f /tmp/ffmpeg*.stderr
rm -f /tmp/gstreamer.log
rm -f /tmp/gst*.stderr
}
function check_dependencies() {
missingDeps=false
@ -171,8 +182,31 @@ function download() {
################################
function patch() {
check_dependencies
info "====== Patching procedure (branch: $branch) ======"
if [[ -f "$vs_path/lib/libsynovte.so.orig" ]]; then
error "You're trying to patch over an already patched VideoStation, if that's really what you want to do, please unpatch before patching again."
exit 1
fi
for filename in "${vs_scripts[@]}"; do
if [[ -f "$vs_base_path/scripts/$filename" ]]; then
info "Saving current $filename script as $filename.orig"
mv -n "$vs_base_path/scripts/$filename" "$vs_base_path/scripts/$filename.orig"
info "Downloading $filename script..."
download "$repo_base_url/$branch/scripts/$filename.sh" "$vs_base_path/scripts/$filename"
info "Injecting script variables..."
repo_full_url="$repo_base_url/$branch"
sed -i -e "s|@repo_full_url@|$repo_full_url|" "$vs_base_path/scripts/$filename"
chmod 755 "$vs_base_path/scripts/$filename"
fi
done
for filename in "${wrappers[@]}"; do
if [[ -f "$vs_path/bin/$filename" ]]; then
info "Saving current $filename as $filename.orig"
@ -196,7 +230,6 @@ function patch() {
mv -n "$cp_bin_path/$filename" "$cp_bin_path/$filename.orig"
ln -s -f "$vs_path/bin/$target" "$cp_bin_path/$filename"
ln -s -f "$vs_path/bin/$target" "$cp_base_path/target/bin/$filename"
fi
done
fi
@ -236,6 +269,7 @@ function patch() {
sed -i -e 's/eac3/3cae/' -e 's/dts/std/' -e 's/truehd/dheurt/' "$libsynovte_path"
restart_packages
clean
echo ""
info "Done patching, you can now enjoy your movies ;) (please add a star to the repo if it worked for you)"
@ -244,14 +278,23 @@ function patch() {
function unpatch() {
info "====== Unpatch procedure ======"
info "Restoring libsynovte.so"
mv -T -f "$libsynovte_path.orig" "$libsynovte_path"
if [[ -f "$libsynovte_path.orig" ]]; then
info "Restoring libsynovte.so"
mv -T -f "$libsynovte_path.orig" "$libsynovte_path"
else
info "libsynovte.so was not patched, keeping actual file."
fi
find "$vs_path/bin" -type f -name "*.orig" | while read -r filename; do
info "Restoring VideoStation's $filename"
mv -T -f "$filename" "${filename::-5}"
done
find "$vs_base_path/scripts" -type f -name "*.orig" | while read -r filename; do
info "Restoring VideoStation's $filename script"
mv -T -f "$filename" "${filename::-5}"
done
if [[ -d $cp_bin_path ]]; then
for file in "${cp_to_patch[@]}"; do
filename="${file%%:*}"
@ -259,10 +302,6 @@ function unpatch() {
if [[ -f "$cp_bin_path/$filename.orig" ]]; then
info "Restoring CodecPack's $filename"
mv -T -f "$cp_bin_path/$filename.orig" "$cp_bin_path/$filename"
if [[ $cp_pack_path ]]; then
ln -s -f "../pack/bin/$filename" "$cp_base_path/target/bin/$filename"
fi
fi
done
fi
@ -278,11 +317,16 @@ function unpatch() {
rm -f "$vs_path/lib/gstreamer/$lib"
done
info "Restoring GSTOmx configuration..."
mv -T -f "$vs_path/etc/gstomx.conf.orig" "$vs_path/etc/gstomx.conf"
if [[ -f "$vs_path/etc/gstomx.conf.orig" ]]; then
info "Restoring GSTOmx configuration..."
mv -T -f "$vs_path/etc/gstomx.conf.orig" "$vs_path/etc/gstomx.conf"
else
info "GSTOmx configuration was not patched, keeping actual file."
fi
fi
restart_packages
clean
echo ""
info "unpatch complete"
@ -292,7 +336,6 @@ function unpatch() {
# ENTRYPOINT
################################
root_check
check_dependencies
while getopts a:b:p:v: flag; do
case "${flag}" in
@ -316,7 +359,6 @@ info "You're running DSM $dsm_version"
if [[ -d /var/packages/CodecPack/target/pack ]]; then
cp_path="$cp_base_path/target/pack"
cp_bin_path="$cp_path/bin"
cp_pack_path=true
info "Tuned script for DSM $dsm_version"
fi

@ -0,0 +1,6 @@
#!/bin/sh
repo_full_url=@repo_full_url@
curl "$repo_full_url/patcher.sh" | bash -s -- -a unpatch
exit 0

@ -7,7 +7,6 @@
pid=$$
child=""
stderrfile="/tmp/ffmpeg-$pid.stderr"
logfile="/tmp/ffmpeg.log"
errcode=0
#########################
@ -15,19 +14,17 @@ errcode=0
#########################
function log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$1] $2" >> $logfile
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$1] $2" >> $stderrfile
}
function newline() {
echo "" >> $logfile
echo "" >> $stderrfile
}
function info() {
log "INFO" "$1"
}
function handle_error() {
log "ERROR" "An error occurred, here is the $stderrfile content: "
newline
cat "$stderrfile" >> $logfile
log "ERROR" "An error occurred"
newline
errcode=1
endprocess
@ -49,7 +46,7 @@ function endprocess() {
# ENTRYPOINT
#########################
trap endprocess SIGTERM
trap endprocess SIGINT SIGTERM
trap handle_error ERR
newline

@ -7,7 +7,6 @@
pid=$$
child=""
stderrfile="/tmp/gstinspect-$pid.stderr"
logfile="/tmp/gstreamer.log"
errcode=0
#########################
@ -15,19 +14,17 @@ errcode=0
#########################
function log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$1] $2" >> $logfile
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$1] $2" >> $stderrfile
}
function newline() {
echo "" >> $logfile
echo "" >> $stderrfile
}
function info() {
log "INFO" "$1"
}
function handle_error() {
log "ERROR" "An error occurred, here is the $stderrfile content: "
newline
cat "$stderrfile" >> $logfile
log "ERROR" "An error occurred"
newline
errcode=1
endprocess
@ -49,7 +46,7 @@ function endprocess() {
# ENTRYPOINT
#########################
trap endprocess SIGTERM
trap endprocess SIGINT SIGTERM
trap handle_error ERR
newline

@ -7,7 +7,6 @@
pid=$$
child=""
stderrfile="/tmp/gstlaunch-$pid.stderr"
logfile="/tmp/gstreamer.log"
errcode=0
#########################
@ -15,19 +14,17 @@ errcode=0
#########################
function log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$1] $2" >> $logfile
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$1] $2" >> $stderrfile
}
function newline() {
echo "" >> $logfile
echo "" >> $stderrfile
}
function info() {
log "INFO" "$1"
}
function handle_error() {
log "ERROR" "An error occurred, here is the $stderrfile content: "
newline
cat "$stderrfile" >> $logfile
log "ERROR" "An error occurred"
newline
errcode=1
endprocess
@ -49,7 +46,7 @@ function endprocess() {
# ENTRYPOINT
#########################
trap endprocess SIGTERM
trap endprocess SIGINT SIGTERM
trap handle_error ERR
newline

Loading…
Cancel
Save