From b3ae7d8c427f9dc45db9eb7117cb2b609e4bfae5 Mon Sep 17 00:00:00 2001 From: Colin P. McCabe Date: Wed, 1 Mar 2023 13:14:00 -0800 Subject: [PATCH] Rename mtube.sh to tube, use yt-dlp --- mtube.sh | 21 --------------------- tube | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 21 deletions(-) delete mode 100755 mtube.sh create mode 100755 tube diff --git a/mtube.sh b/mtube.sh deleted file mode 100755 index 2343649..0000000 --- a/mtube.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -die() { - echo $@ - exit 1 -} - -MTUBE_ARGS=$@ -MTUBE_DIR="./mtube-$$" -ABSPATH_MTUBE_DIR="$(pwd)/${MTUBE_DIR}" -mkdir "${MTUBE_DIR}" || die "failed to mkdir ${MTUBE_DIR}" -trap "rm -rf -- \"${ABSPATH_MTUBE_DIR}\"" EXIT -pushd "${MTUBE_DIR}" || die "failed to pushed ${MTUBE_DIR}" -youtube-dl -f bestaudio -- ${MTUBE_ARGS} || die "youtube-dl failed" -music-to-mp3.sh * || die "music-to-mp3.sh failed" -shopt -s extglob -rm !(*.mp3) || die "rm of non-mp3 files failed" -set -x -mv *.mp3 .. -set +x -popd || die "failed to popd" diff --git a/tube b/tube new file mode 100755 index 0000000..ddc9731 --- /dev/null +++ b/tube @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +die() { + echo $@ + exit 1 +} + +MTUBE_ARGS=$@ +MTUBE_DIR="./mtube-$$" +ABSPATH_MTUBE_DIR="$(pwd)/${MTUBE_DIR}" +mkdir "${MTUBE_DIR}" || die "failed to mkdir ${MTUBE_DIR}" +trap "rm -rf -- \"${ABSPATH_MTUBE_DIR}\"" EXIT +pushd "${MTUBE_DIR}" || die "failed to pushed ${MTUBE_DIR}" +yt-dlp -f bestaudio -- ${MTUBE_ARGS} || die "yt-dlp failed" +music-to-mp3.sh * || die "music-to-mp3.sh failed" +shopt -s extglob +rm !(*.mp3) || die "rm of non-mp3 files failed" +set -x +mv *.mp3 .. +set +x +popd || die "failed to popd" -- 1.6.6.rc1.39.g9a42