News for hackers. Stuff that matters.
Re:Shell Scripting with Objective-C by gatehouse on Sunday June 01, 2014 @02:46AM (#7828380)
Decided to give it a shot in bash.

    #!/bin/bash
    set -eu 
    
    curl -s "https://raw.githubusercontent.com/manbolo/appicon/master/mask.png" >"icon_mask.png"
    
    for app_id in "$@"
    do
        metadata=$(curl -s "http://itunes.apple.com/us/lookup?id=$app_id")
        icon_url=$(echo $metadata | jq -r ".results[0].artworkUrl512")
        name=$(echo $metadata | jq -r ".results[0].trackCensoredName")
    
        icon_base="icon_$name"
        curl -s "$icon_url" >"$icon_base.png"
        convert "$icon_base.png" "icon_mask.png" -compose copy-opacity -composite "$icon_base.png"
        
        for size in 1024 512 120 114 60 57
        do
    	convert "$icon_base.png" -resize "${size}x${size}" "${icon_base}_${size}x${size}.png"
        done
    done
    
    rm icon_mask.png
Run like

    ./appicon.bash  400274934 598581396
Notes

- didn't replicate the slugify

- dependencies: imagemagick, jq

- here without spaces: http://pastebin.com/yBPwHwdk

- to get the same clarity as the python & Obj-C samples, I'd probably be approaching the same length.

Re:Shell Scripting with Objective-C by jicea on Sunday June 01, 2014 @03:16AM (#7828432)
Author here, the bash version is too beautiful: compact and clean! I will include it in the article if you're ok!
Re:Shell Scripting with Objective-C by gatehouse on Sunday June 01, 2014 @09:01AM (#7829004)
Sure.
Re:Shell Scripting with Objective-C by yesbabyyes on Sunday June 01, 2014 @03:56AM (#7828498)
You could easily make a quick slugify with `tr`:

    10a11
    >     name=$(echo $name | tr -cd '[:blank:][:alnum:]' | tr -s '[:blank:]' '-' | tr '[:upper:]' '[:lower:]')
Re:Shell Scripting with Objective-C by js2 on Sunday June 01, 2014 @09:35PM (#7831451)
You may be able to use sips instead of imagemagick.