add Duration indication

main
Christos Angelopoulos 2022-04-03 15:09:26 +03:00
parent 11abf9307f
commit 6219c181df
2 changed files with 15 additions and 9 deletions

13
Sapo.sh
View File

@ -20,7 +20,8 @@ case $? in
esac esac
DIRECTORY=${FILE%/*}/ DIRECTORY=${FILE%/*}/
NAME=${FILE##*/} NAME=${FILE##*/}
echo "FILE : ""$FILE" TEXT_EDITOR="xed"
AUDIO_EDITOR="audacity"
mkdir "$DIRECTORY""Sapo_""$NAME"/ mkdir "$DIRECTORY""Sapo_""$NAME"/
@ -89,7 +90,7 @@ case $? in
;; ;;
1) exit 1) exit
;; ;;
2) xed "$DIRECTORY""Sapo_""$NAME"/"$NAME"sentenced.txt & yad --image "$HOME/git/sapo/sapo.png" --height=40 --width=400 --title="${NAME} - Sapo" --button=gtk-cancel:1 --button=gtk-ok:0 --text="If you are done editing $NAME\sentenced.txt, <span foreground='yellow'><b>press OK</b></span> to continue!" --window-icon=$HOME/git/sapo/sapo.png 2) $TEXT_EDITOR "$DIRECTORY""Sapo_""$NAME"/"$NAME"sentenced.txt & yad --image "$HOME/git/sapo/sapo.png" --height=40 --width=400 --title="${NAME} - Sapo" --button=gtk-cancel:1 --button=gtk-ok:0 --text="If you are done editing $NAME\sentenced.txt, <span foreground='yellow'><b>press OK</b></span> to continue!" --window-icon=$HOME/git/sapo/sapo.png
case $? in case $? in
0) 0)
;; ;;
@ -124,7 +125,7 @@ do
TOTALCHARS=$(wc -m "$DIRECTORY""Sapo_""$NAME"/"$NAME"sentenced.txt |awk '{print $1}') TOTALCHARS=$(wc -m "$DIRECTORY""Sapo_""$NAME"/"$NAME"sentenced.txt |awk '{print $1}')
CHARSDONE=$(head -$LINE "$DIRECTORY""Sapo_""$NAME"/"$NAME"sentenced.txt|wc -m) CHARSDONE=$(head -$LINE "$DIRECTORY""Sapo_""$NAME"/"$NAME"sentenced.txt|wc -m)
CHARSLEFT=$(($TOTALCHARS - $CHARSDONE)) CHARSLEFT=$(($TOTALCHARS - $CHARSDONE))
SECONDS=$(( $CHARSLEFT / 4 )) SECONDS=$(( $CHARSLEFT / 8 ))
CHARSDONE100=$(($CHARSDONE * 100)) CHARSDONE100=$(($CHARSDONE * 100))
PERCENTAGE=$(( $CHARSDONE100 / $TOTALCHARS)) PERCENTAGE=$(( $CHARSDONE100 / $TOTALCHARS))
HOURS=$(( SECONDS / 3600 )) HOURS=$(( SECONDS / 3600 ))
@ -240,6 +241,7 @@ do
killall mplayer;mplayer "$DIRECTORY""Sapo_""$NAME"/$ERROR_WAV & killall mplayer;mplayer "$DIRECTORY""Sapo_""$NAME"/$ERROR_WAV &
fi fi
BROWSE_NEXT=false BROWSE_NEXT=false
DURATION=$(sox "$DIRECTORY""Sapo_""$NAME"/$ERROR_WAV -n stat 2>&1 |grep "Length"|sed 's/^.*\: *//')
yad --image "$HOME/git/sapo/sapo.png" \ yad --image "$HOME/git/sapo/sapo.png" \
--height=40 --width=400 \ --height=40 --width=400 \
--title="Line $ERROR_TEXT_LINE ( of $TOTAL_ERRORS )- $NAME" \ --title="Line $ERROR_TEXT_LINE ( of $TOTAL_ERRORS )- $NAME" \
@ -256,8 +258,9 @@ do
--button='⏩ Browse':9 \ --button='⏩ Browse':9 \
--text="Text of line $ERROR_TEXT_LINE ( of $TOTAL_ERRORS ): --text="Text of line $ERROR_TEXT_LINE ( of $TOTAL_ERRORS ):
<span foreground='yellow'><b>$TEXT_TO_CORRECT</b></span> <span foreground='yellow'><b>$TEXT_TO_CORRECT</b></span> sec
-Duration : <span foreground='orange'><b>$DURATION</b></span>
-What would you like to do?" \ -What would you like to do?" \
--window-icon=$HOME/git/sapo/sapo.png --window-icon=$HOME/git/sapo/sapo.png
case $? in case $? in
@ -276,7 +279,7 @@ do
;; ;;
6) if [[ -e "$DIRECTORY""Sapo_""$NAME"/$ERROR_WAV ]];then rm "$DIRECTORY""Sapo_""$NAME"/$ERROR_WAV;notify-send "$DIRECTORY""Sapo_""$NAME"/"$ERROR_WAV"" has been deleted."; else notify-send "There is no file ""$DIRECTORY""Sapo_""$NAME"/"$ERROR_WAV"". Already deleted?";fi;GO=true 6) if [[ -e "$DIRECTORY""Sapo_""$NAME"/$ERROR_WAV ]];then rm "$DIRECTORY""Sapo_""$NAME"/$ERROR_WAV;notify-send "$DIRECTORY""Sapo_""$NAME"/"$ERROR_WAV"" has been deleted."; else notify-send "There is no file ""$DIRECTORY""Sapo_""$NAME"/"$ERROR_WAV"". Already deleted?";fi;GO=true
;; ;;
7)killall mplayer;audacity "$DIRECTORY""Sapo_""$NAME"/$ERROR_WAV 7)killall mplayer;$AUDIO_EDITOR "$DIRECTORY""Sapo_""$NAME"/$ERROR_WAV
;; ;;
8)killall mplayer; GO=true; ERROR_LINE=$(($ERROR_LINE - 2)) 8)killall mplayer; GO=true; ERROR_LINE=$(($ERROR_LINE - 2))
;; ;;

View File

@ -21,6 +21,7 @@ case $? in
esac esac
DIRECTORY=${FILE%/*}/ DIRECTORY=${FILE%/*}/
NAME=${FILE##*/} NAME=${FILE##*/}
AUDIO_EDITOR="audacity"
####### FIXING ERRORS ONE BY ONE or EDIT THE FILE LINE BY LINE############ ####### FIXING ERRORS ONE BY ONE or EDIT THE FILE LINE BY LINE############
yad --image "$HOME/git/sapo/sapo-fix.png" \ yad --image "$HOME/git/sapo/sapo-fix.png" \
--height=40 --width=200 --title="${NAME} - Sapo" \ --height=40 --width=200 --title="${NAME} - Sapo" \
@ -70,7 +71,8 @@ do
killall mplayer;mplayer "$DIRECTORY""Sapo_""$NAME"/$ERROR_WAV & killall mplayer;mplayer "$DIRECTORY""Sapo_""$NAME"/$ERROR_WAV &
fi fi
BROWSE_NEXT=false BROWSE_NEXT=false
yad --image "$HOME/git/sapo/sapo-fix.png" \ DURATION=$(sox "$DIRECTORY""Sapo_""$NAME"/$ERROR_WAV -n stat 2>&1 |grep "Length"|sed 's/^.*\: *//')
yad --image "$HOME/git/sapo/sapo.png" \
--height=40 --width=400 \ --height=40 --width=400 \
--title="Line $ERROR_TEXT_LINE ( of $TOTAL_ERRORS )- $NAME" \ --title="Line $ERROR_TEXT_LINE ( of $TOTAL_ERRORS )- $NAME" \
--button=gtk-cancel:1 \ --button=gtk-cancel:1 \
@ -84,12 +86,13 @@ do
--button='➡️ Next':0 \ --button='➡️ Next':0 \
--button='👉 Go To':10 \ --button='👉 Go To':10 \
--button='⏩ Browse':9 \ --button='⏩ Browse':9 \
--text="Text of line $ERROR_TEXT_LINE ( of $TOTAL_ERRORS ): --text="-Text of line $ERROR_TEXT_LINE ( of $TOTAL_ERRORS ):
<span foreground='yellow'><b>$TEXT_TO_CORRECT</b></span> <span foreground='yellow'><b>$TEXT_TO_CORRECT</b></span>
-Duration : <span foreground='orange'><b>$DURATION</b></span> sec
-What would you like to do?" \ -What would you like to do?" \
--window-icon=$HOME/git/sapo/sapo-fix.png --window-icon=$HOME/git/sapo/sapo.png
case $? in case $? in
0) killall mplayer;GO=true 0) killall mplayer;GO=true
;; ;;
@ -106,7 +109,7 @@ do
;; ;;
6)killall mplayer; if [[ -e "$DIRECTORY""Sapo_""$NAME"/$ERROR_WAV ]];then rm "$DIRECTORY""Sapo_""$NAME"/$ERROR_WAV;notify-send "$DIRECTORY""Sapo_""$NAME"/"$ERROR_WAV"" has been deleted."; else notify-send "There is no file ""$DIRECTORY""Sapo_""$NAME"/"$ERROR_WAV"". Already deleted?";fi;GO=true 6)killall mplayer; if [[ -e "$DIRECTORY""Sapo_""$NAME"/$ERROR_WAV ]];then rm "$DIRECTORY""Sapo_""$NAME"/$ERROR_WAV;notify-send "$DIRECTORY""Sapo_""$NAME"/"$ERROR_WAV"" has been deleted."; else notify-send "There is no file ""$DIRECTORY""Sapo_""$NAME"/"$ERROR_WAV"". Already deleted?";fi;GO=true
;; ;;
7)killall mplayer;audacity "$DIRECTORY""Sapo_""$NAME"/$ERROR_WAV 7)killall mplayer;$AUDIO_EDITOR "$DIRECTORY""Sapo_""$NAME"/$ERROR_WAV
;; ;;
8)killall mplayer; GO=true; ERROR_LINE=$(($ERROR_LINE - 2)) 8)killall mplayer; GO=true; ERROR_LINE=$(($ERROR_LINE - 2))
;; ;;