diff --git a/schedule b/schedule index 1ae875f..fdcabdf 100755 --- a/schedule +++ b/schedule @@ -113,7 +113,7 @@ function show_tour_sequence { function output_tour_info { local date_re="([0-9?]{2})\.([0-9?]{2})\.([0-9?]{4})" - local res_re="(1-0|1/2|0-1)" + local res_re="(1|½|0|\+|-)" local tour_num= date_beg= date_end= local white= black= result= game_date= # Lines with game info @@ -130,7 +130,7 @@ function output_tour_info { output_lines+=$(sed -E "s/$date_re +//" <<< "$line") # Append the link of game to the end of output line if $SHOW_LINK; then - [[ -n $result ]] && append_game_url + [[ $result =~ ^(\+|-)*$ ]] || append_game_url fi output_lines+="\n" fi @@ -177,8 +177,9 @@ function get_tour_dates { function keep_game_info { local keep=1 - if [[ $line =~ $date_re\ +([^\ ]+)\ +-\ +([^\ ]+)(\ +$res_re)? ]]; then - white=${BASH_REMATCH[4]} black=${BASH_REMATCH[5]} result=${BASH_REMATCH[7]} + if [[ $line =~ $date_re\ +([^\ ]+)\ +-\ +([^\ ]+)(\ +$res_re-$res_re)? ]]; then + white=${BASH_REMATCH[4]} black=${BASH_REMATCH[5]} + result=${BASH_REMATCH[7]}-${BASH_REMATCH[8]} game_date=${BASH_REMATCH[3]}-${BASH_REMATCH[2]}-${BASH_REMATCH[1]} # If the player was passed as an argument, check if it is his game or not @@ -187,7 +188,7 @@ function keep_game_info { keep=0 else # Keep line if the game is not finished - [[ -z $result ]] && keep=0 + [[ $result == "-" ]] && keep=0 fi fi fi @@ -213,14 +214,14 @@ function info_output_term { players=$(grep -o "[^ ]*${PLAYER}[^ ]*" <<< "$line") for name in $players; do # PLAYER is a part of 'game_url' or 'result' - [[ $name =~ ^http:// || $name =~ ^${res_re}$ ]] && continue + [[ $name =~ ^http:// || $name =~ ^${res_re}-${res_re}$ ]] && continue line=$(sed -E "s/(${name})/$(tput setaf 1)\1$(tput sgr0)/" <<< "$line") done fi # Highlight result - line=$(sed -E "s~ ${res_re}( |$)~ $(tput setaf 6)\1$(tput sgr0)\2~" <<< "$line") + line=$(sed -E "s~ ${res_re}-${res_re}( |$)~ $(tput setaf 6)\1-\2$(tput sgr0)~" <<< "$line") echo "$line" done @@ -252,9 +253,7 @@ function info_output_html { echo " " echo -en "$output_lines" | while read white hyphen black result url; do - [[ $result == 1/2 ]] && result=½-½ [[ -n $url ]] && result="${result}" - echo " " echo " ${white} - ${black}${result}" echo " "