fixed brighteon not being able to grab video url at end of upload. Split up shared functions file into multiple pieces

pull/2/head
Yuriy 2 years ago
parent 7a27fa82b7
commit 9570085229

@ -165,6 +165,16 @@ IniRead, AutoLogin, %SettingsIniFilepath%, General, AutoLogin, 1
IniRead, PingOnCompletion, %SettingsIniFilepath%, General, PingOnCompletion, 1 IniRead, PingOnCompletion, %SettingsIniFilepath%, General, PingOnCompletion, 1
(PingOnCompletion)?(PingOnCompletionCheckStatus := 1) : (PingOnCompletionCheckStatus := 0) (PingOnCompletion)?(PingOnCompletionCheckStatus := 1) : (PingOnCompletionCheckStatus := 0)
if(PingOnCompletion){
IniRead, DiscordUsernameID, %SettingsIniFilepath%, General, DiscordUsernameID, %A_space%
if(!DiscordUsernameID){
Message = DiscordUsernameID is blank. Will not be able to ping to notify when uploads are complete.`nPlease add user ID in settings.ini under: `n`n[General]`nDiscordUsernameID=`nOr Uncheck "Discord Ping on Completion"
; SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar")
}
}
IniRead, KillLBRYAfterUpload, %SettingsIniFilepath%, General, KillLBRYAfterUpload, 1 IniRead, KillLBRYAfterUpload, %SettingsIniFilepath%, General, KillLBRYAfterUpload, 1
(KillLBRYAfterUpload)?(=KillLBRYAfterUploadCheckStatus := 1) : (KillLBRYAfterUploadCheckStatus := 0) (KillLBRYAfterUpload)?(=KillLBRYAfterUploadCheckStatus := 1) : (KillLBRYAfterUploadCheckStatus := 0)
@ -174,11 +184,7 @@ if(DiscordErrorLoggingWebhookBotURL = ""){
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
} }
IniRead, DiscordUsernameID, %SettingsIniFilepath%, General, DiscordUsernameID, %A_space%
if(DiscordUsernameID = ""){
Message = DiscordUsernameID is blank. Will not be able to ping to notify when uploads are complete.`nPlease add user ID in settings.ini under: `n`n[General]`nDiscordUsernameID=
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
}
;---Auto Updater Settings--- ;---Auto Updater Settings---
;------------------------------------------------ ;------------------------------------------------
@ -1570,7 +1576,7 @@ SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordError
AudioLength_Seconds := ((AudioLengthArray[1] * 60 ) * 60) + (AudioLengthArray[2] * 60) + AudioLengthArray[3] AudioLength_Seconds := ((AudioLengthArray[1] * 60 ) * 60) + (AudioLengthArray[2] * 60) + AudioLengthArray[3]
Message = MP3 Audio Length in Seconds: %TotalTimeInSeconds% Message = MP3 Audio Length in Seconds: %TotalTimeInSeconds%
SaveOrPostProgress(Message:="Message",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; AudioLength_Hours := AudioLengthArray[1] ; AudioLength_Hours := AudioLengthArray[1]
; AudioLength_Minutes := AudioLengthArray[2] ; AudioLength_Minutes := AudioLengthArray[2]
@ -3386,6 +3392,13 @@ TooltipThis("Inputting Video Description")
; Attempt to input video description a couple of times ; Attempt to input video description a couple of times
Loop, 10 { Loop, 10 {
if(A_index = 10){
Message = Failed to input Video Description after 10 attempts.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
SaveDriverURLOFErrorPage()
Return
}
Message = Inputting Description. Attempt Number: %A_index% Message = Inputting Description. Attempt Number: %A_index%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; SaveOrPostProgress(Message:=Message,PostType:="DiscordErrorLogging") ; SaveOrPostProgress(Message:=Message,PostType:="DiscordErrorLogging")
@ -3396,9 +3409,9 @@ Loop, 10 {
Xpath = //div[@class='e-content e-lib e-keyboard'] Xpath = //div[@class='e-content e-lib e-keyboard']
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoDescription) Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoDescription)
if(Status){ if(Status){
SaveOrPostProgress(Message:="Failed to input Video Description",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") SaveOrPostProgress(Message:="Failed to input Video Description",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
SaveDriverURLOFErrorPage() ; SaveDriverURLOFErrorPage()
Return ; Return
} }
; DevModeMsgBox("pause") ; DevModeMsgBox("pause")
@ -3567,16 +3580,14 @@ Loop, 10 { ; 5 loops of 1 minute each
} }
Message = Trying to Grab Uploaded Video URL Message = Trying to Grab Newest Video's URL
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
sleep, 2000
; Message = Waiting 60 Seconds Before Checking Results Page for URL ; Navigate to Videos page to make sure it's refreshed with latest video
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; Navigate to Videos page and loop through the videos and grab the URL of the latest upload
try driver.Get("https://www.brighteon.com/dashboard/videos") ;Open selected URL try driver.Get("https://www.brighteon.com/dashboard/videos") ;Open selected URL
try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
sleep, 2000
; Get First word in video title to use in grabbing video URL ; Get First word in video title to use in grabbing video URL
@ -3595,9 +3606,13 @@ Loop % VideoTitleArray.Length(){
Message = VideoTitleLongWord: %VideoTitleLongWord% Message = VideoTitleLongWord: %VideoTitleLongWord%
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
try, CurrentURL := driver.url
Message = Trying to Grab URL of latest upload containing keyword: %VideoTitleLongWord%. Tab's current URL: %CurrentURL%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; DevModeMsgBox(Message)
Loop, 4 { Loop, 4 {
ElementIndexNumber := A_index + 1 ElementIndexNumber := A_index
jsCheck = return document.getElementsByClassName('col')[%ElementIndexNumber%].outerHTML; jsCheck = return document.getElementsByClassName('col')[%ElementIndexNumber%].outerHTML;
try BrighteonURL := driver.executeScript(jsCheck) try BrighteonURL := driver.executeScript(jsCheck)
@ -3605,11 +3620,17 @@ Loop, 4 {
jsCheck = return document.getElementsByClassName('col')[%ElementIndexNumber%].textContent; jsCheck = return document.getElementsByClassName('col')[%ElementIndexNumber%].textContent;
try InnerText := driver.executeScript(jsCheck) try InnerText := driver.executeScript(jsCheck)
Message = InnerText: %InnerText% ; Message = Loop Number: %ElementIndexNumber% element's Text Content: %innerText%`nBrighteonURL: %BrighteonURL%
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile") ; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; Message = InnerText: %InnerText%
; SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
; DevModeMsgBox(InnerText)
; Message = BrighteonURL: %BrighteonURL%
; SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
Message = BrighteonURL: %BrighteonURL%
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
; Msgbox % "VideoTitleLongWord: " VideoTitleLongWord "`nInnerText: " InnerText ; Msgbox % "VideoTitleLongWord: " VideoTitleLongWord "`nInnerText: " InnerText
; clipboard := Message ; clipboard := Message
@ -3617,20 +3638,27 @@ Loop, 4 {
; Msgbox % "InnerText: " InnerText . "`n" . "BrighteonURL: " . BrighteonURL ; Msgbox % "InnerText: " InnerText . "`n" . "BrighteonURL: " . BrighteonURL
if(InStr(InnerText, VideoTitleLongWord)){ if(InStr(InnerText, VideoTitleLongWord)){
Message = Title Keyword was found on %A_index% loop, within element: %innerText%`nTrying to pull out BrighteonURL from element's outerHTML
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
BrighteonURL := StrSplit(BrighteonURL, "/dashboard/videos/") BrighteonURL := StrSplit(BrighteonURL, "/dashboard/videos/")
BrighteonURL := BrighteonURL[2] BrighteonURL := BrighteonURL[2]
BrighteonURL := StrSplit(BrighteonURL, "><div") BrighteonURL := StrSplit(BrighteonURL, "><div")
BrighteonURL := BrighteonURL[1] BrighteonURL := BrighteonURL[1]
BrighteonURL := StrReplace(BrighteonURL, """", "") BrighteonURL := StrReplace(BrighteonURL, """", "")
BrighteonURL := "https://www.brighteon.com/" . BrighteonURL BrighteonURL := "https://www.brighteon.com/" . BrighteonURL
; Msgbox % "BrighteonURL: " BrighteonURL
Break Break
} }
else, {
message = Keyword was not within: %VideoTitle%. Trying again with next element.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
BrighteonURL := BrighteonURL :=
} }
}
; Convert dashboard URL to Public URL ; Convert dashboard URL to Public URL
@ -4474,18 +4502,17 @@ Return
try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
CheckForAlerts() CheckForAlerts()
Message = Checking Login Status
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
try CurrentURL := driver.URL try CurrentURL := driver.URL
if(InStr(CurrentURL, "/login.php")){ if(InStr(CurrentURL, "/login.php")){
; AutoLogin := 1
; Msgbox % "AutoLogin: " AutoLogin
if(AutoLogin){ if(AutoLogin){
Message = Logging in Automatically by clicking into the UN+PW fields for info to register Message = Logging in Automatically by clicking into the UN+PW fields for info to register
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
@ -4530,7 +4557,7 @@ if(InStr(CurrentURL, "/login.php")){
sleep, 5000 sleep, 5000
} }
CheckForAlerts() ; CheckForAlerts()
Message = Uploading Video File Message = Uploading Video File
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
@ -4885,8 +4912,11 @@ Return
; -------------------------------Functions------------------------------- ; -------------------------------Functions-------------------------------
; Included Files ; Included Files
#include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\StdOutToVar.ahk ; used for chrome debugging mode connection #include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\StdOutToVar.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Freedomain-Posters-Shared-Functions.ahk #Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\General-Shared-Functions.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Selenium-Shared-Functions.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Gitea-Shared-Functions.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\APIs-Shared-Functions.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\JSON.ahk #Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\JSON.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\RunCMD.ahk #Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\RunCMD.ahk

@ -1 +1 @@
Subproject commit f39051ff5fd27550ef00d62d1bfaffcf2cf4a51b Subproject commit c5be14ba23e58f79bc7d8886c3528394b285decc
Loading…
Cancel
Save