Merge branch 'master' into specify-output
This commit is contained in:
commit
0c707af239
7
.editorconfig
Normal file
7
.editorconfig
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[*.sh]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
shell_variant = posix
|
||||||
|
binary_next_line = true
|
||||||
|
switch_case_indent = true
|
27
.github/workflows/check.yml
vendored
Normal file
27
.github/workflows/check.yml
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
name: Check
|
||||||
|
|
||||||
|
# Controls when the action will run. Triggers the workflow on push or pull request
|
||||||
|
# events but only for the master branch
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||||
|
jobs:
|
||||||
|
# This workflow contains a single job called "build"
|
||||||
|
check:
|
||||||
|
# The type of runner that the job will run on
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||||
|
steps:
|
||||||
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Shell Linter
|
||||||
|
run: docker run -v $GITHUB_WORKSPACE:/mnt -w /mnt koalaman/shellcheck reStream.sh
|
||||||
|
|
||||||
|
- name: Shell Formatter
|
||||||
|
run: docker run -v $GITHUB_WORKSPACE:/mnt -w /mnt mvdan/shfmt -d reStream.sh
|
@ -49,8 +49,8 @@ and compiling `lz4` from source with the toolchain enabled, or you can use the
|
|||||||
statically linked binary I have already built and put in this repo.
|
statically linked binary I have already built and put in this repo.
|
||||||
|
|
||||||
Copy the `lz4` program to your reMarkable with
|
Copy the `lz4` program to your reMarkable with
|
||||||
`scp lz4.arm.static root@10.11.99.1:~/lz4`, make it executable with
|
`scp lz4.arm.static root@10.11.99.1:/home/root/lz4`, make it executable with
|
||||||
`ssh root@10.11.99.1 'chmod +x ~/lz4'` and you're ready to go.
|
`ssh root@10.11.99.1 'chmod +x /home/root/lz4'` and you're ready to go.
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
|
28
reStream.sh
28
reStream.sh
@ -9,7 +9,7 @@ format=- # automatic output format
|
|||||||
# loop through arguments and process them
|
# loop through arguments and process them
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-p|--portrait)
|
-p | --portrait)
|
||||||
landscape=false
|
landscape=false
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
@ -31,6 +31,7 @@ while [ $# -gt 0 ]; do
|
|||||||
*)
|
*)
|
||||||
echo "Usage: $0 [-p] [-s <source>] [-o <output>] [-f <format>]"
|
echo "Usage: $0 [-p] [-s <source>] [-o <output>] [-f <format>]"
|
||||||
exit 1
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -40,10 +41,13 @@ height=1872
|
|||||||
bytes_per_pixel=2
|
bytes_per_pixel=2
|
||||||
loop_wait="true"
|
loop_wait="true"
|
||||||
loglevel="info"
|
loglevel="info"
|
||||||
ssh_cmd="ssh -o ConnectTimeout=1 "$ssh_host""
|
|
||||||
|
ssh_cmd() {
|
||||||
|
ssh -o ConnectTimeout=1 "$ssh_host" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
# check if we are able to reach the remarkable
|
# check if we are able to reach the remarkable
|
||||||
if ! $ssh_cmd true; then
|
if ! ssh_cmd true; then
|
||||||
echo "$ssh_host unreachable"
|
echo "$ssh_host unreachable"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -56,12 +60,11 @@ fallback_to_gzip() {
|
|||||||
sleep 2
|
sleep 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# check if lz4 is present on remarkable
|
# check if lz4 is present on remarkable
|
||||||
if $ssh_cmd "[ -f /opt/bin/lz4 ]"; then
|
if ssh_cmd "[ -f /opt/bin/lz4 ]"; then
|
||||||
compress="/opt/bin/lz4"
|
compress="/opt/bin/lz4"
|
||||||
elif $ssh_cmd "[ -f ~/lz4 ]"; then
|
elif ssh_cmd "[ -f ~/lz4 ]"; then
|
||||||
compress="~/lz4"
|
compress="\$HOME/lz4"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# gracefully degrade to gzip if is not present on remarkable or host
|
# gracefully degrade to gzip if is not present on remarkable or host
|
||||||
@ -82,7 +85,7 @@ output_args=""
|
|||||||
video_filters=""
|
video_filters=""
|
||||||
|
|
||||||
# calculate how much bytes the window is
|
# calculate how much bytes the window is
|
||||||
window_bytes="$(($width*$height*$bytes_per_pixel))"
|
window_bytes="$((width * height * bytes_per_pixel))"
|
||||||
|
|
||||||
# rotate 90 degrees if landscape=true
|
# rotate 90 degrees if landscape=true
|
||||||
$landscape && video_filters="$video_filters,transpose=1"
|
$landscape && video_filters="$video_filters,transpose=1"
|
||||||
@ -94,9 +97,9 @@ head_fb0="dd if=/dev/fb0 count=1 bs=$window_bytes 2>/dev/null"
|
|||||||
read_loop="while $head_fb0; do $loop_wait; done | $compress"
|
read_loop="while $head_fb0; do $loop_wait; done | $compress"
|
||||||
|
|
||||||
if [ "$output_path" = - ]; then
|
if [ "$output_path" = - ]; then
|
||||||
output_command=ffplay
|
output_cmd=ffplay
|
||||||
else
|
else
|
||||||
output_command=ffmpeg
|
output_cmd=ffmpeg
|
||||||
|
|
||||||
if [ "$format" != - ]; then
|
if [ "$format" != - ]; then
|
||||||
output_args="$output_args -f '$format' "
|
output_args="$output_args -f '$format' "
|
||||||
@ -112,9 +115,10 @@ output_args="$output_args -vf '${video_filters#,}'"
|
|||||||
|
|
||||||
set -e # stop if an error occurs
|
set -e # stop if an error occurs
|
||||||
|
|
||||||
$ssh_cmd "$read_loop" \
|
# shellcheck disable=SC2086
|
||||||
|
ssh_cmd "$read_loop" \
|
||||||
| $decompress \
|
| $decompress \
|
||||||
| "$output_command" \
|
| "$output_cmd" \
|
||||||
-vcodec rawvideo \
|
-vcodec rawvideo \
|
||||||
-loglevel "$loglevel" \
|
-loglevel "$loglevel" \
|
||||||
-f rawvideo \
|
-f rawvideo \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user