# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           github 1.0
PortGroup           python 1.0

# This is renamed FastAnime 3.x, from the same upstream.
# https://github.com/Benexl/FastAnime
# For a while we keep it as a separate port.
github.setup        Benexl viu 3.5.0 v
revision            0
categories-prepend  www multimedia anime
# Does not work on 10.5 due to an obscure python bug: https://trac.macports.org/ticket/67046
# Works fine on 10.6 powerpc.
platforms           {darwin >= 10}
license             Unlicense
maintainers         {@barracuda156 macos-powerpc.org:barracuda} \
                    openmaintainer
description         Your browser anime experience, from the terminal
long_description    {*}${description}
checksums           rmd160  143a7f165b4b7363934d9822e6230c69e2421d30 \
                    sha256  ea3998ae3c6219a6b92f6acf55ae34bab71c41307093c46cc31810bbd5493e99 \
                    size    702766
github.tarball_from archive
supported_archs     noarch

# TODO/FIXME: not everything is expected to work at the moment.
# However, basic functionality has been fixed. Search, downloading
# and streaming appear to work fine.

patch.pre_args-replace  -p0 -p1

# https://github.com/Benexl/FastAnime/issues/123
patchfiles-append   0001-Fixes-for-pydantic.patch
# Use block graphics with chafa due to: https://github.com/ArthurSonzogni/FTXUI/issues/1219
patchfiles-append   0002-chafa.patch

# This should match libtorrent-rasterbar:
python.default_version  313

python.pep517_backend   hatch

depends_lib-append  port:py${python.version}-click \
                    port:py${python.version}-httpx \
                    port:py${python.version}-inquirerpy \
                    port:py${python.version}-pydantic \
                    port:py${python.version}-rich

# TODO: consider alternatives to mpv as possible choices.
depends_run-append  path:bin/ffmpeg:ffmpeg \
                    path:bin/mpv:mpv \
                    port:py${python.version}-lxml \
                    port:py${python.version}-pycryptodomex \
                    port:py${python.version}-pypresence \
                    port:py${python.version}-thefuzz \
                    port:yt-dlp

# Move optional and heavy dependencies here:
variant full conflicts fzf description "Enable extra functionality" {
    depends_run-append \
                    port:chafa \
                    port:dbus-python${python.version} \
                    port:feh \
                    port:ffmpegthumbnailer \
                    path:bin/fzf:fzfpp \
                    port:libtorrent-rasterbar \
                    port:rofi
}

variant fzf conflicts full description "Use fzf" {
    depends_run-append \
                    port:chafa \
                    path:bin/fzf:fzfpp
}

if {![variant_isset full]} {
    default_variants    +fzf
}

# py-pyobjc and py-plyer are dropped due to being broken presently.
