Update readme and rename output to library

This commit is contained in:
phil
2025-04-03 11:08:04 +02:00
parent 92320d08b8
commit 50e1efd31c
3 changed files with 13 additions and 12 deletions
+11 -11
View File
@@ -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."