Browse Source

delayed new_file_in_astroport put in ~/.astroport/nf_$timestamp_cmd.sh

master
fred 2 months ago
parent
commit
2d978f0aca
  1. 28
      ajouter_video.sh
  2. 14
      zen/new_file_in_astroport.sh

28
ajouter_video.sh

@ -526,8 +526,14 @@ echo "new_file_in_astroport.sh \"$HOME/astroport/${CAT}/${MEDIAID}/\" \"${FILE_N
########################################################################
[[ "$CAT" == "film" || "$CAT" == "serie" ]] && CHOICE="TMDB"
~/.zen/astrXbian/zen/new_file_in_astroport.sh "$HOME/astroport/${CAT}/${MEDIAID}/" "${FILE_NAME}" > /tmp/${MEDIAKEY}.log 2>&1
[ ! $? == 0 ] && zenity --warning --width 300 --text "Désolé une erreur est survenue... Signalez ce log /tmp/${MEDIAKEY}.log sur https://git.p2p.legal/axiom-team/astrXbian" && exit 1
echo "MEDIAKEY=${MEDIAKEY}
~/.zen/astrXbian/zen/new_file_in_astroport.sh \"$HOME/astroport/${CAT}/${MEDIAID}/\" \"${FILE_NAME}\"
rm -f /tmp/\${MEDIAKEY}.pass
rm -f /tmp/\${MEDIAKEY}.dunikey ## REMOVE KEYS
" >> ~/astroport/nf_$(date -u +%s%N | cut -b1-13)_cmd.sh
# ~/.zen/astrXbian/zen/new_file_in_astroport.sh "$HOME/astroport/${CAT}/${MEDIAID}/" "${FILE_NAME}" > /tmp/${MEDIAKEY}.log 2>&1
# [ ! $? == 0 ] && zenity --warning --width 300 --text "Désolé une erreur est survenue... Signalez ce log /tmp/${MEDIAKEY}.log sur https://git.p2p.legal/axiom-team/astrXbian" && exit 1
########################################################################
########################################################################
########################################################################
@ -547,22 +553,20 @@ echo "# ZENBALANCE for ${MEDIAKEY} , WALLET $MEDIAPUBKEY"
FILE_SIZE=$(cat $HOME/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/.filesize)
FILE_SIZE=$(echo "${FILE_SIZE}" | awk '{ split( "B KB MB GB TB PB" , v ); s=1; while( $1>1024 ){ $1/=1024; s++ } printf "%.2f %s", $1, v[s] }')
G1BALANCE=$(~/.zen/astrXbian/zen/jaklis/jaklis.py balance -p $G1PUB) && [[ "$G1BALANCE" == "null" ]] && G1BALANCE=0 || G1BALANCE=$(echo "$G1BALANCE" | cut -d '.' -f 1)
if [[ $G1BALANCE -gt 0 ]]; then
[ ! $2 ] && G1AMOUNT=$(zenity --entry --width 400 --title "VIRER DE LA MONNAIE LIBRE AU MEDIAKEY (MAX $G1BALANCE)" --text "Combien de JUNE (G1) souhaitez-vous offrir à ce MEDIA ($FILE_SIZE)" --entry-text="")
[[ ! "$G1AMOUNT" =~ ^[0-9]+$ ]] && G1AMOUNT=0
~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey pay -p ${MEDIAPUBKEY} -a $G1AMOUNT -c "#ASTROPORT:${MEDIAKEY} DON"
ZENBALANCE=$(echo "100 * $G1AMOUNT" | bc -l | cut -d '.' -f 1)
else
#G1BALANCE=$(~/.zen/astrXbian/zen/jaklis/jaklis.py balance -p $G1PUB) && [[ "$G1BALANCE" == "null" ]] && G1BALANCE=0 || G1BALANCE=$(echo "$G1BALANCE" | cut -d '.' -f 1)
#if [[ $G1BALANCE -gt 0 ]]; then
# [ ! $2 ] && G1AMOUNT=$(zenity --entry --width 400 --title "VIRER DE LA MONNAIE LIBRE AU MEDIAKEY (MAX $G1BALANCE)" --text "Combien de JUNE (G1) souhaitez-vous offrir à ce MEDIA ($FILE_SIZE)" --entry-text="")
# [[ ! "$G1AMOUNT" =~ ^[0-9]+$ ]] && G1AMOUNT=0
# ~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey pay -p ${MEDIAPUBKEY} -a $G1AMOUNT -c "#ASTROPORT:${MEDIAKEY} DON"
# ZENBALANCE=$(echo "100 * $G1AMOUNT" | bc -l | cut -d '.' -f 1)
#else
ZENBALANCE=0
fi
#fi
########################################################################
########################################################################
echo "${MEDIAKEY} = RECORDED TO IPFS."
cat /tmp/${MEDIAKEY}.log
rm -f /tmp/${MEDIAKEY}.pass
rm -f /tmp/${MEDIAKEY}.dunikey ## REMOVE KEYS
if [ ! $2 ]; then
[ $? == 0 ] && zenity --warning --width 300 --text "OK! MEDIA transféré ($ZENBALANCE ZEN). URL LOCALHOST prête à coller (/tmp/${MEDIAKEY}.log)" && exit 0 \

14
zen/new_file_in_astroport.sh

@ -1,4 +1,4 @@
#!/bin/bash -x
#!/bin/bash
########################################################################
# Author: Fred (support@qo-op.com)
# Version: 0.3
@ -10,6 +10,10 @@
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l)
[[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0
start=`date +%s`
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
IPFSNODEID=$(ipfs id -f='<id>\n')
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2)
@ -310,7 +314,7 @@ IPNSLINK=$(ipfs key list -l | grep ${MEDIAKEY} | cut -d ' ' -f 1)
| sed "s/\${XZUID}/$XZUID/g" \
| sed "s/\${G1PUB}/$G1PUB/g" \
| sed "s/\${TITLE}/$TITLE/g" \
> ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/index.html
> ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/index.html
## SECOND REDIRECT PAGE ${MEDIAKEY}/${G1PUB}/index.html
@ -324,7 +328,7 @@ IPNSLINK=$(ipfs key list -l | grep ${MEDIAKEY} | cut -d ' ' -f 1)
| sed "s/\${XZUID}/$XZUID/g" \
| sed "s/\${IPFSREPFILEID}/$IPFSREPFILEID/g" \
| sed "s/\${URLENCODE_FILE_NAME}/$URLENCODE_FILE_NAME/g" \
> ~/.zen/ipfs/.${IPFSNODEID}/KEY/${mediakey}/${G1PUB}/index.html
> ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
# echo "<meta http-equiv=\"Refresh\" content=\"0;URL=http://127.0.0.1:8181/ipfs/$IPFSREPFILEID/$URLENCODE_FILE_NAME\">" > ~/.zen/ipfs/.${IPFSNODEID}/KEY/${MEDIAKEY}/${G1PUB}/index.html
@ -434,4 +438,8 @@ echo "DUNIKEY PASS $PASS"
echo "NEW $TYPE ($file) ADDED. http://127.0.0.1:8181/ipfs/$IPFSREPFILEID/$URLENCODE_FILE_NAME"
echo "INDEX UPDATED : http://127.0.0.1:8181/ipns/${IPFSNODEID}/.${IPFSNODEID}/${PREFIX}ASTRXBIAN"
echo "VIDEO IPNS LINK : http://127.0.0.1:8181/ipns/$KEY/$G1PUB/"
echo "#### EXCECUTION TIME"
end=`date +%s`
echo Execution time was `expr $end - $start` seconds.
echo "########################################################################"
exit 0

Loading…
Cancel
Save