forked from axiom-team/astrXbian
Adding inotifywait task
This commit is contained in:
parent
75479575d3
commit
f5005cc0eb
|
@ -36,6 +36,7 @@ export YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep'
|
||||||
### MODIFY WITH GREAT CARE!!! MUST BE BUG FREE !!!!!
|
### MODIFY WITH GREAT CARE!!! MUST BE BUG FREE !!!!!
|
||||||
### EVERY STATION RUN THIS SCRIPT EVERY MINUTE.
|
### EVERY STATION RUN THIS SCRIPT EVERY MINUTE.
|
||||||
export isKodiRunning=$(ps auxf --sort=+utime | grep -w kodi | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1)
|
export isKodiRunning=$(ps auxf --sort=+utime | grep -w kodi | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1)
|
||||||
|
export isinotifywaitRunning=$(ps auxf --sort=+utime | grep -w inotifywait | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1)
|
||||||
|
|
||||||
# ? isNextcloudRunning=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1)
|
# ? isNextcloudRunning=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1)
|
||||||
### DETECT FLAVOURS (TODO: Publish and share into ipfs/.12D3KooW***/ )
|
### DETECT FLAVOURS (TODO: Publish and share into ipfs/.12D3KooW***/ )
|
||||||
|
@ -77,9 +78,22 @@ fi
|
||||||
[[ $(($minute % 12)) == 0 ]] && sleep $((1 + RANDOM % 10)) && $MY_PATH/zen/cesium_IPFS_swarm.sh &
|
[[ $(($minute % 12)) == 0 ]] && sleep $((1 + RANDOM % 10)) && $MY_PATH/zen/cesium_IPFS_swarm.sh &
|
||||||
[[ $(($minute % 15)) == 0 ]] && sleep $((1 + RANDOM % 10)) && $MY_PATH/zen/ipfs_SWARM_refresh.sh &
|
[[ $(($minute % 15)) == 0 ]] && sleep $((1 + RANDOM % 10)) && $MY_PATH/zen/ipfs_SWARM_refresh.sh &
|
||||||
|
|
||||||
|
#
|
||||||
|
# _ _
|
||||||
|
# __ _| |__ (_) __ _ _ __
|
||||||
|
# \ \/ / '_ \| |/ _` | '_ \
|
||||||
|
# > <| |_) | | (_| | | | |
|
||||||
|
# /_/\_\_.__/|_|\__,_|_| |_|
|
||||||
|
#
|
||||||
# Transfert ~/astroport/films and animes to IPFS and make Vstream/ASTROPORT indexes on IPNS
|
# Transfert ~/astroport/films and animes to IPFS and make Vstream/ASTROPORT indexes on IPNS
|
||||||
if [[ "$minute" == "03" ]]; then
|
# NOT DELETING SOURCE
|
||||||
$MY_PATH/zen/xbian_vstream.sh &
|
[[ $(($minute % 30 )) == 0 ]] && $MY_PATH/zen/xbian_vstream.sh &
|
||||||
|
|
||||||
|
# restart inotifywait DELETING SOURCE
|
||||||
|
if [[ "$timebar" == "03:03" ]]; then
|
||||||
|
# killall inotifywait
|
||||||
|
# inotifywait -e close_write -m ~/astroport/films | while read dir flags file; do $MY_PATH/zen/xbian_FASTRXBIAN.sh "$file"; done &
|
||||||
|
# inotifywait -e close_write -m ~/astroport/animes | while read dir flags file; do $MY_PATH/zen/xbian_AASTRXBIAN.sh "$file"; done &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
#!/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/animes to IPFS
|
||||||
|
# Create Astroport(pastebin) index for Xbian/Vstream
|
||||||
|
# ipfs publish with xbian key
|
||||||
|
########################################################################
|
||||||
|
[[ ! -f ~/.zen/ipfs/.${IPFSNODEID}/_xbian.zuid ]] && echo "ERROR no _xbian.zuid" && exit 1
|
||||||
|
|
||||||
|
mkdir -p ~/astroport/animes
|
||||||
|
|
||||||
|
# GET XZUID
|
||||||
|
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
|
||||||
|
|
||||||
|
### Animes
|
||||||
|
echo "ADDING ~/astroport/animes/ to IPFS. should be only one file"
|
||||||
|
echo "-----------------------------------------------------------------"
|
||||||
|
AASHARE=$(ipfs add -rq ~/astroport/animes/ | tail -n 1)
|
||||||
|
[[ $AASHARE == "" ]] && echo "ipfs add ERROR" && exit 1
|
||||||
|
|
||||||
|
echo "WRITE own ~/.zen/ipfs/xbian/A$XZUID Animes index"
|
||||||
|
echo "-----------------------------------------------------------------"
|
||||||
|
mkdir -p ~/.zen/ipfs/xbian
|
||||||
|
[[ ! -f ~/.zen/ipfs/xbian/A${XZUID} ]] && echo "CAT;TITLE;URLS" > ~/.zen/ipfs/xbian/A${XZUID}
|
||||||
|
|
||||||
|
file="$1"
|
||||||
|
filename=$(basename -- "$file")
|
||||||
|
extension="${filename##*.}"
|
||||||
|
filena="${filename%.*}"
|
||||||
|
echo "animes;$filena;http://localhost:8181/ipfs/$AASHARE/$filename" >> ~/.zen/ipfs/xbian/A${XZUID}
|
||||||
|
|
||||||
|
rm -f "~/astroport/animes/$file"
|
||||||
|
cat ~/.zen/ipfs/xbian/A${XZUID} | uniq > /tmp/A${XZUID}
|
||||||
|
mv /tmp/A${XZUID} ~/.zen/ipfs/xbian/A${XZUID}
|
||||||
|
|
||||||
|
ipfs cat /ipns/$NODEIPNS/xbian/A${XZUID}
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
echo "PUBLISH ~/.zen/ipfs to IPNS self"
|
||||||
|
echo "-----------------------------------------------------------------"
|
||||||
|
MIPFS=$(ipfs add -rHq ~/.zen/ipfs | tail -n 1)
|
||||||
|
NODEIPNS=$(ipfs name publish --quieter /ipfs/$MIPFS)
|
||||||
|
|
||||||
|
echo "SYNCing SWARM..."
|
||||||
|
echo "-----------------------------------------------------------------"
|
||||||
|
~/.zen/astrXbian/zen/ipfs_SWARM_refresh.sh
|
||||||
|
|
||||||
|
echo "PREPARE GLOBAL AASTRXBIAN (animes) global swarm list from ipfs_swarm"
|
||||||
|
echo "-----------------------------------------------------------------"
|
||||||
|
mkdir -p /tmp/xbian/
|
||||||
|
mkdir -p ~/.zen/xbian/
|
||||||
|
|
||||||
|
echo 'CAT;TITLE;URL' > ~/.zen/xbian/AASTRXBIAN
|
||||||
|
# Get all animes published in swarm
|
||||||
|
cat ~/.zen/ipfs_swarm/xbian/A* | grep -v -E 'CAT;TITLE;URL' >> /tmp/xbian/AASTRXBIAN
|
||||||
|
# Create global swarm animes index
|
||||||
|
cat /tmp/xbian/AASTRXBIAN | uniq > ~/.zen/xbian/AASTRXBIAN
|
||||||
|
|
||||||
|
echo "PUBLISH ~/.zen/xbian/ IPNS with 'xbian' key"
|
||||||
|
echo "-----------------------------------------------------------------"
|
||||||
|
ISTREAM=$(ipfs add -qrw ~/.zen/xbian/ | tail -n 1)
|
||||||
|
ipfs name publish -k xbian $ISTREAM
|
|
@ -0,0 +1,69 @@
|
||||||
|
#!/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/films to IPFS
|
||||||
|
# Create Astroport(pastebin) index for Xbian/Vstream
|
||||||
|
# ipfs publish ~/.zen/xbian/INDEXes with xbian key
|
||||||
|
########################################################################
|
||||||
|
[[ ! -f ~/.zen/ipfs/.${IPFSNODEID}/_xbian.zuid ]] && echo "ERROR no _xbian.zuid" && exit 1
|
||||||
|
|
||||||
|
mkdir -p ~/astroport/films
|
||||||
|
|
||||||
|
# GET XZUID
|
||||||
|
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
|
||||||
|
|
||||||
|
### Films
|
||||||
|
echo "ADDING ~/astroport/films/ to IPFS. should be only one file"
|
||||||
|
echo "-----------------------------------------------------------------"
|
||||||
|
AFSHARE=$(ipfs add -rq ~/astroport/films/ | tail -n 1)
|
||||||
|
[[ $AFSHARE == "" ]] && echo "ipfs add ERROR" && exit 1
|
||||||
|
|
||||||
|
echo "WRITE own ~/.zen/ipfs/xbian/F$XZUID Films index"
|
||||||
|
echo "-----------------------------------------------------------------"
|
||||||
|
mkdir -p ~/.zen/ipfs/xbian
|
||||||
|
[[ ! -f ~/.zen/ipfs/xbian/F${XZUID} ]] && echo "CAT;TITLE;URLS" > ~/.zen/ipfs/xbian/F${XZUID}
|
||||||
|
|
||||||
|
file="$1"
|
||||||
|
filename=$(basename -- "$file")
|
||||||
|
extension="${filename##*.}"
|
||||||
|
filena="${filename%.*}"
|
||||||
|
echo "films;$filena;http://localhost:8181/ipfs/$FASHARE/$filename" >> ~/.zen/ipfs/xbian/F${XZUID}
|
||||||
|
|
||||||
|
rm -f "~/astroport/films/$file"
|
||||||
|
cat ~/.zen/ipfs/xbian/F${XZUID} | uniq > /tmp/F${XZUID}
|
||||||
|
mv /tmp/F${XZUID} ~/.zen/ipfs/xbian/F${XZUID}
|
||||||
|
|
||||||
|
ipfs cat /ipns/$NODEIPNS/xbian/F${XZUID}
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
echo "PUBLISH ~/.zen/ipfs to IPNS self"
|
||||||
|
echo "-----------------------------------------------------------------"
|
||||||
|
MIPFS=$(ipfs add -rHq ~/.zen/ipfs | tail -n 1)
|
||||||
|
NODEIPNS=$(ipfs name publish --quieter /ipfs/$MIPFS)
|
||||||
|
|
||||||
|
echo "SYNCing SWARM..."
|
||||||
|
echo "-----------------------------------------------------------------"
|
||||||
|
~/.zen/astrXbian/zen/ipfs_SWARM_refresh.sh
|
||||||
|
|
||||||
|
echo "PREPARE GLOBAL FASTRXBIAN (animes) global swarm list from ipfs_swarm"
|
||||||
|
echo "-----------------------------------------------------------------"
|
||||||
|
mkdir -p /tmp/xbian/
|
||||||
|
mkdir -p ~/.zen/xbian/
|
||||||
|
|
||||||
|
echo 'CAT;TITLE;URL' > ~/.zen/xbian/FASTRXBIAN
|
||||||
|
# Get all animes published in swarm
|
||||||
|
cat ~/.zen/ipfs_swarm/xbian/F* | grep -v -E 'CAT;TITLE;URL' >> /tmp/xbian/FASTRXBIAN
|
||||||
|
# Create global swarm animes index
|
||||||
|
cat /tmp/xbian/FASTRXBIAN | uniq > ~/.zen/xbian/FASTRXBIAN
|
||||||
|
|
||||||
|
echo "PUBLISH ~/.zen/xbian/ IPNS with 'xbian' key"
|
||||||
|
echo "-----------------------------------------------------------------"
|
||||||
|
ISTREAM=$(ipfs add -qrw ~/.zen/xbian/ | tail -n 1)
|
||||||
|
ipfs name publish -k xbian $ISTREAM
|
||||||
|
|
|
@ -14,7 +14,9 @@ mkdir -p ~/astroport/films
|
||||||
mkdir -p ~/astroport/animes
|
mkdir -p ~/astroport/animes
|
||||||
|
|
||||||
## TODO: REMOVE SOURCE FILE and ONLY KEEP IPFS links
|
## TODO: REMOVE SOURCE FILE and ONLY KEEP IPFS links
|
||||||
## BE CAREFUL TO WAIT FOR FULL FILE (in case copying is in progress)
|
#inotifywait -e close_write -m ~/astroport/films | while read dir flags file; do
|
||||||
|
# ...do something with the file...
|
||||||
|
#done
|
||||||
|
|
||||||
# GET XZUID
|
# GET XZUID
|
||||||
XZUID=$(cat ~/.zen/ipfs/.${IPFSNODEID}/_xbian.zuid)
|
XZUID=$(cat ~/.zen/ipfs/.${IPFSNODEID}/_xbian.zuid)
|
||||||
|
|
Loading…
Reference in New Issue