init
This commit is contained in:
commit
6f668fa9e0
3 changed files with 71 additions and 0 deletions
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
*
|
||||
!.gitignore
|
||||
!get_latest.sh
|
||||
!get_latest_voices.py
|
||||
!README.md
|
41
get_latest.sh
Normal file
41
get_latest.sh
Normal file
|
@ -0,0 +1,41 @@
|
|||
#!/bin/bash
|
||||
export base="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
cd $base
|
||||
echo "Checking for program update..."
|
||||
server_version="$(curl https://arcsidian.com/xivv/version.json 2>/dev/null)"
|
||||
[ "$(cat version.json)" = "$server_version" ] && echo "Up to date: $server_version" || (
|
||||
echo "Downloading $server_version..."
|
||||
curl -O https://arcsidian.com/xivv/XivVoices_Setup.exe
|
||||
WINEPREFIX=$base/pfx wine XivVoices_Setup.exe /VERYSILENT /SP-
|
||||
rm XivVoices_Setup.exe
|
||||
tee version.json <<<"$server_version"
|
||||
echo "Updated to $server_version"
|
||||
) 2>/dev/null
|
||||
rm $base/share $base/pfx/drive_c/Xiv_Voices/Data -f
|
||||
ln -s $base/pfx/drive_c/Xiv_Voices $base/share
|
||||
mkdir -p Data tmp bak
|
||||
ln -s $base/Data $base/pfx/drive_c/Xiv_Voices/Data
|
||||
rm -f share/{nameless,npcData,voiceNames,ignored,data}.json
|
||||
echo "Updating metadata..."
|
||||
wget -P share -c https://arcsidian.com/xivv/{nameless,npcData,voiceNames,ignored,data}.json 2>/dev/null
|
||||
echo "Checking for updated voice lines..."
|
||||
pids=""
|
||||
while read url fn; do
|
||||
[[ -z "$url" || -z "$fn" ]] && break
|
||||
echo " - Downloading $fn..."
|
||||
(
|
||||
key=$(<<<$url sed 's/.zip$//' | awk -F/ '{print $(NF-1) "/" $NF}')
|
||||
keysize=$(<<<$fn sed 's/.zip$//' | awk -F. '{print $NF}')
|
||||
mv "share/Data/$key" "bak/${key//\//_}" 2>/dev/null
|
||||
curl -o "tmp/$fn" "$url" 2>/dev/null && unzip -d share/Data -P "$keysize#Arc" "tmp/$fn" 2>&1 >/dev/null && rm "tmp/$fn" && echo " - Downloaded $fn"
|
||||
) &
|
||||
pids="$pids $!"
|
||||
|
||||
if [[ $(jobs -r -p | wc -l) -ge 5 ]]; then
|
||||
wait -n
|
||||
fi
|
||||
#done <<< $(echo "https://xivvoices.com/npcs/Alphinaud/Alphinauds_Voice.zip Alphinauds_Voice.1534982.zip")
|
||||
done <<< $(python3 get_latest_voices.py)
|
||||
echo "Waiting for downloads to complete..."
|
||||
wait $pids
|
||||
echo "Update complete"
|
25
get_latest_voices.py
Normal file
25
get_latest_voices.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
from urllib.request import urlopen
|
||||
from json import load, dump
|
||||
from pathlib import Path
|
||||
from urllib.parse import urlparse
|
||||
from os.path import basename
|
||||
from sys import stderr
|
||||
|
||||
manifest = load(urlopen("https://arcsidian.com/xivv/manifest.json"))
|
||||
|
||||
get = []
|
||||
|
||||
for key in manifest.keys():
|
||||
p = Path(f"share/Data/{key}")
|
||||
if p.exists():
|
||||
s = sum(f.stat().st_size for f in p.glob('**/*') if f.is_file())
|
||||
if s == manifest[key]:
|
||||
continue
|
||||
# print(f"{p} {s} != {manifest[key]}", file=stderr)
|
||||
url = f"https://xivvoices.com/npcs/{key}.zip"
|
||||
fn = f"{basename(key)}.{manifest[key]}.zip"
|
||||
print(f"{url} {fn}")
|
||||
# print(f"curl --limit-rate 3M -o 'tmp/{fn}' '{url}' && rm -rf 'share/Data/{key}' && unzip -d share/Data -P '{manifest[key]}#Arc' tmp/{fn} && rm 'tmp/{fn}'")
|
||||
|
||||
with open("share/manifest.json", "w") as f:
|
||||
dump(manifest,f,indent=2)
|
Loading…
Reference in a new issue