summaryrefslogtreecommitdiff
blob: 68428f716f704d5eb3b03de8843749e5501657b4 (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
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{8..10} )
inherit bash-completion-r1 distutils-r1 git-r3 optfeature

DESCRIPTION="Download videos from YouTube.com (and more sites...)"
HOMEPAGE="https://youtube-dl.org/"
EGIT_REPO_URI="https://github.com/ytdl-org/${PN}.git"

LICENSE="Unlicense"
SLOT="0"
IUSE="+yt-dlp"

RDEPEND="
	dev-python/pycryptodome[${PYTHON_USEDEP}]
	yt-dlp? ( >=net-misc/yt-dlp-2022.2.4-r1 )
	!yt-dlp? ( !net-misc/yt-dlp )"

distutils_enable_tests nose

python_prepare_all() {
	distutils-r1_python_prepare_all

	sed -i '/flake8/d' Makefile || die
}

python_compile_all() {
	emake youtube-dl.{bash-completion,fish,zsh}
}

python_test() {
	emake offlinetest
}

python_install_all() {
	dodoc AUTHORS ChangeLog README.md docs/supportedsites.md
	#doman youtube-dl.1 # would require pandoc in live ebuild

	newbashcomp youtube-dl.bash-completion youtube-dl

	insinto /usr/share/zsh/site-functions
	newins youtube-dl.zsh _youtube-dl

	insinto /usr/share/fish/vendor_completions.d
	doins youtube-dl.fish

	# keep man pages / completions either way given they are useful
	# for yt-dlp's compatibility wrapper which tries to mimic options
	use !yt-dlp || rm -r "${ED}"/usr/{lib/python-exec,bin} || die
}

pkg_postinst() {
	optfeature "converting and merging tracks on some sites" media-video/ffmpeg
	optfeature "embedding metadata thumbnails in MP4/M4A files" media-video/atomicparsley
	optfeature "downloading videos streamed via RTMP" media-video/rtmpdump
	optfeature "downloading videos streamed via MMS/RTSP" media-video/mplayer media-video/mpv

	ewarn "Note that it is preferable to use net-misc/yt-dlp over youtube-dl for"
	ewarn "latest features and site support. youtube-dl is only kept maintained for"
	ewarn "compatibility with older software (notably its python module, yt-dlp has"
	ewarn "a 'bin/youtube-dl' compatibility wrapper but not for the module)."
}