From 5846b4607b653b35def8f595ef1cfb4fea5e516c Mon Sep 17 00:00:00 2001 From: qo-op Date: Tue, 8 Dec 2020 02:22:33 +0100 Subject: [PATCH] AstXbian ipfs sharing --- ISOconfig.sh | 14 +++++++------- cron_MINUTE.sh | 6 ++++++ zen/xbian_vstream.sh | 29 +++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 7 deletions(-) create mode 100755 zen/xbian_vstream.sh diff --git a/ISOconfig.sh b/ISOconfig.sh index 3eff342..71e38bb 100755 --- a/ISOconfig.sh +++ b/ISOconfig.sh @@ -82,19 +82,19 @@ mv /tmp/config.ipfs ~/.ipfs/config # WRITE ~/.zen/ipfs.sync CONFIG echo "IPFS_SYNC_DIR=$IPFS_sync_directory" > ~/.zen/ipfs.sync +######################################################################## +echo "INIT ~/.zen/ipfs/.${IPFSNODEID}" +######################################################################## +rm -Rf ~/.zen/ipfs +mkdir -p ~/.zen/ipfs/.${IPFSNODEID}/G1SSB ######################################################################## # Give $(hostname)-$ZUID to your (gchange friends) to add in Vstream Astroport and access your sharings # IPNS link to "pastebin list" http://localhost:8080/ipns/$IPNSKEY/xbian/$(hostname)-$ZUID ######################################################################## ZUID=$(~/.zen/astroport/zen/tools/diceware.sh 1 | xargs)$(hostname -I | cut -d ' ' -f 1 | cut -d "." -f 4 ) echo "CREATE ~/.zen/ipfs/xbian/$(hostname)-$ZUID" -touch ~/.zen/ipfs/xbian/$(hostname)-$ZUID # https://github.com/Kodi-vStream/venom-xbmc-addons/wiki/Voir-et-partager-sa-biblioth%C3%A8que-priv%C3%A9e#d%C3%A9clarer-des-films - -######################################################################## -echo "INIT ~/.zen/ipfs/.${IPFSNODEID}" -######################################################################## -mkdir -Rf ~/.zen/ipfs -mkdir -p ~/.zen/ipfs/.${IPFSNODEID}/G1SSB +touch ~/.zen/ipfs/xbian/$(hostname)-$ZUID +# https://github.com/Kodi-vStream/venom-xbmc-addons/wiki/Voir-et-partager-sa-biblioth%C3%A8que-priv%C3%A9e#d%C3%A9clarer-des-films echo "$(hostname)-$ZUID" > ~/.zen/ipfs/.${IPFSNODEID}/_xbian.zuid ######################################################################## diff --git a/cron_MINUTE.sh b/cron_MINUTE.sh index dc2437f..6aca241 100755 --- a/cron_MINUTE.sh +++ b/cron_MINUTE.sh @@ -95,6 +95,12 @@ fi [[ $(($minute % 12)) == 0 ]] && sleep $((1 + RANDOM % 10)) && $MY_PATH/zen/gchange_IPFS_swarm.sh & [[ $(($minute % 15)) == 0 ]] && sleep $((1 + RANDOM % 10)) && $MY_PATH/zen/ipfs_SWARM_refresh.sh & +# Transfert ~/astroport/files to IPFS and make Astroport(pastebin) index for Xbian/Vstream +if [[ "$timebar" == "03:03" ]]; then + $MY_PATH/zen/xbian_vstream.sh & +fi + + ## TODO investigate could breaks "ipfs p2p" forwards ? ################################################################## diff --git a/zen/xbian_vstream.sh b/zen/xbian_vstream.sh new file mode 100755 index 0000000..28d1509 --- /dev/null +++ b/zen/xbian_vstream.sh @@ -0,0 +1,29 @@ +#!/bin/bash +######################################################################## +# Author: Fred (support@qo-op.com) +# Version: 2020.12.05 +# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) +######################################################################## +# Transfert ~/astroport/files to IPFS and create Astroport(pastebin) index for Xbian/Vstream +######################################################################## +[[ -f ~/.zen/ipfs/.${IPFSNODEID}/_xbian.zuid ]] && echo "ERROR no _xbian.zuid" && exit 1 + +# GET xbian-ZUID +XZUID=$(cat ~/.zen/ipfs/.${IPFSNODEID}/_xbian.zuid) + +# CREATE Vstream/Pastebin file format +# https://github.com/Kodi-vStream/venom-xbmc-addons/wiki/Voir-et-partager-sa-biblioth%C3%A8que-priv%C3%A9e#d%C3%A9clarer-des-films + +ASHARE=$(ipfs add -rq ~/astroport/ | tail -n 1) + +[[ $ASHARE == "" ]] && echo "ERROR adding ~/astroport to IPFS" && exit 1 + +echo "TITLE;URLS" > ~/.zen/ipfs/xbian/$XZUID +for file in ~/astroport/* +do + filename=$(basename -- "$file") + extension="${filename##*.}" + filena="${filename%.*}" + echo "$filena;http://localhost:8080/ipfs/$ASHARE/$filename" + echo "$filena;http://localhost:8080/ipfs/$ASHARE/$filename" >> ~/.zen/ipfs/xbian/$XZUID +done