# along with Serve0 If not, see <http://www.gnu.org/licenses/>.
fifofile="${_DATA}/mplayer.fifo"
+statusfile="${_DATA}/mplayer.status"
volfile="${_DATA}/mplayer.volume"
if [ -n "${_POST[amp]+x}" ]; then
[ -n "$info" ] && playuri="${_DATA}/videos/$info"
fifofile="${_DATA}/mplayer.fifo"
+ statusfile="${_DATA}/mplayer.status"
volume="$(validate "$(cat "${_DATA}/mplayer.volume")" '[1-9]?[0-9]|100' 20)"
[ \! -p "$fifofile" ] && rm -f "$fifofile" && mkfifo -m 600 "$fifofile"
debug PLAYURI $playuri
DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/1006 \
- nohup /usr/bin/mplayer -ao pulse -quiet \
+ nohup /usr/bin/mplayer -ao pulse \
-slave -input file="$fifofile" \
-volume "$volume" \
- "$playuri" >/dev/null 2>/dev/null &
+ "$playuri" >"$statusfile" 2>/dev/null &
# # MPlayer2:
# DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/1006 \
info="${_GET[i]}"
location="$(invalidate "${_GET[l]}" '(.*/)?\.\.(/.*)?|' /)"
directory="${location%/*}"
+statusfile="$_DATA/mplayer.status"
TITLE="$info"
volume=$(validate "$(cat "$_DATA/mplayer.volume")" '[1-9]?[0-9]|100' 20)
debug VIDEO: $video
+
+progress(){
+ tail --pid=$$ -f "$statusfile" \
+ | tr '\r' '\n' \
+ | sed -urn 's;^.* ([0-9]{1,3})(,[0-9]+)?% *$;\1;p' \
+ | while read n; do
+ [ "$n" != "$previous" ] && printf "%s\n" "$((100 - $n))"
+ previous=$n
+ done
+}
overflow: visible;
}
+body.playctl .panel#search,
+body.playctl .panel#foot { padding-right: .25em; }
+
.panel:target {
max-height: 100%;
overflow-y: scroll;
#playctl form button[name="vol"][value="100"],
#playctl form button[name="vol"][value="0"] { width: 6%;}
+span.progress {
+ display: block;
+ position: fixed;
+ bottom: 2.5em;
+ width: 100%; left:0; right: 0;
+ color: white;
+ background-color: black;
+ border-top: 1px solid white;
+ padding: 0;
+ height: 1em;
+}
+span.progress > * {
+ display: block;
+ text-align: center;
+ background-color: #333;
+}
+
@media (min-width: 460px){
#playctl form button {
max-width: 4em;
cat <<EOF
<!Doctype HTML>
-<html>
- <head>
- <meta name="viewport" content="width=device-width">
- <link rel="stylesheet" href="?static=common.css" />
- <title>${TITLE:-${PAGE}}</title>
- </head>
-EOF
-cat <<EOF
- <body>
- $([ -x "${BODY}" ] && . "${BODY}" || printf %s Error)
- </body>
-</html>
+<html><head>
+ <meta name="viewport" content="width=device-width">
+ <link rel="stylesheet" href="?static=common.css" />
+ <title>${TITLE:-${PAGE}}</title>
+</head>
EOF
+printf '<body class="%s">' "${PAGE}"
+
+[ -x "${BODY}" ] && . "${BODY}" || printf %s Error
+
+printf '</body></html>'
+
# vi:set filetype=html:
<a class="panel clearsearch" href="?">Clear All</a>
<a class="panel" href="${info:+?p=list&${page_this}}${directory:+?p=tree&d=${directory}&${page_this}}#$(urlsafe $info)">Dismiss</a>
-
- <div class="pagination_nav">
- <label>Page:</label>
- <a href="?p=view&${page_prev}"><<</a>
- <a href="?p=view&${page_this}">$(($page + 1))</a>
- <a href="?p=view&${page_next}">>></a>
- </div>
</form>
<div id="playctl">
printf '<button class="%s" type="submit" name="vol" value="%s"> </button>' "$([ "$volume" = "$n" ] && printf selected)" "$n"
done)
<br>
- <button type="submit" name="osd" value="progression">Progress</button>
+ <!--button type="submit" name="osd" value="progression">Progress</button -->
</form>
<span class="info length">$(($length / 60)):$(($length % 60)) min</span>
<div class="panel footer" id="foot">
<a class="panel toggle" href="#tagger">Edit Tags</a>
-
- <div class="pagination_nav">
- <label>Page:</label>
- <a href="?${page_prev}"><<</a>
- <a href="?${page_this}">$(($page + 1))</a>
- <a href="?${page_next}">>></a>
- </div>
</div>
EOF
+cnt=0
+progress \
+| while read n; do
+ printf '<span class="progress"><span style="width: %s%%;">%s</span></span>\n' $n $n
+done
+
+
+
+
# vi:set filetype=html: