# Copyright 2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

PYTHON_COMPAT=( python3_{8..13} )

inherit distutils-r1 meson gnome2-utils xdg-utils

DESCRIPTION="A modern audio book player for Linux and macOS using GTK+ 3"
HOMEPAGE="https://cozy.sh https://github.com/geigi/cozy"
SRC_URI="https://github.com/geigi/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""

RDEPEND=">=dev-lang/python-3.0
		>=x11-libs/gtk+-3.22:3
		>=dev-libs/granite-5.3.0
		>=dev-python/peewee-3.9.6[${PYTHON_USEDEP}]
		media-libs/mutagen[${PYTHON_USEDEP}]
		dev-python/pygobject:3[cairo,${PYTHON_USEDEP}]
		sys-apps/file
		dev-python/apsw[${PYTHON_USEDEP}]
		dev-python/requests[${PYTHON_USEDEP}]
		dev-python/pytz[${PYTHON_USEDEP}]
		dev-python/packaging[${PYTHON_USEDEP}]
		gui-libs/libhandy:1
		media-libs/gstreamer:1.0
		media-libs/gst-plugins-good:1.0
		media-libs/gst-plugins-bad:1.0
		media-libs/gst-plugins-ugly:1.0
		media-plugins/gst-plugins-libav:1.0
		dev-python/gst-python:1.0[${PYTHON_USEDEP}]
		dev-python/distro[${PYTHON_USEDEP}]
		dev-libs/appstream-glib
		dev-util/desktop-file-utils
		dev-libs/libdazzle"
DEPEND="${RDEPEND}"

src_prepare() {
	default

	sed -i '/post_install_desktop_database.py/Id' meson.build || die
}

src_configure() {
	meson_src_configure
}

src_install() {
	meson_src_install
}

pkg_postinst() {
	xdg_icon_cache_update
	gnome2_schemas_update
	xdg_desktop_database_update
	xdg_mimeinfo_database_update
}

pkg_postrm() {
	xdg_icon_cache_update
	gnome2_schemas_update
	xdg_desktop_database_update
	xdg_mimeinfo_database_update
}
