X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=page_video.sh;h=e69089e058424df87a2013a3c0b08689aa04848d;hb=29da441efa7c3d5364548d5af0b4747ddfc7da3a;hp=9e49a6fdefae7afaed27c164c335fee232e6bad0;hpb=8b374fb64933f92041613b3eb625da593208d275;p=rawnet diff --git a/page_video.sh b/page_video.sh index 9e49a6f..e69089e 100755 --- a/page_video.sh +++ b/page_video.sh @@ -6,6 +6,7 @@ includepage_video="$0" . "$_EXEC/db_channel.sh" . "$_EXEC/db_video.sh" . "$_EXEC/upload.sh" +. "$_EXEC/transcoding.sh" read_channel "$channel" read_video "$video" @@ -36,7 +37,8 @@ read_video "$video" elif [ "$(POST delconfirm)" != confirm ]; then REDIRECT "${_BASE}/channel/$CHANNEL_ID/$VIDEO_ID/#ERROR_NOT_CONFIRMED" elif delete_video "$VIDEO_ID"; then - rm -f -- "$VIDEO_FILE" "$VIDEO_THUMB" "$VIDEO_MP4" "$VIDEO_WEBM" + rm -f -- "$VIDEO_FILE" "$VIDEO_THUMB" "$VIDEO_MP4" "$VIDEO_WEBM" \ + "${VIDEO_MP4%.mp4}".*.mp4 "${VIDEO_WEBM%.webm}".*.webm REDIRECT "${_BASE}/channel/$CHANNEL_ID/#DELETE_CONFIRM" else REDIRECT "${_BASE}/channel/$CHANNEL_ID/$VIDEO_ID/#ERROR_UPDATE_NOLOCK" @@ -52,6 +54,7 @@ if [ "$REQUEST_METHOD" = POST -a "$CHANNEL_ID" -a "$VIDEO_ID" ]; then head -c "$CONTENT_LENGTH" >/dev/null REDIRECT "${_BASE}/channel/$CHANNEL_ID/$VIDEO_ID/#ERROR_UPLOAD_NOCLOBBER" elif UPLOAD "$VIDEO_FILE"; then + transcode "$VIDEO_FILE" REDIRECT "${_BASE}/channel/$CHANNEL_ID/$VIDEO_ID/edit" fi fi @@ -118,6 +121,24 @@ elif [ "$CHANNEL_ID" -a "$VIDEO_ID" -a -f "$VIDEO_FILE" ]; then "$_BASE" "$CHANNEL_ID" "$VIDEO_ID" \ "The video has not yet been transcoded and may not be displayed correctly." )] + $([ ! -f "$VIDEO_MP4" -a ! -f "$VIDEO_WEBM" ] && { + read file <"$_DATA/transcoding.queue" + if [ "$file" = "$VIDEO_FILE" ]; then + printf '[div .transcoding . This video is currently being + converted to various publishing formats. It may not be + rendered correctly until the conversion is finished.]' + elif grep -qFx "$VIDEO_FILE" "${_DATA}/transcoding.queue"; then + printf '[div .transcoding . This video is not yet converted to a + suitable publishing format. It may not be rendered + correctly until the conversion is finished. The conversion + will start automatically once previous jobs have been + finished.]' + else + printf '[div .transcoding Publishing formats do not seem to be + available for this video. It may be possible that the + uploaded file is broken and cannot be transcoded.]' + fi + }) $(AUTHOR && printf '[a .button href="edit" edit]') [h1 .name $(HTML "$VIDEO_NAME")] [div .description . ${VIDEO_DESCR_CACHE}]