Merge branch 'master' into specify-output

This commit is contained in:
Mattéo Delabre 2020-04-07 10:55:20 +02:00 committed by GitHub
commit 0c707af239
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 52 additions and 14 deletions

7
.editorconfig Normal file
View 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
View 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

View File

@ -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.
Copy the `lz4` program to your reMarkable with
`scp lz4.arm.static root@10.11.99.1:~/lz4`, make it executable with
`ssh root@10.11.99.1 'chmod +x ~/lz4'` and you're ready to go.
`scp lz4.arm.static root@10.11.99.1:/home/root/lz4`, make it executable with
`ssh root@10.11.99.1 'chmod +x /home/root/lz4'` and you're ready to go.
## Troubleshooting

View File

@ -9,7 +9,7 @@ format=- # automatic output format
# loop through arguments and process them
while [ $# -gt 0 ]; do
case "$1" in
-p|--portrait)
-p | --portrait)
landscape=false
shift
;;
@ -31,6 +31,7 @@ while [ $# -gt 0 ]; do
*)
echo "Usage: $0 [-p] [-s <source>] [-o <output>] [-f <format>]"
exit 1
;;
esac
done
@ -40,10 +41,13 @@ height=1872
bytes_per_pixel=2
loop_wait="true"
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
if ! $ssh_cmd true; then
if ! ssh_cmd true; then
echo "$ssh_host unreachable"
exit 1
fi
@ -56,12 +60,11 @@ fallback_to_gzip() {
sleep 2
}
# 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"
elif $ssh_cmd "[ -f ~/lz4 ]"; then
compress="~/lz4"
elif ssh_cmd "[ -f ~/lz4 ]"; then
compress="\$HOME/lz4"
fi
# gracefully degrade to gzip if is not present on remarkable or host
@ -82,7 +85,7 @@ output_args=""
video_filters=""
# 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
$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"
if [ "$output_path" = - ]; then
output_command=ffplay
output_cmd=ffplay
else
output_command=ffmpeg
output_cmd=ffmpeg
if [ "$format" != - ]; then
output_args="$output_args -f '$format' "
@ -112,9 +115,10 @@ output_args="$output_args -vf '${video_filters#,}'"
set -e # stop if an error occurs
$ssh_cmd "$read_loop" \
# shellcheck disable=SC2086
ssh_cmd "$read_loop" \
| $decompress \
| "$output_command" \
| "$output_cmd" \
-vcodec rawvideo \
-loglevel "$loglevel" \
-f rawvideo \