Please Log in or Create an account to join the conversation.
#!/bin/bash
#set -x
COLOR=#FFD700
which lynx > /dev/null
if [ $? -ne 0 ]; then
echo lynx not found, please install
exit 1
fi
echo "Enter URL to game analysis"
read URL
echo "Enter WEC nunber"
read WEC
echo "Date (YYYY-MM-DD)"
read DATE
echo "Enter Time (HH:MM)"
read TIME
echo "Enter Admin (HH:MM)"
read ADMIN
clear
TABLE=$(lynx --dump --width=200 "$URL" \
|sed -n '/Ranking/,/Course/p' \
|tail -n +4 \
|head -n -2 \
|sed -r 's:^[\t]*$::g' \
|sed -r 's:([0-9]{1,3})[\ ]{2,4}\[line\.php\?player=[0-9]{1,2}\]:\[/td\]\[td\]\1\[/td\]\[td\]:' \
|sed -r 's:^[\ ]{3}([0-9]{1,2}\.)[\ ]{1,2}:\[td\]\1\[/td]\[td]:' \
|sed -r 's:$:\[/td\]\n:' \
|sed -r 's:^$:\[/tr\]\[tr\]:' \
|head -n -1 )
PLAYERS=$(echo "$TABLE"|sed -r 's:^\[/tr\]\[tr\]$::' \
|sed -r 's:\[td\][0-9]{1,2}\.\[/td\]\[td\]:#:' \
|sed -r 's:.\[/td].*$::' )
PLAYERS=$(echo $PLAYERS|sed 's/.#/#/g')
WINNER=$(echo $PLAYERS|cut -d"#" -f2)
echo "[img]http://pokerth.net/media/kunena/attachments/30607/Logo-WECUP_small1.jpg[/img]"
echo " "
echo "[b]WeCup - $WEC - $DATE - $TIME[/b]"
echo " "
echo " "
echo "[table][tr]"
echo "$TABLE"
echo "[/tr][/table]"
echo " "
echo "[b]Congratulations to [color=$COLOR][size=5]$WINNER[/size][/color][/b]"
echo " "
echo "[size=2][b]Opening Table Admin(s): $ADMIN[/b]"
echo "[url=$URL]Logfile analysis[/url]"
echo "WECup#$WEC#$DATE#$TIME"$PLAYERS"[/size]"
Please Log in or Create an account to join the conversation.
#!/bin/bash
user=$*;
if [[ -z "$user" ]]; then
echo "User not set. Quit";
exit -1;
fi;
## check first for WeCs membership
urlWeCMembers="http://www.poker-heroes.com/data/wec/wec-members-list.html";
curl -s ${urlWeCMembers} | grep -waF ">${user}</td>" | grep -iE "xl6[46]29223" | grep -v "height" > /dev/null
if [[ $? -eq 0 ]]; then
echo "$user is WeC member";
exit 0;
fi
url="http://www.poker-heroes.com/profile.html?user=";
temporal="temp.txt"
userEncoded=$(python -c "import sys, urllib as ul; print ul.quote_plus('${user}')");
url="${url}${userEncoded}"
curl -s ${url} | grep -A 3 "All Time-Rank-O-Meter" | tail -1 | sed 's/<[./]*t[rd]>/\n/g' | cut -d ">" -f2 > $temporal
posNext=true; ## next value indicates position
numNext=false; ## next value indicates games played
addNext=false; ## next value indicates games ended 1-4
sumPos=0;
sumTot=0;
while read line; do
if [[ "${#line}" -eq 0 ]]; then continue; ## skip blank lines
else
if [[ $posNext == true ]]; then
if [[ $line -eq 1 ]] || [[ $line -eq 2 ]] || [[ $line -eq 3 ]] || [[ $line -eq 4 ]]; then
addNext=true;
else addNext=false;
fi;
posNext=false;
numNext=true;
else
if [[ $numNext == true ]]; then
if [[ $addNext == true ]]; then
[[ $line =~ ^[0-9]+$ ]] && sumPos=$(($sumPos + $line)); ## to avoid add not a number
addNext=false;
fi;
[[ $line =~ ^[0-9]+$ ]] && sumTot=$(($sumTot + $line)); ## to avoid add not a number
numNext=false;
else
posNext=true;
fi;
fi;
fi;
done < $temporal;
rm $temporal;
if [[ $sumTot -le 300 ]]; then
echo "Player $user has $sumTot games. NOT Eligible";
exit 0;
fi;
res=$(echo "scale=4; $sumPos*100./$sumTot" | bc -l );
isOK="";
compRes=$(echo $res '>' 60.0 | bc -l);
if [[ $compRes -eq 1 ]]; then isOK="is Eligible";
else isOK="is NOT Eligible";
fi;
echo "[$sumPos/$sumTot] ==> $res. Player $user $isOK"
exit 0;
Please Log in or Create an account to join the conversation.
tahr wrote: Hello WeCuppers,
I have a some questions about WeC that I should have asked some time ago... I'm pretty sure they are answered on an older WeC post, but I didn't read them all
I post this here because I didn't want to interfere the discussion about 2016 rules. Sorry if this is not the right place.
...
PD: The script is for bash and can be run ./checkPlayer.sh "PlayerName". It needs curl and python installed. Quotes are not necessary, except for $$$ player, which bash thinks is the bash PID and needs single quotes ( in that case ./checkPlayer.sh '$$$'). I'm not expert in bash programming, so I'm pretty sure it can be improved, or it may have errors.
Warning: Spoiler! [ Click to expand ] [ Click to hide ]<code>#!/bin/bash
user=$*;
if -z "$user"; then
echo "User not set. Quit";
exit -1;
fi;
## check first for WeCs membership
urlWeCMembers="http://www.poker-heroes.com/data/wec/wec-members-list.html";
curl -s ${urlWeCMembers} | grep -waF ">${user}</td>" | grep -iE "xl6[46]29223" | grep -v "height" > /dev/null
if $? -eq 0; then
echo "$user is WeC member";
exit 0;
fi
url="http://www.poker-heroes.com/profile.html?user=";
temporal="temp.txt"
userEncoded=$(python -c "import sys, urllib as ul; print ul.quote_plus('${user}')");
url="${url}${userEncoded}"
curl -s ${url} | grep -A 3 "All Time-Rank-O-Meter" | tail -1 | sed 's/<[./]*t[rd]>/\n/g' | cut -d ">" -f2 > $temporal
posNext=true; ## next value indicates position
numNext=false; ## next value indicates games played
addNext=false; ## next value indicates games ended 1-4
sumPos=0;
sumTot=0;
while read line; do
if "${#line}" -eq 0; then continue; ## skip blank lines
else
if $posNext == true; then
if $line -eq 1 || $line -eq 2 || $line -eq 3 || $line -eq 4; then
addNext=true;
else addNext=false;
fi;
posNext=false;
numNext=true;
else
if $numNext == true; then
if $addNext == true; then
$line =~ ^[0-9]+$ && sumPos=$(($sumPos + $line)); ## to avoid add not a number
addNext=false;
fi;
$line =~ ^[0-9]+$ && sumTot=$(($sumTot + $line)); ## to avoid add not a number
numNext=false;
else
posNext=true;
fi;
fi;
fi;
done < $temporal;
rm $temporal;
if $sumTot -le 300; then
echo "Player $user has $sumTot games. NOT Eligible";
exit 0;
fi;
res=$(echo "scale=4; $sumPos*100./$sumTot" | bc -l );
isOK="";
compRes=$(echo $res '>' 60.0 | bc -l);
if $compRes -eq 1; then isOK="is Eligible";
else isOK="is NOT Eligible";
fi;
echo "[$sumPos/$sumTot] ==> $res. Player $user $isOK"
exit 0;
</code>
Please Log in or Create an account to join the conversation.
We use cookies to personalize content and ads to offer features for social media and analyze the number of hits on our website. We also provide information about your use of our website to our partner for social media, advertising and analysis on.
http://www.google.com/intl/de/policies/privacy/partners/