From 16027fe8c543f337c2482b7dc71d5a5ae9a0e53a Mon Sep 17 00:00:00 2001 From: B. Watson Date: Mon, 25 May 2020 23:17:10 -0400 Subject: multimedia/straw-viewer: Updated for version 0.0.3+20200516_820ebc7. Signed-off-by: B. Watson Signed-off-by: Willy Sudiarto Raharjo --- multimedia/straw-viewer/README | 34 +++++---- multimedia/straw-viewer/restore_mplayer.diff | 95 +++++++++++++++++++++++++ multimedia/straw-viewer/straw-viewer.SlackBuild | 13 +++- multimedia/straw-viewer/straw-viewer.info | 6 +- 4 files changed, 131 insertions(+), 17 deletions(-) create mode 100644 multimedia/straw-viewer/restore_mplayer.diff diff --git a/multimedia/straw-viewer/README b/multimedia/straw-viewer/README index b25df5614e..a4ba9509c0 100644 --- a/multimedia/straw-viewer/README +++ b/multimedia/straw-viewer/README @@ -1,7 +1,7 @@ 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 +videos from YouTube, using the API of invidio.us[2]. 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 @@ -9,8 +9,9 @@ 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 14.2 has some issues with straw-viewer (or -actually with youtube: the audio stream cuts out randomly). Using vlc -or mpv is highly recommended. +actually with youtube: the audio stream cuts out randomly, and can be +fixed by pressing the left arrow usually). Using vlc or mpv is highly +recommended. Optional dependencies: @@ -27,17 +28,24 @@ 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 +GTK client (gtk-straw-viewer[3]), 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"). +Notes: + +[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. + +[2] The default API host is https://invidio.us. If straw-viewer gives "Bad + gateway" or "Too many requests" errors, try changing the api_host in + ~/.config/straw-viewer/straw-viewer.conf or via the --api-host option. + A list of API hosts can be found at: https://instances.invidio.us/ + +[3] 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/restore_mplayer.diff b/multimedia/straw-viewer/restore_mplayer.diff new file mode 100644 index 0000000000..e61d01420c --- /dev/null +++ b/multimedia/straw-viewer/restore_mplayer.diff @@ -0,0 +1,95 @@ +diff --git a/bin/gtk-straw-viewer b/bin/gtk-straw-viewer +index c6c17dd..9bd9bd8 100755 +--- a/bin/gtk-straw-viewer ++++ b/bin/gtk-straw-viewer +@@ -161,6 +161,13 @@ my %CONFIG = ( + fs => q{--fullscreen}, + arg => q{--really-quiet --title=*TITLE* --no-ytdl}, + }, ++ mplayer => { ++ cmd => q{mplayer}, ++ srt => q{-sub *SUB*}, ++ audio => q{-audiofile *AUDIO*}, ++ fs => q{-fs}, ++ arg => q{-prefer-ipv4 -really-quiet -title *TITLE*}, ++ }, + smplayer => { + cmd => q{smplayer}, + srt => q{-sub *SUB*}, +@@ -3042,9 +3049,8 @@ sub get_player_command { + my ($streaming, $video) = @_; + + my %MPLAYER; +- +- $MPLAYER{fullscreen} = $CONFIG{fullscreen} ? $CONFIG{video_players}{$CONFIG{video_player_selected}}{fs} : q{}; +- $MPLAYER{arguments} = $CONFIG{video_players}{$CONFIG{video_player_selected}}{arg} // q{}; ++ $MPLAYER{fullscreen} = $CONFIG{fullscreen} ? $CONFIG{video_players}{$CONFIG{video_player_selected}}{fs} : q{}; ++ $MPLAYER{mplayer_arguments} = $CONFIG{video_players}{$CONFIG{video_player_selected}}{arg} // q{}; + + my $cmd = join( + q{ }, +diff --git a/bin/straw-viewer b/bin/straw-viewer +index 9292f7e..5e4d5b2 100755 +--- a/bin/straw-viewer ++++ b/bin/straw-viewer +@@ -19,7 +19,7 @@ + # https://github.com/trizen/straw-viewer + #------------------------------------------------------- + +-# straw-viewer is a command line utility for streaming YouTube videos in mpv/vlc. ++# straw-viewer is a command line utility for streaming YouTube videos in mpv/vlc/mplayer. + + # This is a fork of youtube-viewer: + # https://github.com/trizen/youtube-viewer +@@ -167,11 +167,19 @@ my %CONFIG = ( + arg => q{--really-quiet --title=*TITLE* --no-ytdl}, + 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*}, ++ novideo => q{-novideo}, ++ }, + }, + + video_player_selected => ( + $constant{win32} +- ? 'vlc' ++ ? 'mplayer' + : undef # auto-defined + ), + +@@ -1769,6 +1777,21 @@ sub apply_input_arguments { + return 1; + } + ++# Get mplayer ++sub get_mplayer { ++ if ($constant{win32}) { ++ my $smplayer = catfile($ENV{ProgramFiles}, qw(SMPlayer mplayer mplayer.exe)); ++ ++ if (not -e $smplayer) { ++ warn "\n\n!!! Please install SMPlayer in order to stream YouTube videos.\n\n"; ++ } ++ ++ return $smplayer; # Windows MPlayer ++ } ++ ++ return 'mplayer'; # *NIX MPlayer ++} ++ + # Get term width + sub get_term_width { + return $term_width if $constant{win32}; +@@ -3319,7 +3342,7 @@ sub get_player_command { + + $MPLAYER{fullscreen} = $opt{fullscreen} ? $opt{video_players}{$opt{video_player_selected}}{fs} // '' : q{}; + $MPLAYER{novideo} = $opt{novideo} ? $opt{video_players}{$opt{video_player_selected}}{novideo} // '' : q{}; +- $MPLAYER{arguments} = $opt{video_players}{$opt{video_player_selected}}{arg} // q{}; ++ $MPLAYER{mplayer_arguments} = $opt{video_players}{$opt{video_player_selected}}{arg} // q{}; + + my $cmd = join( + q{ }, diff --git a/multimedia/straw-viewer/straw-viewer.SlackBuild b/multimedia/straw-viewer/straw-viewer.SlackBuild index 7ac1fee7a9..953b339045 100644 --- a/multimedia/straw-viewer/straw-viewer.SlackBuild +++ b/multimedia/straw-viewer/straw-viewer.SlackBuild @@ -6,6 +6,11 @@ # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. +# 20200525 bkw: +# - update to latest git. +# - add patch to re-enable mplayer. +# - add note in README about new --api-host option. + # 20200310 bkw: update to not-quite-latest git. Next commit after 9089523 # removes mplayer support, which kinda sucks for Slackware users since # mplayer ships with the OS (but mpv and vlc don't). My next update will @@ -17,7 +22,7 @@ # issues that have been fixed. PRGNAM=straw-viewer -VERSION=${VERSION:-0.0.2+20200307_9089523} +VERSION=${VERSION:-0.0.3+20200516_820ebc7} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} @@ -76,6 +81,12 @@ esac echo "=== GTK=$GTK BUILD_GTK=$BUILD_GTK GTKOPT=$GTKOPT" +# 20200525 bkw: Upstream removed mplayer support because it's flaky. +# 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 made with: git diff 9c9bbdf4..9089523 +patch -p1 < $CWD/restore_mplayer.diff + # 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 diff --git a/multimedia/straw-viewer/straw-viewer.info b/multimedia/straw-viewer/straw-viewer.info index 5144df6a25..506c4a6d7e 100644 --- a/multimedia/straw-viewer/straw-viewer.info +++ b/multimedia/straw-viewer/straw-viewer.info @@ -1,8 +1,8 @@ PRGNAM="straw-viewer" -VERSION="0.0.2+20200307_9089523" +VERSION="0.0.3+20200516_820ebc7" HOMEPAGE="https://github.com/trizen/straw-viewer/" -DOWNLOAD="http://urchlay.naptime.net/~urchlay/src/straw-viewer-0.0.2+20200307_9089523.tar.xz" -MD5SUM="60675a74c96dd9d7fa0f1096f32977c5" +DOWNLOAD="http://urchlay.naptime.net/~urchlay/src/straw-viewer-0.0.3+20200516_820ebc7.tar.xz" +MD5SUM="c626d1adc40db23d8517ccdc98d81596" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="perl-data-dump perl-LWP-Protocol-https perl-JSON perl-Module-Build perl-List-MoreUtils" -- cgit v1.2.3