summaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorLéo Lam <leo@innovatetechnologi.es>2017-05-24 13:22:14 +0200
committerLéo Lam <leo@innovatetechnologi.es>2017-05-26 10:05:18 +0200
commitbaac0d78bf9d073c5ed69e632b119b32a43714a2 (patch)
tree57e1e3abb742359401896866af1b67df0f2b0959 /Tools
parentd592bdd4d40046a16528df31343710c936a6186d (diff)
Tools: Simplify update-wiitdb.sh
After getting in touch with the GameTDB maintainer about using their databases, they have decided to implement a UNIQUE parameter so we don't need to deduplicate ourselves. This simplifies the script a bit. Thanks to lustar for their help.
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/update-wiitdb.sh42
1 files changed, 15 insertions, 27 deletions
diff --git a/Tools/update-wiitdb.sh b/Tools/update-wiitdb.sh
index 21101b6835..014d1a8255 100755
--- a/Tools/update-wiitdb.sh
+++ b/Tools/update-wiitdb.sh
@@ -1,26 +1,22 @@
#!/bin/bash
-# Script to update the bundled WiiTDBs and remove duplicate entries.
+# Script to update the bundled WiiTDBs.
set -eu
-ENGLISH_DB_NAME="Data/Sys/wiitdb-en.txt"
-ENGLISH_TMP_DB_NAME="Data/Sys/wiitdb-en.tmp"
-TIMESTAMP_PATTERN="TITLES = "
-
-echo "Downloading WiiTDB (en)..."
-curl -s "http://www.gametdb.com/wiitdb.txt?LANG=EN" | sort > "$ENGLISH_TMP_DB_NAME"
dbs=()
-dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=DE de")
-dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=ES es")
-dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=FR fr")
-dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=IT it")
-dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=JA ja")
-dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=KO ko")
-dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=NL nl")
-dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=PT pt")
-dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=RU ru")
-dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=ZHCN zh_CN")
-dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=ZHTW zh_TW")
+dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=EN en")
+# UNIQUE means "only return non-English titles".
+dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=DE&UNIQUE=TRUE de")
+dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=ES&UNIQUE=TRUE es")
+dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=FR&UNIQUE=TRUE fr")
+dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=IT&UNIQUE=TRUE it")
+dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=JA&UNIQUE=TRUE ja")
+dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=KO&UNIQUE=TRUE ko")
+dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=NL&UNIQUE=TRUE nl")
+dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=PT&UNIQUE=TRUE pt")
+dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=RU&UNIQUE=TRUE ru")
+dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=ZHCN&UNIQUE=TRUE zh_CN")
+dbs+=("http://www.gametdb.com/wiitdb.txt?LANG=ZHTW&UNIQUE=TRUE zh_TW")
for i in "${dbs[@]}"
do
@@ -29,14 +25,6 @@ do
lang_code="${entry[1]}"
dest="Data/Sys/wiitdb-$lang_code.txt"
- tmp_dest="Data/Sys/wiitdb-$lang_code.tmp"
echo "Downloading WiiTDB ($lang_code)..."
- curl -s "$url" | sort | comm -23 - "$ENGLISH_TMP_DB_NAME" > "$tmp_dest"
- grep "$TIMESTAMP_PATTERN" "$tmp_dest" > "$dest"
- grep -v "$TIMESTAMP_PATTERN" "$tmp_dest" >> "$dest"
- rm "$tmp_dest"
+ curl -s "$url" > "$dest"
done
-
-grep "$TIMESTAMP_PATTERN" "$ENGLISH_TMP_DB_NAME" > "$ENGLISH_DB_NAME"
-grep -v "$TIMESTAMP_PATTERN" "$ENGLISH_TMP_DB_NAME" >> "$ENGLISH_DB_NAME"
-rm "$ENGLISH_TMP_DB_NAME"