From 50e1efd31c9d3f1d65580f99490243144300962f Mon Sep 17 00:00:00 2001 From: phil Date: Thu, 3 Apr 2025 11:08:04 +0200 Subject: [PATCH] Update readme and rename output to library --- .gitignore | 1 + README.md | 2 +- mopa_loader.sh | 22 +++++++++++----------- 3 files changed, 13 insertions(+), 12 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fd5106f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_STORE diff --git a/README.md b/README.md index 26eee13..8181143 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ A simple file downloader for your favourite File-Listing-Website. 1) Clone the repository 2) Make the script executable: `chmod +x mopa_loader.sh` -3) Edit `.env` and update all variables (Download location is optional) +3) copy `.env.example` to `.env` and update all variables (Download location is optional) 4) Run `./mopa_loader.sh` ## Usage diff --git a/mopa_loader.sh b/mopa_loader.sh index 099ffbd..1e9a3af 100755 --- a/mopa_loader.sh +++ b/mopa_loader.sh @@ -95,15 +95,15 @@ update_json() { JSON_OUTPUT+="}" # JSON speichern - echo -e "$JSON_OUTPUT" > output.json + echo -e "$JSON_OUTPUT" > library.json - echo "Daten gespeichert in output.json" + echo "Daten gespeichert in library.json" } # Funktion zum Auflisten der Ordnernamen list_folder_names() { - if [ -f "output.json" ]; then - folder_names=$(jq -r '.folders[].name' output.json) + if [ -f "library.json" ]; then + folder_names=$(jq -r '.folders[].name' library.json) if [ -n "$folder_names" ]; then echo "Ordnernamen:" echo "$folder_names" @@ -111,7 +111,7 @@ list_folder_names() { echo "Keine Ordnernamen im JSON gefunden." fi else - echo "Die Datei output.json existiert nicht." + echo "Die Datei library.json existiert nicht." fi } @@ -122,12 +122,12 @@ search_folder() { exit 1 fi - if [ ! -f "output.json" ]; then - echo "Die Datei output.json existiert nicht." + if [ ! -f "library.json" ]; then + echo "Die Datei library.json existiert nicht." exit 1 fi - results=$(jq -r --arg search "$2" '.folders[].name | select(test($search; "i"))' output.json) + results=$(jq -r --arg search "$2" '.folders[].name | select(test($search; "i"))' library.json) if [ -z "$results" ]; then echo "Keine passenden Ordner gefunden." @@ -152,15 +152,15 @@ download_file() { exit 1 fi - if [ ! -f "output.json" ]; then - echo "Die Datei output.json existiert nicht." + if [ ! -f "library.json" ]; then + echo "Die Datei library.json existiert nicht." exit 1 fi # Wenn DOWNLOAD_LOCATION nicht gesetzt, nach dem Zielordner fragen DOWNLOAD_LOCATION=${DOWNLOAD_LOCATION:-$(read -p "Bitte Zielordner für den Download angeben (Standard: .): " loc; echo ${loc:-.})} - results=$(jq -r --arg search "$2" '.folders[] | select(.name | test($search; "i"))' output.json) + results=$(jq -r --arg search "$2" '.folders[] | select(.name | test($search; "i"))' library.json) if [ -z "$results" ]; then echo "Keine passenden Dateien gefunden."