Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix print script #7

Open
Dup4 opened this issue Apr 22, 2024 · 1 comment
Open

Fix print script #7

Dup4 opened this issue Apr 22, 2024 · 1 comment

Comments

@Dup4
Copy link
Member

Dup4 commented Apr 22, 2024

 "print_command": "domjuge-print [filename] [origname] [language] [username] [teamname] [teamid] [location]"

#!/bin/bash -e
# SPDX-License-Identifier: MIT

if [ $# -lt 7 ]; then
    echo "Something went wrong. Please contact the contest staff."
    echo "Error: not enough arguments" >&2
    echo "Usage: $0 <filename> <origname> <language> <username> <teamname> <teamid> <location>" >&2
    echo "Set print command to: $0 [file] [original] [language] [username] [teamname] [teamid] [location]" >&2
    exit 1
fi

PRINT_SERVER=https://print.ecfinal.icpc/

filename=$1; shift
origname=$1; shift
language=$1; shift
username=$1; shift
teamname=$1; shift
teamid=$1; shift
location=$1; shift


echo "Filename: $origname"
echo "Language: $language"
echo "Username: $username"
[ -n "$teamname" ] && echo "Team Name: $teamname" || teamname="$username"
[ -n "$teamid" ] && echo "Team ID: $teamid"
[ -n "$location" ] && echo "Location: $location"

exec curl -fsS \
    -F file=@"$filename" \
    -F filename="$origname" \
    -F lang="$language" \
    -F tname="$teamname" \
    -F team="$teamid"  \
    -F location="$location" \
    $PRINT_SERVER 2>&1

Refer to this.

@cubercsl
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants