aboutsummaryrefslogtreecommitdiff
path: root/copy-annotations-from-kobo
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2023-01-01 16:30:42 -0300
committerSilvio Rhatto <rhatto@riseup.net>2023-01-01 16:30:42 -0300
commitf375d80d17d7ab02e7045d5f2aa2eeff6192f4f6 (patch)
tree7cab93c4e4b723a18758285ac61d78561566a262 /copy-annotations-from-kobo
parent08283dceeb64eaaf8aafed7913adcbdc1ad22ba1 (diff)
downloadscripts-f375d80d17d7ab02e7045d5f2aa2eeff6192f4f6.tar.gz
scripts-f375d80d17d7ab02e7045d5f2aa2eeff6192f4f6.tar.bz2
Minor copy-annotations-from-kobo enhancements (2)
Diffstat (limited to 'copy-annotations-from-kobo')
-rwxr-xr-xcopy-annotations-from-kobo16
1 files changed, 15 insertions, 1 deletions
diff --git a/copy-annotations-from-kobo b/copy-annotations-from-kobo
index 271328f..19c894c 100755
--- a/copy-annotations-from-kobo
+++ b/copy-annotations-from-kobo
@@ -14,7 +14,8 @@ PATTERN="$1"
# https://serverfault.com/questions/36421/stop-ssh-login-from-printing-motd-from-the-client#38160
function silentSsh {
local connectionString="$1"
- local commands="$2"
+ shift
+ local commands="$*"
if [ -z "$commands" ]; then
commands=`cat`
fi
@@ -34,6 +35,19 @@ show --search "$PATTERN" | while read item; do
extension="$(echo $item | sed -e "s|$basename.||")"
sdr="$basename.sdr"
+ # Check if remote file exists
+ silentSsh $REMOTE <<EOT
+ test -e "$REMOTE_BASE/$sdr/metadata.$extension.lua"
+EOT
+
+ # Skip if remote file does not exist
+ if [ "$?" != "0" ]; then
+ echo "Skipping $item as it's not available at $REMOTE..."
+ continue
+ fi
+
+ echo "Processing $item..."
+
# Make sure that the annotation file exists
mkdir -p "$BASEFOLDER/$sdr"
touch "$BASEFOLDER/$sdr/metadata.$extension.lua"