diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 2b3a0d9..759b87b 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -107,7 +107,9 @@ jobs: pp_country_rank="RESTRICTED" padded_rank="9999999" osu_profile_url="https://osu.ppy.sh/users/$osu_id" - #avatar_url=$(echo "$users_json" | jq -r ".[$i].avatar_url")"?size=512" + + # ensure timestamp exists before using it + timestamp=$(( $(date +%s) / 86400 * 86400 )) avatar_url="https://a.ppy.sh/$osu_id?$timestamp" printf "%s|%s%s%sProfileSkins\n" \ @@ -122,17 +124,29 @@ jobs: pp_rank=$(echo "$user_data" | jq -r '.[0].pp_rank // "9999999"') pp_country_rank=$(echo "$user_data" | jq -r '.[0].pp_country_rank // "-"') + country=$(echo "$user_data" | jq -r '.[0].country // "-"') username=$(echo "$user_data" | jq -r '.[0].username // "'$owner'"') padded_rank=$(printf "%07d" "$pp_rank") + # Build CC+rank like CH28; fall back sanely if data missing + if [ "$pp_country_rank" != "-" ] && [ -n "$pp_country_rank" ] && [ "$pp_country_rank" != "null" ]; then + if [ "$country" != "-" ] && [ -n "$country" ] && [ "$country" != "null" ]; then + cc_rank="${country}${pp_country_rank}" + else + cc_rank="$pp_country_rank" + fi + else + cc_rank="-" + fi + printf "%s|%s%s%sProfileSkins\n" \ - "$padded_rank" "$username" "$pp_rank" "$pp_country_rank" "$osu_id" "$html_url" >> "$USER_ROWS_FILE" + "$padded_rank" "$username" "$pp_rank" "$cc_rank" "$osu_id" "$html_url" >> "$USER_ROWS_FILE" timestamp=$(( $(date +%s) / 86400 * 86400 )) printf "%s|\n" \ "$padded_rank" "$html_url" "$osu_id" "$timestamp" >> "$AVATAR_ROWS_FILE" - echo " ✅ Added: $username (#$pp_rank)" + echo " ✅ Added: $username (#$pp_rank, $cc_rank)" total_valid_entries=$((total_valid_entries + 1)) done done