summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: dc382d2cc9b32258e8a91ae8ed1320ca62f594cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Maintainer: Ricardo (XenGi) Band <email@ricardo.band>

_maxwidth=80
_maxheight=22
_firstpokemon=1
_lastpokemon=151
pkgname=pokeshell
pkgver=1.0.0
pkgrel=1
pkgdesc="Displays pokemons in your shell"
arch=(any)
url="https://github.com/XenGi/pokeshell"
license=('MIT')
builddepends=('curl' 'imagemagick' 'img2xterm')
options=(!emptydirs)
install='pokeshell.install'
#source=("https://github.com/rossy/$pkgname/archive/v$pkgver.tar.gz")
#sha256sums=('')

build() {
    cd "$srcdir/"
    for _i in `seq $_firstpokemon 1 $_lastpokemon` ; do
        printf "Generating Pokemon #$_i"
        # download pokemon image
        curl -s http://pokeapi.co/media/img/$_i.png -o $_i.png
        printf "."
        # trim image
        convert $_i.png -trim -resize ${_maxwidth}x$(($_maxheight * 2))\>  $_i.png
        printf "."
        # convert to escape sequences
        img2xterm $_i.png > $_i.pokemon
        printf ". done\n"
        # cleanup
        rm -f $_i.png
    done
}

package() {
    cd "$srcdir/"
    for _i in `seq $_firstpokemon 1 $_lastpokemon` ; do
        install -D -m644 $_i.pokemon "${pkgdir}/usr/share/${pkgname}/$_i.pokemon"
    done
}