case $CAT

This commit is contained in:
qo-op 2021-03-03 13:10:55 +01:00
parent 53500176d0
commit 9ecb0ad279
1 changed files with 17 additions and 29 deletions

View File

@ -39,30 +39,7 @@ large=$((width-300))
haut=$((height-200)) haut=$((height-200))
######################################################################## ########################################################################
# CHECK for Kodi + astroport.py
IPFSNODEID=$(ipfs id -f='<id>\n') IPFSNODEID=$(ipfs id -f='<id>\n')
if [[ -f ~/.zen/astroport.py ]]
then
## NORMAL behaviour (ISOConfig.sh made the Job)
## astroport.py already created (refresh vstream plugin,in case update erase it)
cp ~/.zen/astroport.py ~/.kodi/addons/plugin.video.vstream/resources/sites/astroport.py
else
## astroport.py missing
cp -f ~/.zen/astrXbian/.install/.kodi/addons/plugin.video.vstream/resources/sites/astroport.py ~/.zen/astroport.py
## CONFIGURE ASTROPORT ACCOUNT
# Make xbian G1BILLET or ASK for it?
zenity --warning --width 300 --text "Vous devez avoir un compte Gchange.fr pour utiliser ASTROPORT / KODI"
zenity --question --width 300 --text "Avez vous déjà un compte sur Gchange.fr ?"
[ $? == 1 ] && xdg-open "https://gchange.fr"
#sed -i "s/_PROFIL_/$XZUID/g" ~/.zen/astroport.py
#sed -i "s/_LOGIN_/$salt/g" ~/.zen/astroport.py
#sed -i "s/_MDP_/$pepper/g" ~/.zen/astroport.py
sed -i "s/_IPFSNODEID_/$IPFSNODEID/g" ~/.zen/astroport.py
cp ~/.zen/astroport.py ~/.kodi/addons/plugin.video.vstream/resources/sites/astroport.py
fi
## GET XZUID
[[ -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title ]] && XZUID=$(cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title) || XZUID=$(hostname) [[ -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title ]] && XZUID=$(cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title) || XZUID=$(hostname)
zenity --warning --width 300 --text "Ajoutez une vidéo à ASTROPORT/KODI" zenity --warning --width 300 --text "Ajoutez une vidéo à ASTROPORT/KODI"
@ -76,11 +53,11 @@ CAT=$(echo "${CHOICE}" | awk '{print tolower($0)}')
PREFIX=$(echo "${CAT}" | head -c 1 | awk '{ print toupper($0) }' ) # ex: F, S, A, Y PREFIX=$(echo "${CAT}" | head -c 1 | awk '{ print toupper($0) }' ) # ex: F, S, A, Y
[[ $PREFIX == "" ]] && exit 1 [[ $PREFIX == "" ]] && exit 1
case ${PREFIX} in case ${CAT} in
######################################################################## ########################################################################
# CASE ## YOUTUBE # CASE ## YOUTUBE
######################################################################## ########################################################################
Y) youtube)
YTURL=$(zenity --entry --width 300 --title "Lien ou identifiant à copier" --text "Copiez le lien (URL) ou l'ID de la vidéo" --entry-text="") YTURL=$(zenity --entry --width 300 --title "Lien ou identifiant à copier" --text "Copiez le lien (URL) ou l'ID de la vidéo" --entry-text="")
[[ $YTURL == "" ]] && exit 1 [[ $YTURL == "" ]] && exit 1
@ -119,7 +96,7 @@ rm -Rf ${YTEMP}
######################################################################## ########################################################################
# CASE ## MP3 # CASE ## MP3
######################################################################## ########################################################################
M) mp3)
# Create TEMP directory # Create TEMP directory
YTEMP="/tmp/$(date -u +%s%N | cut -b1-13)" YTEMP="/tmp/$(date -u +%s%N | cut -b1-13)"
@ -166,11 +143,12 @@ GROUPES="${XZUID}"
rm -Rf ${YTEMP} rm -Rf ${YTEMP}
;; ;;
######################################################################## ########################################################################
# CASE ## DEFAULT # CASE ## film serie anime
######################################################################## ########################################################################
*) film | serie | anime)
# SELECT FILE TO ADD TO ASTROPORT/KODI # SELECT FILE TO ADD TO ASTROPORT/KODI
FILE=$(zenity --file-selection --title="Sélectionner le fichier à ajouter") FILE=$(zenity --file-selection --title="Sélectionner le fichier à ajouter")
@ -269,6 +247,16 @@ mkdir -p ~/astroport/${CAT}/${TMDB}/
mv "${FILE_PATH}/${FILE_NAME}" "$HOME/astroport/${CAT}/${TMDB}/${TITLE}.${FILE_EXT}" && zenity --warning --width ${large} --text "Votre fichier ~/astroport/${CAT}/${TMDB}/${TITLE}.${FILE_EXT} est prêt à embarquer. Cliquez sur OK puis patientez quelques minutes..." mv "${FILE_PATH}/${FILE_NAME}" "$HOME/astroport/${CAT}/${TMDB}/${TITLE}.${FILE_EXT}" && zenity --warning --width ${large} --text "Votre fichier ~/astroport/${CAT}/${TMDB}/${TITLE}.${FILE_EXT} est prêt à embarquer. Cliquez sur OK puis patientez quelques minutes..."
FILE_NAME="${TITLE}.${FILE_EXT}" FILE_NAME="${TITLE}.${FILE_EXT}"
;; ;;
########################################################################
# CASE ## DEFAULT
########################################################################
*)
zenity --warning --width ${large} --text "Impossible d'interpréter votre commande $CAT"
;;
esac esac
## TRANSMIT "ajouter_video.txt" ## TRANSMIT "ajouter_video.txt"