add rsync dependency
This commit is contained in:
parent
25827cf21f
commit
95f8902486
2 changed files with 17 additions and 9 deletions
|
|
@ -67,6 +67,8 @@
|
||||||
- The machine shall serve as controller :: An SSH client must be installed and *strm* must be executable.
|
- The machine shall serve as controller :: An SSH client must be installed and *strm* must be executable.
|
||||||
|
|
||||||
A machine can be used for multiple purposes, make sure all required dependencies are fulfilled.
|
A machine can be used for multiple purposes, make sure all required dependencies are fulfilled.
|
||||||
|
|
||||||
|
If the =playback_directory= is set, [[https://rsync.samba.org/][rsync]] is used to synchronize it with a local directory.
|
||||||
|
|
||||||
** Installation
|
** Installation
|
||||||
|
|
||||||
|
|
@ -162,10 +164,11 @@
|
||||||
# bob@another-machine/media/movies,bob@10.0.0.1/home/bob/series
|
# bob@another-machine/media/movies,bob@10.0.0.1/home/bob/series
|
||||||
media_directories=""
|
media_directories=""
|
||||||
|
|
||||||
# Directory with which the saved playback positions are synchronized on exit of the following form:
|
# Directory which contains the saved playback positions of the following form:
|
||||||
#
|
#
|
||||||
# <SSH connection string><absolute_path_to_media_directory>
|
# <SSH connection string><absolute_path_to_media_directory>
|
||||||
#
|
#
|
||||||
|
# It is synchronized with the local ~/.cache/strm directory before and after playing files.
|
||||||
# If it is not set, the mpv resume playback functionality is not enabled by default.
|
# If it is not set, the mpv resume playback functionality is not enabled by default.
|
||||||
# If <SSH connection string> is not set, 'localhost' is used.
|
# If <SSH connection string> is not set, 'localhost' is used.
|
||||||
#
|
#
|
||||||
|
|
|
||||||
21
strm
21
strm
|
|
@ -205,8 +205,10 @@ fi
|
||||||
# Synchronize playback directory
|
# Synchronize playback directory
|
||||||
if [ "$list" == false ] && [ "$playback_directory" != "" ]; then
|
if [ "$list" == false ] && [ "$playback_directory" != "" ]; then
|
||||||
|
|
||||||
# Make local playback directory if not existent
|
# Check if rsync is installed
|
||||||
mkdir -p "$HOME/.cache/strm"
|
if ! command -v rsync &>/dev/null; then
|
||||||
|
error "rsync was not found, please install it"
|
||||||
|
fi
|
||||||
|
|
||||||
# Get connection string and remote directory
|
# Get connection string and remote directory
|
||||||
IFS="/" read -r connection_string directory <<< "$playback_directory"
|
IFS="/" read -r connection_string directory <<< "$playback_directory"
|
||||||
|
|
@ -216,16 +218,19 @@ if [ "$list" == false ] && [ "$playback_directory" != "" ]; then
|
||||||
connection_string="localhost"
|
connection_string="localhost"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -ne "Synchronizing playback directory with $text_bold$(basename $connection_string)$text_reset\n"
|
|
||||||
|
|
||||||
# Check validity of directory
|
# Check validity of directory
|
||||||
if [ "$directory" == "" ]; then
|
if [ "$directory" == "" ]; then
|
||||||
error "Not a valid playback directory ($playback_directory)"
|
error "Not a valid playback directory ($playback_directory)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Make local playback directory if not existent
|
||||||
|
mkdir -p "$HOME/.cache/strm"
|
||||||
|
|
||||||
# Add leading and trailing slash to directory if missing
|
# Add leading and trailing slash to directory if missing
|
||||||
[[ "$directory" != /*/ ]] && directory="/$directory/"
|
[[ "$directory" != /*/ ]] && directory="/$directory/"
|
||||||
|
|
||||||
|
echo -ne "Synchronizing playback directory with $text_bold$(basename $connection_string)$text_reset\n"
|
||||||
|
|
||||||
# Make remote directory if not existent
|
# Make remote directory if not existent
|
||||||
ssh -o ConnectTimeout=10 "$connection_string" "mkdir -p $directory"
|
ssh -o ConnectTimeout=10 "$connection_string" "mkdir -p $directory"
|
||||||
|
|
||||||
|
|
@ -282,11 +287,11 @@ for media_directory in "${media_directories[@]}"; do
|
||||||
error "Not a valid media directory ($media_directory)"
|
error "Not a valid media directory ($media_directory)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -ne "Fetching results from $text_bold$(basename $directory)$text_reset on $text_bold$connection_string$text_reset\n"
|
|
||||||
|
|
||||||
# Add leading and trailing slash to directory if missing
|
# Add leading and trailing slash to directory if missing
|
||||||
[[ "$directory" != /*/ ]] && directory="/$directory/"
|
[[ "$directory" != /*/ ]] && directory="/$directory/"
|
||||||
|
|
||||||
|
echo -ne "Fetching results from $text_bold$(basename $directory)$text_reset on $text_bold$connection_string$text_reset\n"
|
||||||
|
|
||||||
# Get search results from remote
|
# Get search results from remote
|
||||||
# Look for paths matching given queries in visible directories, listing only filenames and links
|
# Look for paths matching given queries in visible directories, listing only filenames and links
|
||||||
mapfile -t tmp_results < <(ssh -o ConnectTimeout=10 "$connection_string" find "'$directory'" "${find_arguments[@]}" | sort)
|
mapfile -t tmp_results < <(ssh -o ConnectTimeout=10 "$connection_string" find "'$directory'" "${find_arguments[@]}" | sort)
|
||||||
|
|
@ -387,11 +392,11 @@ if [ "$list" == false ]; then
|
||||||
connection_string="localhost"
|
connection_string="localhost"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -ne "\nSynchronizing playback directory with $text_bold$(basename $connection_string)$text_reset"
|
|
||||||
|
|
||||||
# Add leading and trailing slash to directory if missing
|
# Add leading and trailing slash to directory if missing
|
||||||
[[ "$directory" != /*/ ]] && directory="/$directory/"
|
[[ "$directory" != /*/ ]] && directory="/$directory/"
|
||||||
|
|
||||||
|
echo -ne "\nSynchronizing playback directory with $text_bold$(basename $connection_string)$text_reset"
|
||||||
|
|
||||||
# Synchronize local to remote
|
# Synchronize local to remote
|
||||||
rsync -az --delete "$HOME/.cache/strm/" "$connection_string:$directory"
|
rsync -az --delete "$HOME/.cache/strm/" "$connection_string:$directory"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue