reworked telegram posting, add transcript URL to GUI, Added Transcript and fdrpodcast hyperlinsk to telegram and discord posts

pull/49/head 3.35
Yuriy 7 months ago
parent dd7c85e22e
commit 777cfaa242

@ -296,7 +296,7 @@ Loop, files, %VideoFolderDir%\*.*, F ; loop through the files in the director
} }
if(FileExt = "png" OR FileExt = "jpg"){ if(FileExt = "png" OR FileExt = "jpg" OR FileExt = "jpeg"){
VideoThumbFilepath := A_LoopFileFullPath VideoThumbFilepath := A_LoopFileFullPath
} }
} }
@ -348,8 +348,8 @@ Loop, files, %VideoFolderDir%\*.mp3, F ; loop through the files in the direct
VideoLinksIniFile = %VideoFolderDir%\VideoLinks.ini VideoLinksIniFile = %VideoFolderDir%\VideoLinks.ini
if(FileExist(VideoLinksIniFile)){ if(FileExist(VideoLinksIniFile)){
; IniRead, StreamanityURL, %VideoLinksIniFile%, URLs, StreamanityURL, %A_Space%
IniRead, BitChuteURL, %VideoLinksIniFile%, URLs, BitChuteURL, %A_Space% IniRead, BitChuteURL, %VideoLinksIniFile%, URLs, BitChuteURL, %A_Space%
; LBRY ; LBRY
IniRead, LBRYURLSlug, %VideoLinksIniFile%, Misc, LBRYURLSlug, %A_Space% IniRead, LBRYURLSlug, %VideoLinksIniFile%, Misc, LBRYURLSlug, %A_Space%
if(LBRYURLSlug = ""){ if(LBRYURLSlug = ""){
@ -377,7 +377,8 @@ if(FileExist(VideoLinksIniFile)){
IniRead, DailyMotionURL, %VideoLinksIniFile%, URLs, DailyMotionURL, %A_Space% IniRead, DailyMotionURL, %VideoLinksIniFile%, URLs, DailyMotionURL, %A_Space%
IniRead, PodcastNumber, %VideoLinksIniFile%, Misc, PodcastNumber, %A_Space% IniRead, PodcastNumber, %VideoLinksIniFile%, Misc, PodcastNumber, %A_Space%
IniRead, LocalsURL, %VideoLinksIniFile%, URLs, LocalsURL, %A_Space% IniRead, LocalsURL, %VideoLinksIniFile%, URLs, LocalsURL, %A_Space%
IniRead, FacebookURL, %VideoLinksIniFile%, URLs, FacebookURL, %A_Space% IniRead, PodcastTranscriptURL, %VideoLinksIniFile%, URLs, PodcastTranscriptURL, %A_Space%
; MISC ; MISC
IniRead, ErrorLoggingFilePath, %VideoLinksIniFile%, Misc, ErrorLoggingFilePath, %A_Space% IniRead, ErrorLoggingFilePath, %VideoLinksIniFile%, Misc, ErrorLoggingFilePath, %A_Space%
@ -1026,9 +1027,10 @@ if(SocialMediaPosterFilepath = "" or !FileExist(SocialMediaPosterFilepath)){
; ------------------------------------------------ ; ------------------------------------------------
; @todo: this can be converted into 1 gosub, with if/else statements based on the button clicked ; @todo: this can be converted into 1 gosub, with if/else statements based on the button clicked
CopyPodcastNumber: CopyPodcastTranscriptURL:
Clipboard := PodcastNumber Clipboard := PodcastTranscriptURL
SaveOrPostProgress(Message:=PodcastNumber "`nCopied to Clipboard",PostType:="Tooltip,ErrorLoggingTextFile") Message := PodcastTranscriptURL . "`nCopied to Clipboard"
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 1000 sleep, 1000
ToolTip ToolTip
Return Return
@ -1108,7 +1110,7 @@ Return
; @todo: Add thumbnail status to this ; @todo: Add thumbnail status to this
; @todo: add podcast tags to this ; @todo: add podcast tags to this
UpdateINI: UpdateINI:
IniWrite, %PodcastNumber%, %VideoLinksIniFile%, URLs, PodcastNumber IniWrite, %PodcastTranscriptURL%, %VideoLinksIniFile%, URLs, PodcastTranscriptURL
IniWrite, %VideoTitle%, %VideoLinksIniFile%, Misc, VideoTitle IniWrite, %VideoTitle%, %VideoLinksIniFile%, Misc, VideoTitle
IniWrite, %LocalsURL%, %VideoLinksIniFile%, URLs, LocalsURL IniWrite, %LocalsURL%, %VideoLinksIniFile%, URLs, LocalsURL
IniWrite, %RumbleURL%, %VideoLinksIniFile%, URLs, RumbleURL IniWrite, %RumbleURL%, %VideoLinksIniFile%, URLs, RumbleURL

@ -253,7 +253,7 @@ Gui, Font, Bold
; Settings Section ; Settings Section
Gui, Add, GroupBox,r5 y+0 x%PageTwoXStartPos% w%PageTwoGroupBoxWidth%,Settings Gui, Add, GroupBox,r5 y+0 x%PageTwoXStartPos% w%PageTwoGroupBoxWidth%,Settings
Gui, Add, Checkbox, xp+10 yp+20 vAutoUpdateCheck gUpdateVars Checked%AutoUpdateCheckCheckStatus%, Auto Update Check Gui, Add, Checkbox, xp+10 yp+20 vAutoUpdateCheck gUpdateVars Checked%AutoUpdateCheckCheckStatus%, Auto Update Check
Gui, Add, Checkbox, vShowTooltipProgress Checked%ShowTooltipProgressCheckStatus% gUpdateVars,Show Tooltip Progress Gui, Add, Checkbox, vShowTooltipProgress Checked%ShowTooltipProgressCheckStatus% gUpdateVars,Show Tooltip of Actions
Gui, Add, Checkbox, vKillLBRYAfterUpload Checked%KillLBRYAfterUploadCheckStatus%, Kill LBRY After Uploading Gui, Add, Checkbox, vKillLBRYAfterUpload Checked%KillLBRYAfterUploadCheckStatus%, Kill LBRY After Uploading
Gui, Add, Checkbox, vAutoLogin gUpdateVars Checked%AutoLoginCheckStatus%, Try to Login Automatically Gui, Add, Checkbox, vAutoLogin gUpdateVars Checked%AutoLoginCheckStatus%, Try to Login Automatically
Gui, Add, Checkbox, vPingOnCompletion gUpdateVars Checked%PingOnCompletionCheckStatus%, Discord Ping Upon Completion Gui, Add, Checkbox, vPingOnCompletion gUpdateVars Checked%PingOnCompletionCheckStatus%, Discord Ping Upon Completion

@ -1,10 +1,9 @@
Gui, Font, s%GuiFontSize% Gui, Font, s%GuiFontSize%
Gui, Font, Bold Gui, Font, Bold
; Gui, Add, Text,x10 y+10, Podcast #: Gui, Add, Button, x10 y+%Marginspace% h%ButtonHeights% w%CopyButtonWidths% gCopyPodcastTranscriptURL,Transcript URL
Gui, Add, Button, x10 y+%Marginspace% h%ButtonHeights% w%CopyButtonWidths% gCopyPodcastNumber, Podcast #
Gui, Font, Normal Gui, Font, Normal
Gui, Add, Edit, x+5 yp+0 h%ButtonHeights% w%ResultEditBoxWidths% gUpdateVars vPodcastNumber, %PodcastNumber% Gui, Add, Edit, x+5 yp+0 h%ButtonHeights% w%ResultEditBoxWidths% gUpdateVars vPodcastTranscriptURL, %PodcastTranscriptURL%
Gui, Font, Bold Gui, Font, Bold
Gui, Add, Button, x10 y+%Marginspace% h%ButtonHeights% w%CopyButtonWidths% gCopyBitChuteURL, Bitchute Gui, Add, Button, x10 y+%Marginspace% h%ButtonHeights% w%CopyButtonWidths% gCopyBitChuteURL, Bitchute

@ -13,7 +13,7 @@ OnMsgBoxConfirmChromiumOverwrite() {
; https://www.autohotkey.com/docs/v2/Functions.htm#Variadic ; https://www.autohotkey.com/docs/v2/Functions.htm#Variadic
Join(sep, params*) { Join(sep, params*) {
For index, param in params For index, param in params
str .= param . sep str .= param . sep
return SubStr(str, 1, -StrLen(sep)) return SubStr(str, 1, -StrLen(sep))
} }
@ -254,18 +254,54 @@ Check_For_Stuck_Video_Upload(Index_Number, Upload_Status){
} }
} ; end of func } ; end of func
/*
*/
; Find the longest word in a string of words ; Find the longest word in a string of words
FindLongestWordInString(m, calloutNumber, pos, haystack, pattern){ FindLongestWordInString(m, calloutNumber, pos, haystack, pattern){
Global wordLength, longestWord Global wordLength, longestWord
len := StrLen(m) len := StrLen(m)
If ( len > wordLength ) If ( len > wordLength )
{ {
wordLength := len wordLength := len
longestWord := m longestWord := m
; MsgBox, %m%
}
}
/*
*/
; MsgBox, %m% ; Split a long string into multiple pieces based on the string lengtht you want and return an array with all strings
SplitStringWithSentences(text, maxChunkSize) {
sentences := StrSplit(text, "\. ") ; split at period with space after it
currentChunk := ""
chunks := []
Loop, % sentences.Length()
{
sentence := sentences[A_Index]
CurrentChunkAndSentence := currentChunk . sentence
; Msgbox % "CurrentChunkAndSentence: " CurrentChunkAndSentence
; msgbox % StrLen(CurrentChunkAndSentence)
if (StrLen(CurrentChunkAndSentence) <= maxChunkSize)
{
currentChunk .= sentence . "\. "
}
else
{
chunks.Push(currentChunk)
currentChunk := sentence . "\. "
} }
} }
if (currentChunk != "")
chunks.Push(currentChunk)
return chunks
}

@ -25,13 +25,10 @@ if(SocialMediaDescription = ""){
CreateDescriptionForSocialMedia() CreateDescriptionForSocialMedia()
} }
; Msgbox % "SocialMediaDescription: " SocialMediaDescription
SubmitDescriptionForDiscordVideosChannel: SubmitDescriptionForDiscordVideosChannel:
Message := "**" . VideoTitle . "**" . "`n" . SocialMediaDescription . "`n" Message := "**" . VideoTitle . "**" . "`n" . SocialMediaDescription . "`n"
; https://stackoverflow.com/questions/63160401/how-to-create-hyperlink-in-discord-in-an-embed-in-general ; https://stackoverflow.com/questions/63160401/how-to-create-hyperlink-in-discord-in-an-embed-in-general
; Do this with an array!!
;
if(BitChuteURL != "") if(BitChuteURL != "")
Message .= "[BitChute](<" . BitChuteURL . ">) \| " Message .= "[BitChute](<" . BitChuteURL . ">) \| "
@ -44,23 +41,18 @@ Message .= "[Odysee](<" . OdyseeVideoURL . ">) \| "
if(OdyseeAudioURL != "") if(OdyseeAudioURL != "")
Message .= "[Odysee (Audio)](<" . OdyseeAudioURL . ">) \| " Message .= "[Odysee (Audio)](<" . OdyseeAudioURL . ">) \| "
/*
if(OdyseeVideoURL != "")
Message .= "[Odysee](<" . OdyseeVideoURL . ") \| "
if(OdyseeAudioURL != "")
Message .= "[Odysee Audio](<" . OdyseeAudioURL . ") \| "
*/
if(RumbleURL != "") if(RumbleURL != "")
Message .= "[Rumble](<" . RumbleURL . ">) \| " Message .= "[Rumble](<" . RumbleURL . ">) \| "
/*if(StreamanityURL != "" AND InStr(StreamanityURL, "streamanity.com"))
Message .= "[Streamanity](<" . StreamanityURL . ">) \| "
*/
if(DailyMotionURL != "") if(DailyMotionURL != "")
Message .= "[DailyMotion](<" . DailyMotionURL . ">)" Message .= "[DailyMotion](<" . DailyMotionURL . ">) \| "
if(PodcastTranscriptURL != "")
Message .= "[Video Transcript](<" . PodcastTranscriptURL . ">) \| "
if(PodcastNumber != "")
Message .= "[FDRPodcasts](<" . "https://fdrpodcasts.com/" . PodcastNumber . ">) \| "
UploadImageToDiscord(DiscordVideosWebhookURL, Message, VideoThumbFilepath) UploadImageToDiscord(DiscordVideosWebhookURL, Message, VideoThumbFilepath)

@ -56,24 +56,19 @@ VideoLinks .= "[Odysee](" . OdyseeVideoURL . ") \| "
if(OdyseeAudioURL != "") if(OdyseeAudioURL != "")
VideoLinks .= "[Odysee \(Audio\)](" . OdyseeAudioURL . ") \| " VideoLinks .= "[Odysee \(Audio\)](" . OdyseeAudioURL . ") \| "
/*
if(OdyseeVideoURL != "")
VideoLinks .= "[Odysee](" . OdyseeVideoURL . ") \| "
if(OdyseeAudioURL != "")
VideoLinks .= "[Odysee Audio](" . OdyseeAudioURL . ") \| "
*/
if(RumbleURL != "") if(RumbleURL != "")
VideoLinks .= "[Rumble](" . RumbleURL . ") \| " VideoLinks .= "[Rumble](" . RumbleURL . ") \| "
/*
if(InStr(StreamanityURL, "https://streamanity.com/video/"))
VideoLinks .= "[Streamanity](" . StreamanityURL . ") \| "
*/
if(DailyMotionURL != "") if(DailyMotionURL != "")
VideoLinks .= "[DailyMotion](" . DailyMotionURL . ") \| " VideoLinks .= "[DailyMotion](" . DailyMotionURL . ") \| "
if(PodcastTranscriptURL != "")
VideoLinks .= "[Video Transcript](" . PodcastTranscriptURL . ") \| "
if(PodcastNumber != "")
VideoLinks .= "[FDRPodcasts](" . "https://fdrpodcasts.com/" . PodcastNumber . ") \| "
TelegramMessage := TelegramVideoTitle . "`n" . TelegramBodymessage . "`n" . VideoLinks TelegramMessage := TelegramVideoTitle . "`n" . TelegramBodymessage . "`n" . VideoLinks
@ -83,86 +78,73 @@ StrLenOfMessageAndVideoLinks := StrLen(TelegramVideoTitle) + StrLen(TelegramBody
; DevModeMsgBox(StrLenOfMessageAndVideoLinks) ; DevModeMsgBox(StrLenOfMessageAndVideoLinks)
if(StrLenOfMessageAndVideoLinks > 1024){ ; If Length of Title, Video Links and Message is less than 1024 characters:
; Telegram SendMessage is limited to 4096 characters ; ------------------------------------------------
if(StrLenOfMessageAndVideoLinks < 4096){ ; split into sendphoto and 1 sendmessage if(StrLenOfMessageAndVideoLinks < 1024) {
; DevModeMsgBox("Less than 4096 chars") Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramMessage ) ; you could add more options; compare the Telegram API docs
; Photo and Video Title go into SendPhoto if(InStr(Status, "error_code")){
TelegramVideoTitle := TelegramVideoTitle . "`n" . VideoLinks Message = Telegram Post Failed due to an API Issue. Error was saved to ErrorLogging file. Please send it to Yuriy.
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramVideoTitle ) ; you could add more options; compare the Telegram API docs SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
; Video Description goes into TelegramMessage
Status2 := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := TelegramBodymessage)
} ; split into 2 SendMessages
else if (StrLenOfMessageAndVideoLinks > 4096 AND StrLenOfMessageAndVideoLinks < 8192){ ; Split into 2 parts
TelegramVideoTitle := TelegramVideoTitle . "`n" . VideoLinks
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramVideoTitle ) ; you could add more options; compare the Telegram API docs
TelegramBodymessagePiece := SubStr(TelegramBodymessage, 1, 4096) ; SaveOrPostProgress(Message:=Status,PostType:=",ErrorLoggingTextFile")
Status2 := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := TelegramBodymessagePiece) Message = Telegram Error: %Status%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
TelegramBodymessagePiece := SubStr(TelegramBodymessage, 4097, 8192) ToolTip
Status3 := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := TelegramBodymessagePiece) Return
}
}
} ; split into 3 sendMessages
else if (StrLenOfMessageAndVideoLinks > 8192 AND StrLenOfMessageAndVideoLinks < 12288){ ; Split into 3 parts
TelegramVideoTitle := TelegramVideoTitle . "`n" . VideoLinks
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramVideoTitle ) ; you could add more options; compare the Telegram API docs
TelegramBodymessagePiece := SubStr(TelegramBodymessage, 1, 4096) ; If Title, Links and Message are longer than 1024, but less than 4096, split into 2 pieces: sendphoto and sendmessage
msgbox % StrLen(TelegramBodymessagePiece) ; ------------------------------------------------
Status2 := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := TelegramBodymessagePiece) if(StrLenOfMessageAndVideoLinks < 4096){
; Photo and Video Title go into SendPhoto
TelegramVideoTitle := TelegramVideoTitle . "`n" . VideoLinks
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramVideoTitle ) ; you could add more options; compare the Telegram API docs
; Video Description goes into TelegramMessage
Status2 := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := TelegramBodymessage)
TelegramBodymessagePiece := SubStr(TelegramBodymessage, 4097, 8192) } else, {
msgbox % StrLen(TelegramBodymessagePiece) ; If Title, links and message are longer than 4096 chars, we need to split them into multiple messages
DevModeMsgBox(TelegramBodymessagePiece) ; ------------------------------------------------
Status3 := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := TelegramBodymessagePiece) TelegramVideoTitle := TelegramVideoTitle . "`n" . VideoLinks
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramVideoTitle ) ; you could add more options; compare the Telegram API docs
; TelegramBodymessagePiece := SubStr(TelegramBodymessage, 8193, 12288)
; Status3 := SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := TelegramBodymessagePiece)
}
; Split the Description into 4096 character chunks while preserving sentences
; Used 4095 because a ". " has to be put in at the end of the chunk.
VideoDescriptionChunks := SplitStringWithSentences(TelegramBodymessage, 4094)
} else, { ; if less than 1024 characters, send normally
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramMessage ) ; you could add more options; compare the Telegram API docs
if(InStr(Status, "error_code")){
Message = Telegram Post Failed due to an API Issue. Error was saved to ErrorLogging file. Please send it to Yuriy.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
; SaveOrPostProgress(Message:=Status,PostType:=",ErrorLoggingTextFile") ; go through array and post each chunk as new message
Message = Telegram Error: %Status% Loop % VideoDescriptionChunks.Length(){
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") ; ArrayItem := ARRAY[A_Index]
Description := VideoDescriptionChunks[A_Index]
ToolTip
Return
}
} SendTelegramMessage(TelegramBotToken, TelegramBotChatID, text := Description)
; Msgbox % "SizeOfCaption: " SizeOfCaption ; Clipboard := Description
; SizeOfCaption := SizeOfCaption + ; msgbox % Description
; Message .= VideoLinks
; msgbox % StrLen(VideoLinks)
; Message := StrReplace(Message, "`n", LineBreakChar) ; replace all new line characters with the global charater }
; msgbox % StrLen(Message)
; SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordVideos") }
; SaveOrPostProgress(Message:="Video Links posted to #Videos Successfully.",PostType:="Tooltip,ErrorLoggingTextFile") ; SaveOrPostProgress(Message:="Video Links posted to #Videos Successfully.",PostType:="Tooltip,ErrorLoggingTextFile")
Message = Video Links Posted to Telegram Successfully Message = Video Links Posted to Telegram Successfully
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
GuiControl,, PostToTelegramButton, Telegram - Posted Successfully GuiControl,, PostToTelegramButton, Telegram - Posted Successfully
; sleep, 2000 ; sleep, 2000
ToolTip ToolTip
CurrentSite := CurrentSite :=
Return Return
; -------------------------------/Telegram------------------------------- ; -------------------------------/Telegram-------------------------------

@ -1,3 +1,3 @@
[Video-Uploader] [Video-Uploader]
Version=3.33 Version=3.34
Name=Freedomain Video Uploader Name=Freedomain Video Uploader

Loading…
Cancel
Save