Skip to content

Instantly share code, notes, and snippets.

@dashdanw
Created October 20, 2018 22:28
Show Gist options
  • Save dashdanw/e7c2965fc2849a31034419d0d508005d to your computer and use it in GitHub Desktop.
Save dashdanw/e7c2965fc2849a31034419d0d508005d to your computer and use it in GitHub Desktop.
#!/bin/bash
if [[ -z $(pip3 show scdl) ]]; then
sudo pip3 install scdl
fi
SCDL_TARGET="$1"
shift
SCDL_ADD_ARGS="$@"
SCDL_TARGET_DIR="$(pwd)/$SCDL_TARGET"
SCDL_PREFIX="scdl -l https://soundcloud.com/$SCDL_TARGET"
SCDL_SUFFIX="-c --addtofile --min-size 1.8m --max-size 20m"
echo -e "Downloading everything from $SCDL_TARGET to $SCDL_TARGET_DIR . . . . \n\n"
mkdir -p $SCDL_TARGET_DIR
SCDL_FLAGS=( "uploads:-t" "favorites:-f" "commented:-C" "playlists:-p" )
for SCDL_TYPE_FLAG in "${SCDL_FLAGS[@]}"; do
SCDL_TYPE=$(echo $SCDL_TYPE_FLAG | cut -f1 -d":")
SCDL_FLAG=$(echo $SCDL_TYPE_FLAG | cut -f2 -d":")
SCDL_TARGET_TYPE_DIR=$SCDL_TARGET_DIR/$SCDL_TYPE
mkdir -p $SCDL_TARGET_TYPE_DIR
SCDL_CMD="$SCDL_PREFIX $SCDL_FLAG --path $SCDL_TARGET_TYPE_DIR $SCDL_SUFFIX $SCDL_ADD_ARGS"
echo "$SCDL_CMD"
eval $SCDL_CMD
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment