-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScrape
executable file
·71 lines (55 loc) · 1.76 KB
/
Scrape
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/data/data/com.termux/files/usr/bin/bash
# Look for new ROMs since the last run.
##### Config #####
# Don't edit the configuration in this file as it would be overwritten on updates.
# Create the file .config/pegasus_android_helpers.conf and override the variables.
module=screenscraper
exclude=("android")
##################
if [[ -f ~/.config/pegasus_android_helpers.conf ]]; then
source ~/.config/pegasus_android_helpers.conf
fi
#---------------
lastrun=~/.skyscraper/skyscraper.lastrun
if [ ! -f ${lastrun} ]; then
echo "First run: this could take a long time..."
# create a lastrun file far in the past to scan everything
touch -d "1/1/1970" ${lastrun}
fi
#---------------
inputline=$(grep -m 1 inputFolder ~/.skyscraper/config.ini)
rompath=${inputline##*=}
rompath="${rompath%\"}"
rompath="${rompath#\"}"
echo Looking for new ROMs in $rompath
systems=$(find ${rompath} -mindepth 2 -maxdepth 2 -type f -cnewer ${lastrun} -exec sh -c 'basename $(dirname "$0")' {} \; | sort | uniq)
if [[ "$systems" == "" ]];then
echo "No new game found."
fi
for system in $systems
do
for i in "${exclude[@]}"
do
if [ "$i" == "$system" ] ; then
echo "Skipping $system"
skip=true
fi
done
if ! $skip ; then
echo Processing $system ...
if [ "$system" = "mame" ]; then
system="mame-libretro"
elif [ "$system" = "fbneo" ]; then
system="fba"
fi
Skyscraper -p ${system} -s ${module} --flags unattendskip
Skyscraper -p ${system} --flags unattendskip
fi
skip=false
done
# Update lastrun
touch ${lastrun}
# If launched from a Termux shortcut, closes automatically
# wait for a key press
read -n 1 -r -s -p "Press any key to continue..." key
echo ""