diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/rename_retroarch_arcade_thumbnails.sh b/rename_retroarch_arcade_thumbnails.sh new file mode 100755 index 0000000..21bf0cb --- /dev/null +++ b/rename_retroarch_arcade_thumbnails.sh @@ -0,0 +1,51 @@ +#!/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 \ No newline at end of file