aboutsummaryrefslogtreecommitdiff
path: root/articles/2025/Lynx,-Gopher,-and-video-files.html
blob: 62884148ed7c74407e0d98813b77f6f06eacbce8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!doctype html>
<html lang="EN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="/style.css">
    <title>Lynx, Gopher, and video files</title>
  </head>
  <body>
    <header>
      <h1>Bloggings</h1>
      <a href="/index.php">Back</a>
      
    </header>
    
<main>
<article>
<h2>Lynx, Gopher, and video files</h2>
<h3>2025-09-21</h3>
<h4>Getting Lynx to open video files</h4>

<p>I've been using Lynx as a Gopher browser on Artix Linux,
and I like it a lot as it renders cleanly, has logical
keybindings, and enables following html links.</p>
<p>But...</p>
<p>Trying to open video files with an external application
wasn't working. Luckily on one test I saw an error
concerning "mpeg_play".</p>

<p>The only mention of this file is as a VIEWER entry in
lynx.cfg. But changing it to something else has no effect
at all.</p>

<p>Somewhere in lynx, mpeg_play is hardcoded. 🤔. Checking the Lynx source code, I found it in HTInit.c</p>
<p>Why short circuit the config file this way? Anyway, I wrote a bash script named mpeg_play:</p>

<p>
#!/usr/bin/env bash<br>
/usr/bin/mpv --title="Mpv" >/dev/null 2>&1 $1
</p>

<p>chmod +x mpeg_play and put it in my PATH</p>

<p>and it works!<br>
Lynx can now play media files in Gopher holes.
(Note the --title parameter is to get it to play nice with dwm).</p>

<p>The question remains: why is this hard coded?</p>

<p>As for mpeg_play, it appears in Linux mailcap
entries in the 90's and seems to have been  bundled
in ximagetools.</p>

<p>Mpeg_play appears to date back a long way as a UNIX application:</p>

<p><a href="http://www.geom.uiuc.edu/software/mpeg_play">http://www.geom.uiuc.edu/software/mpeg_play</a></p>

<h3>Update 2025-09-23</h3>

<p>A little tweak made this script capable of opening playlists</h3>

<p>----------</p>
<p>
#!/usr/bin/env bash<br>
# necessary for Lynx browser video files<br>
# chmod +x and place in your PATH<br>
<br>
# mpv can sometimes take a few seconds to open when streaming<br>
# so I use notification that it's happening<br>
<br>
dunstify -t 2000 -a "Video" -u low -i "media-playback-start-symbolic"\<br>
&nbsp;&nbsp;-h string:x-dunst-stack-tag:"Media" "MPV Launching" &<br>
<br>
# detect if playlist<br>
# Lynx uses an anonymous file in /tmp, so we can only<br>
# detect a file type by it's contents, not it's extension<br>
<br>
if [ "$(grep -c "EXT3MU" "$1")" -eq 1 ]; then<br>            
&nbsp;&nbsp;# this is a playlist<br>
&nbsp;&nbsp;# I use dwm, the mpv options used here make it compatible<br>
&nbsp;&nbsp;mpv --geometry=1068x600 --ontop --idle=yes --force-window=yes\<br>
&nbsp;&nbsp;&nbsp;&nbsp;--playlist="$1" >/dev/null 2>&1 &<br>
else<br>	
&nbsp;&nbsp;mpv --geometry=1068x600 --ontop --idle=yes --force-window=yes\<br>
&nbsp;&nbsp;&nbsp;&nbsp;"$1" >/dev/null 2>&1	&<br>
fi<br>
<br>
exit 0<br>
</p>
<p>----------</p>
<p>The latest version can be found at <a href="https://git.wittamore.fr">git.wittamore.fr</a></p>

    </article>
</main>
<footer>

    <p>&nbsp;</p>
    
    <p>§</p>
  </footer>
</body>
</html>