From 7be8ebf5cc2af1736feaf33c3bdc038b690dcbed Mon Sep 17 00:00:00 2001 From: Yuriy Date: Sun, 14 Jan 2024 22:46:19 -0500 Subject: [PATCH] added any length option and code to handle it --- Whisper-AHK.ahk | 71 ++++++++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 31 deletions(-) diff --git a/Whisper-AHK.ahk b/Whisper-AHK.ahk index 9281558..cc305e4 100644 --- a/Whisper-AHK.ahk +++ b/Whisper-AHK.ahk @@ -154,21 +154,24 @@ gui, add, text, y%GUIMargin% x%GUIRowTwoVerticalLineXPos% 0x11 h270 ; 0x11 is a Gui, font, Bold Gui, Add, Text,x%GUIRowTwoXPos% y%GUIMargin% w200 center,Transcription Model Gui, font, normal ; , Param2, Param3, Param4] + ; Gui, Add, Radio -Gui, Add, Checkbox,y+%GUImargin% vTinyM checked%TinyM% , Tiny (75 MB Disk, ~125 MB RAM) + Gui, Add, Checkbox, vBaseM checked%BaseM%, Base (142 MB Disk, ~210 MB RAM) Gui, Add, Checkbox, vSmallM checked%SmallM%, Small (466 MB Disk, ~600 MB RAM) Gui, Add, Checkbox, vMediumM checked%MediumM%, Medium (1.5 GB Disk, ~1.7 GB RAM) Gui, Add, Checkbox, vLargeM checked%LargeM% ,Large (2.9 GB Disk, ~3.3 GB RAM) -; Gui, Add, Checkbox, vAllMQualities checked%AllMQualities%, ALL (One by One) +Gui, Add, Checkbox, vAllMQualities checked%AllMQualities%, ALL (One by One) Gui, Font, Bold Gui, Add, Text,x%GUIRowTwoXPos% y+15 w200 center,Length of Podcasts to Transcribe Gui, font, normal +Gui, Add, Checkbox, vAnyLengthMediaFile gUpdateGUI checked%AnyLengthMediaFileCheckStatus%, ANY Length Gui, Add, Checkbox,y+%GUIMargin% gUpdateGUI vShortPodcasts checked%ShortPodcastsCheckStatus%, Short ( < 30 Mins) Gui, Add, Checkbox, vMediumPodcasts gUpdateGUI checked%MediumPodcastsCheckStatus%, Medium (30-60 Mins) Gui, Add, Checkbox, vLongPodcasts gUpdateGUI checked%LongPodcastsCheckStatus%, Long ( > 60 Mins) + ; Gui, Add, Text Gui, Font, Bold Gui, Add, Text,x%GUIRowTwoXPos% y+15 w200 center,Other Settings @@ -399,6 +402,8 @@ TranscriptionLengthsSelected := (ShortPodcasts)?(TranscriptionLengthsSelected .= "Short|"):("") (MediumPodcasts)?(TranscriptionLengthsSelected .= "Medium|"):("") (LongPodcasts)?(TranscriptionLengthsSelected .= "Long|"):("") +(AnyLengthMediaFile)?(TranscriptionLengthsSelected .= "AnyLengthMediaFile|"):("") + if(TranscriptionLengthsSelected = ""){ ToolTip @@ -507,37 +512,41 @@ loop % SelectedAudioFilesArray.Length() { TotalTimeInSeconds := ((AudioLengthArray[1] * 60 ) * 60) + (AudioLengthArray[2] * 60) + AudioLengthArray[3] - if(ShortPodcasts){ - if(TotalTimeInSeconds > 1860){ ; greater than 31 minutes - Text = Podcast is longer than 30 minutes. Skipping - ShowTooltipText(Text) - PrePendToErrorLogText(text) - ; msgbox, skipping medium/Long podcast - Continue - } - - } - - if(MediumPodcasts){ ; if less than 31 minutes or greater than 61 minutes - if(TotalTimeInSeconds < 1860 OR TotalTimeInSeconds > 3660){ - Text = Podcast is either shorter than 30 minutes or longer than 60 minutes. Skipping - ShowTooltipText(Text) - PrePendToErrorLogText(text) - Continue - } - } - - if(LongPodcasts){ - if(TotalTimeInSeconds < 3660){ - Text = Podcast is shorter than 60 minutes Skipping - ShowTooltipText(Text) - PrePendToErrorLogText(text) - ; msgbox, skipping short/medium podcast - Continue - } - + if(AnyLengthMediaFile){ + ; continue onwards } + else, { ; otherwise check length and skip accordingly + if(ShortPodcasts){ + if(TotalTimeInSeconds > 1860){ ; greater than 31 minutes + Text = Podcast is longer than 30 minutes. Skipping + ShowTooltipText(Text) + PrePendToErrorLogText(text) + ; msgbox, skipping medium/Long podcast + Continue + } + } + + if(MediumPodcasts){ ; if less than 31 minutes or greater than 61 minutes + if(TotalTimeInSeconds < 1860 OR TotalTimeInSeconds > 3660){ + Text = Podcast is either shorter than 30 minutes or longer than 60 minutes. Skipping + ShowTooltipText(Text) + PrePendToErrorLogText(text) + Continue + } + } + + if(LongPodcasts){ + if(TotalTimeInSeconds < 3660){ + Text = Podcast is shorter than 60 minutes Skipping + ShowTooltipText(Text) + PrePendToErrorLogText(text) + ; msgbox, skipping short/medium podcast + Continue + } + + } + } if(FileExist(WavFilepath)){ ; re-use previously converted wav file if it exists