forked from axiom-team/astroport
41 lines
1.5 KiB
Bash
Executable File
41 lines
1.5 KiB
Bash
Executable File
#!/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
|
|
|
|
mkdir -p ~/astroport/
|
|
# GET xbian-ZUID
|
|
XZUID=$(cat ~/.zen/ipfs/.${IPFSNODEID}/_xbian.zuid)
|
|
|
|
echo "CREATE ~/.zen/ipfs/xbian/$XZUID FROM ~/astroport/"
|
|
# 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
|
|
|
|
mkdir -p ~/.zen/ipfs/xbian
|
|
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" >> ~/.zen/ipfs/xbian/$XZUID
|
|
done
|
|
|
|
## SHARE ~/.zen/ipfs to my SWARM
|
|
IWALLETS=$(ipfs add -rHq ~/.zen/ipfs | tail -n 1)
|
|
NODEIPNS=$(ipfs name publish --quieter /ipfs/$IWALLETS)
|
|
|
|
ipfs cat /ipns/$NODEIPNS/xbian/$XZUID
|
|
|
|
~/.zen/astroport/zen/ipfs_SWARM_refresh.sh
|
|
|