- printf '<!DOCTYPE HTML>
- <html><head>
- <title>Upload Progress</title>
- <style type="text/css"><!--
- body {
- text-align: center;
- }
- .progress {
- display: block;
- position: absolute;
- width: 20em;
- background-color: #FFF;
- border: 1pt solid;
- border-radius: 4pt;
- height: 1.25em;
- }
- .progress .bar {
- display: block;
- position: absolute;
- left: 0; top: 0; bottom: 0;
- background-color: #666;
- }
- .progress .count {
- display: block;
- position: absolute;
- left: 0; top: 0; right: 0; bottom: 0;
- line-height: 1.375em;
- }
- --></style>
- </head><body>
- '
- printf '<div class=progress><div class=bar style="width: 0%%;"></div><div class=count>%i / %i</div></div>\n' 0 0
- while [ ! -f "$_DATA/$channel/$video.mp4" -a \
- ! -f "$_DATA/$channel/$video.mp4.upload" ]; do sleep 1; done
- read size <"$_DATA/$channel/$video.mp4.upload"
- while [ -f "$_DATA/$channel/$video.mp4.upload" ]; do
- stat="$(stat -c %s "$_DATA/$channel/$video.mp4" 2>&-)"
- printf '<div class=progress><div class=bar style="width:%i%%;"></div><div class=count>%iMB / %iMB</div></div>\n' \
- "$(( stat * 100 / size ))" "$((stat / 1048576))" "$((size / 1048576))"
- sleep 1
- done
- printf '<span class=progress><div class=bar style="width:100%%;"></div><div class=count>Ready!</div></span>\n'
- printf '</body></html>'