diff --git a/ajouter_video.sh b/ajouter_video.sh index f1b6cf2..cb1035c 100755 --- a/ajouter_video.sh +++ b/ajouter_video.sh @@ -106,7 +106,7 @@ rm -Rf ${YTEMP} YTEMP="/tmp/$(date -u +%s%N | cut -b1-13)" mkdir -p ${YTEMP} -artist=$(zenity --entry --width 300 --title "Extraction MP3 depuis Youtube" --text "Artiste recherché ou Lien Youtube" --entry-text="") +artist=$(zenity --entry --width 400 --title "Extraction MP3 depuis Youtube" --text "Artiste recherché ou Lien Youtube" --entry-text="") [[ $artist == "" ]] && exit 1 ## CHECK if artist is LINK or ID @@ -124,10 +124,11 @@ fi # Download mp3 from 1st youtube search video result /usr/local/bin/youtube-dl --default-search ytsearch1: \ ---ignore-errors --no-mtime \ +--ignore-errors --no-mtime --write-info-json \ --embed-thumbnail --metadata-from-title "%(artist)s - %(title)s" --add-metadata \ --extract-audio --audio-format mp3 -o "${YTEMP}/%(id)s_%(title)s.%(ext)s" "$artist $song" +ls ${YTEMP} # Get filename, extract ID, make destination dir and move copy. YFILE=$(ls -t ${YTEMP} | head -n 1) FILE_NAME="$(basename "${YFILE}")" @@ -136,7 +137,7 @@ FILE_EXT="${FILE_NAME##*.}" YID=$(echo "${FILE_NAME}" | cut -d "_" -f 1) YNAME=$(echo "${FILE_NAME}" | cut -d "_" -f 2-) -[[ ! $islink ]] && FILE_PATH="$HOME/astroport/$CAT/$artist/$song" \ +[[ ! $islink && "$song" != "" ]] && FILE_PATH="$HOME/astroport/$CAT/$artist/_o-o_" \ || FILE_PATH="$HOME/astroport/$CAT/${YID}" mkdir -p "${FILE_PATH}" && mv -f ${YTEMP}/* "${FILE_PATH}/" @@ -147,8 +148,10 @@ GENRES="[MP3]" GROUPES="${XZUID}" rm -Rf ${YTEMP} -zenity --warning --width ${large} --text "DEBUG: MP3 copié dans ${FILE_PATH}" - +# zenity --warning --width ${large} --text "MP3 copié" +echo "~/.zen/astrXbian/zen/new_mp3_in_astroport.sh \"${FILE_PATH}/\" \"${FILE_NAME}\"" +~/.zen/astrXbian/zen/new_mp3_in_astroport.sh "${FILE_PATH}/" "${FILE_NAME}" > /tmp/${CAT}_${TMDB}.log 2>&1 +cat /tmp/${CAT}_${TMDB}.log exit 0 ;;