summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pcr/youtube-viewer/PKGBUILD65
-rw-r--r--pcr/youtube-viewer/libre.patch26
2 files changed, 91 insertions, 0 deletions
diff --git a/pcr/youtube-viewer/PKGBUILD b/pcr/youtube-viewer/PKGBUILD
new file mode 100644
index 000000000..ea4f619a5
--- /dev/null
+++ b/pcr/youtube-viewer/PKGBUILD
@@ -0,0 +1,65 @@
+#$Id: PKGBUILD 223893 2017-04-20 06:52:58Z arojas $
+# Maintainer (Arch): Alexander F Rødseth <xyproto@archlinux.org>
+# Contributor (Arch): Daniel Wallace < danielwallace at gtmanfred dot com>
+# Contributor (Arch): Trizen <echo dHJpemVueEBnbWFpbC5jb20K | base64 -d>
+# Maintainer (Hyperbola): André Silva <emulatorman@hyperbola.info>
+# Contributor (Hyperbola): Márcio Silva <coadde@hyperbola.info>
+# Maintainer: Jesús E. <heckyel@parabola.nu>
+
+pkgbase=youtube-viewer
+pkgname=(youtube-viewer gtk-youtube-viewer)
+epoch=1
+pkgver=3.3.1
+pkgrel=1.parabola1
+arch=('any')
+url='https://github.com/trizen/youtube-viewer'
+license=('GPL3')
+source=("https://github.com/trizen/$pkgname/archive/$pkgver.tar.gz"
+ "libre.patch")
+sha512sums=('16ac8f899c4c37d7380856951db175df5c0d4d849f939c15e64c9f89303af6826748098c34dd64982dc20ee505c120f853bd83700a0cc63383220e23dbbe17c6'
+ '0298cc97e97755afd02e425872165ecd0465796c857378ffd2829c0ea8e65c88863963fd31b5f8bb880dc9a6a5eb13e80696057c3c6d34ff0e0f02dbf411719d')
+depends=('perl>=5.16.0' 'perl-data-dump' 'perl-json' 'perl-lwp-protocol-https' 'perl-libwww')
+makedepends=('perl-module-build')
+optdepends=(
+ 'perl-json-xs: faster JSON to HASH conversion'
+ 'perl-text-charwidth: to print the results in a fixed-width format (-W)'
+ 'perl-term-readline-gnu: for better STDIN support'
+ 'avideo: for playing videos with AVideo'
+ 'wget: for downloading videos with wget'
+ 'vlc: for playing videos with VLC'
+ 'mpv: for playing videos with MPV (recommended)'
+)
+
+prepare() {
+ cd "$pkgbase-$pkgver"
+ patch -p1 -i ../libre.patch
+}
+
+build() {
+ cd "$pkgbase-$pkgver"
+ perl Build.PL --installdirs vendor --gtk
+}
+
+check(){
+ cd $pkgbase-$pkgver
+ ./Build test
+}
+
+package_youtube-viewer() {
+ pkgdesc='Utility for viewing YouTube videos (CLI), with AVideo support'
+ optdepends+=('gtk-youtube-viewer: to use youtube-viewer with GTK+ GUI')
+ cd $pkgbase-$pkgver
+ ./Build install --destdir "$pkgdir"
+ rm -r "$pkgdir"/usr/lib
+ rm "$pkgdir"/usr/bin/vendor_perl/gtk-youtube-viewer
+}
+
+package_gtk-youtube-viewer() {
+ pkgdesc='Utility for viewing YouTube videos (GTK+ GUI), with AVideo support'
+ depends+=('youtube-viewer' 'gtk2-perl' 'perl-file-sharedir')
+ cd $pkgbase-$pkgver
+ install -d "$pkgdir/usr/"{bin/vendor_perl,share/{applications,pixmaps}}
+ install -Dm 755 "bin/$pkgname" "$pkgdir/usr/bin/vendor_perl/$pkgname"
+ install -Dm 644 "share/$pkgname.desktop" "$pkgdir/usr/share/applications/$pkgname.desktop"
+ install -Dm 644 "share/icons/$pkgname.png" "$pkgdir/usr/share/pixmaps/$pkgname.png"
+}
diff --git a/pcr/youtube-viewer/libre.patch b/pcr/youtube-viewer/libre.patch
new file mode 100644
index 000000000..491b34ee3
--- /dev/null
+++ b/pcr/youtube-viewer/libre.patch
@@ -0,0 +1,26 @@
+diff --git a/lib/WWW/YoutubeViewer.pm b/lib/WWW/YoutubeViewer.pm
+index a68b11c..bdacb08 100644
+--- a/lib/WWW/YoutubeViewer.pm
++++ b/lib/WWW/YoutubeViewer.pm
+@@ -535,10 +535,10 @@ sub get_video_tops {
+ sub _get_formats_from_ytdl {
+ my ($self, $videoID) = @_;
+
+- ((state $x = $self->proxy_system('youtube-dl', '--version')) == 0)
++ ((state $x = $self->proxy_system('avideo', '--version')) == 0)
+ || return;
+
+- my $json = $self->proxy_stdout('youtube-dl', '--all-formats', '--dump-single-json',
++ my $json = $self->proxy_stdout('avideo', '--all-formats', '--dump-single-json',
+ quotemeta("https://www.youtube.com/watch?v=" . $videoID));
+
+ my @array;
+@@ -705,7 +705,7 @@ sub get_streaming_urls {
+ Data::Dump::pp(\@caption_urls);
+ }
+
+- # Try again with youtube-dl
++ # Try again with avideo
+ if (!@streaming_urls or $info{status} =~ /fail|error/i) {
+ @streaming_urls = $self->_get_formats_from_ytdl($videoID);
+ }