]> git.plutz.net Git - serve0/blob - view.sh
adjustable eye distance in stereoview + use of gyroscopes
[serve0] / view.sh
1 #!/bin/sh
2
3 . "$_EXEC/db_meta.sh"
4 . "$_EXEC/widgets.sh"
5
6 read_meta "${ITEM%.*}"
7
8 printf 'Content-Type: text/html;charset=utf-8\r\n\r\n'
9
10 { cat <<-EOF
11         [!DOCTYPE HTML]
12         [html [head
13           [title . $(HTML "${ITEM##*/}")]
14           [meta name="viewport" content="width=device-width"]
15           [link rel=stylesheet href="/cgilite/common.css" ]
16           [link rel=stylesheet href="/style.css" ]
17         ] [body #view
18           [script type="text/javascript" src="/stereoview.js"\n]
19           [div #navigation
20             [a #t_bookmarks href="#bookmarks" &#x2605;]
21             $(w_search)
22             [a #t_prefs href="#prefs" &#x2699;]
23           ]
24         EOF
25   w_bookmarks
26   w_advsearch
27   w_prefs
28   cat <<-EOF
29           [input type=hidden id=StereoFOV  name=StereoFOV  value="$(COOKIE StereoFOV  |grep -xE '[0-9]+' || printf 90)"]
30           [input type=hidden id=StereoDist name=StereoDist value="$(COOKIE StereoDist |grep -xE '[0-9]+' || printf  0)"]
31           [video #mainvideo controls="controls" preload="auto" [source src="?a=download" type="video/mp4"]]
32           [a "?a=download" Download]
33           [a "javascript:stereoview(180, document.getElementById(&#34;mainvideo&#34;));" View 180° Stereoscopic]
34           [a "javascript:stereoview(360, document.getElementById(&#34;mainvideo&#34;));" View 360° Stereoscopic]
35           [h1 . $(HTML "${ITEM##*/}" |sed -E 's;[^0-9a-zA-Z&#];&[wbr];g')]
36           [span .time $((META_LENGTH / 60)):$(printf %02i $((META_LENGTH % 60)))min] [span .dim ${META_WIDTH}x${META_HEIGHT}]
37         EOF
38   printf %s\\n "$META_TAGS" |tr , \\n |while read tag; do
39     [ "$tag" ] && printf '  [span .tag . %s]\n' "$(HTML "${tag#-}")"
40   done
41
42   if [ "${META_GROUP}" ]; then
43     printf '[div .itemlist'
44     list_meta "$_DATA/${ITEM%/*}/.index/meta" \
45     | grep -F "${CR}    ${META_GROUP}" \
46     | sort -n -k8 -k6,6 \
47     | while read_meta; do
48       file="$(printf %s\\n "$_DATA/${META_NAME}".*)"
49       [ "/${file#${_DATA}/}" = "$ITEM" ] && continue
50       name="$(HTML "/${file#${_DATA}/}")"
51
52       printf '[div .list .file
53                 [a href="%s" [img src="%s?a=thumbnail"]][label . %s]
54                 [span .time %i:%02imin] [span .dim %ix%i] %s
55               ]' \
56         "$name" "$name" "${name##/}" \
57         "$((META_LENGTH / 60))" "$((META_LENGTH % 60))" \
58         "$META_WIDTH" "$META_HEIGHT" \
59         "$(printf %s\\n "${META_TAGS}" \
60            | sed -r 's;^;,;; s;,+;,;g; s;,$;;;
61                      :X s;,-?([^,]+)(,|$); [span .tag\n \1]\2;; tX;'
62         )"
63     done
64     printf ']'
65   fi
66
67   printf '
68   [div #editing
69     [form method=POST action="/?a=multitag"
70     [hidden "select" "%s"]' "$(HTML "${ITEM}")"
71       [ -d "$_DATA/${ITEM%/*}/.index/" ] && w_tagging
72     printf '
73     ]
74   ]
75 ] ]
76 '; } | "$_EXEC/cgilite/html-sh.sed"