From 46303b0f4d9ab83c8ee50e0d7787ba135bbc978a Mon Sep 17 00:00:00 2001 From: B. Watson Date: Sat, 7 Mar 2020 09:05:51 +0700 Subject: multimedia/straw-viewer: Added (search/stream videos from youtube). Signed-off-by: Willy Sudiarto Raharjo --- multimedia/straw-viewer/README | 38 +++++++ multimedia/straw-viewer/git2tarxz.sh | 71 +++++++++++++ multimedia/straw-viewer/list-moreutils.diff | 18 ++++ multimedia/straw-viewer/slack-desc | 19 ++++ multimedia/straw-viewer/straw-viewer.SlackBuild | 130 ++++++++++++++++++++++++ multimedia/straw-viewer/straw-viewer.info | 10 ++ multimedia/straw-viewer/straw-viewer.sqf | 46 +++++++++ 7 files changed, 332 insertions(+) create mode 100644 multimedia/straw-viewer/README create mode 100644 multimedia/straw-viewer/git2tarxz.sh create mode 100644 multimedia/straw-viewer/list-moreutils.diff create mode 100644 multimedia/straw-viewer/slack-desc create mode 100644 multimedia/straw-viewer/straw-viewer.SlackBuild create mode 100644 multimedia/straw-viewer/straw-viewer.info create mode 100644 multimedia/straw-viewer/straw-viewer.sqf (limited to 'multimedia') diff --git a/multimedia/straw-viewer/README b/multimedia/straw-viewer/README new file mode 100644 index 0000000000..3ad09abd81 --- /dev/null +++ b/multimedia/straw-viewer/README @@ -0,0 +1,38 @@ +straw-viewer (search and stream videos from youtube) + +straw-viewer is a lightweight application for searching and streaming +videos from YouTube, using the API of invidio.us. The project is in its +early development stages and some features are not implemented yet. + +straw-viewer is a fork of youtube-viewer that does not require a Google +API key. Usage and user interface are identical to youtube-viewer. + +Optional dependencies: + +perl-Gtk3, perl-File-ShareDir - for gtk-straw-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. +perl-Term-ReadLine-Gnu - for command editing/history in the terminal. +youtube-dl [1] - if this is present, straw-viewer will use it to detect + available formats for the video. + +Counting optional ones, straw-viewer has over 40 dependencies. To make +life easier, there's a "straw-viewer.sqf" queue file included with this +build, which includes everything listed above. + +[1] A small caveat about youtube-dl: straw-viewer works without it, +though occasionally it'll choose a lower quality than is available +for some videos. However, if youtube-dl is present but outdated, +straw-viewer will fail to play videos at all! If you suspect this, +remove youtube-dl and try without it. + +This build always includes the command-line client (straw-viewer). For the +GTK client (gtk-straw-viewer), install perl-Gtk3 and perl-File-ShareDir +before running this script. If you have them installed but don't want +gtk-straw-viewer, you can set GTK=no in the script's environment. + +To force gtk-straw-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"). diff --git a/multimedia/straw-viewer/git2tarxz.sh b/multimedia/straw-viewer/git2tarxz.sh new file mode 100644 index 0000000000..3cc7487637 --- /dev/null +++ b/multimedia/straw-viewer/git2tarxz.sh @@ -0,0 +1,71 @@ +#!/bin/sh + +# Create source tarball from git repo, with generated version number. + +# Takes one optional argument, which is the commit or tag to create a +# tarball of. With no arg, HEAD is used. + +# Version number example: 0.0.1+20200227_ad7ec17 + +# Notes: + +# Do not use this if you're packaging a release. + +# This script doesn't need to be run as root. It does need to be able +# to write to the current directory it's run from. + +# Running this script twice for the same commit will NOT give identical +# tarballs, even if the contents are identical. This is because tar +# includes the current time in a newly-created tarball (plus there may +# be other git-related reasons). + +# Once you've generated a tarball, you'll still need a place to host it. +# Ask on the mailing list, if you don't have your own web server to +# play with. + +## Config: +# Github project and user names: +PRGNAM=straw-viewer +GITUSER=trizen + +# For github projects, you can use this unmodified: +CLONE_URL=https://github.com/$GITUSER/$PRGNAM.git + +# For non-github projects, you might not need GITUSER, in which case +# just omit it from the script. + +## End of config. + +set -e + +GITDIR=$( mktemp -dt $PRGNAM.git.XXXXXX ) +rm -rf $GITDIR +git clone $CLONE_URL $GITDIR + +CWD="$( pwd )" +cd $GITDIR + +if [ "$1" != "" ]; then + git reset --hard "$1" || exit 1 +fi + +GIT_SHA=$( git rev-parse --short HEAD ) + +DATE=$( git log --date=format:%Y%m%d --format=%cd | head -1 ) + +VERTAG=$( git tag -l | tail -1 ) + +VERSION=${VERTAG}+${DATE}_${GIT_SHA} + +rm -rf .git +find . -name .gitignore -print0 | xargs -0 rm -f + +cd "$CWD" +rm -rf $PRGNAM-$VERSION $PRGNAM-$VERSION.tar.xz +mv $GITDIR $PRGNAM-$VERSION +tar cvfJ $PRGNAM-$VERSION.tar.xz $PRGNAM-$VERSION + +echo +echo "Created tarball: $PRGNAM-$VERSION.tar.xz" +echo "VERSION=\"$VERSION\"" +echo "MD5SUM=\"$( md5sum $PRGNAM-$VERSION.tar.xz | cut -d' ' -f1 )\"" diff --git a/multimedia/straw-viewer/list-moreutils.diff b/multimedia/straw-viewer/list-moreutils.diff new file mode 100644 index 0000000000..3e90735e3b --- /dev/null +++ b/multimedia/straw-viewer/list-moreutils.diff @@ -0,0 +1,18 @@ +diff -Naur straw-viewer-0.0.1/bin/gtk-straw-viewer straw-viewer-0.0.1.patched/bin/gtk-straw-viewer +--- straw-viewer-0.0.1/bin/gtk-straw-viewer 2020-02-26 05:17:22.000000000 -0500 ++++ straw-viewer-0.0.1.patched/bin/gtk-straw-viewer 2020-02-28 17:04:39.723002906 -0500 +@@ -643,11 +643,11 @@ + undef $history{lc($line)}; + } + +- require List::Util; ++ require List::MoreUtils; + + # Keep only the most recent non-duplicated entries +- @history = reverse(List::Util::uniq(reverse(@history))); +- @search_history = List::Util::uniq(@search_history); ++ @history = reverse(List::MoreUtils::uniq(reverse(@history))); ++ @search_history = List::MoreUtils::uniq(@search_history); + + # Set entry completion + $completion = Gtk3::EntryCompletion->new; diff --git a/multimedia/straw-viewer/slack-desc b/multimedia/straw-viewer/slack-desc new file mode 100644 index 0000000000..aea1cf0983 --- /dev/null +++ b/multimedia/straw-viewer/slack-desc @@ -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------------------------------------------------------| +straw-viewer: straw-viewer (search and stream videos from youtube) +straw-viewer: +straw-viewer: straw-viewer is a lightweight application for searching and streaming +straw-viewer: videos from YouTube, using the API of invidio.us. The project is in +straw-viewer: its early development stages and some features are not implemented +straw-viewer: yet. +straw-viewer: +straw-viewer: +straw-viewer: +straw-viewer: +straw-viewer: diff --git a/multimedia/straw-viewer/straw-viewer.SlackBuild b/multimedia/straw-viewer/straw-viewer.SlackBuild new file mode 100644 index 0000000000..4ae5be4d63 --- /dev/null +++ b/multimedia/straw-viewer/straw-viewer.SlackBuild @@ -0,0 +1,130 @@ +#!/bin/sh + +# Slackware build script for straw-viewer + +# Written by B. Watson (yalhcru@gmail.com) + +# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. + +# 20200302 bkw: new build, based on youtube-viewer, of which straw-viewer +# is a fork. See https://github.com/trizen/youtube-viewer/issues/308 for +# why. Packaging a git commit because the latest (only) release has some +# issues that have been fixed. + +PRGNAM=straw-viewer +VERSION=${VERSION:-0.0.1+20200227_ad7ec17} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +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.?z +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" + +# 20200228 bkw: upstream claims gtk+3-3.20 is required, but everything +# actually works fine with 14.2's 3.18. So: +sed -i 's,"3.20","3.18",' share/gtk-$PRGNAM.glade + +# 20200228 bkw: 14.2's perl package has List::Util 1.4.1, which lacks +# the uniq() function. However, SBo's perl-List-MoreUtils provides it. +# This means we can ignore the build warning: +# ! List::Util (1.41) is installed, but we need version >= 1.43 +patch -p1 < $CWD/list-moreutils.diff + +# 20200306 bkw: upstream must not have ever run 'make test' in a clean +# environment... +sed -i 's,Youtube,Straw,g' t/*.t + +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 and icon to standard locations + mkdir -p $PKG/usr/share/applications $PKG/usr/share/pixmaps + LNPATH="../perl5/vendor_perl/auto/share/dist/WWW-StrawViewer" + ln -s $LNPATH/gtk-$PRGNAM.desktop \ + $PKG/usr/share/applications/gtk-$PRGNAM.desktop + ln -s $LNPATH/icons/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:-tgz} diff --git a/multimedia/straw-viewer/straw-viewer.info b/multimedia/straw-viewer/straw-viewer.info new file mode 100644 index 0000000000..b09a7f334a --- /dev/null +++ b/multimedia/straw-viewer/straw-viewer.info @@ -0,0 +1,10 @@ +PRGNAM="straw-viewer" +VERSION="0.0.1+20200227_ad7ec17" +HOMEPAGE="https://github.com/trizen/straw-viewer/" +DOWNLOAD="http://urchlay.naptime.net/~urchlay/src/straw-viewer-0.0.1+20200227_ad7ec17.tar.xz" +MD5SUM="405dd0bc791b9a970c8b09dbde909fe3" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="perl-data-dump perl-LWP-Protocol-https perl-JSON perl-Module-Build perl-List-MoreUtils" +MAINTAINER="B. Watson" +EMAIL="yalhcru@gmail.com" diff --git a/multimedia/straw-viewer/straw-viewer.sqf b/multimedia/straw-viewer/straw-viewer.sqf new file mode 100644 index 0000000000..dff04810ae --- /dev/null +++ b/multimedia/straw-viewer/straw-viewer.sqf @@ -0,0 +1,46 @@ +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-Net-LibIDN +Net-SSLeay +perl-Types-Serialiser +perl-Test-RequiresInternet +perl-PAR-Dist +perl-Mozilla-CA +perl-MIME-Charset +perl-List-MoreUtils-XS +perl-IO-Socket-SSL +perl-Glib-Object-Introspection +perl-Exporter-Tiny +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-List-MoreUtils +perl-LWP-Protocol-https +perl-JSON-XS +perl-JSON +perl-Gtk3 +perl-File-ShareDir +straw-viewer -- cgit v1.2.3