summaryrefslogtreecommitdiff
blob: 54b1b7d180dd3e2c7be412d6c2112ad1733728b3 (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
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=3
PYTHON_DEPEND="2"
inherit eutils distutils fdo-mime

MY_P="Pymazon-${PV}"
DESCRIPTION="Downloader for the Amazon.com MP3 music store"
HOMEPAGE="https://code.google.com/p/pymazon/"
SRC_URI="https://pymazon.googlecode.com/files/${MY_P}.tar.gz"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE="+gtk +qt4"

DEPEND="gtk? ( dev-python/pygtk )
	qt4? ( dev-python/PyQt4 )"
RDEPEND="${DEPEND}
	dev-python/pycrypto"
S="${WORKDIR}/${MY_P}"

pkg_setup() {
	python_set_active_version 2
	python_pkg_setup
}

src_install() {
	distutils_src_install

	insinto /usr/share/pixmaps
	newins pymazon/resource/icons/download.png pymazon.png

	if ! use gtk && ! use qt4; then
		EXTRA_FIELDS="\nTerminal=true\nNoDisplay=true"
		DEFAULTARGS=" -c"
	fi
	make_desktop_entry "pymazon${DEFAULTARGS}" "Pymazon MP3 Downloader" \
		pymazon "Network;FileTransfer" \
		"MimeType=audio/x-amzxml;${EXTRA_FIELDS}"

	insinto /usr/share/mime/packages
	doins "${FILESDIR}/amz.xml"
}

pkg_postinst() {
	distutils_pkg_postinst
	fdo-mime_desktop_database_update
	fdo-mime_mime_database_update
	einfo "To link pymazon with your amazon.com account, visit:"
	einfo "  http://www.amazon.com/gp/dmusic/after_download_manager_install.html"
}

pkg_postrm() {
	distutils_pkg_postrm
	fdo-mime_desktop_database_update
	fdo-mime_mime_database_update
}