From d56eddda0c3f7956c3b711823926c044c5e5a0ed Mon Sep 17 00:00:00 2001 From: ebbit1q Date: Thu, 10 Nov 2022 00:25:31 +0100 Subject: [PATCH] sort sets and cards (#165) * use proper set code for fnm 2012 token * change order of each set using script some sets were not properly sorted the release date of SLD might be contestable but the script seems to have found 27 real discrepancies the release date is as shown in scryfall, eg SLD has a date of 2019-12-02 bash is a real programming language and I can put it on my resume, don't tell me otherwise: set -eo pipefail mapfile -t sets < <(LC_ALL=C curl -L 'https://mtgjson.com/api/v5/SetList.json' | jq -r '.data[]|.releaseDate,.code' | sed 'N;s/\n/ /' | sort -r | sed 's/.* //') setrx="]*>([^<]+)" list=() while IFS= read -r line; do if [[ $line =~ $setrx ]]; then code="${BASH_REMATCH[1]}" list+=("$code" "$line") elif [[ $code ]]; then for set_ in "${sets[@]}"; do for (( i=0; i<${#list[@]}; i+=2 )); do code="${list[$i]}" if [[ $set_ == "$code" ]]; then echo "${list[$i+1]}" fi done done code="" list=() echo "$line" else echo "$line" fi done Cockatrice/Magic-Token https://raw.githubusercontent.com/Cockatrice/Magic-Token/master/tokens.xml - 20221109c + 20221109d