Update readme and rename output to library
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
.DS_STORE
|
||||||
@@ -6,7 +6,7 @@ A simple file downloader for your favourite File-Listing-Website.
|
|||||||
|
|
||||||
1) Clone the repository
|
1) Clone the repository
|
||||||
2) Make the script executable: `chmod +x mopa_loader.sh`
|
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`
|
4) Run `./mopa_loader.sh`
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|||||||
+11
-11
@@ -95,15 +95,15 @@ update_json() {
|
|||||||
JSON_OUTPUT+="}"
|
JSON_OUTPUT+="}"
|
||||||
|
|
||||||
# JSON speichern
|
# 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
|
# Funktion zum Auflisten der Ordnernamen
|
||||||
list_folder_names() {
|
list_folder_names() {
|
||||||
if [ -f "output.json" ]; then
|
if [ -f "library.json" ]; then
|
||||||
folder_names=$(jq -r '.folders[].name' output.json)
|
folder_names=$(jq -r '.folders[].name' library.json)
|
||||||
if [ -n "$folder_names" ]; then
|
if [ -n "$folder_names" ]; then
|
||||||
echo "Ordnernamen:"
|
echo "Ordnernamen:"
|
||||||
echo "$folder_names"
|
echo "$folder_names"
|
||||||
@@ -111,7 +111,7 @@ list_folder_names() {
|
|||||||
echo "Keine Ordnernamen im JSON gefunden."
|
echo "Keine Ordnernamen im JSON gefunden."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Die Datei output.json existiert nicht."
|
echo "Die Datei library.json existiert nicht."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,12 +122,12 @@ search_folder() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "output.json" ]; then
|
if [ ! -f "library.json" ]; then
|
||||||
echo "Die Datei output.json existiert nicht."
|
echo "Die Datei library.json existiert nicht."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
if [ -z "$results" ]; then
|
||||||
echo "Keine passenden Ordner gefunden."
|
echo "Keine passenden Ordner gefunden."
|
||||||
@@ -152,15 +152,15 @@ download_file() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "output.json" ]; then
|
if [ ! -f "library.json" ]; then
|
||||||
echo "Die Datei output.json existiert nicht."
|
echo "Die Datei library.json existiert nicht."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Wenn DOWNLOAD_LOCATION nicht gesetzt, nach dem Zielordner fragen
|
# 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:-.})}
|
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
|
if [ -z "$results" ]; then
|
||||||
echo "Keine passenden Dateien gefunden."
|
echo "Keine passenden Dateien gefunden."
|
||||||
|
|||||||
Reference in New Issue
Block a user