summaryrefslogtreecommitdiffstats
path: root/multimedia/straw-viewer/restore_mplayer.diff
blob: e61d01420c208ec831ccaf9fcaefea736efc71a5 (plain)
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{ },