From: Paul Hänsch Date: Fri, 22 Oct 2021 14:34:15 +0000 (+0200) Subject: consistent variable use, move AUTHOR function to db_channel X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=03f7b5633394de84a7420568dbfe8fe4141ce929;p=rawnet consistent variable use, move AUTHOR function to db_channel --- diff --git a/db_channel.sh b/db_channel.sh index 1df83fe..bb24961 100755 --- a/db_channel.sh +++ b/db_channel.sh @@ -103,3 +103,11 @@ new_channel(){ return 1 fi } + +AUTHOR(){ + if [ "$CHANNEL_ID" -a "$USER_ID" -a ! "${CHANNEL_AUTHORS##*${USER_ID}*}" ]; then + return 0 + else + return 1 + fi +} diff --git a/page_video.sh b/page_video.sh index 74e03e6..9e49a6f 100755 --- a/page_video.sh +++ b/page_video.sh @@ -5,7 +5,6 @@ includepage_video="$0" . "$_EXEC/db_channel.sh" . "$_EXEC/db_video.sh" -. "$_EXEC/widgets.sh" . "$_EXEC/upload.sh" read_channel "$channel" diff --git a/upload.sh b/upload.sh index e698573..f9e4296 100755 --- a/upload.sh +++ b/upload.sh @@ -43,11 +43,12 @@ frame_uploadprogress() { ' "$_BASE" printf '
%i / %i
\n' 0 0 - while [ ! -f "$_DATA/$CHANNEL_ID/${VIDEO_ID}.upload.mp4" \ - -a ! -f "$_DATA/$CHANNEL_ID/${VIDEO_ID}.upload.mp4.upload" ]; do sleep 1; done - read size <"$_DATA/$CHANNEL_ID/${VIDEO_ID}.upload.mp4.upload" - while [ -f "$_DATA/$CHANNEL_ID/${VIDEO_ID}.upload.mp4.upload" ]; do - stat="$(stat -c %s "$_DATA/$CHANNEL_ID/${VIDEO_ID}.upload.mp4" 2>&-)" + while [ ! -f "${VIDEO_FILE}" -a ! -f "${VIDEO_FILE}.upload" ]; do + sleep 1 + done + read size <"${VIDEO_FILE}.upload" + while [ -f "${VIDEO_FILE}.upload" ]; do + stat="$(stat -c %s "$VIDEO_FILE" 2>&-)" printf '
%iMB / %iMB
\n' \ "$(( stat * 100 / size ))" "$((stat / 1048576))" "$((size / 1048576))" sleep 1 diff --git a/widgets.sh b/widgets.sh index 1aa6272..f844ba4 100755 --- a/widgets.sh +++ b/widgets.sh @@ -6,14 +6,6 @@ include_widgets="$0" . "$_EXEC/db_channel.sh" . "$_EXEC/db_video.sh" -AUTHOR(){ - if [ "$CHANNEL_ID" -a "$USER_ID" -a ! "${CHANNEL_AUTHORS##*${USER_ID}*}" ]; then - return 0 - else - return 1 - fi -} - w_video(){ local thumb eval "$LOCAL_VIDEO"