]> git.plutz.net Git - serve0/blobdiff - templates/playctl.html.sh
enable some PulseAudio features, put some player controls in extra panel
[serve0] / templates / playctl.html.sh
index 62fe1d262a1e48105968636462a56cc0e3a6a2cb..6bf7dcc7719ead5975c4c994baa24e6cce7353e4 100755 (executable)
@@ -35,76 +35,91 @@ cat <<EOF
   <h1>$info</h1>
   <a href="$video">Download</a>
 
-  <form action="?action=playctl" method="post">
-     <button type="submit" name="seek" value="-60">&lt;&lt;&lt;</button>
-     <button type="submit" name="seek" value="-10">&lt;&lt;</button>
-     <button type="submit" name="ctl" value="stop">&#x25a0;</button>
-     <button type="submit" name="ctl" value="pause">|| / &#x25b6;</button>
-     <button type="submit" name="seek" value="+10">&gt;&gt;</button>
-     <button type="submit" name="seek" value="+60">&gt;&gt;&gt;</button>
-     <br>
-     <button type="submit" name="amp" value="off">Amp Off</button>
-     <button type="submit" name="amp" value="on">Amp On</button>
-     <br>
-     $(for n in $(seq 0 5 100); do
-       printf '<button class="%s" type="submit" name="vol" value="%s">&nbsp;</button>' "$([ "$volume" = "$n" ] && printf selected)" "$n"
-     done)
-     <br>
-     <!--button type="submit" name="osd" value="progression">Progress</button -->
+  <form action="?action=playctl" method="post" class="playctl">
+    <fieldset class="playback">
+      <button type="submit" name="seek" value="-60">&lt;&lt;&lt;</button>
+      <button type="submit" name="seek" value="-10">&lt;&lt;</button>
+      <button type="submit" name="ctl" value="stop">&#x25a0;</button>
+      <button type="submit" name="ctl" value="pause">|| / &#x25b6;</button>
+      <button type="submit" name="seek" value="+10">&gt;&gt;</button>
+      <button type="submit" name="seek" value="+60">&gt;&gt;&gt;</button>
+    </fieldset>
+    <fieldset class="volume">
+      $(for n in $(seq 0 5 100); do
+        printf '<button class="%s" type="submit" name="vol" value="%s">&nbsp;</button>' "$([ "$volume" = "$n" ] && printf selected)" "$n"
+      done)
+    </fieldset>
   </form>
 
-  <span class="info length">$(($length / 60)):$(($length % 60)) min</span>
+  <span class="info length">$(printf "%d:%02d min" $(($length / 60)) $(($length % 60)) )</span>
   <span class="info width" >Width: $width</span>
   <span class="info height">Height: $height</span><br>
   
   $(printf %s\\n "$tags" |sed -r 's:\|*([^|]+)\|*:<span class="info tag">\1</span> :g')
   ${description:+<span class="info description">$(printf %s "$description" |_wiki)</span>}
+</div>
 
-  <form class="panel" id="tagger" action="?action=meta&${page_this}" method="post" accept-charset="UTF-8">
-    <input type="hidden" name="length" value="$length">
-    <input type="hidden" name="width" value="$width">
-    <input type="hidden" name="height" value="$height">
-
-    $(
-    for cat in $(list_categories); do
-      printf '<p class="newtag"><label class="category">%s:</label><select name="tag" size="12" multiple>' "${cat}"
-      catt="${cat}:"
-      [ "$catt" = "none:" ] && catt=''
-      
-      printf %s "$taglist_set" |egrep '^'"$catt"'[^:]+$' |while read line; do
-        printf '<option %s value="%s">%s</option>' \
-               "$(egrep -q "(^|.*\|)$line(\|.*|$)" "$meta" && printf selected)" \
-               "$line" "${line#*:}"
-      done
-      printf '</select></p>'
-    done
-    )
+<form class="panel playctl" id="advctl" action="?action=playctl" method="post">
+  <fieldset class="volume">
+    <button type="submit" name="amp" value="off">Amp Off</button>
+    <button type="submit" name="amp" value="on">Amp On</button>
+  </fieldset>
+  <fieldset class="pasink">
+    $(pa_sinks |while read no name; do
+      printf '<button type="submit" name="pasink" value="%s">%s</button>' "$no" "$name"
+    done)
+  </fieldset>
+  <a class="panel toggle" href="#foot">Hide</a>
+</form>
 
-    <p class="newtag additional">
-      <label class="additional">Additional Tags (one per line):</label>
-      <textarea name="tags" rows="4"></textarea>
-    </p>
-    <p class="newtag description">
-      <label class="description">Description:</label>
-      <textarea name="description" rows="4">$description</textarea>
-    </p>
-    <input type="submit" value="Edit!">
-    <input type="submit" name="trash" value="Delete Video">
+<form class="panel" id="tagger" action="?action=meta&${page_this}" method="post" accept-charset="UTF-8">
+  <input type="hidden" name="length" value="$length">
+  <input type="hidden" name="width" value="$width">
+  <input type="hidden" name="height" value="$height">
 
-    <a class="panel toggle" href="#foot">Hide</a>
+  $(
+  for cat in $(list_categories); do
+    printf '<p class="newtag"><label class="category">%s:</label><select name="tag" size="12" multiple>' "${cat}"
+    catt="${cat}:"
+    [ "$catt" = "none:" ] && catt=''
+    
+    printf %s "$taglist_set" |egrep '^'"$catt"'[^:]+$' |while read line; do
+      printf '<option %s value="%s">%s</option>' \
+             "$(egrep -q "(^|.*\|)$line(\|.*|$)" "$meta" && printf selected)" \
+             "$line" "${line#*:}"
+    done
+    printf '</select></p>'
+  done
+  )
 
-  </form>
-</div>
+  <p class="newtag additional">
+    <label class="additional">Additional Tags (one per line):</label>
+    <textarea name="tags" rows="4"></textarea>
+  </p>
+  <p class="newtag description">
+    <label class="description">Description:</label>
+    <textarea name="description" rows="4">$description</textarea>
+  </p>
+  <input type="submit" value="Edit!">
+  <input type="submit" name="trash" value="Delete Video">
+
+  <a class="panel toggle" href="#foot">Hide</a>
+</form>
 
 <div class="panel footer" id="foot">
   <a class="panel toggle" href="#tagger">Edit Tags</a>
+  <a class="panel toggle" href="#advctl">More</a>
 </div>
+
+<span class="progress">
 EOF
 
 cnt=0
 progress \
 | while read p t; do
-  printf '<span class="progress"><span style="width: %d%%;">%s</span></span>\n' "${p}" "${t}"
+  printf '<span style="width: %d%%;">%d:%02d</span>\n' "${p}" "$(($t / 60))" "$(($t % 60))"
 done
 
+printf '</span>'
+
 # vi:set filetype=html: