added ability to automatically download latest chromium-testing and chromedriver and move them to their proper locations

pull/2/head
Yuriy 1 year ago
parent f66ada0635
commit e5998959cc

@ -20,7 +20,6 @@ Menu, Tray, Add, Pause, PauseScript
Menu, Tray, Add, Show Results, DisplayResults
Menu, Tray, Add, Open New Project, ReloadScript
; Menu, Tray, Add, Restart to Last Project Upload Results, ReloadToResults ; @todo fix this as it currently just loads the last project
Menu, Tray, Add, Restart with Last Project, RetryUpload
Menu, Tray, Default, Restart with Last Project
@ -32,7 +31,7 @@ global FullScriptName
ScriptName = Freedomain Video Uploader
ScriptVersion = 3.20
ScriptVersion = 3.21
FullScriptName := ScriptName . " - " . ScriptVersion
@ -47,6 +46,7 @@ UStartTime := A_TickCount ; start time
#Include %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\JSON.ahk
#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
;---ToDo---
@ -142,7 +142,6 @@ IniRead, ShowTooltipProgress, %SettingsIniFilepath%, General, ShowTooltipProgres
IniRead, XPosition, %SettingsIniFilepath%, General, XPosition
IniRead, YPosition, %SettingsIniFilepath%, General, YPosition
IniRead, RootDirToStartIn, %SettingsIniFilepath%, General, RootDirToStartIn
IniRead, LogErrorsToMsgbox, %SettingsIniFilepath%, General, LogErrorsToMsgbox, %A_Space%
IniRead, UpdateAvailable, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable, 0
@ -466,22 +465,11 @@ if(TestingMode){ ; save currently seelcted sites to ini file for next test
}
; @todo: DELETE
if(DevMode){
; IniWrite, 0, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
; UpdateAvailable := 0
; Menu, Tray, Add, Reload to Results, ReloadToResults
}
if(PassedParameter = "ShowResults"){
goto, DisplayResults
}
;---GUI Variables---
;------------------------------------------------
GuiHeight = 800
@ -595,25 +583,21 @@ Gui, Add, Edit, x%Marginspace% Y+5 w%EditBoxHalfWidths% h%EditBoxHeight% gUpdate
Gui, Add, Edit, yp+0 x+%Marginspace% w%EditBoxHalfWidths% h%EditBoxHeight% gUpdateVars vPodcastTags, %PodcastTags%
/*; Podcast Number & Tags
Gui, Font, Bold
Gui, Add, Text,x%MarginSpace% y+%Marginspace%,Podcast Number
Gui, Font, Normal
*/
; Video Description
Gui, Font, Bold
if(NoOriginalVideoDescription)
Gui, Add, Text,cRed y+%Marginspace% x%Marginspace%,Video Description
else,
Gui, Add, Text,y+%Marginspace% x%Marginspace%,Video Description:
if(TestingMode){
if(TestingMode)
Gui, Add, Text,cRed yp+0 xp+150 ,TESTING MODE
}
if(DevMode){
if(DevMode)
Gui, Add, Text,cRed yp+0 xp+150 ,DEV MODE
}
Gui, Font, Normal
Gui, Add, Edit,x%Marginspace% y+2 w%EditBoxWidths% h%VideoDescriptionEditBoxHeight% vVideoDescription gSubmitDescription,%VideoDescription%
gui, font, s8
@ -676,7 +660,7 @@ gui, Font, Bold
; Script Update Button
if(UpdateAvailable){
Gui, Add, Button, w%EditBoxHalfWidths% x%MarginSpace% gUpdateScript vUpdateAvailable h%SecondaryButtonHeights% center,Uploader Update Available
Gui, Add, Button, w%EditBoxHalfWidths% x%MarginSpace% gUpdateScript vUpdateAvailable h%SecondaryButtonHeights% center,Uploader Update Available!
; GuiButtonIcon(Icon, "shell32.dll", 278, "s20 a1 r2")
}
else, {
@ -694,7 +678,7 @@ Gui, Font, s%GuiFontSize%
; Chrome Update Button
if(ChromeUpdateAvailable){
Gui, Add, Button, x%MarginSpace% w%EditBoxHalfWidths% y+%Marginspace% h%SecondaryButtonHeights% vChromeUpdateAvailable gUpdateChrome center,Chrome Update Available
Gui, Add, Button, x%MarginSpace% w%EditBoxHalfWidths% y+%Marginspace% h%SecondaryButtonHeights% vChromeUpdateAvailable gUpdateChrome center,Chrome Update Available!
}
else, {
Gui, Add, Button, x%MarginSpace% w%EditBoxHalfWidths% y+%Marginspace% h%SecondaryButtonHeights% vChromeUpdateAvailable gUpdateChrome center,Chrome Up-to-Date
@ -736,28 +720,19 @@ Gui, Add, Button, x+5 y5 w50 h10 gOpenGiteaPage, Gitea
Gui, Font, s%GuiFontSize%
Gui, Font, Bold
; Gui, Add, Button, x%PageTwoXStartPos% yp+20 w%PageTwoGroupBoxWidth% h15 gCancelPost center,Chrome Update Available
; Settings Section
Gui, Add, GroupBox,r5 y+0 x%PageTwoXStartPos% w%PageTwoGroupBoxWidth%,Settings
; Gui, Add, Text, y%CheckboxesStartYPos% x+80, Miscellaneous Settings:
; Gui, Font, Normal
; Gui, Add, Checkbox, vIncludeDescriptionWhenPostingToVideos %IncludeDescriptionWhenPostingToVideos%, Include Description in #videos Posts
; Gui, Add, Checkbox, vReuseTabs Checked%ReuseTabsCheckStatus% gUpdateVars, Try to Re-Use Tabs
Gui, Add, Checkbox, xp+10 yp+20 vAutoUpdateCheck gUpdateVars Checked%AutoUpdateCheckCheckStatus%, Auto Update Check
Gui, Add, Checkbox, vShowTooltipProgress Checked%ShowTooltipProgressCheckStatus% gUpdateVars,Show Tooltip Progress
Gui, Add, Checkbox, vKillLBRYAfterUpload Checked%KillLBRYAfterUploadCheckStatus%, Kill LBRY After Uploading
Gui, Add, Checkbox, vAutoLogin gUpdateVars Checked%AutoLoginCheckStatus%, Try to Login Automatically
Gui, Add, Checkbox, vPingOnCompletion gUpdateVars Checked%PingOnCompletionCheckStatus%, Discord Ping Upon Completion
; Gui, Add, Checkbox, vAutoUploadErrorLog gUpdateVars Checked%AutoUploadErrorLog%, Auto-Upload Large Errors
GroupBoxCheckboxPos := PageTwoXStartPos + MarginSpace
; -------------------------------PLATFORMS-------------------------------
Gui, Add, GroupBox,r6 y+%MarginSpaceTripled% x%PageTwoXStartPos% w%PageTwoGroupBoxWidth%, Platforms
; Gui, Add, Text,y+25 x%PageTwoXStartPos%, ---Platforms----
; Gui, Font, Bold
; Msgbox % "LocalsURL: " LocalsURL
; if(VideoFileSizeInMB < 1792)
@ -829,10 +804,13 @@ if(AutoUpdateCheck AND !UpdateAvailable){
; UpdateAvailable :=
if(CheckForUpdates(GitReleasesAPIURL))
GuiControl,,UpdateAvailable, Uploader Update Available
GuiControl,,UpdateAvailable, Uploader Update Available!
if(CheckForChromeUpdates(ChromeFilepath)){
GuiControl,,ChromeUpdateAvailable, Chrome Update Available!
ChromeUpdateAvailable := 1
if(CheckForChromeUpdates(ChromeFilepath))
GuiControl,,ChromeUpdateAvailable, Chrome Update Available
}
}
@ -955,6 +933,25 @@ Return
UpdateChrome:
if(CheckForChromeUpdates = "")
Status := CheckForChromeUpdates(ChromeFilepath)
if(!status){
OnMessage(0x44, "OnMsgBoxConfirmChromiumOverwrite")
MsgBox 0x41, Already Up-to-Date, Yor current Chromium version is already up to date. `nDo you want to download and overwrite it?
OnMessage(0x44, "")
IfMsgBox OK, {
Return
} Else IfMsgBox Cancel, {
}
}
DownloadLatestChromium()
Return
; now defunt, safe to remove
@ -1005,16 +1002,13 @@ WinGetPos, XPosition, YPosition, , , A
IniWrite, %XPosition%, %SettingsIniFilepath%, General, XPosition
IniWrite, %YPosition%, %SettingsIniFilepath%, General, YPosition
; Msgbox % "XPosition: " XPosition
; Msgbox % "YPosition: " YPosition
Gui, Submit
Gui, Destroy
;---Save Testing Mode Info---
; Save Testing Mode Info
;------------------------------------------------
if(TestingMode){ ; save currently seelcted sites to ini file for next test
; IniWrite, %Streamanity%, %SettingsIniFilepath%, Testing, Streamanity
@ -1031,33 +1025,8 @@ if(TestingMode){ ; save currently seelcted sites to ini file for next test
IniWrite, %Facebook%, %SettingsIniFilepath%, Testing, Facebook
}
;---\Save Testing Mode Info---
; Save Video Info
;------------------------------------------------
; -------------------------------Save All Info .txt Files-------------------------------
/*; Msgbox % "NOOriginalVideoTitle: " NOOriginalVideoTitle
if(VideoTitleEmpty){
; msgbox, appending title.
FileAppend, %VideoTitle%, %VideoFolderDir%\title.txt
}
if(VideoDescriptionEmpty){
; msgbox, appending description
FileAppend, %VideoDescription%, %VideoFolderDir%\body.txt
}
if(VideoTagsEmpty){
; msgbox, appending vieo tags
FileAppend, %VideoTags%, %VideoFolderDir%\keywords.txt
}
if(PodcastTagsEmpty){
; msgbox, appending vieo tags
FileAppend, %VideoTags%, %VideoFolderDir%\keywords.txt
}
*/
; -------------------------------Save Video Info-------------------------------
; if changes made, delete the original file and save the new content to it
if(VideoTitle != OriginalVideoTitle){
@ -1109,8 +1078,6 @@ if(VideoFilepath = ""){
ExitApp
}
; -------------------------------/Save All Info .txt Files-------------------------------
; Format the LBRYURLSlug to be API Compatible
if(LBRYURLSlug = "") ; if slug spot is blank, then set it to video title
LBRYURLSlug := VideoTitle
@ -1412,7 +1379,7 @@ IniRead, SocialMediaPosterFilepath, %SettingsIniFilepath%, SocialMediaPoster, So
if(SocialMediaPosterFilepath = "" or !FileExist(SocialMediaPosterFilepath)){
OnMessage(0x44, "OnMsgBoxSocialMediaPoster")
MsgBox 0x21, No Filepath Found, Unable to find filepath for Social Media Poster`nWould you like to add it?
MsgBox 0x21, Filepath Not Found, Unable to find filepath for Social Media Poster`nWould you like to add it?
OnMessage(0x44, "")
IfMsgBox OK, {
@ -1420,20 +1387,16 @@ if(SocialMediaPosterFilepath = "" or !FileExist(SocialMediaPosterFilepath)){
if(ErrorLevel)
Return
; Msgbox % "SocialMediaPosterFilepath: " SocialMediaPosterFilepath
; if(!InStr(SocialMediaPosterFilepath, ".ahk") OR !InStr(SocialMediaPosterFilepath, ".exe"))
; Return
if(!InStr(SocialMediaPosterFilepath, ".exe"))
Return
} Else IfMsgBox Cancel, {
Return
}
; IniRead, SocialMediaPosterFilepath, %SettingsIniFilepath%, SocialMediaPoster, SocialMediaPosterFilepath, %A_Space%
IniWrite, SocialMediaPosterFilepath, %SettingsIniFilepath%, SocialMediaPoster, SocialMediaPosterFilepath
; Return
}
; msgbox %SocialMediaPosterFilepath%
run, %SocialMediaPosterFilepath% "%VideoLinksIniFile%"
Return
@ -1663,3 +1626,14 @@ Return
; Miscellaneous-Functions
;------------------------------------------------
#Include %A_ScriptDir%\Modules\Miscellaneous-Functions.ahk
OnMsgBoxConfirmChromiumOverwrite() {
DetectHiddenWindows, On
Process, Exist
If (WinExist("ahk_class #32770 ahk_pid " . ErrorLevel)) {
ControlSetText Button1, Cancel
ControlSetText Button2, Yes
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1 +1 @@
Subproject commit ca7145fa8258665bfb4ee6615467ee042e58fe34
Subproject commit 1962743565d49bd0ed3c36a67a05642483e28eff

@ -224,7 +224,6 @@ if(Status){
Message = Failed to Click "Finish" button
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
}
; try driver.FindElementByXPath(Xpath).click() ;Try to click on the "Finish" button
; Error Popup Location if something goes wrong.
Xpath = /html/body/div[2]/div

@ -6,7 +6,7 @@ SaveOrPostProgress(Message:="Starting Upload",PostType:="Tooltip,ErrorLoggingTex
IniRead, DailyMotionParnerUploadPage, %SettingsIniFilepath%, General, DailyMotionPostPageURL, %A_Space%
if(DailyMotionParnerUploadPage = ""){
Message = Please add your DailyMotion Upload URL to settings.ini file under:`n`n[General]`nDailyMotionParnerUploadPage=https://www.dailymotion.com/partner/[YOURIDNUMBER]/media/video/upload
Message = Please add your DailyMotion Upload URL to settings.ini file under:`n`n[General]`nDailyMotionPostPageURL=https://www.dailymotion.com/partner/[YOURIDNUMBER]/media/video/upload
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
Return
}

@ -22,7 +22,7 @@ Automated posting to the following media platform using either the Platform's AP
- Open Chrome and type in `about::version` into the URL bar. The very first line will tell you what Chrome version you have
- After downloading, extract “chromedriver_win32.zip” and move the extracted chromedriver.exe to: `C:\Program Files\SeleniumBasic\chromedriver.exe`
- NOTE: The chromedriver will need to be re-downloaded whenever Chrome updates to keep up with API changes
4. Install the [LBRY Desktop Application](https://lbry.com/)
4. Install the [LBRY Desktop Application Manually](https://lbry.com/ or through chocolatey `choco install -y lbry`)
- Once installed log into your account, and also add your LBRY Channel ID to the settings.ini file
5. [Download the latest .exe of the Uploader](https://git.freedomainplaylists.com/yuriy/Freedomain-Video-Uploader/releases)
- When run, the Uploader will automatically create the folders and files it requires in the same directory it's run from.

@ -0,0 +1,83 @@
; ENVIRONMENT
;------------------------------------------------
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
;#Warn ; Enable warnings to assist with detecting common errors.
;DetectHiddenWindows, On
#SingleInstance, Force
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
; Notes/Extra Info/#Includes
;------------------------------------------------
; #Include C:\Users\%A_Username%\Syncthing\Scripts\AutoHotKey\RadialMenu\My codes\My Global Variables.ahk
;Menu, Tray, Icon, %A_ICODir%\ICONAME
ChromeDriverTemporaryFilepath = %1%
; VARIABLES
;------------------------------------------------
; MAIN SCRIPT
;------------------------------------------------
StartScriptAsAdmin()
chromedriverfplocal = %A_ScriptDir%\chromedriver.exe
chromedriverfpProgramFiles = C:\Program Files\SeleniumBasic\chromedriver.exe
;
FileDelete, %chromedriverfpProgramFiles%
if(FileExist(chromedriverfpProgramFiles)){
msgbox, failed to delete old chromedriver from: C:\Program Files\SeleniumBasic\chromedriver.exe. Please run this program as admin or move the chromedriver manually.
ExitApp
}
msgbox, pause
FileCopy, %chromedriverfplocal%, %chromedriverfpProgramFiles%, 1 ; , Dest [, Flag (1 = overwrite)]
if(!FileExist(chromedriverfpProgramFiles)){
msgbox, failed to move chromedriver to C:\Program Files\SeleniumBasic\chromedriver.exe. Please run this program as admin or move the chromedriver manually.
ExitApp
}
msgbox, Chromedriver copied successfully. `nPlease run the TestSeleniumPortable script
; Functions
;------------------------------------------------
StartScriptAsAdmin(){
full_command_line := DllCall("GetCommandLine", "str")
if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)")) {
try {
if A_IsCompiled
Run *RunAs "%A_ScriptFullPath%" /restart
else
Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
}
ExitApp
}
if(!A_IsAdmin){
Msgbox, failed to get admin to move chromedriver to program files
Return
}
}
; Misc
;------------------------------------------------
; Escape::ExitApp
Loading…
Cancel
Save