added auto update checks option and functionality

main 1.21
Yuriy 7 months ago
parent a008541c7c
commit 44b343a0a7

@ -0,0 +1,84 @@
;---ENVIRONMENT---------------------------------------------------------------------
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
;#Warn ; Enable warnings to assist with detecting common errors.
;DetectHiddenWindows, On
#SingleInstance, Force
DetectHiddenWindows, ON
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
;SetKeyDelay, 500
CoordMode, ToolTip, Screen
CoordMode, Mouse, Screen
; #NoTrayIcon
; Menu, Tray, Icon, RMScriptManager.ico
;---Notes/Extra Info/#Includes------------------------------------------------------
;---VARIABLES-----------------------------------------------------------------------
ScriptName = Freedomain Livestream Scheduler
AHKFilepath = %A_ScriptDir%\%ScriptName%.ahk
Exefilepath = %A_ScriptDir%\%ScriptName%.exe
icopath = %A_ScriptDir%\Assets\Icon.ico
VersionIniFP = %A_ScriptDir%\Version.ini
;---MAIN SCRIPT---------------------------------------------------------------------
; Bump the version number in the version.ini file
IniRead, VersionNumber, %VersionIniFP%, %ScriptName%, Version, 0.0 ; , Filename, Section, Key [, Default]
VersionNumber += .01
VersionNumber := SubStr(VersionNumber, 1, 4)
IniWrite, %VersionNumber%, %VersionIniFP%,%ScriptName%, Version
; Kill any active intances of the uploaders so the .exe file can be overwriten by the compilation
process, close, %ScriptName%.exe
sleep, 1000
; Delete the .exe file so it can be repalced
if(FileExist(Exefilepath)){
FileDelete, %Exefilepath%
if(ErrorLevel){
msgbox, failed to delete Exe file. Please delete manually and re-run the compiler.
ExitApp
}
}
if(!FileExist(AHKFilepath)){
msgbox, %AHKFilepath% does not exist`nExiting
ExitApp
}
if(!FileExist(icopath)){
msgbox, %icopath% does not exist`nExiting
ExitApp
}
run, %comspec% /c ""C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe" /in "%AHKFilepath%" /out "%exefilepath%" /icon "%icopath%""
; OldNotify(ScriptToCompile,"Compiled Successfully",5)
; sleep, 5000
ExitApp
;---FUNCTIONS-----------------------------------------------------------------------

@ -27,11 +27,11 @@ VersionIniFP = %A_ScriptDir%\Version.ini
;---MAIN SCRIPT--------------------------------------------------------------------- ;---MAIN SCRIPT---------------------------------------------------------------------
; Bump the version number in the version.ini file ; Bump the version number in the version.ini file
IniRead, VersionNumber, %VersionIniFP%, %ScriptName%, Version, 0.0 ; , Filename, Section, Key [, Default] IniRead, VersionNumber, %VersionIniFP%, Livestream-Scheduler, Version, 0.0 ; , Filename, Section, Key [, Default]
VersionNumber += .01 VersionNumber += .01
VersionNumber := SubStr(VersionNumber, 1, 4) VersionNumber := SubStr(VersionNumber, 1, 4)
IniWrite, %VersionNumber%, %VersionIniFP%,%ScriptName%, Version IniWrite, %VersionNumber%, %VersionIniFP%,Livestream-Scheduler, Version

@ -105,12 +105,15 @@ FileInstall, Version.ini, %A_ScriptDir%\Lib\Version.ini, 1
IniRead, ScriptVersion, %A_ScriptDir%\Lib\Version.ini,%ScriptSettingsSection%, Version, 0.0 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 ScriptName := "Freedomain Livestream Scheduler"
global ScriptAbbreviatedName := "FLS" ; used for error logging global ScriptAbbreviatedName := "FLS" ; used for error logging
FullScriptName := ScriptName . " - " . ScriptVersion FullScriptName := ScriptName . " - " . ScriptVersion
; Msgbox % "FullScriptName: " FullScriptName
global GitReleasesAPIURL
GitReleasesAPIURL = https://freedomain.dev/api/v1/repos/yuriy/livestream-scheduler/releases
; Read Info From Files ; Read Info From Files
@ -145,13 +148,15 @@ LivestreamThumbnail := ThumbnailJPGFilepath
if(FileExist(ThumbnailJPEGFilepath)) if(FileExist(ThumbnailJPEGFilepath))
LivestreamThumbnail := ThumbnailJPEGFilepath LivestreamThumbnail := ThumbnailJPEGFilepath
} }
; Read settings.ini
; ------------------------------------------------
IniRead, ConfirmBeforeSubmit, %SettingsIniFilepath%, %ScriptSettingsSection%, ConfirmBeforeSubmit, 1
IniRead, AutoUpdateCheck, %SettingsIniFilepath%, %ScriptSettingsSection%, AutoUpdateCheck, 1
@ -227,11 +232,18 @@ Gui, Add, Picture, x%MarginSize% w%ThumbnailPreviewWidth% h-1 vThumbnailPreview,
; ------------------------------------------------ ; ------------------------------------------------
Gui, Font, s%GuiFontSize% Gui, Font, s%GuiFontSize%
Gui, Font, Bold Gui, Font, Bold
; Gui, Add, Text, , Settings
Gui, Add, Text,y0 x%ColumnTwoXPosition%, Settings Gui, Add, Text,y0 x%ColumnTwoXPosition%, Settings
Gui, Font, Normal Gui, Font, Normal
Gui, Font, s8 Gui, Font, s8
Gui, Add, Checkbox, vConfirmBeforeSubmit checked, Confirm Before Submit Gui, Add, Checkbox, vConfirmBeforeSubmit checked%ConfirmBeforeSubmit%, Confirm Before Submit
Gui, Add, Checkbox, vAutoUpdateCheck Checked%AutoUpdateCheck%, Auto Update Check
if(UpdateAvailable){
Gui, Add, Button, cRed w%ColumnTwoEditBoxWidth% gUpdateScript vUpdateAvailable center, Update Available!
}
else, {
Gui, Add, Button, w%ColumnTwoEditBoxWidth% gUpdateScript vUpdateAvailable center, No Updates Available
}
Gui, Font, s%GuiFontSize% Gui, Font, s%GuiFontSize%
@ -256,20 +268,32 @@ Gui, Font, Normal
; Gui, Add, Checkbox,, Dlive ; Gui, Add, Checkbox,, Dlive
Gui, Add, Checkbox, vOdysee, Odysee Gui, Add, Checkbox,checked vOdysee, Odysee
Gui, Add, Checkbox, vLocals, Locals Gui, Add, Checkbox,checked vLocals, Locals
Gui, Add, Checkbox,checked vRumble, Rumble Gui, Add, Checkbox,checked vRumble, Rumble
Gui, Font, Bold Gui, Font, Bold
Gui, Add, Button,gSchedulePost w%ColumnTwoEditBoxWidth% gSaveAsTemplate y+50, Save as Template
Gui, Font, S10
Gui, Add, Button,gSchedulePost w%ColumnTwoEditBoxWidth% gSaveAsTemplate y+%marginsize%, Save as Template
Gui, Add, Button,gSchedulePost w%ColumnTwoEditBoxWidth% gLoadTemplate, Load Template Gui, Add, Button,gSchedulePost w%ColumnTwoEditBoxWidth% gLoadTemplate, Load Template
Gui, Font, s15 Gui, Font, s15
Gui, Add, Button,gSchedulePost w%ColumnTwoEditBoxWidth% h40, Schedule Gui, Add, Button,gSchedulePost w%ColumnTwoEditBoxWidth% h40, Schedule
Gui, Font, Normal Gui, Font, Normal
Gui, Show, h%GuiHeight% Gui, Show, h%GuiHeight%, %FullScriptName%
;---Check for Updates---
;------------------------------------------------
if(AutoUpdateCheck AND !UpdateAvailable){
SetTimer, CheckForUpdates, -1000
}
Return Return
@ -350,6 +374,11 @@ SchedulePost:
Gui, submit, NoHide Gui, submit, NoHide
; Save Settings.ini
; ------------------------------------------------
IniWrite, %ConfirmBeforeSubmit%, %SettingsIniFilepath%, %ScriptSettingsSection%, ConfirmBeforeSubmit
IniWrite, %AutoUpdateCheck%, %SettingsIniFilepath%, %ScriptSettingsSection%, AutoUpdateCheck
; Re-use an existing errorlog or create new directory ; Re-use an existing errorlog or create new directory
if(InStr(PassedInArgument, "\ErrorLogging\")) if(InStr(PassedInArgument, "\ErrorLogging\"))
@ -506,6 +535,7 @@ Return
#Include %A_ScriptDir%\Modules\Odysee-Schedule.ahk #Include %A_ScriptDir%\Modules\Odysee-Schedule.ahk
#Include %A_ScriptDir%\Modules\Odysee-Grab-URL.ahk #Include %A_ScriptDir%\Modules\Odysee-Grab-URL.ahk
#Include %A_ScriptDir%\Modules\Rumble-Schedule.ahk #Include %A_ScriptDir%\Modules\Rumble-Schedule.ahk
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Update-Functions.ahk
; Misc ; Misc

@ -1 +1 @@
Subproject commit 124a26c3b03e5f1292691909c20a116f64957955 Subproject commit 0e02ae24bd4d909df30a58ba61693cef321fcaaa

@ -174,6 +174,29 @@ if(Status){
; Select each Secondary Platform checkbox ; Select each Secondary Platform checkbox
; ------------------------------------------------ ; ------------------------------------------------
IniRead, RumbleSecondaryPlatformsList, %SettingsIniFilepath%, %ScriptSettingsSection%, RumbleSecondaryPlatforms, %A_Space%
if(RumbleSecondaryPlatformsList = ""){
; if variable is empty, get all items in the list and write them to .ini file
Loop, 10 {
IndexPlusOne := A_index + 1
Xpath = (//div[@class='flex shrink-0 items-center gap-x-4'])[%A_index%]
XpathCheckbox = (//div[@class='relative shrink-0'])[%IndexPlusOne%]
try SecondaryPlatformCheckboxName := driver.findelementbyxpath(Xpath).Attribute("innerText") ;XPATH Inner Text
RumbleSecondaryPlatformsList .= SecondaryPlatformCheckboxName . "--"
if(SecondaryPlatformCheckboxName = "Add new destination" OR SecondaryPlatformCheckboxName = ""){
Break
}
}
IniWrite, %RumbleSecondaryPlatformsList%, %SettingsIniFilepath%, %ScriptSettingsSection%, RumbleSecondaryPlatformsList
MsgBox 0x40, Rumble Secondary Platforms List Generated, Rumble Secondary Platforms List was genearted and all the available options were added to it.`n`nPlease edit the settings.ini file and remove any platforms you do not need selected from the follwoing KEY:`n`n[%ScriptSettingsSection%]`nRumbleSecondaryPlatformsList=
}
Loop, 10 { Loop, 10 {
IndexPlusOne := A_index + 1 IndexPlusOne := A_index + 1
@ -187,6 +210,9 @@ Loop, 10 {
Break Break
} }
if(!InStr(RumbleSecondaryPlatformsList,SecondaryPlatformCheckboxName))
Continue
Status := Selenium_LoopToClickXpath(Xpath:=XpathCheckbox,NumOfLoops:=2,SleepLength:=1000) Status := Selenium_LoopToClickXpath(Xpath:=XpathCheckbox,NumOfLoops:=2,SleepLength:=1000)
if(Status){ if(Status){
Message = Failed to check off the checkbox for: %SecondaryPlatformCheckboxName% Message = Failed to check off the checkbox for: %SecondaryPlatformCheckboxName%
@ -261,11 +287,6 @@ Loop, 5 {
} }
Xpath = (//h2[@class='video-title'])[1] Xpath = (//h2[@class='video-title'])[1]
RumbleURLSlug := GetHTMLValueFromXpathOuterHTML(XPATH, "href") RumbleURLSlug := GetHTMLValueFromXpathOuterHTML(XPATH, "href")

Binary file not shown.
Loading…
Cancel
Save