forked from axiom-team/astrXbian
add URL support
This commit is contained in:
parent
001a3b90f5
commit
d926f2818a
|
@ -28,11 +28,15 @@ ME="${0##*/}"
|
|||
[[ $(which xdpyinfo) == "" ]] && echo "ERREUR! Installez x11-utils" && echo "sudo apt install x11-utils" && exit 1
|
||||
|
||||
URL="$1"
|
||||
[ $URL ] && echo "URL: $URL" \
|
||||
[ $URL ] && echo "URL: $URL" && REVSOURCE="$(echo "$URL" | awk -F/ '{print $3}' | rev)_"\
|
||||
&& IMPORT=$(zenity --entry --width 640 --title="$URL => Astroport" --text="Choisissez comment copier cette source" --entry-text="Video" MP3 Web) \
|
||||
&& [[ $IMPORT == "Video" ]] && IMPORT="Youtube" \
|
||||
&& CHOICE="$IMPORT"
|
||||
|
||||
|
||||
|
||||
[[ $CHOICE == "Web" ]] && CHOICE=$(zenity --entry --width 640 --title="$URL => Astroport" --text="Cette source WEB est à encrigistrer comme " --entry-text="Page" WebSite)
|
||||
|
||||
# REMOVE GtkDialog errors for zenity
|
||||
shopt -s expand_aliases
|
||||
alias zenity='zenity 2> >(grep -v GtkDialog >&2)'
|
||||
|
@ -49,7 +53,7 @@ IPFSNODEID=$(ipfs id -f='<id>\n')
|
|||
[[ -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title ]] && XZUID="$(cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title)" || XZUID="$(cat /etc/hostname)"
|
||||
[[ -f ~/.zen/ipfs/.$IPFSNODEID/_xbian.zuid ]] && AXID=$(cat ~/.zen/ipfs/.$IPFSNODEID/_xbian.zuid)
|
||||
|
||||
zenity --warning --width 300 --text "Ajoutez un MEDIA dans ASTROPORT"
|
||||
# zenity --warning --width 300 --text "Ajoutez un MEDIA dans ASTROPORT"
|
||||
|
||||
|
||||
########################################################################
|
||||
|
@ -90,7 +94,7 @@ CAT=$(echo "${CHOICE}" | awk '{print tolower($0)}')
|
|||
# UPPER CARACTERS
|
||||
CHOICE=$(echo "${CAT}" | awk '{print toupper($0)}')
|
||||
|
||||
PREFIX=$(echo "${CAT}" | head -c 1 | awk '{ print toupper($0) }' ) # ex: F, S, A, Y, M ...
|
||||
PREFIX=$(echo "${CAT}" | head -c 1 | awk '{ print toupper($0) }' ) # ex: F, S, A, Y, M ... P W
|
||||
[[ $PREFIX == "" ]] && exit 1
|
||||
|
||||
########################################################################
|
||||
|
@ -107,8 +111,6 @@ case ${CAT} in
|
|||
########################################################################
|
||||
youtube)
|
||||
|
||||
zenity --warning --width 600 --text 'DEVELOPPEMENT . ZONE . Please Participate https://git.p2p.legal'
|
||||
|
||||
YTURL="$URL"
|
||||
[[ $YTURL == "" ]] && YTURL=$(zenity --entry --width 300 --title "Lien ou identifiant à copier" --text "Indiquez le lien (URL) ou l'ID de la vidéo" --entry-text="")
|
||||
[[ $YTURL == "" ]] && exit 1
|
||||
|
@ -133,7 +135,6 @@ JSON_FILE=$(echo ${FILE_NAME} | sed "s/${FILE_EXT}/json/g")
|
|||
YID=$(echo "${FILE_NAME}" | cut -d "&" -f 1)
|
||||
YNAME=$(echo "${FILE_NAME}" | cut -d "&" -f 2- | sed "s/[(][^)]*[)]//g" | sed -e 's/[^A-Za-z0-9._-]/_/g' | sed -e 's/__/_/g' ) # Remove YoutubeID_ and (what is in perentheses)
|
||||
[[ $(which detox) ]] && YNAME=$(echo "${FILE_NAME}" | cut -d "&" -f 2- | detox --inline)
|
||||
[[ $IMPORT != "" ]] && REVSOURCE="$(echo "$YTURL" | awk -F/ '{print $3}' | rev)_"
|
||||
MEDIAID="$REVSOURCE${YID}"
|
||||
TITLE="${YNAME%.*}"
|
||||
MEDIAKEY="YOUTUBE_${MEDIAID}"
|
||||
|
@ -183,6 +184,43 @@ rm -Rf ${YTEMP}
|
|||
|
||||
;;
|
||||
|
||||
########################################################################
|
||||
# CASE ## WEB
|
||||
web)
|
||||
|
||||
zenity --warning --width 600 --text 'DEVELOPPEMENT . ZONE . Please Participate https://git.p2p.legal'
|
||||
|
||||
## httrack all web site
|
||||
[[ ! $(which httrack) ]] && zenity --warning --width ${large} --text "Utilitaire de copie de site web absent.. Lancez la commande 'sudo apt install httrack'" && exit 1
|
||||
echo "httrack --mirror $URL"
|
||||
;;
|
||||
|
||||
|
||||
########################################################################
|
||||
# CASE ## PAGE
|
||||
page)
|
||||
|
||||
zenity --warning --width 600 --text 'DEVELOPPEMENT . ZONE . Please Participate https://git.p2p.legal'
|
||||
|
||||
## record one page only
|
||||
[[ ! $(which chromium) ]] && zenity --warning --width ${large} --text "Utilitaire de copie de page web absent.. Lancez la commande 'sudo apt install chromium'" && exit 1
|
||||
cd /tmp/ && rm output.pdf && chromium --headless --no-sandbox --print-to-pdf $URL
|
||||
|
||||
TITLE=$(zenity --entry --width 480 --title "Titre" --text "Indiquez le titre de la vidéo" --entry-text="${URL}")
|
||||
[[ $TITLE == "" ]] && exit 1
|
||||
FILE_NAME="$(echo "${TITLE}" | detox --inline).pdf" ## TODO make it better
|
||||
|
||||
MEDIAID="$REVSOURCE$(echo "${TITLE}" | detox --inline)"
|
||||
MEDIAKEY="PAGE_${MEDIAID}"
|
||||
FILE_PATH="$HOME/astroport/youtube/$MEDIAID"
|
||||
mkdir -p ${FILE_PATH} && mv -f output.pdf ${FILE_PATH}/${FILE_NAME}
|
||||
|
||||
|
||||
echo "page;${MEDIAID};${YEAR};${TITLE};${SAISON};${GENRES};_IPNSKEY_;${RES};/ipfs/_IPFSREPFILEID_/$FILE_NAME" > ~/astroport/${CAT}/${MEDIAID}/ajouter_video.txt
|
||||
|
||||
|
||||
;;
|
||||
|
||||
########################################################################
|
||||
# CASE ## MP3
|
||||
# _____
|
||||
|
@ -230,7 +268,7 @@ FILE_EXT="${FILE_NAME##*.}"
|
|||
|
||||
YID=$(echo "${FILE_NAME}" | cut -d "&" -f 1)
|
||||
YNAME=$(echo "${FILE_NAME}" | cut -d "&" -f 2- | sed "s/[(][^)]*[)]//g" | sed -e 's/[^A-Za-z0-9._-]/_/g' | sed -e 's/__/_/g') # Remove YoutubeID_ and (what is in perentheses)
|
||||
[[ $(which detox) ]] && YNAME=$(echo "${FILE_NAME}" | cut -d "&" -f 2- | detox --inline)
|
||||
[[ $(which detox) ]] && YNAME="$(echo "${FILE_NAME}" | cut -d "&" -f 2- | detox --inline)"
|
||||
|
||||
[[ ! $islink && "$song" != "" ]] && FILE_PATH="$HOME/astroport/$CAT/$artist/_o-o_" \
|
||||
|| FILE_PATH="$HOME/astroport/$CAT/${YID}"
|
||||
|
@ -452,8 +490,6 @@ echo "${CAT};${MEDIAID};${YEAR};${TITLE};${SAISON};${GENRES};${GROUPES};${RES};/
|
|||
zenity --warning --width ${large} --text "UTILISEZ download_from_kodi_log.sh en ligne de commande..."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
;;
|
||||
|
||||
########################################################################
|
||||
|
@ -472,7 +508,7 @@ esac
|
|||
# ADD $FILE to IPFS / ASTROPORT / KODI
|
||||
echo "new_file_in_astroport.sh \"$HOME/astroport/${CAT}/${MEDIAID}/\" \"${FILE_NAME}\""
|
||||
[[ -f ~/astroport/${CAT}/${MEDIAID}/ajouter_video.txt ]] && cat ~/astroport/${CAT}/${MEDIAID}/ajouter_video.txt
|
||||
[[ -f ~/astroport/${CAT}/${MEDIAID}/video.json ]] && cat ~/astroport/${CAT}/${MEDIAID}/video.json
|
||||
# LOG NOISE # [[ -f ~/astroport/${CAT}/${MEDIAID}/video.json ]] && cat ~/astroport/${CAT}/${MEDIAID}/video.json
|
||||
|
||||
########################################################################
|
||||
########################################################################
|
||||
|
|
Loading…
Reference in New Issue