AstXbian ipfs sharing

This commit is contained in:
qo-op 2020-12-08 02:22:33 +01:00
parent 418b0a27bb
commit 5846b4607b
3 changed files with 42 additions and 7 deletions

View File

@ -83,18 +83,18 @@ mv /tmp/config.ipfs ~/.ipfs/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
########################################################################

View File

@ -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 ?
##################################################################

29
zen/xbian_vstream.sh Executable file
View File

@ -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