diff --git a/Compile and Release.ahk b/Compile and Release.ahk index 6aa4eb6..3e93175 100644 --- a/Compile and Release.ahk +++ b/Compile and Release.ahk @@ -25,7 +25,7 @@ VersionIniFP = %A_ScriptDir%\Version.ini ; Generate a new errorlog text file each run FormatTime, TodayDate , YYYYMMDDHH24MISS, yyyyMMdd_hhmmss -ErrorLogTextFile = %A_ScriptDir%\Lib\ErrorLogging\Compiler_%TodayDate%.txt +ErrorLogFilepath = %A_ScriptDir%\Lib\ErrorLogging\Compiler_%TodayDate%.txt ; Read Credential token from Windows Credential Manager using WindowCredentialManager.ahk @@ -83,7 +83,7 @@ if(!FileExist(icopath)){ ; run, %comspec% /c ""C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe" /in "%AHKFilepath%" /out "%exefilepath%" /icon "%icopath%"" Command = "C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe" /in "%AHKFilepath%" /out "%exefilepath%" /icon "%icopath%" Results := RunCMD(Command) -LogToErrorLogFile(Results, ErrorLogTextFile) +LogToErrorLogFile(Results, ErrorLogFilepath) if(!InStr(Results, "Successfully")){ Msgbox, Error, Compilation failed with the following error:`n`n%Results% @@ -104,10 +104,11 @@ ReleaseTag := VersionNumber Command = Powershell "%CreateReleasePS1Filepath%" "%CreateReleaseAPIURL%" "%ReleaseName%" "%ReleaseTag%" "'%ReleaseBody%'" Message = PowerShell Command to Create Release:`n%Command% -LogToErrorLogFile(Message, ErrorLogTextFile) +LogToErrorLogFile(Message, ErrorLogFilepath) Results := RunCMD(Command) -LogToErrorLogFile(Results, ErrorLogTextFile) +Message = API Returned:`n%Results% +LogToErrorLogFile(Message, ErrorLogFilepath) ; Pull out the release ID Number, needed for attaching a file to the release @@ -116,8 +117,15 @@ SplitText2 = `; ReleaseID := StrSplit(Results, SplitText)[2] ReleaseID := StrSplit(ReleaseID, SplitText2)[1] +if(ReleaseID = ""){ + Message = Failed to Grab Release ID`nPlease See Errorlog for Details:`n%ErrorLogFilepath% + LogToErrorLogFile(Message, ErrorLogFilepath) + Msgbox, %Message% + Return +} + Message = ReleaseID: %ReleaseID% -LogToErrorLogFile(Message, ErrorLogTextFile) +LogToErrorLogFile(Message, ErrorLogFilepath) @@ -129,10 +137,11 @@ AttachAssetToReleaseAPIURL = %AttachAssetToReleaseAPIURL%/%ReleaseID%/assets ; 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%'" -LogToErrorLogFile(Command, ErrorLogTextFile) +LogToErrorLogFile(Command, ErrorLogFilepath) Results := RunCMD(Command) -LogToErrorLogFile(Results, ErrorLogTextFile) +Message = API Returned: %Results% +LogToErrorLogFile(Message, ErrorLogFilepath) ExitApp @@ -151,5 +160,5 @@ ExitApp ;---FUNCTIONS----------------------------------------------------------------------- LogToErrorLogFile(Text, TextFileFilepath){ - FileAppend, %Text%`n, %TextFileFilepath% + FileAppend, `n%Text%`n, %TextFileFilepath% } \ No newline at end of file diff --git a/Modules/Post-To-Discord.ahk b/Modules/Post-To-Discord.ahk index bf4fb22..4f8297b 100644 --- a/Modules/Post-To-Discord.ahk +++ b/Modules/Post-To-Discord.ahk @@ -86,7 +86,9 @@ if((StrLen(VideoTitle) + StrLen(VideoDescription) + StrLen(VideoLinks)) > 2000){ else, DiscordVideoDescription := VideoDescription -Message := "**" . VideoTitle . "**" . "`n" . VideoLinks . "`n" . DiscordVideoDescription +Message = VideoLinks variable contents: + +Message := "**" . VideoTitle . "**" . "`n" . DiscordVideoDescription . "`n`n" . VideoLinks Status := UploadImageToDiscord(DiscordVideosWebhookURL, Message, VideoThumbFilepath) Message = API Response:`n%Status% diff --git a/Modules/Rumble-Upload.ahk b/Modules/Rumble-Upload.ahk index c97656f..0d600e2 100644 --- a/Modules/Rumble-Upload.ahk +++ b/Modules/Rumble-Upload.ahk @@ -124,51 +124,32 @@ Loop, 5 { ; Attempt to input video description a couple of times Xpath = (//input[@placeholder='- Primary category -'])[1] try, driver.FindElementByXPath(Xpath).SendKeys("Podcasts").SendKeys(driver.Keys.ENTER) +/* +; Skip the channel selection for now +; Rumble now has a "Set this channel as default" checkbox Message = Selecting Channel SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") +; Get list of channels and select the second one in the list +; First is the user profile +; Second is the Normal Channel -; @todo replace with regex -js = return document.querySelector("#channelId").innerHTML; -try, ChannelIDNumber := driver.executeScript(js) -; Msgbox % "ChannelIDNumber: " ChannelIDNumber -ChannelIDNumber := StrSplit(ChannelIDNumber, "option value=") +Xpath = (//fieldset[@id='channelId'])[1] +Try Channels := driver.findelementbyxpath(Xpath).Attribute("innerText") ;XPATH Inner Text +UploadChannelName := StrSplit(Channels, "`n")[2] -ChannelIDNumber := ChannelIDNumber[3] -SingleQuote = " -ChannelIDNumber := StrSplit(ChannelIDNumber, "data-private") -ChannelIDNumber := ChannelIDNumber[1] -ChannelIDNumber := StrReplace(ChannelIDNumber, SingleQuote, "") -ChannelIDNumber := StrReplace(ChannelIDNumber, " ", "") - -; Msgbox % "ChannelIDNumber: " ChannelIDNumber - - -; js = return document.querySelector("#channelId").value; -; try, ChannelIDNumber := driver.executeScript(js) -; Msgbox % "ChannelIDNumber: " ChannelIDNumber -if(ChannelIDNumber = ""){ - Message = ChannelIDNumber is blank. Unable to select Upload Channel - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - SaveDriverURLOFErrorPage() - Return +if(!UploadChannelName){ + Message = Failed to Grab Upload Channel Name + SaveOrPostProgress(Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") + Return } -; //option[@value='762377'] ; freedomain -Xpath = //option[@value='%ChannelIDNumber%'] -try driver.FindElementByXPath(Xpath).click() -catch e { - Message = Failed to click on Channel using %ChannelIDNumber%. - SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - SaveDriverURLOFErrorPage() - Return - ; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") - ; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") -} - +Xpath = (//label[normalize-space()='%UploadChannelName%'])[1] +Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) +*/ ; Input Tags Message = Inputting Tags diff --git a/Version.ini b/Version.ini index 6352f22..e767451 100644 --- a/Version.ini +++ b/Version.ini @@ -1,3 +1,3 @@ [Video-Uploader] -Version=3.48 -Name=Freedomain Video Uploader \ No newline at end of file +Version=3.51 +Name=Freedomain Video Uploader