Fixed some items not being logged to errorlog.txt

pull/49/head
Yuriy 5 months ago
parent 9e76ace3c3
commit da34b98324

@ -38,7 +38,7 @@ CreateReleaseAPIURL = https://freedomain.dev/api/v1/repos/yuriy/video-uploader/r
; Info for Attaching exe file to release using Gitea-AttachAssetToRelease.ps1 ; Info for Attaching exe file to release using Gitea-AttachAssetToRelease.ps1
AttachAssetToReleasePS1Filepath = %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Gitea-AttachAssetToRelease.ps1 AttachAssetToReleasePS1Filepath = %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Gitea-AttachAssetToRelease.ps1
AttachAssetToReleaseAPIURL = https://freedomain.dev/api/v1/repos/yuriy/video-uploader/releases/%ReleaseID%/assets AttachAssetToReleaseAPIURL = https://freedomain.dev/api/v1/repos/yuriy/video-uploader/releases
;---\VARIABLES----------------------------------------------------------------------- ;---\VARIABLES-----------------------------------------------------------------------
@ -125,6 +125,8 @@ LogToErrorLogFile(Message, ErrorLogTextFile)
; Attach .exe File to Release using Gitea-AttachAssetToRelease.ps1 ; Attach .exe File to Release using Gitea-AttachAssetToRelease.ps1
; ------------------------------------------------ ; ------------------------------------------------
AttachAssetToReleaseAPIURL = %AttachAssetToReleaseAPIURL%/%ReleaseID%/assets
; Strings with spaces in them need to be surrounted by a single quote and double quote, eg: "'spaced string'" ; Strings with spaces in them need to be surrounted by a single quote and double quote, eg: "'spaced string'"
Command = Powershell "%AttachAssetToReleasePS1Filepath%" "%AttachAssetToReleaseAPIURL%" "%GiteaToken%" "'%ExeProgramName%'" "'%Exefilepath%'" Command = Powershell "%AttachAssetToReleasePS1Filepath%" "%AttachAssetToReleaseAPIURL%" "%GiteaToken%" "'%ExeProgramName%'" "'%Exefilepath%'"
LogToErrorLogFile(Command, ErrorLogTextFile) LogToErrorLogFile(Command, ErrorLogTextFile)

@ -108,6 +108,7 @@ Array_Index_Num_of_Upload_StatusChecks := [144,288,432, 576,720,864]
; Check if Lib folder exists and create it if not ; Check if Lib folder exists and create it if not
LibFolder := A_ScriptDir . "\Lib" LibFolder := A_ScriptDir . "\Lib"
ErrorLoggingFolder := A_ScriptDir . "\Lib\ErrorLogging" ErrorLoggingFolder := A_ScriptDir . "\Lib\ErrorLogging"
if(!FileExist(ErrorLoggingFolder))
FileCreateDir, %ErrorLoggingFolder% FileCreateDir, %ErrorLoggingFolder%
; Set filepaths for different files and folders ; Set filepaths for different files and folders
@ -399,19 +400,18 @@ if(FileExist(VideoLinksIniFile)){
IniRead, UnauthorizedTVURL, %VideoLinksIniFile%, URLs, UnauthorizedTVURL, %A_Space% IniRead, UnauthorizedTVURL, %VideoLinksIniFile%, URLs, UnauthorizedTVURL, %A_Space%
; MISC ; Misc Info
; ------------------------------------------------
IniRead, ErrorLoggingFilePath, %VideoLinksIniFile%, Misc, ErrorLoggingFilePath, %A_Space% IniRead, ErrorLoggingFilePath, %VideoLinksIniFile%, Misc, ErrorLoggingFilePath, %A_Space%
; Double check that the file/directory exists and create if not
; I don't remember why I added this, commenting this out on 2024/06/22 for now SplitPath, ErrorLoggingFilePath,, ErrorLogDir
; IniRead, TempVideoThumbFilepath, %VideoLinksIniFile%, Misc, VideoThumbFilepath, %A_Space% if(!FileExist(ErrorLogDir)){
/* if(TempVideoThumbFilepath){ ; if Video Thumbnail was saved in last run, overwrite variable path that was grabbed in the file loop above FileCreateDir, %ErrorLogDir%
VideoThumbFilepath := TempVideoThumbFilepath
} }
*/
} }
; Create a directory for errorlogging if this is the first time working on this project ; Create a directory for errorlogging if this is the first time working on this project
if(ErrorLoggingFilePath = ""){ if(ErrorLoggingFilePath = ""){
FormatTime, TodayDate , YYYYMMDDHH24MISS, yyyyMMdd_hhmmss FormatTime, TodayDate , YYYYMMDDHH24MISS, yyyyMMdd_hhmmss
@ -627,11 +627,25 @@ IniWrite, %YPosition%, %SettingsIniFilepath%, General, YPosition
Gui, Submit, NoHide Gui, Submit, NoHide
if(VideoFilepath = ""){
Msgbox,4096,Error,No Video Filepath Found.`nPlease Input Video Filepath to Upload a Video. ; Double Check Files and Show Errors if there are any Issues
; In case the project files change between the time the gui was created and the Upload button is clicked
; ------------------------------------------------
(VideoFilepath = "")?(DoubleCheckErrorMessage .= "Video Filepath is BLANK`n"):()
(!FileExist(VideoFilepath))?(DoubleCheckErrorMessage .= "Video Filepath Points to a Non-Existing File`n"):()
(VideoThumbFilepath = "")?(DoubleCheckErrorMessage .= "Thumbnail Filepath is BLANK`n"):()
(!FileExist(VideoThumbFilepath))?(DoubleCheckErrorMessage .= "Thumbnail Filepath Points to a Non-Existing File`n"):()
if(DoubleCheckErrorMessage){
Message = Issue found when double checking files:`n%DoubleCheckErrorMessage%
SaveOrPostProgress(Message,PostType:="ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Msgbox,4096,Error,%DoubleCheckErrorMessage%
Return Return
} }
; Destroy GUI after checking everything is working ; Destroy GUI after checking everything is working
Gui, Destroy Gui, Destroy

@ -1 +1 @@
Subproject commit 8447b6009a8f1e6764aff7ee4d695df6fd6237e5 Subproject commit 670b97d6b130bf09b8c032e2f6fdb940a099b36a

@ -1,7 +1,15 @@
PostToDiscord: PostToDiscord:
;------------------------------------------------ ;------------------------------------------------
CurrentSite := "Discord"
if(!FileExist(VideoThumbFilepath)){
Message = Post Aborted.`nVideo Thumbnail not found at:`n%VideoThumbFilepath%
SaveOrPostProgress(Message,PostType:="ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
MsgBox 0x10,, %Message%
Return
}
CurrentSocialMediaPosting := "Discord"
Message = Posting Video Links to Discord Message = Posting Video Links to Discord
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")

@ -1,6 +1,14 @@
PostToTelegram: PostToTelegram:
;------------------------------------------------ ;------------------------------------------------
CurrentSocialMediaPosting := "Telegram" CurrentSite := "Telegram"
if(!FileExist(VideoThumbFilepath)){
Message = Post Aborted.`nVideo Thumbnail not found at:`n%VideoThumbFilepath%
SaveOrPostProgress(Message,PostType:="ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
MsgBox 0x10,, %Message%
Return
}
Message = Posting Video Links to Telegram Message = Posting Video Links to Telegram
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -90,11 +98,10 @@ if(StrLenOfMessageAndVideoLinks < 1024) {
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
if(InStr(Status, "error_code")){ 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. Message = Telegram Post Failed Due To An Api Issue. Please See Errorlog For More Info.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
; SaveOrPostProgress(Message:=Status,PostType:=",ErrorLoggingTextFile") Message = Telegram API Error:`n %Status%
Message = Telegram Error: %Status%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
ToolTip ToolTip
@ -129,7 +136,8 @@ else, {
; ------------------------------------------------ ; ------------------------------------------------
TelegramVideoTitle := TelegramVideoTitle . "`n" . VideoLinks TelegramVideoTitle := TelegramVideoTitle . "`n" . VideoLinks
Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramVideoTitle ) ; you could add more options; compare the Telegram API docs Status := SendTelegramPhoto(TelegramBotToken, TelegramBotChatID, VideoThumbFilepath, caption := TelegramVideoTitle ) ; you could add more options; compare the Telegram API docs
Message = API Response:`n%Status% ; Output returned data to ErrorLog File
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
; Split the Description into 4096 character chunks while preserving sentences ; 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. ; Used 4095 because a ". " has to be put in at the end of the chunk.
@ -149,7 +157,6 @@ else, {
} }
} }
; 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

Loading…
Cancel
Save