Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dcd947b136 | |||
| 4476bfdda6 | |||
| 5f63640185 | |||
| 6639c907c9 | |||
| 3492ecccee | |||
| 38a579c486 | |||
| 4beb83caa6 |
@@ -67,7 +67,6 @@ global VideoFilepath
|
||||
global VideoThumbFilepath
|
||||
global VideoTags
|
||||
global VideoDescription
|
||||
global SocialMediaDescription
|
||||
global DiscordErrorLoggingWebhookBotURL
|
||||
global DiscordVideosWebhookURL
|
||||
global VideoFolderDir
|
||||
@@ -464,85 +463,87 @@ if(PassedInArgument2_Action = "Scheduled"){
|
||||
; }
|
||||
goto, StartScheduledPost
|
||||
}
|
||||
/*
|
||||
*/
|
||||
|
||||
;---/Read Info From Previous Run And Set Upload Options---
|
||||
;--------------------------------------------------------
|
||||
|
||||
;---/Read Info From Previous Run And Set Upload Options---
|
||||
;--------------------------------------------------------
|
||||
|
||||
if(PassedInArgument2_Action = "ShowResults"){
|
||||
goto, DisplayResults
|
||||
}
|
||||
if(PassedInArgument2_Action = "ShowResults"){
|
||||
goto, DisplayResults
|
||||
}
|
||||
|
||||
|
||||
|
||||
; Main GUI Window
|
||||
; ------------------------------------------------
|
||||
gosub, SetAndShowMainGUI
|
||||
; Main GUI Window
|
||||
; ------------------------------------------------
|
||||
; Write current project to ini file for easy reloading
|
||||
IniWrite, %BodyTextFilePath%, %SettingsIniFilepath%, %ScriptSettingsSection%, LastPost
|
||||
|
||||
gosub, SetAndShowMainGUI
|
||||
|
||||
; Write current project to ini file for easy reloading
|
||||
IniWrite, %BodyTextFilePath%, %SettingsIniFilepath%, %ScriptSettingsSection%, LastPost
|
||||
RunTimeToShowGui := round(((A_TickCount - UStartTime) / 1000), 2)
|
||||
|
||||
Return
|
||||
|
||||
RunTimeToShowGui := round(((A_TickCount - UStartTime) / 1000), 2)
|
||||
; -------------------------------GUI GoSubs-------------------------------
|
||||
; Kill the script if user clicks on cancel button
|
||||
KillScript:
|
||||
; GuiClose:
|
||||
ExitApp
|
||||
Return
|
||||
|
||||
Return
|
||||
PauseScript:
|
||||
Pause,Toggle
|
||||
Return
|
||||
|
||||
; -------------------------------GUI GoSubs-------------------------------
|
||||
; Kill the script if user clicks on cancel button
|
||||
KillScript:
|
||||
; GuiClose:
|
||||
ExitApp
|
||||
Return
|
||||
CancelPost:
|
||||
GuiClose:
|
||||
; ExitApp
|
||||
Gui, Submit,
|
||||
Return
|
||||
|
||||
PauseScript:
|
||||
Pause,Toggle
|
||||
Return
|
||||
ReloadScript:
|
||||
Reload
|
||||
Return
|
||||
|
||||
CancelPost:
|
||||
GuiClose:
|
||||
; ExitApp
|
||||
Gui, Submit,
|
||||
Return
|
||||
; Gets activated each time that text gets input into any of the text boxes
|
||||
; updates the variables with the new text
|
||||
UpdateVars:
|
||||
Gui, Submit, NoHide
|
||||
Return
|
||||
|
||||
ReloadScript:
|
||||
Reload
|
||||
Return
|
||||
|
||||
; Gets activated each time that text gets input into any of the text boxes
|
||||
; updates the variables with the new text
|
||||
UpdateVars:
|
||||
Gui, Submit, NoHide
|
||||
Return
|
||||
|
||||
SubmitDescription:
|
||||
Gui, Submit, NoHide
|
||||
DescriptionCharCount := StrLen(VideoDescription)
|
||||
GuiControl,, DescriptionCharCount, %DescriptionCharCount%
|
||||
Return
|
||||
SubmitDescription:
|
||||
Gui, Submit, NoHide
|
||||
DescriptionCharCount := StrLen(VideoDescription)
|
||||
GuiControl,, DescriptionCharCount, %DescriptionCharCount%
|
||||
Return
|
||||
|
||||
|
||||
|
||||
; Open folder of the project
|
||||
OpenProjectFolder:
|
||||
run, %VideoFolderDir%
|
||||
Return
|
||||
; Open folder of the project
|
||||
OpenProjectFolder:
|
||||
if(FileExist(VideoFolderDir))
|
||||
run, %VideoFolderDir%
|
||||
else,
|
||||
msgbox, Cannot Open Folder as it no longer exists at:`n%VideoFolderDir%
|
||||
Return
|
||||
|
||||
ClearVideoLinks:
|
||||
FileDelete, %VideoLinksIniFile%
|
||||
Return
|
||||
ClearVideoLinks:
|
||||
FileDelete, %VideoLinksIniFile%
|
||||
Return
|
||||
|
||||
|
||||
|
||||
ToggleTestingMode:
|
||||
ToggleTestingMode()
|
||||
run, "%A_ScriptFullPath%" "LastPost"
|
||||
Return
|
||||
ToggleTestingMode:
|
||||
ToggleTestingMode()
|
||||
run, "%A_ScriptFullPath%" "LastPost"
|
||||
Return
|
||||
|
||||
ToggleDevMode:
|
||||
ToggleDevMode()
|
||||
run, "%A_ScriptFullPath%" "LastPost"
|
||||
Return
|
||||
ToggleDevMode:
|
||||
ToggleDevMode()
|
||||
run, "%A_ScriptFullPath%" "LastPost"
|
||||
Return
|
||||
|
||||
/*
|
||||
OpenGiteaPage:
|
||||
@@ -618,19 +619,6 @@ Return
|
||||
*/
|
||||
|
||||
|
||||
CreateDescriptionForSocialMedia(){
|
||||
SplitText = Free Documentaries:
|
||||
|
||||
SocialMediaDescription := StrSplit(VideoDescription, SplitText)
|
||||
SocialMediaDescription := SocialMediaDescription[1]
|
||||
|
||||
if(strlen(SocialMediaDescription) > 1400){
|
||||
SocialMediaDescription := SubStr(SocialMediaDescription, 1, 1400)
|
||||
SocialMediaDescription .= "..."
|
||||
}
|
||||
|
||||
Return
|
||||
}
|
||||
; -------------------------------Upload Video Functionality-------------------------------
|
||||
StartScript:
|
||||
WinGetPos, XPosition, YPosition, , , A
|
||||
@@ -1190,6 +1178,10 @@ Return
|
||||
; ------------------------------------------------
|
||||
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Shared-GoTos.ahk
|
||||
|
||||
; Special Website Functions
|
||||
; ------------------------------------------------
|
||||
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Locals-Functions.ahk
|
||||
|
||||
; GUI Windows
|
||||
; ------------------------------------------------
|
||||
#include C:\Users\%A_Username%\Syncthing\Git\Freedomain-Video-Uploader\Modules\GUI-Main-Window.ahk
|
||||
|
||||
Submodule Lib/Freedomain-Posters-Shared-Functions updated: a3d89a9892...e654611bf3
@@ -200,8 +200,6 @@ Gui, Add, Button, x+%MarginSize% w%EditBoxFourthWidths% h%SecondaryButtonHeights
|
||||
|
||||
Gui, Add, Button, x+%MarginSize% w%EditBoxHalfWidths% h%SecondaryButtonHeights% gScheduleUpload, Schedule for Later
|
||||
|
||||
; Gui, Add, Button, w%EditBoxFourthWidths% x%MarginSize% y+%MarginSize% h%SecondaryButtonHeights% gOpenProjectFolder, Open New Project
|
||||
|
||||
Gui, Add, Button, w%EditBoxFourthWidths% h%SecondaryButtonHeights% x%MarginSize% y+%MarginSize% vChromeUpdateAvailable gUpdateChrome, Chrome Up-to-Date
|
||||
|
||||
Gui, Add, Button, x+%MarginSize% yp+0 w%EditBoxFourthWidths% h%SecondaryButtonHeights% gDisplayResults, View Status
|
||||
@@ -210,6 +208,9 @@ Gui, Add, Button, x+%MarginSize% w%EditBoxHalfWidths% h%SecondaryButtonHeights%
|
||||
Gui, Add, Button, w%EditBoxFourthWidths% h%SecondaryButtonHeights% x%MarginSize% y+%MarginSize% vPostSchedulerUpdateAvailable gUpdatePostScheduler, Post Scheduler Up-To-Date
|
||||
; Gui, Add, Button, w%EditBoxFourthWidths% h%SecondaryButtonHeights% x%MarginSize% y+%MarginSize% vPostSchedulerUpdateAvailable, Post Scheduler Up-To-Date
|
||||
|
||||
Gui, Add, Button, x+%MarginSize% w%EditBoxFourthWidths% h%SecondaryButtonHeights%
|
||||
Gui, Add, Button, x+%MarginSize% w%EditBoxHalfWidths% h%SecondaryButtonHeights% gReloadScript, Open New Project
|
||||
|
||||
|
||||
if(DevMode){
|
||||
Gui, Add, Button, x%MarginSize% w%EditBoxFourthWidths% h30 y+5 h%SecondaryButtonHeights% gOpenErrorLog, Open ErrorLog
|
||||
@@ -432,7 +433,7 @@ Gui, Add, Button, x%MarginSize% w%ResultsEditAndCopyButtonWidth% h%SecondaryButt
|
||||
; Error Log Column
|
||||
; ------------------------------------------------
|
||||
Gui, Font, s%GuiFontSize%
|
||||
Gui, Add, Button, x+%MarginSize% y%MarginSize% w%ErrorLogEditBoxWidth% h%ButtonHeights% y%MarginSize%, Error Log
|
||||
Gui, Add, Button, x+%MarginSize% y%MarginSize% w%ErrorLogEditBoxWidth% h%ButtonHeights% y%MarginSize% gOpenErrorLog, Error Log (Click to Open Detailed Log)
|
||||
Gui, Add, Edit,x%ErrorLogEditBoxXPos% h%ErrorLogEditBoxHeight% w%ErrorLogEditBoxWidth% y+10, %ErrorLogVar%
|
||||
|
||||
gui, font, Normal
|
||||
|
||||
@@ -100,6 +100,14 @@ Loop, 5 {
|
||||
sleep, 2000
|
||||
}
|
||||
|
||||
; click the "Hide Links Preview" checkbox to hide previews of hyperlinks
|
||||
if(InStr(VideoDescription, "https")){
|
||||
Xpath = (//div[@class='hide-switcher-container'])[1]
|
||||
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=100)
|
||||
|
||||
}
|
||||
|
||||
|
||||
; SaveOrPostProgress(Message:="Waiting Video to finish uploading",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
Message = Uploading Video File
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
@@ -112,6 +120,17 @@ if(Status){
|
||||
}
|
||||
|
||||
|
||||
; make sure the "Notify Users" checkbox is selected
|
||||
Xpath = (//input[contains(@name,'is_do_promo')])[1]
|
||||
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=1,SleepLength:=1000)
|
||||
try, Status := driver.findelementbyxpath(Xpath).isSelected()
|
||||
if(Status = "0"){
|
||||
Message = Failed to Check ON the Notify Users Checkbox
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
}
|
||||
|
||||
|
||||
|
||||
; check if the "Auto Submit Post" checkbox is checked, and if not check it
|
||||
js = return document.querySelector("#autosubmit_enabled").checked;
|
||||
try AutoSubmitstatus := driver.executeScript(js)
|
||||
@@ -288,9 +307,9 @@ Loop % VideoTitleArray.Length(){
|
||||
|
||||
|
||||
; 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
|
||||
; RegExMatch(VideoTitle, "ms)\b\S+(?CFindLongestWordInString)\b(?R)", m)
|
||||
; LongestWordInVideoTitle := longestWord
|
||||
; Msgbox % "LongestWordInVideoTitle: " LongestWordInVideoTitle
|
||||
|
||||
; MsgBox, Longest word: %longestWord%`, #%wordLength%
|
||||
|
||||
@@ -299,9 +318,23 @@ Msgbox % "LongestWordInVideoTitle: " LongestWordInVideoTitle
|
||||
|
||||
; Grab Video Share Link From Page Source
|
||||
; ------------------------------------------------
|
||||
ShareLink := GrabLocalsPostURLUsingTitle(VideoTitle)
|
||||
|
||||
if(!InStr(ShareLink, "https")){
|
||||
Message = Couldn't find Video Share link in the first 10 posts. Is the video possibly still uploading?
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
Return
|
||||
}
|
||||
|
||||
; Msgbox % "ShareLink: " ShareLink
|
||||
|
||||
; Msgbox % "LocalsVideoURL: " LocalsVideoURL
|
||||
|
||||
|
||||
|
||||
; Iterate over the last couple of posts, find the post with the title that contains the Longest word from the uploaded video
|
||||
; And grab the share URL for it
|
||||
|
||||
/*
|
||||
Message = Looking for - %LongestWordInVideoTitle% - within first 7 posts in order to grab share URL
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
@@ -358,6 +391,7 @@ loop, 7 {
|
||||
ShareLink :=
|
||||
}
|
||||
|
||||
*/
|
||||
if(ShareLink = ""){
|
||||
Message = Video was published succsessfully, but failed to grab Share Link.
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
|
||||
@@ -13,23 +13,11 @@ if(DiscordVideosWebhookURL = ""){
|
||||
Msgbox, Unable to Grab DiscordVideosWebhookURL from %SettingsIniFilepath%.`nPlease input the URL and then try again.
|
||||
Return
|
||||
}
|
||||
|
||||
/*
|
||||
; If description is longer than 2k chars, then API will error out. goto section that will allow user to edit video description to shorten it for posting
|
||||
if(StrLen(SocialMediaDescription) > 2000 AND VideoDescriptionForVideosChannel = ""){
|
||||
Goto, CreateDescriptionForVideosPosting
|
||||
}
|
||||
|
||||
*/
|
||||
if(SocialMediaDescription = ""){
|
||||
CreateDescriptionForSocialMedia()
|
||||
}
|
||||
|
||||
|
||||
SubmitDescriptionForDiscordVideosChannel:
|
||||
Message := "**" . VideoTitle . "**" . "`n" . SocialMediaDescription . "`n"
|
||||
; https://stackoverflow.com/questions/63160401/how-to-create-hyperlink-in-discord-in-an-embed-in-general
|
||||
|
||||
|
||||
Message :=
|
||||
|
||||
if(BitChuteURL != "")
|
||||
Message .= "[BitChute](<" . BitChuteURL . ">) \| "
|
||||
|
||||
@@ -55,6 +43,20 @@ if(PodcastNumber != "")
|
||||
Message .= "[FDRPodcasts](<" . "https://fdrpodcasts.com/" . PodcastNumber . ">) \| "
|
||||
|
||||
|
||||
; StrLenOfDiscordMessage :=
|
||||
|
||||
; trim the video description if Title + Body + Links is longer than 2000 chars
|
||||
if((StrLen(VideoTitle) + StrLen(VideoDescription) + StrLen(Message)) > 2000){
|
||||
|
||||
DiscordAPICharsLeft := 2000 - StrLen(VideoTitle) - StrLen(Message) - 15
|
||||
|
||||
DiscordVideoDescription := SubStr(VideoDescription, 1, DiscordAPICharsLeft) . "..."
|
||||
}
|
||||
else,
|
||||
DiscordVideoDescription := VideoDescription
|
||||
|
||||
Message := "**" . VideoTitle . "**" . "`n" . Message . "`n" . DiscordVideoDescription
|
||||
|
||||
Status := UploadImageToDiscord(DiscordVideosWebhookURL, Message, VideoThumbFilepath)
|
||||
Message = API Response:`n%Status%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile")
|
||||
|
||||
@@ -24,7 +24,7 @@ try CurrentURL := driver.URL
|
||||
if(InStr(CurrentURL, "/login.php")){
|
||||
|
||||
if(AutoLogin){
|
||||
Message = Logging in Automatically by clicking into the UN+PW fields for info to register
|
||||
Message = Trying to Log in Automatically by clicking into the UN+PW fields for info to register from Password Manager
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
; have to click into username and password field for page to register that there's input
|
||||
@@ -39,11 +39,12 @@ if(InStr(CurrentURL, "/login.php")){
|
||||
js = document.querySelector("button[type='submit']").click();
|
||||
driver.executeScript(js)
|
||||
|
||||
|
||||
; Do a double check to make sure that login worked
|
||||
Message = Checking Login Status
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
sleep, 5000
|
||||
|
||||
try CurrentURL := driver.URL
|
||||
|
||||
if(!InStr(CurrentURL, "/upload")){
|
||||
@@ -67,11 +68,10 @@ if(InStr(CurrentURL, "/login.php")){
|
||||
sleep, 5000
|
||||
}
|
||||
|
||||
; CheckForAlerts()
|
||||
|
||||
Message = Uploading Video File
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
|
||||
Xpath = //input[@id='Filedata']
|
||||
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoFilepath)
|
||||
@@ -84,6 +84,9 @@ if(Status){
|
||||
}
|
||||
|
||||
|
||||
Message = Inputting Video Information
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
; Input Title
|
||||
try driver.findElementsByName("title").item[1].SendKeys(VideoTitle) ;selects element based on Name and sends variable to it.
|
||||
catch e {
|
||||
@@ -117,30 +120,22 @@ Loop, 5 { ; Attempt to input video description a couple of times
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
; sleep, 5000
|
||||
; Input Primary Category
|
||||
Xpath = (//input[@placeholder='- Primary category -'])[1]
|
||||
try, driver.FindElementByXPath(Xpath).SendKeys("Podcasts").SendKeys(driver.Keys.ENTER)
|
||||
|
||||
|
||||
Message = Selecting Channel
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
|
||||
|
||||
; try driver.findElementsByID("channelId").item[1].click()
|
||||
|
||||
; @todo replace with regex
|
||||
js = return document.querySelector("#channelId").innerHTML;
|
||||
try, ChannelIDNumber := driver.executeScript(js)
|
||||
; Msgbox % "ChannelIDNumber: " ChannelIDNumber
|
||||
ChannelIDNumber := StrSplit(ChannelIDNumber, "option value=")
|
||||
|
||||
; Msgbox % "ChannelIDNumber: " ChannelIDNumber
|
||||
|
||||
ChannelIDNumber := ChannelIDNumber[3]
|
||||
; Msgbox % "ChannelIDNumber: " ChannelIDNumber
|
||||
|
||||
SingleQuote = "
|
||||
ChannelIDNumber := StrSplit(ChannelIDNumber, "data-private")
|
||||
ChannelIDNumber := ChannelIDNumber[1]
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
[Video-Uploader]
|
||||
Version=3.37
|
||||
Version=3.39
|
||||
Name=Freedomain Video Uploader
|
||||
|
||||
Reference in New Issue
Block a user