add rules to fix image and update image script

master
melvinzhang 2016-08-30 08:57:54 +08:00
parent 0843f044a5
commit 70532664f7
2 changed files with 9 additions and 8 deletions

View File

@ -928,3 +928,11 @@ github-releases.json:
correct-release-label:
curl -XPATCH https://api.github.com/repos/magarena/magarena/releases/assets/${mac} -H"Content-Type: application/json" -d'{"name": "Magarena-${tag}.app.zip", "label":"Magarena-${tag}.app.zip for Mac"}' -u ${username}
curl -XPATCH https://api.github.com/repos/magarena/magarena/releases/assets/${linux} -H"Content-Type: application/json" -d'{"name": "Magarena-${tag}.zip", "label":"Magarena-${tag}.zip for Linux/Windows"}' -u ${username}
%_img.tsv:
paste <(cat conspiracy-take-crown | pup 'img attr{alt}') <(cat conspiracy-take-crown | pup 'img attr{src}') > $@
# edit tsv file to use only ASCII characters
%_fix_image:
grep /$*/ -r release/Magarena/scripts_missing release/Magarena/scripts -l | parallel awk -f scripts/update_image.awk $*_img.tsv {} '>' {}.new
grep /$*/ -r release/Magarena/scripts_missing/*.txt release/Magarena/scripts/*.txt -l | parallel mv {}.new {}

View File

@ -20,14 +20,7 @@ NF == 2 {
}
/^image=/ {
old_set = gensub("image=","","g", $0)
new_set = gensub("http://magiccards.info/scans/en/", "", "g", image)
new_set = gensub("/[^/]*.jpg", "", "g", new_set)
if (old_set == new_set) {
print "image=" image
} else {
print $0
}
print "image=" image
next
}