Last active
May 23, 2024 15:52
-
-
Save bemxio/8f533d0ac53abd50d77046beb7e75c6f to your computer and use it in GitHub Desktop.
A tool for downloading all of a creator's levels from the LittleBigPlanet archive (https://archive.org/details/dry23db). Requires `sqlite3` and `archive_dl` (the latter will be downloaded if you're on x86_64), as well as the `dry.db` database file inside the directory where the script is located.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This is free and unencumbered software released into the public domain. | |
# | |
# Anyone is free to copy, modify, publish, use, compile, sell, or | |
# distribute this software, either in source code form or as a compiled | |
# binary, for any purpose, commercial or non-commercial, and by any | |
# means. | |
# | |
# In jurisdictions that recognize copyright laws, the author or authors | |
# of this software dedicate any and all copyright interest in the | |
# software to the public domain. We make this dedication for the benefit | |
# of the public at large and to the detriment of our heirs and | |
# successors. We intend this dedication to be an overt act of | |
# relinquishment in perpetuity of all present and future rights to this | |
# software under copyright law. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | |
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | |
# OTHER DEALINGS IN THE SOFTWARE. | |
# | |
# For more information, please refer to <https://unlicense.org> | |
if [ -z "$(command -v sqlite3)" ]; then | |
echo "sqlite3 not found! Please install it in order to use this script." && exit 1 | |
fi | |
if [ ! -f "dry.db" ]; then | |
echo "dry.db not found! Please download it from the Internet Archive (https://archive.org/details/dry23db)." && exit 1 | |
fi | |
if [ "$(command -v archive_dl)" ]; then | |
archive_dl="archive_dl" | |
elif [ -f "archive_dl" ]; then | |
archive_dl="./archive_dl" | |
else | |
if [ $(uname -m) = "x86_64" ]; then | |
echo "archive_dl not found, downloading..." | |
curl -O -L https://github.com/uhwot/lbp_archive_dl/releases/download/1.5/archive_dl-x86_64-unknown-linux-gnu.tar.gz | |
tar -xf archive_dl-x86_64-unknown-linux-gnu.tar.gz && rm archive_dl-x86_64-unknown-linux-gnu.tar.gz | |
archive_dl="./archive_dl" | |
else | |
echo "archive_dl not found! Please download or compile the binary and place it in the same directory as this script or in your PATH." && exit 1 | |
fi | |
fi | |
creators="$@" | |
if [ -z "$creators" ]; then | |
echo "No creators specified! Exiting..." && exit 1 | |
fi | |
for creator in $creators; do | |
echo "Downloading levels made by $creator..." | |
IFS=$'\n' | |
result=$(sqlite3 -list dry.db "SELECT name, LOWER(HEX(rootLevel)) AS checksum FROM slot WHERE npHandle = '$creator'") | |
if [ -z "$result" ]; then | |
echo "No levels found made by $creator, skipping..." | |
echo | |
continue | |
fi | |
mkdir -p $creator | |
for level in $result; do | |
name=${level%|*} | |
checksum=${level##*|} | |
echo "Downloading \"$name\"..." | |
"${archive_dl}" $checksum "$creator/$name" | |
if [ $? -ne 0 ]; then | |
echo "Failed to download \"$name\"!" | |
else | |
echo "Successfully downloaded \"$name\"!" | |
fi | |
echo | |
done | |
echo "Finished downloading levels made by $creator!" | |
echo | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment