forked from axiom-team/astrXbian
correct MP3 section
This commit is contained in:
parent
98092ac305
commit
072eb6d02b
|
@ -106,7 +106,7 @@ rm -Rf ${YTEMP}
|
||||||
YTEMP="/tmp/$(date -u +%s%N | cut -b1-13)"
|
YTEMP="/tmp/$(date -u +%s%N | cut -b1-13)"
|
||||||
mkdir -p ${YTEMP}
|
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
|
[[ $artist == "" ]] && exit 1
|
||||||
|
|
||||||
## CHECK if artist is LINK or ID
|
## CHECK if artist is LINK or ID
|
||||||
|
@ -124,10 +124,11 @@ fi
|
||||||
|
|
||||||
# Download mp3 from 1st youtube search video result
|
# Download mp3 from 1st youtube search video result
|
||||||
/usr/local/bin/youtube-dl --default-search ytsearch1: \
|
/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 \
|
--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"
|
--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.
|
# Get filename, extract ID, make destination dir and move copy.
|
||||||
YFILE=$(ls -t ${YTEMP} | head -n 1)
|
YFILE=$(ls -t ${YTEMP} | head -n 1)
|
||||||
FILE_NAME="$(basename "${YFILE}")"
|
FILE_NAME="$(basename "${YFILE}")"
|
||||||
|
@ -136,7 +137,7 @@ FILE_EXT="${FILE_NAME##*.}"
|
||||||
YID=$(echo "${FILE_NAME}" | cut -d "_" -f 1)
|
YID=$(echo "${FILE_NAME}" | cut -d "_" -f 1)
|
||||||
YNAME=$(echo "${FILE_NAME}" | cut -d "_" -f 2-)
|
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}"
|
|| FILE_PATH="$HOME/astroport/$CAT/${YID}"
|
||||||
|
|
||||||
mkdir -p "${FILE_PATH}" && mv -f ${YTEMP}/* "${FILE_PATH}/"
|
mkdir -p "${FILE_PATH}" && mv -f ${YTEMP}/* "${FILE_PATH}/"
|
||||||
|
@ -147,8 +148,10 @@ GENRES="[MP3]"
|
||||||
GROUPES="${XZUID}"
|
GROUPES="${XZUID}"
|
||||||
|
|
||||||
rm -Rf ${YTEMP}
|
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
|
exit 0
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in New Issue