-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutcachemanager.sh
43 lines (38 loc) · 1.38 KB
/
utcachemanager.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
#Author: Andrej Mernik, 2008-2017, https://andrej.mernik.eu/clanki/linux/utcachemanager/
#License: GPLv3
#Unreal Tournament install directory
UTdir="/home/user/games/ut"
#Unreal Tournament cache directory
CacheDir="/home/user/.loki/ut/Cache"
#keep reading from the cache.ini until the end
while read inputline
do
#split the line to two pieces
CODE=${inputline%=*}
TMPREALNAME=${inputline#*=}
#remove the carriage return
REALNAME=`echo -e $TMPREALNAME | sed 's/\r//g' `
#get the extension
EXTENSION=${REALNAME#*.}
if [ $EXTENSION ]
then
#Unreal music file
if [ "$EXTENSION" == 'umx' ]; then mv "$CacheDir/$CODE.uxx" "$UTdir/Music/$REALNAME"
#unreal audio file
elif [ "$EXTENSION" == 'uax' ]; then mv "$CacheDir/$CODE.uxx" "$UTdir/Sounds/$REALNAME"
#Unreal system file
elif [ "$EXTENSION" == 'int' ]; then mv "$CacheDir/$CODE.uxx" "$UTdir/System/$REALNAME"
#Unreal system file
elif [ "$EXTENSION" == 'u' ]; then mv "$CacheDir/$CODE.uxx" "$UTdir/System/$REALNAME"
#Unreal texture file
elif [ "$EXTENSION" == 'utx' ]; then mv "$CacheDir/$CODE.uxx" "$UTdir/Textures/$REALNAME"
#unreal map file
elif [ "$EXTENSION" == 'unr' ]; then mv "$CacheDir/$CODE.uxx" "$UTdir/Maps/$REALNAME"
#else skip them
else echo "Skipping ..."
echo $inputline >> "tmpcache.ini"
fi
fi
done < $CacheDir/cache.ini
mv "tmpcache.ini" "$CacheDir/cache.ini"