#!/bin/bash function help_message() { echo "$USAGE" } readonly USAGE=" USAGE: $(basename "$0") [arcade_playlist] [thumbnail_folder]" # check if there are all the parameters if [ "$#" -ne 2 ]; then help_message exit 0 fi readonly ARCADE_PLAYLIST="$1" readonly THUMBNAIL_FOLDER="$2" readonly TEMP_FILE="${THUMBNAIL_FOLDER}"/temp if ! test -d "${THUMBNAIL_FOLDER}"; then echo "${THUMBNAIL_FOLDER}" does not exists exit 0 fi if ! test -f "${ARCADE_PLAYLIST}"; then echo "${ARCADE_PLAYLIST}" does not exists exit 0 fi if test -d "${THUMBNAIL_FOLDER}".bak; then echo deleted "${THUMBNAIL_FOLDER}".bak rm -rdf "${THUMBNAIL_FOLDER:?}" fi if ! test -d "${THUMBNAIL_FOLDER}".bak; then #echo created "${THUMBNAIL_FOLDER}".bak clear fi readonly CURRENT_DIR=$(pwd) cd "${THUMBNAIL_FOLDER}" || return rm -v "${TEMP_FILE}" #grep -e \"label\" -e \"path\" "${ARCADE_PLAYLIST}" | sed s-"$(printf '\r')"-OO-g # | sed -E 's- \"path\": \"-cp \"-g' | sed -E 's-^ \"label\": -X-g' | sed -E 's-,$-X-g' > "${TEMP_FILE}" while IFS= read -r line do echo "$line" done < "$input" cd "${CURRENT_DIR}" || return date