GUI rework, feature expansions

main 1.0
Yuriy 5 months ago
parent 1b6c9939e5
commit f807b99ecc

@ -12,8 +12,27 @@ CoordMode, ToolTip, Screen
CoordMode, Mouse, Screen
;#NoTrayIcon
; Customize the Toolbar Icon Menu
; ------------------------------------------------
Menu, tray, NoStandard
Menu, Tray, Add, Exit, KillScript
Menu, Tray, Add, Pause, PauseScript
; Menu, Tray, Add, Show Results, DisplayResults
Menu, Tray, Add, Schedule New Livestream, ReloadScript
Menu, Tray, Add, Restart with Last Item, RetryUpload
Menu, Tray, Default, Restart with Last Item
; Notes/Extra Info/#Includes
;------------------------------------------------
PassedInArgument = %1%
; Check if Update was just installed and delete the old .exe if so
CheckIfUpdateInstalled(PassedInArgument)
; Included Files and Libraries
; ------------------------------------------------
@ -29,7 +48,7 @@ CoordMode, Mouse, Screen
#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
#Include %A_ScriptDir%\Modules\Miscellaneous-Functions.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Miscellaneous-Functions.ahk
@ -43,14 +62,9 @@ CoordMode, Mouse, Screen
global ScriptNameav
global ScriptVersion
global FullScriptName
global LBRYResolveAPICommand
global LBRYPermanentURL
global VideoTitle
global VideoFilepath
global VideoThumbFilepath
global VideoTags
global VideoDescription
global SocialMediaDescription
global PostStatusesFilepath
global ErrorLoggingDirectory
global DiscordErrorLoggingWebhookBotURL
global DiscordVideosWebhookURL
global VideoFolderDir
@ -88,37 +102,162 @@ ScriptSettingsSection := "Livestream-Scheduler"
FileInstall, Version.ini, %A_ScriptDir%\Lib\Version.ini, 1
IniRead, ScriptVersion, %A_ScriptDir%\Lib\Version.ini,%ScriptSettingsSection%, Version, 0.0
IniRead, ScriptName, %A_ScriptDir%\Lib\Version.ini,%ScriptSettingsSection%, Name, %ScriptSettingsSection%
; IniRead, ScriptName, %A_ScriptDir%\Lib\Version.ini,%ScriptSettingsSection%, Name, %ScriptSettingsSection%
global ScriptName := "Livestream Scheduler"
global ScriptAbbreviatedName := "FLS" ; used for error logging
FullScriptName := ScriptName . " - " . ScriptVersion
; Read Info From Files
; ------------------------------------------------
; For Templates and re-trying a failed previous run
if(StrLen(PassedInArgument) > 5 and !InStr(PassedInArgument, ".exe")){
/*FileAppend, %LivestreamTitle%, %PostTitleFilePath% ; save post content to txt file
FileAppend, %LivestreamDescription%, %PostBodyFilePath% ; save post content to txt file
FileAppend, %LivestreamTags%, %PostTagsFilePath% ; save post content to txt file
if(LivestreamThumbnail){ ; copy thumbnail into folder
SplitPath, LivestreamThumbnail, OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive
FileCopy, %LivestreamThumbnail%, %ErrorLoggingDirectory%\Thumbnail.%OutExtension%
}
*/
TemplateDirectory := PassedInArgument
FileRead, LivestreamTitle, %TemplateDirectory%\PostTitle.txt
FileRead, LivestreamDescription, %TemplateDirectory%\PostBody.txt
FileRead, LivestreamTags, %TemplateDirectory%\PostTags.txt
ThumbnailPNGFilepath = %TemplateDirectory%\Thumbnail.png
ThumbnailJPGFilepath = %TemplateDirectory%\Thumbnail.jpg
ThumbnailJPEGFilepath = %TemplateDirectory%\Thumbnail.jpg
if(FileExist(ThumbnailPNGFilepath))
LivestreamThumbnail := ThumbnailPNGFilepath
if(FileExist(ThumbnailJPGFilepath))
LivestreamThumbnail := ThumbnailJPGFilepath
if(FileExist(ThumbnailJPEGFilepath))
LivestreamThumbnail := ThumbnailJPEGFilepath
}
; GUI Variables
; ------------------------------------------------
GUIEditBoxWidths := 600
MarginSize := 10
MarginSizeDoubled := MarginSize * 2
ButtonHeights := 30
ThumbnailPreviewWidth := 200
; MAIN SCRIPT
GuiHeight := 450
; Column One
ColumnOneWidth := 400
ColumnOneEditBoxWidth := ColumnOneWidth - (MarginSize * 2)
GuiFontSize = 10
; Column Two
ColumnTwoXPosition := ColumnOneWidth + (MarginSize * 2)
ColumnTwoEditBoxWidth := 200
; Results Screen
ResultButtonWidth := 150
ResultButtonEditWidth := 250
ResultButtonHeights := 30
; START OF GUI
; ------------------------------------------------
Gui, Font, s%GuiFontSize%
; Column One
;------------------------------------------------
Gui, Font, S15
Gui, Font, Bold
Gui, Add, Text,, Title
Gui, Add, Edit,w%GUIEditBoxWidths% vLivestreamTitle, We are going to have a livestream!
Gui, Font, Normal
Gui, Add, Edit,w%ColumnOneEditBoxWidth% vLivestreamTitle, %LivestreamTitle%
Gui, Font, Bold
Gui, Add, Text,, Description
Gui, Add, Edit,w%GUIEditBoxWidths% h200 vLivestreamDescription, This livestream is happening soon!
Gui, Font, Normal
Gui, Add, Edit,w%ColumnOneEditBoxWidth% h150 vLivestreamDescription, %LivestreamDescription%
Gui, Font, Bold
Gui, Add, Text,, Tags
Gui, Font, Normal
Gui, Add, Edit,w%ColumnOneEditBoxWidth% vLivestreamTags, %LivestreamTags%
Gui, Add, Text,, Date and Time of Livestream
Gui, Add, DateTime, vLivestreamDate, MM/dd/yyyy
Gui, Add, DateTime, vLivestreamTime, HH:mm
Gui, Add, Text,, Websites
Gui, Add, Checkbox,, Dlive
Gui, Add, Checkbox,, Locals
Gui, Add, Checkbox,, Odysee
Gui, Add, Button,gSchedulePost, Schedule
Gui, Font, Bold
Gui, Add, Text,, Thumbnail
Gui, Font, Normal
Gui, Add, Button, x+%MarginSize% yp-3 gSelectThumbnail, Select
Gui, Add, Picture, x%MarginSize% w%ThumbnailPreviewWidth% h-1 vThumbnailPreview, %LivestreamThumbnail%
Gui, Show
; Gui, Add, Edit,w%ColumnOneEditBoxWidth% h150 vLivestreamDescription, This livestream is happening soon!
; Column Two
; ------------------------------------------------
Gui, Font, s%GuiFontSize%
Gui, Font, Bold
; Gui, Add, Text, , Settings
Gui, Add, Text,y0 x%ColumnTwoXPosition%, Settings
Gui, Font, Normal
Gui, Add, Checkbox, vConfirmBeforeSubmit checked, Confirm Before Submit
Gui, Font, s%GuiFontSize%
Gui, Font, Bold
; Gui, Add, Text, , Settings
Gui, Add, Text, y+%MarginSizeDoubled%, Date and Time of Livestream
Gui, Font, Normal
Gui, Add, DateTime, vLivestreamDate w%ColumnTwoEditBoxWidth%, MM/dd/yyyy
Gui, Add, DateTime, vLivestreamTime w%ColumnTwoEditBoxWidth%, HH:mm
Gui, Font, Bold
Gui, Add, Text,y+%MarginSizeDoubled%, Platform to Schedule On
Gui, Font, Normal
; Gui, Add, Checkbox,, Dlive
Gui, Add, Checkbox, checked vLocals, Locals
; Gui, Add, Checkbox,checked vOdysee, Odysee
Gui, Font, Bold
Gui, Add, Button,gSchedulePost w%ColumnTwoEditBoxWidth% y+100 gSaveAsTemplate, Save as Template
Gui, Add, Button,gSchedulePost w%ColumnTwoEditBoxWidth% gLoadTemplate, Load Template
Gui, Font, s15
Gui, Add, Button,gSchedulePost w%ColumnTwoEditBoxWidth% h40 y+50, Schedule
Gui, Font, Normal
Gui, Show, h%GuiHeight%
Return
@ -130,27 +269,159 @@ Return
; Functions
;------------------------------------------------
SaveAsTemplate:
Gui, submit, NoHide ; Update variables for all modified fields
TemplateDirectory = %A_ScriptDir%\Lib\Templates
if(!FileExist(TemplateDirectory)){
FileCreateDir, %TemplateDirectory%
}
InputBox, TemplateName, Input Name, Please Input Name for the Template:
if(ErrorLevel)
Return
TemplateDirectory = %A_ScriptDir%\Lib\Templates\%TemplateName%
ErrorLoggingDirectory := TemplateDirectory
; FileCreateDir, %TemplateDirectory%
CreateErrorLoggingFiles(ErrorLoggingDirectory)
; Save all the post settings to the Error Logging Directory
FileAppend, %LivestreamTitle%, %PostTitleFilePath% ; save post content to txt file
FileAppend, %LivestreamDescription%, %PostBodyFilePath% ; save post content to txt file
FileAppend, %LivestreamTags%, %PostTagsFilePath% ; save post content to txt file
if(LivestreamThumbnail){ ; copy thumbnail into folder
SplitPath, LivestreamThumbnail, OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive
FileCopy, %LivestreamThumbnail%, %ErrorLoggingDirectory%\Thumbnail.%OutExtension%
}
Return
LoadTemplate:
Message = Loading Template
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,DiscordErrorLogging")
ErrorLoggingDirectory = %A_ScriptDir%\Lib\Templates\
FileSelectFolder, ErrorLoggingDirectory, %ErrorLoggingDirectory%
if(ErrorLevel){
Tooltip
Return
}
RetryUpload:
run, "%A_ScriptFullPath%" "%ErrorLoggingDirectory%"
ExitApp
SelectThumbnail:
FileSelectFile, LivestreamThumbnail,
GuiControl, , ThumbnailPreview, *w%ThumbnailPreviewWidth% *h-1 %LivestreamThumbnail%
Return
SchedulePost:
Gui, submit, NoHide
; Re-use an existing errorlog or create new directory
if(InStr(PassedInArgument, "\ErrorLogging\"))
CreateErrorLoggingFiles(PassedInArgument)
else, {
CreateErrorLoggingFiles()
; Save all the post settings to the Error Logging Directory
FileAppend, %LivestreamTitle%, %PostTitleFilePath% ; save post content to txt file
FileAppend, %LivestreamDescription%, %PostBodyFilePath% ; save post content to txt file
FileAppend, %LivestreamTags%, %PostTagsFilePath% ; save post content to txt file
if(LivestreamThumbnail){ ; copy thumbnail into folder
SplitPath, LivestreamThumbnail, OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive
FileCopy, %LivestreamThumbnail%, %ErrorLoggingDirectory%\Thumbnail.%OutExtension%
}
}
; #Include %A_ScriptDir%\Modules\Rumble-Schedule.ahk
#Include %A_ScriptDir%\Modules\Locals-Schedule.ahk
if(Odysee){
Gosub, OdyseeSchedule
}
if(Locals){
Gosub, LocalsSchedule
}
; msgbox, done!
; Gui, Add,
Gui, Destroy
msgbox, done!
; Results Screen
; ------------------------------------------------
IniRead, LocalsRTMPURL, %PostStatusesFilepath%, Livestream,LocalsRTMPURL, %A_Space%
IniRead, LocalsRTMPKey, %PostStatusesFilepath%, Livestream,LocalsRTMPKey, %A_Space%
; IniRead, OutputVar, Filename, Section, Key [, Default]
Gui, Font, Bold
Gui, Font, s%GuiFontSize%
Gui, Add, Button, x10 y+10 h%ResultButtonHeights% w%ResultButtonWidth%, Locals RTMP Key
Gui, Add, Edit, x+5 yp+0 h%ResultButtonHeights% w%ResultButtonEditWidth% vLocalsRTMPKey center, %LocalsRTMPKey%
Gui, Add, Button, x10 y+10 h%ResultButtonHeights% w%ResultButtonWidth%, Locals RTMP URL
Gui, Add, Edit, x+5 yp+0 h%ResultButtonHeights% w%ResultButtonEditWidth% vLocalsRTMPURL center, %LocalsRTMPURL%
Gui, Add, Button, gRetryUpload,Try Failed Again
Gui, Show
Return
; GoSubs
; ------------------------------------------------
KillScript:
ExitApp
ReloadScript:
Reload
PauseScript:
Pause
Return
#Include %A_ScriptDir%\Modules\Locals-Schedule.ahk
#Include %A_ScriptDir%\Modules\Odysee-Schedule.ahk
; Misc
;------------------------------------------------

@ -1 +1 @@
Subproject commit 5671242faff9800cf19672c738f6adf58b9af06b
Subproject commit b8ffb10db187c70219c594ddfe7cdebc6885d552

@ -1,7 +1,9 @@
LocalsSchedule:
;------------------------------------------------
CurrentSite := "Locals"
SaveOrPostProgress(Message:="Scheduling Post in Locals",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
SaveOrPostProgress(Message:="Scheduling Post",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
IniRead, LocalsPostPageURL, %SettingsIniFilepath%, General, LocalsPostPageURL, %A_Space%
if(LocalsPostPageURL = ""){
@ -21,7 +23,6 @@ Status := NavigateFromBaseURLTo(LocalsPostPageURL)
if(Status)
Return
try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
CheckForAlerts()
@ -89,6 +90,10 @@ try, driver.FindElementByXPath(Xpath).SendKeys(driver.Keys.BackSpace).SendKeys(d
Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=LocalsLivestreamTime)
if(ConfirmBeforeSubmit)
msgbox, Please check that all data was input correctly and then click OK to Finalize Schedule and grab RTMP Settings
; click schedule button
Xpath = //span[normalize-space()='Schedule']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
@ -118,13 +123,26 @@ Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000
if(Status){
Message = Failed to switch Livestream to RTMP mode
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
Message = Waiting 5 seconds for Page to catch up
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
sleep, 5000
; Open Stream Settings Popup Window
Xpath = //button[normalize-space()='Stream Settings']
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000)
Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=5,SleepLength:=1000)
if(Status){
Message = Failed grab RTMP Settings. Unable to click the Stream Settings button.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
Message = Waiting 5 seconds for Page to catch up
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
sleep, 5000
; Get RTMP Values from the popup
@ -137,27 +155,14 @@ try, LocalsRTMPKey := driver.findelementbyxpath(Xpath).Attribute("value")
Xpath = //div[@class='modal-wrapper modal-wrapper_stream']//div[5]
; Try ElementOuterHTML := driver.findelementbyxpath(Xpath).Attribute("outerHTML") ;XPATH-ID & Tag
; Pull Out the RTMPKey from the OuterHTML using RegEx
RTMPKey := GetHTMLValueFromXpathOuterHTML(XPATH, "value")
Msgbox % "RTMPKey: " RTMPKey
/*
regexMatch := RegExMatch(ElementOuterHTML, "value=""([^""]+)""", match)
if (regexMatch)
{
LocalsRTMPKey := match1
}
else {
Message = Failed to Pull out RTMPKey from OuterHTML of RTMPKey Element
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
}
*/
LocalsRTMPKey := GetHTMLValueFromXpathOuterHTML(XPATH, "value")
; Msgbox % "LocalsRTMPURL: " LocalsRTMPURL
; Msgbox % "LocalsRTMPKey: " LocalsRTMPKey
ToolTip
; Msgbox % "PostStatusesFilepath: " PostStatusesFilepath
IniWrite, %LocalsRTMPURL%, %PostStatusesFilepath%, Livestream,LocalsRTMPURL
IniWrite, %LocalsRTMPKey%, %PostStatusesFilepath%, Livestream,LocalsRTMPKey
Return

@ -0,0 +1,33 @@
OdyseeSchedule:
;------------------------------------------------
CurrentSite := "Odysee"
SaveOrPostProgress(Message:="Scheduling Post",PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
Status := NavigateFromBaseURLTo("https://odysee.com/$/livestream")
if(Status)
Return
try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
CheckForAlerts()
; Check Login Status
Try, PageURL := driver.Url
if(InStr(PageURL, "/signup")){
Message = Website is logged out. Please log back in.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}
Return
Loading…
Cancel
Save