Script 'game-add': use an User Agent, otherwise a PGN file could not be downloaded.

This commit is contained in:
vonavi 2014-11-22 11:07:18 +03:00
parent c5692b8fd6
commit 69801befda

View File

@ -10,6 +10,9 @@ TOURNAMENT=
# Version information # Version information
VERSION="0.3" VERSION="0.3"
# Firefox User Agent
FIREFOX_UA="Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0"
argv0=${0##*/} argv0=${0##*/}
function usage { function usage {
@ -231,7 +234,8 @@ trap "rm ${tmp_ini} ${tmp_ini}.prev ${tmp_pgn}" EXIT
[[ $1 =~ ^(http://[^/]*)/([^/]*) ]] [[ $1 =~ ^(http://[^/]*)/([^/]*) ]]
# Link to annotated PGN # Link to annotated PGN
pgn_url=${BASH_REMATCH[1]}/game/export/${BASH_REMATCH[2]::8}.pgn pgn_url=${BASH_REMATCH[1]}/game/export/${BASH_REMATCH[2]::8}.pgn
wget -q "$pgn_url" -O $tmp_pgn || die "PGN file not found." wget -q -U "$FIREFOX_UA" -O $tmp_pgn "$pgn_url" \
|| die "PGN file at $pgn_url not found."
game_get_players game_get_players
game_add_to_repo game_add_to_repo