13 Commits

8 changed files with 448 additions and 267 deletions

4
.gitignore vendored
View File

@@ -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
View File

@@ -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

View File

@@ -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
}
}
; 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.
; 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,
Gui, Add, Text,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,41 +984,46 @@ if(!status){
}
DownloadLatestChromium()
Status := DownloadLatestChromium()
if(Status)
GuiControl,,ChromeUpdateAvailable, Chrome Up-to-Dat
Return
; now defunt, safe to remove
CreateDescriptionForVideosPosting:
; msgbox, here
Gui, VideoDescriptionTrimmer:New,
Gui, Font, s%GuiFontSize%
Gui, Add, Text,, Discord and Telegram have a maximum API post length of 2000 Characters `nwhich the curent description exceeds.`nPlease Trim down the description and then click submit.
Gui, Font, s%GuiFontSize%
Gui, Add, Edit, w800 h500 gUpdateVars vVideoDescriptionForVideosChannel, %VideoDescription%
Gui, Add, Button, gSubmitDescriptionForVideosChannel, Submit
gui, Show,w820, Video Description Trimmer
; msgbox
Return
/*
*/
; now defunt, safe to remove
CreateDescriptionForVideosPosting:
; msgbox, here
Gui, VideoDescriptionTrimmer:New,
Gui, Font, s%GuiFontSize%
Gui, Add, Text,, Discord and Telegram have a maximum API post length of 2000 Characters `nwhich the curent description exceeds.`nPlease Trim down the description and then click submit.
Gui, Font, s%GuiFontSize%
Gui, Add, Edit, w800 h500 gUpdateVars vVideoDescriptionForVideosChannel, %VideoDescription%
Gui, Add, Button, gSubmitDescriptionForVideosChannel, Submit
gui, Show,w820, Video Description Trimmer
; msgbox
Return
SubmitDescriptionForVideosChannel:
Gui, Submit
; msgbox, submitted
if(CurrentSocialMediaPosting = "Discord")
Goto, SubmitDescriptionForDiscordVideosChannel
if(CurrentSocialMediaPosting = "Telegram")
Goto, SubmitDescriptionForTelegramVideosChannel
SubmitDescriptionForVideosChannel:
Gui, Submit
; msgbox, submitted
if(CurrentSocialMediaPosting = "Discord")
Goto, SubmitDescriptionForDiscordVideosChannel
if(CurrentSocialMediaPosting = "Telegram")
Goto, SubmitDescriptionForTelegramVideosChannel
if(CurrentSocialMediaPosting = "Telegram Video")
goto, SubmitDescriptionForTelegramVideoUpload
if(CurrentSocialMediaPosting = "Telegram Video")
goto, SubmitDescriptionForTelegramVideoUpload
Return
Return
CreateDescriptionForSocialMedia(){
CreateDescriptionForSocialMedia(){
SplitText = Free Documentaries:
SocialMediaDescription := StrSplit(VideoDescription, SplitText)
@@ -995,22 +1035,22 @@ DownloadLatestChromium()
}
Return
}
; -------------------------------Upload Video Functionality-------------------------------
StartScript:
WinGetPos, XPosition, YPosition, , , A
IniWrite, %XPosition%, %SettingsIniFilepath%, General, XPosition
IniWrite, %YPosition%, %SettingsIniFilepath%, General, YPosition
}
; -------------------------------Upload Video Functionality-------------------------------
StartScript:
WinGetPos, XPosition, YPosition, , , A
IniWrite, %XPosition%, %SettingsIniFilepath%, General, XPosition
IniWrite, %YPosition%, %SettingsIniFilepath%, General, YPosition
Gui, Submit
Gui, Destroy
Gui, Submit
Gui, Destroy
; Save Testing Mode Info
;------------------------------------------------
if(TestingMode){ ; save currently seelcted sites to ini file for next test
; Save Testing Mode Info
;------------------------------------------------
if(TestingMode){ ; save currently seelcted sites to ini file for next test
; IniWrite, %Streamanity%, %SettingsIniFilepath%, Testing, Streamanity
IniWrite, %BitChute%, %SettingsIniFilepath%, Testing, BitChute
IniWrite, %OdyseeVideo%, %SettingsIniFilepath%, Testing, OdyseeVideo
@@ -1023,140 +1063,133 @@ DownloadLatestChromium()
IniWrite, %Locals%, %SettingsIniFilepath%, Testing, Locals
IniWrite, %Telegram%, %SettingsIniFilepath%, Testing, Telegram
IniWrite, %Facebook%, %SettingsIniFilepath%, Testing, Facebook
}
}
; Save Video Info
;------------------------------------------------
; if changes made, delete the original file and save the new content to it
; Save Video Info
;------------------------------------------------
; if changes made, delete the original file and save the new content to it
if(VideoTitle != OriginalVideoTitle){
if(VideoTitle != OriginalVideoTitle){
VideoTitleFilepath = %VideoFolderDir%\title.txt
FileDelete, %VideoTitleFilepath%
FileAppend, %VideoTitle%, %VideoTitleFilepath%
}
}
if(VideoTags != OriginalVideoTags){
if(VideoTags != OriginalVideoTags){
VideoTagsFilepath = %VideoFolderDir%\keywords.txt
FileDelete, %VideoTagsFilepath%
FileAppend, %VideoTags%, %VideoTagsFilepath%
}
}
if(PodcastTags != OriginalPodcastTags){
if(PodcastTags != OriginalPodcastTags){
PodcastTagsFilepath = %VideoFolderDir%\keywords_podcast.txt
FileDelete, %PodcastTagsFilepath%
FileAppend, %PodcastTags%, %PodcastTagsFilepath%
}
}
if(VideoDescription != OriginalVideoDescription){
if(VideoDescription != OriginalVideoDescription){
VideoBodyFilepath = %VideoFolderDir%\body.txt
FileDelete, %VideoBodyFilepath%
FileAppend, %VideoDescription%, %VideoBodyFilepath%
}
}
; -------------------------------/Save Video Info-------------------------------
; -------------------------------/Save Video Info-------------------------------
; Save settings to config file
IniWrite, %ReuseTabs%, %SettingsIniFilepath%, General, ReuseTabs
IniWrite, %ShowTooltipProgress%, %SettingsIniFilepath%, General, ShowTooltipProgress
IniWrite, %AutoUpdateCheck%, %SettingsIniFilepath%, General, AutoUpdateCheck
IniWrite, %AutoLogin%, %SettingsIniFilepath%, General, AutoLogin
IniWrite, %PingOnCompletion%, %SettingsIniFilepath%, General, PingOnCompletion
IniWrite, %KillLBRYAfterUpload%, %SettingsIniFilepath%, General, KillLBRYAfterUpload
; Save settings to config file
IniWrite, %ReuseTabs%, %SettingsIniFilepath%, General, ReuseTabs
IniWrite, %ShowTooltipProgress%, %SettingsIniFilepath%, General, ShowTooltipProgress
IniWrite, %AutoUpdateCheck%, %SettingsIniFilepath%, General, AutoUpdateCheck
IniWrite, %AutoLogin%, %SettingsIniFilepath%, General, AutoLogin
IniWrite, %PingOnCompletion%, %SettingsIniFilepath%, General, PingOnCompletion
IniWrite, %KillLBRYAfterUpload%, %SettingsIniFilepath%, General, KillLBRYAfterUpload
if(VideoFilepath = ""){
if(VideoFilepath = ""){
Msgbox,4096,Error,No Video Filepath Found.`nPlease Input Video Filepath to Upload a Video.
run, "%A_ScriptFullPath%" "LastPost"
ExitApp
}
}
; Format the LBRYURLSlug to be API Compatible
if(LBRYURLSlug = "") ; if slug spot is blank, then set it to video title
LBRYURLSlug := VideoTitle
LBRYURLSlug := LBRYCMDTextReplacement(LBRYURLSlug)
; Format the LBRYURLSlug to be API Compatible
if(LBRYURLSlug = "") ; if slug spot is blank, then set it to video title
LBRYURLSlug := VideoTitle
LBRYURLSlug := LBRYCMDTextReplacement(LBRYURLSlug)
; Save the LBRY URL Slug to .ini file in case it's needed later
IniWrite, %LBRYURLSlug%, %VideoLinksIniFile%, Misc, LBRYUrlSlug
IniWrite, %VideoThumbFilepath%, %VideoLinksIniFile%, Misc, VideoThumbFilepath
IniWrite, %PodcastNumber%, %VideoLinksIniFile%, Misc, PodcastNumber
; Save the LBRY URL Slug to .ini file in case it's needed later
IniWrite, %LBRYURLSlug%, %VideoLinksIniFile%, Misc, LBRYUrlSlug
IniWrite, %VideoThumbFilepath%, %VideoLinksIniFile%, Misc, VideoThumbFilepath
IniWrite, %PodcastNumber%, %VideoLinksIniFile%, Misc, PodcastNumber
; -------------------------------Log Info To Text-------------------------------
; -------------------------------Log Info To Text-------------------------------
(Facebook = 1)?(PostedWebsites .= "Facebook|") : ()
(Bitchute = 1)?(PostedWebsites .= "Bitchute|") : ()
(Locals = 1)?(PostedWebsites .= "Locals|") : ()
(Rumble = 1)?(PostedWebsites .= "Rumble|") : ()
(Brighteon = 1)?(PostedWebsites .= "Brighteon|") : ()
; (Streamanity = 1)?(PostedWebsites .= "Streamanity|") : ()
(Telegram = 1)?(PostedWebsites .= "Telegram|") : ()
(DailyMotion = 1)?(PostedWebsites .= "DailyMotion|") : ()
(OdyseeVideo = 1)?(PostedWebsites .= "OdyseeVideo|") : ()
(OdyseeAudio = 1)?(PostedWebsites .= "OdyseeAudio|") : ()
(Facebook = 1)?(PostedWebsites .= "Facebook|") : ()
(Bitchute = 1)?(PostedWebsites .= "Bitchute|") : ()
(Locals = 1)?(PostedWebsites .= "Locals|") : ()
(Rumble = 1)?(PostedWebsites .= "Rumble|") : ()
(Brighteon = 1)?(PostedWebsites .= "Brighteon|") : ()
; (Streamanity = 1)?(PostedWebsites .= "Streamanity|") : ()
(Telegram = 1)?(PostedWebsites .= "Telegram|") : ()
(DailyMotion = 1)?(PostedWebsites .= "DailyMotion|") : ()
(OdyseeVideo = 1)?(PostedWebsites .= "OdyseeVideo|") : ()
(OdyseeAudio = 1)?(PostedWebsites .= "OdyseeAudio|") : ()
; Log Basic info to the errorlogging file
Message = %ScriptName% v%ScriptVersion%: Starting Upload `nFor: **%VideoTitle%**`nTo: %PostedWebsites%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
; Log Basic info to the errorlogging file
Message = %ScriptName% v%ScriptVersion%: Starting Upload `nFor: **%VideoTitle%**`nTo: %PostedWebsites%
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Message := "VideoTitle: " VideoTitle
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
Message := "VideoTitle: " VideoTitle
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
Message := "VideoDescription: `n" VideoDescription
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
Message := "VideoDescription: `n" VideoDescription
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
Message := "VideoTags: " VideoTags
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
Message := "VideoTags: " VideoTags
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
Message := "VideoFilepath: " VideoFilepath
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
Message := "VideoFilepath: " VideoFilepath
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
Message := "VideoThumbFilepath: " VideoThumbFilepath
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
Message := "VideoThumbFilepath: " VideoThumbFilepath
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
Message := "TotalVideosUploaded: " TotalVideosUploaded
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
Message := "TotalVideosUploaded: " TotalVideosUploaded
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile")
; Convert Video Description into javascript text format for sending to selenium
JSVideoDescription := FormatTextToJSText(VideoDescription)
JSVideoTitle := FormatTextToJSText(VideoTitle)
; 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-------------------------------
; -------------------------------/Log Info To Text-------------------------------
; Create an array out of the keywords to be used in different places
VideoTags := StrReplace(VideoTags, ", ",",")
VideoTags := StrReplace(VideoTags, " ,",",")
VideoTags := StrReplace(VideoTags, " ",",")
; Create an array out of the keywords to be used in different places
VideoTags := StrReplace(VideoTags, ", ",",")
VideoTags := StrReplace(VideoTags, " ,",",")
VideoTags := StrReplace(VideoTags, " ",",")
KeywordsArray := StrSplit(VideoTags,",")
KeywordsArray := StrSplit(VideoTags,",")
; Call each sub one by one, if errors occur then an upload will be stopped and the next upload will then proceed
; 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()
@@ -1629,11 +1685,11 @@ Return
OnMsgBoxConfirmChromiumOverwrite() {
OnMsgBoxConfirmChromiumOverwrite() {
DetectHiddenWindows, On
Process, Exist
If (WinExist("ahk_class #32770 ahk_pid " . ErrorLevel)) {
ControlSetText Button1, Cancel
ControlSetText Button2, Yes
}
}
}

View File

@@ -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")

View File

@@ -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%

View File

@@ -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%
}
}

View File

@@ -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)
}