forked from axiom-team/astroport
65 lines
2.5 KiB
Bash
Executable File
65 lines
2.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/films
|
|
mkdir -p ~/astroport/series
|
|
mkdir -p ~/astroport/animes
|
|
|
|
# GET xbian-ZUID
|
|
XZUID=$(cat ~/.zen/ipfs/.${IPFSNODEID}/_xbian.zuid)
|
|
|
|
echo "CREATE ~/.zen/ipfs/xbian/F$XZUID FROM ~/astroport/"
|
|
echo "-----------------------------------------------------------------"
|
|
# 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
|
|
|
|
echo "ADDING ~/astroport/films/ to IPFS"
|
|
echo "-----------------------------------------------------------------"
|
|
AFSHARE=$(ipfs add -rq ~/astroport/films/ | tail -n 1)
|
|
[[ $AFSHARE == "" ]] && echo "ipfs add ERROR" && exit 1
|
|
|
|
echo "WRITE ~/.zen/ipfs/xbian/F$XZUID Films index"
|
|
echo "-----------------------------------------------------------------"
|
|
mkdir -p ~/.zen/ipfs/xbian
|
|
echo "TITLE;URLS" > ~/.zen/ipfs/xbian/$XZUID
|
|
for file in ~/astroport/films/*
|
|
do
|
|
filename=$(basename -- "$file")
|
|
extension="${filename##*.}"
|
|
filena="${filename%.*}"
|
|
echo "$filena;http://localhost:8080/ipfs/$AFSHARE/$filename" >> ~/.zen/ipfs/xbian/F$XZUID
|
|
done
|
|
|
|
### TODO
|
|
### ADD Animes
|
|
### ADD Series
|
|
|
|
echo "PUBLISH ~/.zen/ipfs to IPNS self"
|
|
echo "-----------------------------------------------------------------"
|
|
MIPFS=$(ipfs add -rHq ~/.zen/ipfs | tail -n 1)
|
|
NODEIPNS=$(ipfs name publish --quieter /ipfs/$MIPFS)
|
|
|
|
ipfs cat /ipns/$NODEIPNS/xbian/F$XZUID
|
|
|
|
echo "SYNCing SWARM..."
|
|
echo "-----------------------------------------------------------------"
|
|
~/.zen/astroport/zen/ipfs_SWARM_refresh.sh
|
|
|
|
echo "PREPARE my local FASTRXBIAN (films) list from ipfs_swarm"
|
|
echo "-----------------------------------------------------------------"
|
|
mkdir -p /tmp/xbian/
|
|
echo 'TITLE;URL' > /tmp/xbian/FASTRXBIAN
|
|
cat ~/.zen/ipfs_swarm/xbian/F*-* | grep -v -E 'TITLE;URL' >> /tmp/xbian/FASTRXBIAN
|
|
|
|
echo "PUBLISH IPNS with 'xbian' key"
|
|
echo "-----------------------------------------------------------------"
|
|
ISTREAM=$(ipfs add -qrw /tmp/xbian/ | tail -n 1)
|
|
ipfs name publish -k xbian $ISTREAM
|