Same File was updated => Change OLDLINK

master
qo-op 2 years ago
parent ebf24c4bc8
commit 25f9f5df35
  1. 10
      zen/xbian_vstream.sh

@ -52,12 +52,16 @@ mkdir -p ~/.zen/ipfs/xbian
isFILEinINDEX=$(grep "$file" ~/.zen/ipfs/xbian/${PREFIX}${XZUID})
isLINKinINDEX=$(grep "$NEWSHARE" ~/.zen/ipfs/xbian/${PREFIX}${XZUID})
# If new file? add it to INDEX
# Is it a new file? Add it to INDEX
if [[ ! $isFILEinINDEX && ! $isLINKinINDEX ]]; then
echo "$TYPE;$filena;http://localhost:10021/ipfs/$NEWSHARE/$file" >> ~/.zen/ipfs/xbian/${PREFIX}${XZUID}
else
[[ $isFILEinINDEX ]] && echo "$file already in index" ## TODO Update LINK ?
[[ $isLINKinINDEX ]] && echo "$NEWSHARE already in index" ## should not happen
if [[ $isFILEinINDEX ]]; then
echo "$file already in index" ## File was updated => Change OLDLINK
OLDLINK=$(echo $isFILEinINDEX | cut -d "/" -f 5 | tail -n 1)
sed -i "s/$OLDLINK/$NEWSHARE/g" ~/.zen/ipfs/xbian/${PREFIX}${XZUID}
fi
[[ $isLINKinINDEX ]] && echo "$NEWSHARE already in index. DO NOTHING" ## should not happen
fi

Loading…
Cancel
Save