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

# Autogenerated by pycargoebuild 0.13.3

EAPI=8

CRATES="
"

inherit cargo desktop xdg

DESCRIPTION="Play website videos and songs with mpv & yt-dlp"
HOMEPAGE="https://github.com/akiirui/mpv-handler"
SRC_URI="
	${CARGO_CRATE_URIS}
	https://github.com/gentoo-zh-drafts/mpv-handler/releases/download/v${PV}/${P}-crates.tar.xz
	https://github.com/akiirui/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
"

LICENSE="MIT"
# Dependent crate licenses
LICENSE+=" MIT MPL-2.0 Unicode-3.0"
SLOT="0"
KEYWORDS="~amd64"
RESTRICT="strip"

RDEPEND="
	media-video/mpv
"

src_install() {
	dobin "$(cargo_target_dir)/mpv-handler"
	dodoc "share/linux/config.toml"
	domenu "share/linux/mpv-handler.desktop"
	domenu "share/linux/mpv-handler-debug.desktop"
}

pkg_postinst() {
	xdg_pkg_postinst
	elog "install net-misc/youtube-dl (recommended) or net-misc/yt-dlp"
	elog "to enable mpv to play video and music from the websites."
}