You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
livestream-scheduler/Modules/Media-Manager-Update-Redire...

104 lines
3.7 KiB
Plaintext

MediaManagerUpdate:
; ------------------------------------------------
CurrentSite := "Media Manager"
SaveOrPostProgress(Message:="Scheduling Post in Rumble Studio",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
IniRead, FDRRadioURL, %SettingsIniFilepath%, General, FDRRadioURL, %A_Space%
if(FDRRadioURL = ""){
Message = FDRRadioURL is blank in Settings.ini. Please add it to the following location: [General]`nFDRRadioURL=
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
FDRRadioBaseURL := "https://" . ExtractBaseURL(FDRRadioURL)
FDRRadioURL := FDRRadioBaseURL . "/manage/"
Status := NavigateFromBaseURLTo(FDRRadioURL)
if(Status)
Return
CheckForAlerts()
Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Try, PageURL := driver.Url
if(InStr(PageURL, "/NotLoggedIn")){
Message = Logged out. Trying to log back in.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Xpath = (//span[contains(text(),'Login')])[1]
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
sleep, 1000
Try, PageURL := driver.Url
if(InStr(PageURL, "/NotLoggedIn")){
Message = Failed to log back in automatically. Please login and try again.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
}
; URL for each redirect
LocalsLiveRedirectURL := FDRRadioBaseURL . "/manage/#/Redirects/Modify?redirectID=738"
RumbleLiveRedirectURL := FDRRadioBaseURL . "/manage/#/Redirects/Modify?redirectID=739"
OdyseeLiveRedirectURL := FDRRadioBaseURL . "/manage/#/Redirects/Modify?redirectID=742"
; read the url's from the status file
IniRead, LocalsLivestreamURL, %PostStatusesFilepath%, Livestream,LocalsLivestreamURL, %A_Space%
IniRead, RumbleLivestreamURL, %PostStatusesFilepath%, Livestream,RumbleLivestreamURL, %A_Space%
IniRead, OdyseeLivestreamURL, %PostStatusesFilepath%, Livestream,OdyseeLivestreamURL, %A_Space%
UpdateMediaManagerRedirect(LocalsLiveRedirectURL, LocalsLivestreamURL)
UpdateMediaManagerRedirect(RumbleLiveRedirectURL, RumbleLivestreamURL)
UpdateMediaManagerRedirect(OdyseeLiveRedirectURL, OdyseeLivestreamURL)
UpdateMediaManagerRedirect(MediaManagerRedirectPageURL, RedirectURL){
try, driver.Get(MediaManagerRedirectPageURL) ;Open selected URL
try, driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
Xpath = (//input[@id='destinationURL'])[1]
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=RedirectURL, ClearElement := 1)
if(ConfirmBeforeSubmit){
OnMessage(0x44, "OnMsgBoxUserConfirmation")
MsgBox 0x21, User Confirmation, Please check that all data was input correctly and fix any mistakes and then click PROCEED to finalize the Upload.`n`nClick STOP to cancel the rest of this Upload and move on to the next website.
OnMessage(0x44, "")
IfMsgBox OK, {
} Else IfMsgBox Cancel, {
Message = User Selected STOP button when asked for confirmation. Cancelling Rest of Site Upload.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
}
; Save button
Xpath = (//span[contains(text(),'Save')])[1]
Status := Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
if(Status){
Message = Failed to click Save button
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
Return "Success"
}