]>
Commit | Line | Data |
---|---|---|
59b2b248 ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_with doc # don't build doc | |
4 | %bcond_with tests # do not perform "make test" | |
5 | %bcond_without python2 # CPython 2.x module | |
6 | %bcond_without python3 # CPython 3.x module | |
7 | ||
8 | %define module pafy | |
9 | %define egg_name pafy | |
10 | %define pypi_name pafy | |
11 | Summary: Retrieve YouTube content and metadata | |
12 | Name: python-%{pypi_name} | |
69f071dc JP |
13 | Version: 0.5.4 |
14 | Release: 1 | |
59b2b248 ER |
15 | License: LGPLv3 |
16 | Group: Libraries/Python | |
17 | Source0: https://files.pythonhosted.org/packages/source/p/%{pypi_name}/%{pypi_name}-%{version}.tar.gz | |
69f071dc | 18 | # Source0-md5: 092930504c7e4fcea30b7446fa1878c7 |
59b2b248 ER |
19 | URL: http://np1.github.io/pafy/ |
20 | BuildRequires: rpm-pythonprov | |
21 | BuildRequires: rpmbuild(macros) >= 1.714 | |
22 | %if %{with python2} | |
23 | BuildRequires: python-modules | |
24 | BuildRequires: python-setuptools | |
25 | %endif | |
26 | %if %{with python3} | |
27 | BuildRequires: python3-modules | |
28 | BuildRequires: python3-setuptools | |
29 | %endif | |
30 | Requires: python-modules | |
31 | Suggests: youtube-dl | |
32 | BuildArch: noarch | |
33 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
34 | ||
35 | %description | |
36 | Features: | |
37 | ||
38 | - Retreive metadata such as viewcount, duration, rating, author, | |
39 | thumbnail, keywords | |
40 | - Download video or audio at requested resolution / bitrate / format / | |
41 | filesize | |
42 | - Command line tool (ytdl) for downloading directly from the command | |
43 | line | |
44 | - Retrieve the URL to stream the video in a player such as vlc or | |
45 | mplayer | |
46 | - Works with age-restricted videos and non-embeddable videos | |
47 | - Small, standalone, single importable module file (pafy.py) | |
48 | - Select highest quality stream for download or streaming | |
49 | - Download video only (no audio) in m4v or webm format | |
50 | - Download audio only (no video) in ogg or m4a format | |
51 | - Retreive playlists and playlist metadata | |
52 | - Works with Python 2.6+ and 3.3+ | |
53 | - Optionally depends on youtube-dl (recommended; more stable) | |
54 | ||
55 | %description -l pl.UTF-8 | |
56 | ||
57 | %package -n python3-%{module} | |
58 | Summary: - | |
59 | Summary(pl.UTF-8): - | |
60 | Group: Libraries/Python | |
61 | Requires: python3-modules | |
62 | ||
63 | %description -n python3-%{module} | |
64 | ||
65 | %description -n python3-%{module} -l pl.UTF-8 | |
66 | ||
67 | %package apidocs | |
68 | Summary: %{module} API documentation | |
69 | Summary(pl.UTF-8): Dokumentacja API %{module} | |
70 | Group: Documentation | |
71 | ||
72 | %description apidocs | |
73 | API documentation for %{module}. | |
74 | ||
75 | %description apidocs -l pl.UTF-8 | |
76 | Dokumentacja API %{module}. | |
77 | ||
78 | %prep | |
79 | %setup -q -n %{pypi_name}-%{version} | |
80 | ||
81 | rm -r %{egg_name}.egg-info | |
82 | ||
83 | %build | |
84 | %if %{with python2} | |
85 | %py_build %{?with_tests:test} | |
86 | %endif | |
87 | ||
88 | %if %{with python3} | |
89 | %py3_build %{?with_tests:test} | |
90 | %endif | |
91 | ||
92 | %if %{with doc} | |
93 | cd docs | |
94 | %{__make} -j1 html | |
95 | rm -rf _build/html/_sources | |
96 | %endif | |
97 | ||
98 | %install | |
99 | rm -rf $RPM_BUILD_ROOT | |
100 | %if %{with python2} | |
101 | %py_install | |
102 | %py_postclean | |
103 | ||
104 | mv $RPM_BUILD_ROOT%{_bindir}/ytdl{,2} | |
105 | %endif | |
106 | ||
107 | %if %{with python3} | |
108 | %py3_install | |
109 | mv $RPM_BUILD_ROOT%{_bindir}/ytdl{,3} | |
110 | %endif | |
111 | ||
112 | %clean | |
113 | rm -rf $RPM_BUILD_ROOT | |
114 | ||
115 | %if %{with python2} | |
116 | %files | |
117 | %defattr(644,root,root,755) | |
118 | %doc README.rst | |
119 | %attr(755,root,root) %{_bindir}/ytdl2 | |
120 | %{py_sitescriptdir}/%{module} | |
121 | %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
122 | %endif | |
123 | ||
124 | %if %{with python3} | |
125 | %files -n python3-%{module} | |
126 | %defattr(644,root,root,755) | |
127 | %doc README.rst | |
128 | %attr(755,root,root) %{_bindir}/ytdl3 | |
129 | %{py3_sitescriptdir}/%{module} | |
130 | %{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
131 | %endif | |
132 | ||
133 | %if %{with doc} | |
134 | %files apidocs | |
135 | %defattr(644,root,root,755) | |
136 | %doc docs/_build/html/* | |
137 | %endif |