multimedir/pipe-viewer: Added (youtube CLI/GUI).

Signed-off-by: B. Watson <yalhcru@gmail.com>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2022-01-30 15:17:01 -05:00 committed by Willy Sudiarto Raharjo
parent 19b1325015
commit f642c86495
No known key found for this signature in database
GPG key ID: 3F617144D7238786
6 changed files with 286 additions and 0 deletions

View file

@ -0,0 +1,46 @@
pipe-viewer (search and stream videos from youtube)
pipe-viewer is a lightweight application for searching and streaming
videos from YouTube. pipe-viewer is a fork of youtube-viewer that
does not require a Google API key. Usage and user interface are
identical to youtube-viewer.
For playing videos, this uses mplayer, vlc, or mpv. However, the
mplayer that ships with Slackware has some issues with pipe-viewer
(or actually with youtube: the audio stream cuts out randomly, and
can be fixed by pressing the left arrow usually).
Optional dependencies:
vlc and/or mpv - for playing videos. highly recommended.
perl-Gtk3, perl-File-ShareDir - for gtk-pipe-viewer.
perl-lwp-useragent-cached - for local cache support.
perl-JSON-XS - for faster JSON deserialization.
perl-Text-CharWidth, perl-Unicode-LineBreak - for better formatting
in the terminal.
yt-dlp or youtube-dl [1] - if this is present, pipe-viewer will use it
to detect available formats for the video.
Counting optional ones, pipe-viewer has over 40 dependencies. To make
life easier, there's a "pipe-viewer.sqf" queue file included with this
build, which includes everything listed above (except mpv and vlc).
This build always includes the command-line client (pipe-viewer). For
the GTK client (gtk-pipe-viewer[3]), install perl-Gtk3 and
perl-File-ShareDir before running this script. If you have them
installed but don't want gtk-pipe-viewer, you can set GTK=no in the
script's environment.
Notes:
[1] A small caveat about yt-dlp and youtube-dl: pipe-viewer works
without them, though occasionally it'll choose a lower quality
than is available for some videos. However, if yt-dlp or
youtube-dl are present but outdated, pipe-viewer will fail to
play videos at all! If you suspect this, remove yt-dlp and/or
youtube-dl and try without them.
[3] To force gtk-pipe-viewer to use your preferred terminal for
downloading with wget and watching in a terminal, set
TERMINAL in the script's environment (e.g. TERMINAL="xterm" or
TERMINAL="urxvt").

View file

@ -0,0 +1,134 @@
#!/bin/bash
# Slackware build script for pipe-viewer
# Written by B. Watson (yalhcru@gmail.com)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=pipe-viewer
VERSION=${VERSION:-0.1.8}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
# perl-Gtk3 is a runtime dep, we can build with GTK=yes even if it's not
# installed... but don't do that by default.
GTK="${GTK:-auto}"
case "$GTK" in
no) BUILD_GTK="no" ;;
yes) BUILD_GTK="yes" ;;
*) perl -MGtk3 -MFile::ShareDir -e 0 2>/dev/null \
&& BUILD_GTK="yes" \
|| BUILD_GTK="no" ;;
esac
[ "$BUILD_GTK" = "yes" ] && GTKOPT="--gtk"
echo "=== GTK=$GTK BUILD_GTK=$BUILD_GTK GTKOPT=$GTKOPT"
# Upstream used to support mplayer (in the original youtube-viewer,
# before the straw-viewer and pipe-viewer forks), then dropped it.
# That's as may be, but mplayer is included in core Slackware and the
# other players aren't. So we'll give the user the option to at least
# try it.
patch -p1 < $CWD/restore_mplayer.diff
perl Build.PL prefix=/usr installdirs=vendor --destdir="$PKG" $GTKOPT
./Build
./Build test
./Build install --install_path script=/usr/bin
mv $PKG/usr/share/man $PKG/usr/man
gzip -9 $PKG/usr/man/man?/*.?
if [ "$BUILD_GTK" = "yes" ]; then
# link .desktop to standard locations
mkdir -p $PKG/usr/share/applications $PKG/usr/share/pixmaps
LNPATH="../perl5/vendor_perl/auto/share/dist/WWW-PipeViewer"
ln -s $LNPATH/gtk-$PRGNAM.desktop \
$PKG/usr/share/applications/gtk-$PRGNAM.desktop
# icon is huge (351x313)...
for px in 16 32 48 64 128; do
size=${px}x${px}
dir=$PKG/usr/share/icons/hicolor/$size/apps
mkdir -p $dir
convert -resize $size share/icons/gtk-pipe-viewer.png $dir/gtk-$PRGNAM.png
done
ln -s ../icons/hicolor/48x48/apps/gtk-$PRGNAM.png \
$PKG/usr/share/pixmaps/gtk-$PRGNAM.png
# support TERMINAL option for user's preferred terminal.
if [ "$TERMINAL" != "" ]; then
sed -i "s/'gnome-terminal'/'$TERMINAL', &/" $PKG/usr/bin/gtk-$PRGNAM
fi
fi
find $PKG -name perllocal.pod \
-o -name ".packlist" \
-o -name "*.bs" \
| xargs rm -f
find $PKG -depth -type d -empty -delete || true
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a Changes LICENSE README* $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
# the permissions in the final package are weird.
find $PKG -type f -print0 | xargs -0 chmod 644
find $PKG -type d -print0 | xargs -0 chmod 755
chmod +x $PKG/usr/bin/*
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE

View file

@ -0,0 +1,10 @@
PRGNAM="pipe-viewer"
VERSION="0.1.8"
HOMEPAGE="https://github.com/trizen/pipe-viewer/"
DOWNLOAD="https://github.com/trizen/pipe-viewer/archive/0.1.8/pipe-viewer-0.1.8.tar.gz"
MD5SUM="8a3b68e98571248aedf1de23e3869976"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="perl-data-dump perl-JSON perl-http-message perl-LWP-Protocol-https perl-Module-Build perl-Term-ReadLine-Gnu"
MAINTAINER="B. Watson"
EMAIL="yalhcru@gmail.com"

View file

@ -0,0 +1,42 @@
yt-dlp
perl-html-tagset
perl-lwp-mediatypes
perl-http-date
perl-html-parser
perl-encode-locale
perl-IO-HTML
perl-http-message
perl-extutils-pkgconfig
perl-extutils-depends
perl-www-robotrules
perl-net-http
perl-http-negotiate
perl-http-daemon
perl-http-cookies
perl-glib
perl-file-listing
perl-common-sense
perl-cairo
perl-Types-Serialiser
perl-Test-RequiresInternet
perl-PAR-Dist
perl-Mozilla-CA
perl-MIME-Charset
perl-Glib-Object-Introspection
perl-File-ShareDir-Install
perl-Class-Inspector
perl-Canary-Stability
perl-Cairo-GObject
libwww-perl
perl-lwp-useragent-cached
perl-data-dump
perl-Unicode-LineBreak
perl-Text-CharWidth
perl-Term-ReadLine-Gnu
perl-Module-Build
perl-LWP-Protocol-https
perl-JSON-XS
perl-JSON
perl-Gtk3
perl-File-ShareDir
pipe-viewer

View file

@ -0,0 +1,35 @@
diff -Naur pipe-viewer-0.1.8/bin/gtk-pipe-viewer pipe-viewer-0.1.8.patched/bin/gtk-pipe-viewer
--- pipe-viewer-0.1.8/bin/gtk-pipe-viewer 2022-01-21 21:34:05.000000000 -0500
+++ pipe-viewer-0.1.8.patched/bin/gtk-pipe-viewer 2022-01-30 11:34:17.005950305 -0500
@@ -187,6 +187,13 @@
fs => q{--fullscreen},
arg => q{--really-quiet --force-media-title=*TITLE* --no-ytdl *VIDEO*},
},
+ mplayer => {
+ cmd => q{mplayer},
+ srt => q{-sub *SUB*},
+ audio => q{-audiofile *AUDIO*},
+ fs => q{-fs},
+ arg => q{-prefer-ipv4 -really-quiet -title *TITLE* *VIDEO*},
+ },
},
video_player_selected => undef, # autodetect it later
diff -Naur pipe-viewer-0.1.8/bin/pipe-viewer pipe-viewer-0.1.8.patched/bin/pipe-viewer
--- pipe-viewer-0.1.8/bin/pipe-viewer 2022-01-21 21:34:05.000000000 -0500
+++ pipe-viewer-0.1.8.patched/bin/pipe-viewer 2022-01-30 11:35:25.549944074 -0500
@@ -177,6 +177,14 @@
arg => q{--really-quiet --force-media-title=*TITLE* --no-ytdl *VIDEO*},
novideo => q{--no-video},
},
+ mplayer => {
+ cmd => q{mplayer},
+ srt => q{-sub *SUB*},
+ audio => q{-audiofile *AUDIO*},
+ fs => q{-fs},
+ arg => q{-prefer-ipv4 -really-quiet -title *TITLE* *VIDEO*},
+ novideo => q{-novideo},
+ },
},
video_player_selected => (

View file

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
pipe-viewer: pipe-viewer (search and stream videos from youtube)
pipe-viewer:
pipe-viewer: pipe-viewer is lightweight application (fork of straw-viewer) for
pipe-viewer: searching and playing videos from YouTube. This fork parses the
pipe-viewer: YouTube website directly and relies on invidious instances only as a
pipe-viewer: fallback method.
pipe-viewer:
pipe-viewer:
pipe-viewer:
pipe-viewer:
pipe-viewer: