Compare commits
13 Commits
3a09929e6e
...
3.26
| Author | SHA1 | Date | |
|---|---|---|---|
| 08eff7166a | |||
| 8c34e1de09 | |||
|
54b8670438
|
|||
|
|
8d650d3856 | ||
|
|
c8a5e6a286 | ||
|
|
4a6d719a3e | ||
|
|
9f11fd5f00 | ||
| ea91ebb237 | |||
| edb3ad07c8 | |||
| 263fb222e9 | |||
| 45b27311d4 | |||
| 5052713c55 | |||
| 180f89909e |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -2,6 +2,10 @@ Settings.ini
|
||||
VideoLinks.ini
|
||||
body.txt
|
||||
**/ErrorLogging
|
||||
**/chrome-win64
|
||||
**/Downloads
|
||||
**/Chromedriver-Mover.exe
|
||||
**/ChromedriverMover.ini
|
||||
**/Test Videos
|
||||
**/Backups
|
||||
**/Debug
|
||||
|
||||
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -1,3 +1,3 @@
|
||||
[submodule "Lib/Freedomain-Posters-Shared-Functions"]
|
||||
path = Lib/Freedomain-Posters-Shared-Functions
|
||||
url = https://git.freedomainplaylists.com/yuriy/Freedomain-Posters-Shared-Functions.git
|
||||
url = https://freedomain.dev/yuriy/posters-shared-functions.git
|
||||
|
||||
@@ -24,14 +24,15 @@ Menu, Tray, Add, Restart with Last Project, RetryUpload
|
||||
Menu, Tray, Default, Restart with Last Project
|
||||
|
||||
|
||||
global ScriptName
|
||||
|
||||
global ScriptNameav
|
||||
global ScriptVersion
|
||||
global FullScriptName
|
||||
|
||||
|
||||
|
||||
ScriptName = Freedomain Video Uploader
|
||||
ScriptVersion = 3.21
|
||||
ScriptVersion = 3.25
|
||||
FullScriptName := ScriptName . " - " . ScriptVersion
|
||||
|
||||
|
||||
@@ -47,6 +48,7 @@ UStartTime := A_TickCount ; start time
|
||||
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\RunCMD.ahk
|
||||
#include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\StdOutToVar.ahk
|
||||
#include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Zip.ahk
|
||||
#include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\URLDownloadToVar.ahk
|
||||
|
||||
|
||||
;---ToDo---
|
||||
@@ -109,7 +111,7 @@ Number_of_loops_to_Check_Upload_status = 720
|
||||
|
||||
; number of seconds to wait between loops when checking video upload status
|
||||
global Time_Between_Loops_Upload_Status
|
||||
Time_Between_Loops_Upload_Status = 5000
|
||||
Time_Between_Loops_Upload_Status = 15000 ;
|
||||
|
||||
; loop Index number to check if video is stuck uploading
|
||||
global Array_Index_Num_of_Upload_StatusChecks
|
||||
@@ -139,8 +141,8 @@ ScriptSettingsSection := "VideoUploader"
|
||||
IniRead, ShowTooltipProgress, %SettingsIniFilepath%, General, ShowTooltipProgress, 1
|
||||
(ShowTooltipProgress)?(ShowTooltipProgressCheckStatus := 1) : (ShowTooltipProgressCheckStatus := 0)
|
||||
|
||||
IniRead, XPosition, %SettingsIniFilepath%, General, XPosition
|
||||
IniRead, YPosition, %SettingsIniFilepath%, General, YPosition
|
||||
IniRead, XPosition, %SettingsIniFilepath%, General, XPosition, 0
|
||||
IniRead, YPosition, %SettingsIniFilepath%, General, YPosition, 0
|
||||
|
||||
IniRead, RootDirToStartIn, %SettingsIniFilepath%, General, RootDirToStartIn
|
||||
IniRead, LogErrorsToMsgbox, %SettingsIniFilepath%, General, LogErrorsToMsgbox, %A_Space%
|
||||
@@ -189,7 +191,7 @@ if(DiscordErrorLoggingWebhookBotURL = ""){
|
||||
;---Auto Updater Settings---
|
||||
;------------------------------------------------
|
||||
global GitReleasesAPIURL
|
||||
GitReleasesAPIURL = https://git.freedomainplaylists.com/api/v1/repos/yuriy/Freedomain-Video-Uploader/releases
|
||||
GitReleasesAPIURL = https://freedomain.dev/api/v1/repos/yuriy/Freedomain-Video-Uploader/releases
|
||||
|
||||
global GitReleasesLBRYKillerAPIURL
|
||||
GitReleasesLBRYKillerAPIURL = https://git.freedomainplaylists.com/api/v1/repos/yuriy/LBRY-Process-Killer/releases
|
||||
@@ -313,7 +315,7 @@ if(VideoDescription = ""){
|
||||
}
|
||||
|
||||
; Loop through the folder again to find the correct .WAV audio file as Stef has multiple in there and we need the .mp4 file to be found first so we know what to look for file name wise.
|
||||
Loop, files, %VideoFolderDir%\*.WAV, F ; loop through the files in the directory
|
||||
Loop, files, %VideoFolderDir%\*.flac, F ; loop through the files in the directory
|
||||
{ ; D = Directories, F = Files, R = Recursive
|
||||
SplitPath, A_LoopFileFullPath, FileNameWExt, FileDir, FileExt, FileNameNoExt
|
||||
|
||||
@@ -322,7 +324,21 @@ Loop, files, %VideoFolderDir%\*.WAV, F ; loop through the files in the direct
|
||||
}
|
||||
}
|
||||
|
||||
; if no FLAC file, then loop through folder and select WAV file instead
|
||||
if(WavAudioFilepath = ""){
|
||||
; Loop through the folder again to find the correct .WAV audio file as Stef has multiple in there and we need the .mp4 file to be found first so we know what to look for file name wise.
|
||||
Loop, files, %VideoFolderDir%\*.WAV, F ; loop through the files in the directory
|
||||
{ ; D = Directories, F = Files, R = Recursive
|
||||
SplitPath, A_LoopFileFullPath, FileNameWExt, FileDir, FileExt, FileNameNoExt
|
||||
|
||||
if(FileNameNoExt = VideoFileNameNoExt){
|
||||
WavAudioFilepath := A_LoopFileFullPath
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
; Find the .mp3 podcast file
|
||||
Loop, files, %VideoFolderDir%\*.mp3, F ; loop through the files in the directory
|
||||
{ ; D = Directories, F = Files, R = Recursive
|
||||
SplitPath, A_LoopFileFullPath, FileNameWExt, FileDir, FileExt, FileNameNoExt
|
||||
@@ -556,6 +572,13 @@ else, {
|
||||
}
|
||||
|
||||
|
||||
; @ TODO REMOVE
|
||||
; LocalsGrabURL := 0
|
||||
; Locals := 0
|
||||
|
||||
|
||||
|
||||
|
||||
; -------------------------------GUI-------------------------------
|
||||
|
||||
Gui, Font, s%GuiFontSize%
|
||||
@@ -633,8 +656,12 @@ Gui, Add, Button, x+5 yp+0 h%EditBoxHeight% gSelectVideoThumbFilepath, Select
|
||||
Gui, Font, Bold
|
||||
if(WavAudioFilepath = "")
|
||||
Gui, Add, Text,cRed x%MarginSquared% y+15,WAV Filepath
|
||||
else, { ; change text depending on if WAV or FLAC file
|
||||
if(InStr(WavFilepath, ".flac"))
|
||||
Gui, Add, Text,x%MarginSquared% y+15,FLAC Filepath
|
||||
else,
|
||||
Gui, Add, Text,x%MarginSquared% y+15,WAV Filepath
|
||||
}
|
||||
Gui, Font, Normal
|
||||
Gui, Add, Edit, x%MarginSquared% y+2 w%FilePathEditBoxWidths% h%EditBoxHeight% gUpdateVars vWavAudioFilepath,%WavAudioFilepath%
|
||||
Gui, Add, Button, x+5 yp+0 h%EditBoxHeight% gSelectWAVFilepath, Select
|
||||
@@ -738,28 +765,36 @@ Gui, Add, GroupBox,r6 y+%MarginSpaceTripled% x%PageTwoXStartPos% w%PageTwoGroupB
|
||||
; if(VideoFileSizeInMB < 1792)
|
||||
; Gui, Add, Checkbox, x+%MarginSpaceDoubled% vFacebook Checked%FacebookCheckStatus%, Facebook
|
||||
|
||||
Gui, Add, Checkbox, xp+10 yp+25 vBitChute Checked%BitChuteCheckStatus%, BitChute
|
||||
Gui, Add, Checkbox, xp+10 yp+25 vBitChute Checked%BitChuteCheckStatus% gUpdateVars, BitChute
|
||||
|
||||
|
||||
if(LocalsURL = "LocalsUploadStartedNeedToGrabURL"){
|
||||
Gui, Add, Checkbox, x+%MarginSpaceTripled% yp+0 vLocalsGrabURL Checked%LocalsCheckStatus%, Locals (Grab URL)
|
||||
; msgbox, checking grab url
|
||||
Gui, Add, Checkbox, x+%MarginSpaceTripled% yp+0 vLocalsGrabURL Checked%LocalsCheckStatus% gUpdateVars, Locals (Grab URL)
|
||||
LocalsGrabURL := 1
|
||||
Locals := 0
|
||||
}
|
||||
else, {
|
||||
Gui, Add, Checkbox, x+%MarginSpaceTripled% yp+0 vLocals Checked%LocalsCheckStatus%, Locals
|
||||
; msgbox, checking locals
|
||||
Gui, Add, Checkbox, x+%MarginSpaceTripled% yp+0 vLocals Checked%LocalsCheckStatus% gUpdateVars, Locals
|
||||
LocalsGrabURL := 0
|
||||
Locals := 1
|
||||
}
|
||||
|
||||
Gui, Add, Checkbox, x%GroupBoxCheckboxPos% y+%MarginSpace% vOdyseeVideo Checked%OdyseeVideoCheckStatus% gUpdateVars, Odysee Video
|
||||
|
||||
if(VideoFileSizeInMB < 50)
|
||||
Gui, Add, Checkbox, vTelegram x+%MarginSpaceDoubled% Checked%TelegramCheckStatus%, Telegram
|
||||
Gui, Add, Checkbox, vTelegram x+%MarginSpaceTripled% yp+0 Checked%TelegramCheckStatus% gUpdateVars, Telegram (>50 MB)
|
||||
|
||||
|
||||
Gui, Add, Checkbox, x%GroupBoxCheckboxPos% y+%MarginSpace% vOdyseeVideo Checked%OdyseeVideoCheckStatus%, Odysee Video
|
||||
; Gui, Add, Checkbox, x+%MarginSpace% vOdyseeVideoThumb Checked%OdyseeVideoThumbCheckStatus%,Thumbnail
|
||||
Gui, Add, Checkbox, x%GroupBoxCheckboxPos% y+%MarginSpace% vOdyseeAudio Checked%OdyseeAudioCheckStatus%, Odysee Audio
|
||||
Gui, Add, Checkbox, x%GroupBoxCheckboxPos% y+%MarginSpace% vOdyseeAudio Checked%OdyseeAudioCheckStatus% gUpdateVars, Odysee Audio
|
||||
; Gui, Add, Checkbox, x+%MarginSpace% vOdyseeAudioThumb Checked%OdyseeAudioThumbCheckStatus%, Thumbnail
|
||||
|
||||
Gui, Add, Checkbox, x%GroupBoxCheckboxPos% y+%MarginSpace% vRumble Checked%RumbleCheckStatus%, Rumble
|
||||
Gui, Add, Checkbox, x%GroupBoxCheckboxPos% y+%MarginSpace% vRumble Checked%RumbleCheckStatus% gUpdateVars, Rumble
|
||||
|
||||
Gui, Add, Checkbox, vBrighteon y+%MarginSpace% Checked%BrighteonCheckStatus%, Brighteon
|
||||
Gui, Add, Checkbox, vDailyMotion y+%MarginSpace% Checked%DailyMotionCheckStatus%, DailyMotion
|
||||
Gui, Add, Checkbox, vBrighteon y+%MarginSpace% Checked%BrighteonCheckStatus% gUpdateVars, Brighteon
|
||||
Gui, Add, Checkbox, vDailyMotion y+%MarginSpace% Checked%DailyMotionCheckStatus% gUpdateVars, DailyMotion
|
||||
; Gui, Add, Checkbox, vStreamanity Checked%StreamanityCheckStatus%, Streamanity
|
||||
|
||||
; Gui, Font, s12
|
||||
@@ -879,7 +914,7 @@ Return
|
||||
|
||||
|
||||
OpenGiteaPage:
|
||||
run, https://git.freedomainplaylists.com/yuriy/Freedomain-Video-Uploader
|
||||
run, https://freedomain.dev/yuriy/video-uploader
|
||||
Return
|
||||
|
||||
|
||||
@@ -911,7 +946,6 @@ SelectVideoThumbFilepath:
|
||||
FileSelectFile, VideoThumbFilepath,, %FileDir%, Select Thumbnail File
|
||||
|
||||
if(!InStr(VideoThumbFilepath, FileDir)){
|
||||
; ToolTip, Thumbnail Copied to Project Folder, 850, 0
|
||||
TimedToolTip("Thumbnail Copied to Project Folder",,,1000)
|
||||
SplitPath, VideoThumbFilepath, OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive
|
||||
FileCopy, %VideoThumbFilepath%, %FileDir%\*,1
|
||||
@@ -933,6 +967,7 @@ Return
|
||||
|
||||
UpdateChrome:
|
||||
|
||||
|
||||
if(CheckForChromeUpdates = "")
|
||||
Status := CheckForChromeUpdates(ChromeFilepath)
|
||||
|
||||
@@ -949,11 +984,16 @@ if(!status){
|
||||
}
|
||||
|
||||
|
||||
DownloadLatestChromium()
|
||||
Status := DownloadLatestChromium()
|
||||
if(Status)
|
||||
GuiControl,,ChromeUpdateAvailable, Chrome Up-to-Dat
|
||||
|
||||
|
||||
Return
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
; now defunt, safe to remove
|
||||
CreateDescriptionForVideosPosting:
|
||||
; msgbox, here
|
||||
@@ -1126,9 +1166,9 @@ DownloadLatestChromium()
|
||||
Message := "TotalVideosUploaded: " TotalVideosUploaded
|
||||
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
|
||||
|
||||
; Convert Video Description into javascript text format for sending to selenium
|
||||
JSVideoDescription := FormatTextToJSText(VideoDescription)
|
||||
; Convert Video Title and Description into javascript formatting for sending to pages through js instead of plain selenium
|
||||
JSVideoTitle := FormatTextToJSText(VideoTitle)
|
||||
JSVideoDescription := FormatTextToJSText(VideoDescription)
|
||||
|
||||
; -------------------------------/Log Info To Text-------------------------------
|
||||
|
||||
@@ -1145,18 +1185,11 @@ DownloadLatestChromium()
|
||||
|
||||
; Call each sub one by one, if errors occur then an upload will be stopped and the next upload will then proceed
|
||||
|
||||
/*
|
||||
|
||||
if(Facebook)
|
||||
gosub, FacebookUpload
|
||||
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
|
||||
if(Telegram)
|
||||
gosub, TelegramVideoUpload
|
||||
|
||||
|
||||
if(Locals)
|
||||
gosub, LocalsUpload
|
||||
|
||||
@@ -1198,7 +1231,7 @@ if(OdyseeAudio){
|
||||
Gosub, LBRYGetURL
|
||||
}
|
||||
|
||||
if(LocalsGrabURL OR LocalsURL = "LocalsUploadStartedNeedToGrabURL"){
|
||||
if(LocalsGrabURL){
|
||||
Gosub, LocalsGrabURL
|
||||
}
|
||||
|
||||
@@ -1228,6 +1261,25 @@ SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,Disc
|
||||
|
||||
|
||||
DisplayResults:
|
||||
|
||||
/*
|
||||
; i forget why i have it get the window position here
|
||||
WinGetPos, XPosition, YPosition, , , A
|
||||
Msgbox % "XPosition: " XPosition "`n" "YPosition: " YPosition
|
||||
|
||||
if(XPosition > 0 and YPosition > 0){ ; if gui doesn't exist, both are set to -8
|
||||
; Msgbox % "XPosition: " XPosition
|
||||
; Msgbox % "YPosition: " YPosition
|
||||
IniWrite, %XPosition%, %SettingsIniFilepath%, General, XPosition
|
||||
IniWrite, %YPosition%, %SettingsIniFilepath%, General, YPosition
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
Tooltip ; Remove all tooltips
|
||||
|
||||
Gui, Destroy ; destroy GUI in case we're going from the main screen to results without uploading.
|
||||
@@ -1359,6 +1411,10 @@ Gui, +Resize +MaximizeBox
|
||||
OriginalVideoDescription := VideoDescription
|
||||
OriginalPodcastTags := PodcastTags
|
||||
|
||||
|
||||
if(XPosition and YPosition)
|
||||
Gui, Show,x%XPosition% y%YPosition%,%FullScriptName% - Upload Results
|
||||
else,
|
||||
Gui, Show,,%FullScriptName% - Upload Results
|
||||
|
||||
SaveCurrentChromeVersionToIniFile()
|
||||
|
||||
Submodule Lib/Freedomain-Posters-Shared-Functions updated: 1962743565...1e77871bd8
@@ -36,12 +36,12 @@ if(LoggedOutStatus){
|
||||
try driver.FindElementByXPath(Xpath).click()
|
||||
|
||||
Xpath = //input[@placeholder='Enter password']
|
||||
driver.FindElementByXPath(Xpath).click()
|
||||
try driver.FindElementByXPath(Xpath).click()
|
||||
|
||||
js = document.querySelector("button[type='submit']").click();
|
||||
driver.executeScript(js)
|
||||
|
||||
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, 1000
|
||||
|
||||
; Do a double check to make sure that login worked
|
||||
@@ -284,6 +284,25 @@ catch e {
|
||||
}
|
||||
|
||||
|
||||
; Disable Monetization Checkbox
|
||||
Message = Disabling Monetization Checkbox
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
Xpath = //*[@id="advertising_instream_blocked"]
|
||||
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
||||
if(Status){
|
||||
Message = Failed to click on Monetization slider with xpath, trying with full xpath
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
Xpath = /html/body/div/div[2]/div/div[3]/div/div/div[2]/div[2]/div/div/div/div[4]/div/button
|
||||
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
||||
if(Status){
|
||||
Message = Failed to click on Monetization slider with full xpath, sleeping for 5 seconds so user can manually uncheck it.
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
; Disable monitization for video
|
||||
SaveOrPostProgress(Message:="Unchecking monetizaton checkbox",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
@@ -57,7 +57,7 @@ if(DevMode){
|
||||
Return
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Message = Inputting Title
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
@@ -69,6 +69,45 @@ if(DevMode){
|
||||
}
|
||||
|
||||
sleep, 1000
|
||||
*/
|
||||
|
||||
|
||||
|
||||
TooltipThis("Inputting Title")
|
||||
Loop, 5 { ; Attempt to input video description a couple of times
|
||||
|
||||
|
||||
if(A_index = 5){
|
||||
; Clipboard := VideoDescription
|
||||
Message = Failed to input Video Title
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
Return
|
||||
}
|
||||
|
||||
js = document.querySelector("#title").value = "%JSVideoTitle%"; ; Send content through javascript (Great for getting around emoji chrome limitaitons)
|
||||
try driver.executeScript(js) ;Executes a Javascript on the webpage, mostly used for buttons.
|
||||
|
||||
; msgbox
|
||||
; try driver.findElementsByName("body").item[1].SendKeys(driver.Keys.SPACE)
|
||||
; driver.findElementsByID("ELEMENTID").item[1].SendKeys(driver.Keys.ENTER)
|
||||
; msgbox
|
||||
|
||||
jsCheck = return document.querySelector("#title").value; ; Send content through javascript (Great for getting around emoji chrome limitaitons)
|
||||
try VideoTitle := driver.executeScript(jsCheck) ;Executes a Javascript on the webpage, mostly used for buttons.
|
||||
|
||||
|
||||
; try Description := driver.findElementsByName("body").item[1].Attribute("value") ;XPath: ID=site-title & span tag
|
||||
if(VideoTitle != "")
|
||||
Break
|
||||
sleep, 2000
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*Xpath = //textarea[@id='body']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000,StringTextContent:=VideoDescription)
|
||||
@@ -108,7 +147,7 @@ Loop, 5 { ; Attempt to input video description a couple of times
|
||||
sleep, 2000
|
||||
}
|
||||
|
||||
SaveOrPostProgress(Message:="Waiting Video to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
; SaveOrPostProgress(Message:="Waiting Video to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
Message = Uploading Video File
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
Xpath = //div[@class='uploadvideo-wrapper']//input[@name='Filedata']
|
||||
@@ -148,7 +187,7 @@ if(AutoSubmitstatus = "0"){
|
||||
}
|
||||
|
||||
|
||||
DevModeMsgBox("autosubmit status -1 string here")
|
||||
; DevModeMsgBox("autosubmit status -1 string here")
|
||||
; msgbox % AutoSubmitstatus = "-1"
|
||||
if(AutoSubmitstatus = "-1"){ ; if checked YES
|
||||
|
||||
@@ -199,6 +238,9 @@ if(AutoSubmitstatus = "-1"){ ; if checked YES
|
||||
|
||||
; LocalsTabURL := SaveDriverURL()
|
||||
|
||||
; Set variable so that URL gets grabbed later in the upload
|
||||
LocalsGrabURL := 1
|
||||
|
||||
Return
|
||||
}
|
||||
Return
|
||||
@@ -214,7 +256,7 @@ Return
|
||||
;--------------LocalsGrabURL----------------------------------
|
||||
LocalsGrabURL:
|
||||
|
||||
CurrentSite := Locals
|
||||
CurrentSite := "Locals"
|
||||
|
||||
SaveOrPostProgress(Message:="Navigating to Locals Feed to grab URL",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
@@ -254,28 +296,67 @@ Return
|
||||
js = return document.querySelector("a[class='btn']").innerText;
|
||||
try, status := driver.executeScript(js)
|
||||
if(status){
|
||||
Message = Video was uploaded but Locals saved it as a draft instead of instantly publishing it. Please go to the Locals Page and Retrieve Draft and manually Publish it.
|
||||
Message = Video is in Draft Mode. Publishing.
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,DiscordErrorLogging")
|
||||
|
||||
; video is in draft mode, we need to confirm the title and then publish it.
|
||||
|
||||
; click Retrieve draft button
|
||||
js = document.querySelector("a[class='btn']").click()
|
||||
try, driver.executeScript(js)
|
||||
|
||||
js = return document.querySelector("#title").value
|
||||
try LocalsDraftTitle := driver.executeScript(JS)
|
||||
|
||||
if(LocalsDraftTitle != VideoTitle){
|
||||
Message = Failed to Grab URL. Locals Draft Title does not Match video Title:`nVideo Title: %VideoTitle%`nLocals Draft Title: %LocalsDraftTitle%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
SaveDriverURLOFErrorPage()
|
||||
Return
|
||||
}
|
||||
|
||||
; otherwise we are good to publish video
|
||||
Xpath = (//button[@name='submitPost'])[1]
|
||||
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
||||
if(Status){
|
||||
Message = Failed to click Publish button on saved Draft
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
SaveDriverURLOFErrorPage()
|
||||
Return
|
||||
}
|
||||
|
||||
sleep, 2000
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
; Get word that's longer than 4 characters in video title
|
||||
VideoTitleArray := StrSplit(VideoTitle, " ")
|
||||
; Iterate from 1 to the end of the array:
|
||||
Loop % VideoTitleArray.Length(){
|
||||
VideoTitleFirstWord := VideoTitleArray[A_Index]
|
||||
VideoTitleFirstWord := StrReplace(VideoTitleFirstWord, "_","-")
|
||||
if(StrLen(VideoTitleFirstWord) > 4)
|
||||
LongestWordInVideoTitle := VideoTitleArray[A_Index]
|
||||
LongestWordInVideoTitle := StrReplace(LongestWordInVideoTitle, "_","-")
|
||||
if(StrLen(LongestWordInVideoTitle) > 4)
|
||||
Break
|
||||
|
||||
; MsgBox % VideoTitleArray[A_Index]
|
||||
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
; get longest word in video title to use for grabbing the share link from the raw page
|
||||
RegExMatch(VideoTitle, "ms)\b\S+(?CFindLongestWordInString)\b(?R)", m)
|
||||
LongestWordInVideoTitle := longestWord
|
||||
; Msgbox % "LongestWordInVideoTitle: " LongestWordInVideoTitle
|
||||
|
||||
; MsgBox, Longest word: %longestWord%`, #%wordLength%
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
loop, 7 {
|
||||
ElementIndexNum := A_index - 1
|
||||
Message = ElementIndexNum: %ElementIndexNum%
|
||||
@@ -287,18 +368,16 @@ loop, 7 {
|
||||
try outerHTML := driver.executeScript(jsCheck)
|
||||
|
||||
if(DevMode){
|
||||
Message = Looking for VideoTitleFirstWord: %VideoTitleFirstWord% `nwithin outerHTML
|
||||
Message = Looking for LongestWordInVideoTitle: %LongestWordInVideoTitle% `nwithin outerHTML: %outerHTML%
|
||||
DevModeMsgBox(message)
|
||||
Clipboard := outerHTML
|
||||
DevModeMsgBox(outerHTML)
|
||||
Clipboard := message
|
||||
; DevModeMsgBox(outerHTML)
|
||||
}
|
||||
|
||||
if(InStr(OuterHTML,LongestWordInVideoTitle)){
|
||||
|
||||
; msgbox % "outerHTML: " . outerHTML
|
||||
|
||||
if(InStr(OuterHTML,VideoTitleFirstWord)){
|
||||
; @todo replace with regex
|
||||
Message = %VideoTitleFirstWord% is in`n`n %OuterHTML%
|
||||
Message = %LongestWordInVideoTitle% is in`n`n %OuterHTML%
|
||||
DevModeMsgBox(Message)
|
||||
|
||||
Message = Found at at index: %A_index%
|
||||
@@ -328,14 +407,21 @@ loop, 7 {
|
||||
ShareLink :=
|
||||
}
|
||||
|
||||
DevModeMsgBox(ShareLink)
|
||||
if(ShareLink = ""){
|
||||
Message = Video was published succsessfully, but failed to grab Share Link.
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
SaveDriverURLOFErrorPage()
|
||||
Return
|
||||
}
|
||||
|
||||
; DevModeMsgBox(ShareLink)
|
||||
|
||||
; ShareLink := "Successful"
|
||||
|
||||
Message = Upload Complete: %ShareLink%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
|
||||
DevModeMsgBox(ShareLink)
|
||||
IniWrite, %ShareLink%, %VideoLinksIniFile%, URLs, LocalsURL
|
||||
AddToTotalVideosUploadedCount()
|
||||
|
||||
@@ -500,22 +586,22 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
|
||||
VideoTitleArray := StrSplit(VideoTitle, " ")
|
||||
; Iterate from 1 to the end of the array:
|
||||
Loop % VideoTitleArray.Length(){
|
||||
VideoTitleFirstWord := VideoTitleArray[A_Index]
|
||||
VideoTitleFirstWord := StrReplace(VideoTitleFirstWord, "_","-")
|
||||
if(StrLen(VideoTitleFirstWord) > 4)
|
||||
LongestWordInVideoTitle := VideoTitleArray[A_Index]
|
||||
LongestWordInVideoTitle := StrReplace(LongestWordInVideoTitle, "_","-")
|
||||
if(StrLen(LongestWordInVideoTitle) > 4)
|
||||
Break
|
||||
|
||||
; MsgBox % VideoTitleArray[A_Index]
|
||||
|
||||
}
|
||||
|
||||
; DevModeMsgBox(VideoTitleFirstWord)
|
||||
; DevModeMsgBox(LongestWordInVideoTitle)
|
||||
|
||||
; Message = VideoTitleFirstWord: %VideoTitleFirstWord%
|
||||
; Message = LongestWordInVideoTitle: %LongestWordInVideoTitle%
|
||||
; SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
|
||||
|
||||
; VideoTitleFirstWord := VideoTitleFirstWord[1]
|
||||
; Msgbox % "VideoTitleFirstWord: " VideoTitleFirstWord
|
||||
; LongestWordInVideoTitle := LongestWordInVideoTitle[1]
|
||||
; Msgbox % "LongestWordInVideoTitle: " LongestWordInVideoTitle
|
||||
|
||||
/* ; Format the post title to remove all spaces and special characters to match with Locals Post
|
||||
ShareLinkFormatted := StrReplace(VideoTitle, " ", "-")
|
||||
@@ -547,9 +633,9 @@ Loop, %Number_of_loops_to_Check_Upload_status% {
|
||||
|
||||
; msgbox % "outerHTML: " . outerHTML
|
||||
|
||||
if(InStr(OuterHTML,VideoTitleFirstWord)){
|
||||
if(InStr(OuterHTML,LongestWordInVideoTitle)){
|
||||
|
||||
Message = %VideoTitleFirstWord% is in %OuterHTML%
|
||||
Message = %LongestWordInVideoTitle% is in %OuterHTML%
|
||||
; DevModeMsgBox(Message)
|
||||
|
||||
; MsgBox, found match at %A_index%
|
||||
|
||||
@@ -235,3 +235,19 @@ Check_For_Stuck_Video_Upload(Index_Number, Upload_Status){
|
||||
ProgressStatusArray.Push(Upload_Status) ; append current status to array
|
||||
}
|
||||
} ; end of func
|
||||
|
||||
|
||||
; Find the longest word in a string of words
|
||||
FindLongestWordInString(m, calloutNumber, pos, haystack, pattern){
|
||||
Global wordLength, longestWord
|
||||
|
||||
len := StrLen(m)
|
||||
|
||||
If ( len > wordLength )
|
||||
{
|
||||
wordLength := len
|
||||
longestWord := m
|
||||
|
||||
; MsgBox, %m%
|
||||
}
|
||||
}
|
||||
@@ -266,7 +266,7 @@ try pagehtml := driver.pagesource
|
||||
Loop, %LengthOfArrayOfPodcastTags% {
|
||||
Tag := ArrayOfPodcastTags[A_Index] ; find value from position in array
|
||||
|
||||
SpanID = title">%Tag%</span></div></li><li><div id="_easyui_tree_
|
||||
SpanID = title">%Tag%</span></div></li><li><div id="tagIDs_easyui_tree_
|
||||
|
||||
if(InStr(pagehtml, SpanID)){ ; if tag found in page, do this
|
||||
number := StrSplit(pagehtml, SpanID)
|
||||
@@ -289,7 +289,7 @@ Loop, %LengthOfArrayOfPodcastTags% {
|
||||
Continue
|
||||
}
|
||||
|
||||
Xpath = //div[@id='_easyui_tree_%number%']//span[@class='tree-checkbox tree-checkbox0']
|
||||
Xpath = //div[@id='tagIDs__easyui_tree_%number%']//span[@class='tree-checkbox tree-checkbox0']
|
||||
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user