]> git.plutz.net Git - serve0/blobdiff - pages/view.sh
new folder browse section
[serve0] / pages / view.sh
index 639bf0af734bf4ecef48d9635322c906bd0aba37..97b8e37ea672b98e18e69666e47cdf59e8402895 100755 (executable)
 # You should have received a copy of the GNU Affero General Public License
 # along with Serve0.  If not, see <http://www.gnu.org/licenses/>. 
 
+. $_EXEC/pages/list.sh
+. $_EXEC/pages/tree.sh
+
 info="${_GET[i]}"
-. $_EXEC/pages/common.sh
+location="$(invalidate "${_GET[l]}" '(.*/)?\.\.(/.*)?|' /)"
+directory="${location%/*}"
 
 meta="${_DATA}/meta/$info.meta"
-video="${_DATA}/videos/$info"
+[ -n "$info" ] && video="${_DATA}/videos/$info" \
+               || video="${treeroot%/}/${location#/}"
 tags="$(sed -n '2p' "$meta")"
 description="$(sed -n '3,$p' "$meta")"
 length=0; width=0; height=0;
-eval $(mplayer -noconsolecontrols -input file=/dev/null -slave -really-quiet -identify -frames 0 -ao null -vo null "$video" 2>/dev/null\
-| sed -rn 's:ID_VIDEO_WIDTH=(.*):width=\1:p;s:ID_VIDEO_HEIGHT=(.*):height=\1:p;s:ID_LENGTH=(.*)(\..*)$:length=\1:p;')
+
+debug "Analysing video: $video"
+echo '' |mplayer -input nodefault-bindings -nosound -vo null -identify -frames 0 "$video" \
+| sort \
+| sed -rn 's:ID_LENGTH=(.*)(\..*)$:\1:p;
+           s:ID_VIDEO_HEIGHT=(.*):\1:p;
+           s:ID_VIDEO_WIDTH=(.*):\1:p;' \
+| tr '\n' ' ' \
+| read length height width 2>/dev/null
+
 video="videos/$info"
+[ -n "$info" ] && video="videos/$info" \
+               || video="${location#/}"