summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b50c8ee2eeed80d4fad46ff56b926e5de7d776ac (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Maintainer: Darren Ng <$(base64 --decode <<<VW4xR2ZuQGdtYWlsLmNvbQo=)>

pkgname=nhentai-git
pkgver=r441.8452347
pkgrel=1
pkgdesc='CLI tool for downloading doujinshi from nhentai.net'
arch=(any)
url=https://github.com/RicterZ/"${pkgname%-*}"
license=(custom:MIT)

depends=(
  'python-requests>=2.5.0'
  python-soupsieve
  'python-beautifulsoup4>=4.0.0'
  # python-threadpoolctl
  'python-tabulate>=0.7.5'
  'python-future>=0.15.2'
  'python-iso8601>=0.1'
)
makedepends=(git python-setuptools)

provides=({,python-}"${pkgname%-*}")
conflicts=("${provides[@]}" python-$pkgname)
source=(git+https://github.com/RicterZ/"${pkgname%-*}".git)
md5sums=(SKIP)

# prepare() {

#   local _T=doujinshi.txt
#   local _N
#   local _RAND
#   local _PATTERN='https://nhentai.net/g/[1-9][0-9]*/' # Pattern
#   local _ID

#   # https://knowyourmeme.com/memes/boku-no-pico
#   printf "${BLUE}  ->${ALL_OFF}${BOLD} Replace Yoooooooooooooooooooooooo(s) with random ID${ALL_OFF}\n" "$@"
#   cd "$srcdir/${pkgname%-*}"

#   # https://stackoverflow.com/a/114861
#   _N="$(grep -cv '^\s*$' $_T)"
#   [ "$_N" -ge 1 ]
#   rm -v $_T

#   # https://unix.stackexchange.com/q/278496
#   # for i in eval {1..$_N}
#   for ((i=0;i<_N;++i)); do

#     # https://stackoverflow.com/a/3077316
#     _RAND="$(curl -ILs -o /dev/null -w %{url_effective} https://nhentai.net/random/)"
#     [ "$_RAND" = "$(grep -oE "$_PATTERN" <<<"$_RAND")" ]

#     _ID="$(grep -oE '[0-9]+' <<<"$_RAND")"
#     [ "$_ID" -ge 1 ]

#     echo "$_ID" >>$_T

#   done

# }

pkgver() {
  cd "$srcdir/${pkgname%-*}"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  cd "$srcdir/${pkgname%-*}"
  python setup.py build
}

package() {
  cd "$srcdir/${pkgname%-*}"
  # export PYTHONHASHSEED=0
  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1
  install -vDm644 {,"$pkgdir/usr/share/licenses/${pkgname}/"}LICENSE
}