2023-02-12 17:34:03 -05:00
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
#SingleInstance , Force
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
CoordMode , ToolTip , Screen
CoordMode , Mouse , Screen
FileEncoding , UTF - 8 - RAW ; Needed for special symbols that are used in video descritions
2024-06-08 18:26:22 -04:00
DetectHiddenWindows , ON ; used for finding Running .ahk scripts
2024-01-16 06:35:42 -05:00
; Only Set tool tray icon if this is the source .ahk script.
; The .exe has the icon compiled into it
2023-02-12 17:34:03 -05:00
if ( InStr ( A_ScriptFullPath , " .ahk " ) ) {
try Menu , Tray , Icon , %A_ScriptDir% \Assets \FreedomainVideo . ico
}
2024-01-16 06:35:42 -05:00
; Parameter passed in to script
; ------------------------------------------------
2024-05-21 21:25:31 -04:00
PassedInArgument1_Filepath = % 1 % ; Filepath of one of the files in the directory of the video project
PassedInArgument2_Action = % 2 % ; "Scheduled", "ShowResults", "Delete"
PassedInArgument3_Details = % 3 % ; Details of Argument2, eg list of Sites to Upload to
; Msgbox % "PassedInArgument1_Filepath: " PassedInArgument1_Filepath
; Msgbox % "PassedInArgument2: " PassedInArgument2
; Msgbox % "PassedInArgument3: " PassedInArgument3
2023-02-12 17:34:03 -05:00
2024-01-16 06:35:42 -05:00
; Customize the Toolbar Icon Menu
; ------------------------------------------------
2023-02-12 17:34:03 -05:00
Menu , tray , NoStandard
Menu , Tray , Add , Exit , KillScript
Menu , Tray , Add , Pause , PauseScript
2023-09-17 13:27:36 -04:00
Menu , Tray , Add , Show Results , DisplayResults
2023-02-12 17:34:03 -05:00
Menu , Tray , Add , Open New Project , ReloadScript
Menu , Tray , Add , Restart with Last Project , RetryUpload
Menu , Tray , Default , Restart with Last Project
2024-01-16 06:35:42 -05:00
; Track how long sections of code take to run
2023-09-16 23:32:37 -04:00
UStartTime := A_TickCount ; start time
2023-04-03 00:04:18 -04:00
2024-01-16 06:35:42 -05:00
; Included FIles and Libraries
; ------------------------------------------------
; These have to be included at the top for the Global variables to get registered early
2023-07-28 10:56:46 -04:00
#Include %A_ScriptDir% \Lib \Freedomain - Posters - Shared - Functions \General - Functions . ahk
#Include %A_ScriptDir% \Lib \Freedomain - Posters - Shared - Functions \Selenium - Functions . ahk
#Include %A_ScriptDir% \Lib \Freedomain - Posters - Shared - Functions \Chrome - Functions . ahk
#Include %A_ScriptDir% \Lib \Freedomain - Posters - Shared - Functions \Gitea - Functions . ahk
#Include %A_ScriptDir% \Lib \Freedomain - Posters - Shared - Functions \API - Functions . ahk
#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
2023-09-20 20:45:57 -04:00
#include %A_ScriptDir% \Lib \Freedomain - Posters - Shared - Functions \Zip . ahk
2023-10-22 00:06:55 -04:00
#include %A_ScriptDir% \Lib \Freedomain - Posters - Shared - Functions \URLDownloadToVar . ahk
2024-05-09 15:33:22 -04:00
#Include %A_ScriptDir% \Lib \Freedomain - Posters - Shared - Functions \Miscellaneous - Functions . ahk ; Misc functions for video uploading specifically
#Include %A_ScriptDir% \Lib \Freedomain - Posters - Shared - Functions \LBRY - Functions . ahk ; LBRY Specific Functions
2023-04-03 00:04:18 -04:00
2023-12-19 15:48:33 -05:00
2023-02-12 17:34:03 -05:00
;---Global Variables---
;------------------------------------------------
2024-05-21 21:25:31 -04:00
2023-02-12 17:34:03 -05:00
global LBRYResolveAPICommand
global LBRYPermanentURL
global VideoTitle
global VideoFilepath
global VideoThumbFilepath
global VideoTags
global VideoDescription
global DiscordErrorLoggingWebhookBotURL
global DiscordVideosWebhookURL
global VideoFolderDir
global LogErrorsToMsgbox
; global LogErrorsToTextFile
global CurrentSite
global Driver
global DriverStatus
global ChromeProfile
global ShowTooltipProgress
global ErrorLogSummary
global DiscordParlerWebhookURL
global ErrorLoggingFilePath
2023-02-17 00:29:41 -05:00
; global TotalTabLoops
2023-02-12 17:34:03 -05:00
global ErrorLogVar
2023-02-18 13:12:18 -05:00
ErrorLogVar :=
2023-02-12 17:34:03 -05:00
global DevMode
global LBRYNetFilepath
LBRYNetFilepath := " C:\Program Files\LBRY\resources\static\daemon\lbrynet.exe "
global Number_of_loops_to_Check_Upload_status
Number_of_loops_to_Check_Upload_status = 720
; 720 loops, at 5 seonds each = 3600 seconds (60 mins)
; number of seconds to wait between loops when checking video upload status
global Time_Between_Loops_Upload_Status
2023-09-20 23:18:26 -04:00
Time_Between_Loops_Upload_Status = 15000 ;
2023-02-12 17:34:03 -05:00
; loop Index number to check if video is stuck uploading
global Array_Index_Num_of_Upload_StatusChecks
Array_Index_Num_of_Upload_StatusChecks := [ 144 , 288 , 432 , 576 , 720 , 864 ]
; loop number that discord message gets sent off at to track upload progress
; 144 x 5 seconds = 12 minutes
; Check if Lib folder exists and create it if not
LibFolder := A_ScriptDir . " \Lib "
ErrorLoggingFolder := A_ScriptDir . " \Lib\ErrorLogging "
FileCreateDir , %ErrorLoggingFolder%
; Set filepaths for different files and folders
global SettingsIniFilepath
SettingsIniFilepath := A_ScriptDir . " \Settings.ini "
global ScriptSettingsSection
ScriptSettingsSection := " VideoUploader "
2024-05-21 21:25:31 -04:00
global ScriptNameAcronym
ScriptNameAcronym := " FVU "
2023-02-12 17:34:03 -05:00
2024-05-21 21:25:31 -04:00
global ScriptName
global ScriptVersion
global FullScriptName
VersionIniFilepath = %A_ScriptDir% \Lib \Version - %ScriptNameAcronym% . ini
2023-12-19 15:48:33 -05:00
2024-05-21 21:25:31 -04:00
; Install the Version.ini file in lib folder (Used by .exe file)
FileInstall , Version . ini , %VersionIniFilepath% , 1
IniRead , ScriptVersion , %VersionIniFilepath% , Video - Uploader , Version , 0.0
IniRead , ScriptName , %VersionIniFilepath% , Video - Uploader , Name ,
2023-12-19 15:48:33 -05:00
FullScriptName := ScriptName . " - " . ScriptVersion
2023-02-12 17:34:03 -05:00
;---Script Settings---
;------------------------------------------------
; Checkbox Settings
2023-09-21 20:50:06 -04:00
IniRead , XPosition , %SettingsIniFilepath% , General , XPosition , 0
IniRead , YPosition , %SettingsIniFilepath% , General , YPosition , 0
2023-02-12 17:34:03 -05:00
IniRead , RootDirToStartIn , %SettingsIniFilepath% , General , RootDirToStartIn
IniRead , LogErrorsToMsgbox , %SettingsIniFilepath% , General , LogErrorsToMsgbox , %A_Space%
IniRead , UpdateAvailable , %SettingsIniFilepath% , %ScriptSettingsSection% , UpdateAvailable , 0
IniRead , DevMode , %SettingsIniFilepath% , General , DevMode , 0
IniRead , TotalVideosUploaded , %SettingsIniFilepath% , General , TotalVideosUploaded , 0
2023-09-17 14:26:44 -04:00
IniRead , MouseClicksSaved , %SettingsIniFilepath% , General , MouseClicksSaved , 0
2023-02-12 17:34:03 -05:00
IniRead , ShowTooltipProgress , %SettingsIniFilepath% , General , ShowTooltipProgress , 1
IniRead , AutoUpdateCheck , %SettingsIniFilepath% , General , AutoUpdateCheck , 1
2023-02-23 14:58:34 -05:00
; AutoLogin setting
IniRead , AutoLogin , %SettingsIniFilepath% , General , AutoLogin , 1
2024-05-21 21:25:31 -04:00
IniRead , KillLBRYAfterUpload , %SettingsIniFilepath% , General , KillLBRYAfterUpload , 1
IniRead , ConfirmBeforeSubmit , %SettingsIniFilepath% , %ScriptSettingsSection% , ConfirmBeforeSubmit , 0
; Discord Error Logging
; ------------------------------------------------
IniRead , ErrorLogToDiscord , %SettingsIniFilepath% , %ScriptSettingsSection% , ErrorLogToDiscord , 1
IniRead , DiscordPingOnCompletion , %SettingsIniFilepath% , %ScriptSettingsSection% , DiscordPingOnCompletion , 1
2023-02-12 17:34:03 -05:00
2024-05-21 21:25:31 -04:00
if ( ErrorLogToDiscord | | DiscordPingOnCompletion ) {
2023-02-28 18:41:06 -05:00
IniRead , DiscordUsernameID , %SettingsIniFilepath% , General , DiscordUsernameID , %A_space%
if ( ! DiscordUsernameID ) {
Message = DiscordUsernameID is blank . Will not be able to ping to notify when uploads are complete . `n Please add user ID in settings . ini under : `n `n [ General ] `n DiscordUsernameID = `n Or Uncheck " Discord Ping on Completion "
; SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile")
SaveOrPostProgress ( Message := Message , PostType := " Tooltip,ErrorLoggingTextFile,ErrorSummaryVar " )
}
}
2023-02-12 17:34:03 -05:00
IniRead , DiscordErrorLoggingWebhookBotURL , %SettingsIniFilepath% , General , DiscordWebhookBotURL , %A_space%
if ( DiscordErrorLoggingWebhookBotURL = " " ) {
Message = DiscordErrorLoggingWebhookBotURL is blank . `n Will not be able to post error messages or upload status to discord . `n Please add discord webhook URL in settings . ini under : `n `n [ General ] ` DiscordErrorLoggingWebhookBotURL =
SaveOrPostProgress ( Message := Message , PostType := " ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging " )
}
2023-02-28 18:41:06 -05:00
2024-06-08 18:26:22 -04:00
; Auto Updater Settings
; ------------------------------------------------
2023-02-12 17:34:03 -05:00
global GitReleasesAPIURL
2024-06-08 18:26:22 -04:00
GitReleasesAPIURL = https : / / freedomain . dev / api / v1 / repos / yuriy / video - uploader / releases
; Post Scheduler Settings
; ------------------------------------------------
global PostSchedulerGitReleasesAPIURL
PostSchedulerGitReleasesAPIURL = https : / / freedomain . dev / api / v1 / repos / yuriy / post - scheduler / releases
IniRead , PostSchedulerVersion , %SettingsIniFilepath% , Freedomain Post Scheduler , Version , 0.0
IniRead , PostSchedulerFilepath , %SettingsIniFilepath% , Filepaths , PostScheduler , %A_Space%
; Msgbox % "PostSchedulerVersion: " PostSchedulerVersion
; IniRead, OutputVar, Filename, Section, Key [, Default]
2023-02-12 17:34:03 -05:00
;---LBRY Settings---
;------------------------------------------------
2024-05-21 21:25:31 -04:00
IniRead , LBRYNewVideoStakeAmount , %SettingsIniFilepath% , General , LBRYNewVideoStakeAmount , 1.0
2023-02-12 17:34:03 -05:00
IniRead , LBRYChannelID , %SettingsIniFilepath% , General , LBRYChannelID , %A_Space%
if ( LBRYChannelID = " " ) {
LBRYChannelID = b89ed227c49e726fcccf913bdc9dec4c8fec99c2
IniWrite , %LBRYChannelID% , %SettingsIniFilepath% , General , LBRYChannelID
}
2024-05-21 21:25:31 -04:00
; Set Settings based on Passed in Arguments
; ------------------------------------------------
; if passed argument is .exe file, then script has just been updated and we need to move the old version
if ( InStr ( PassedInArgument1_Filepath , ScriptName ) and InStr ( PassedInArgument1_Filepath , " .exe " ) ) {
2023-02-15 03:35:35 -05:00
; create backups folder if it doesn't exist
BackupsFolder = %LibFolder% \Backups \
; Msgbox % "BackupsFolder: " BackupsFolder
if ( ! FileExist ( BackupsFolder ) ) {
FileCreateDir , %BackupsFolder%
}
; move old version to backups folder, overwrite if name conflict
2024-05-21 21:25:31 -04:00
FileDelete , %PassedInArgument1_Filepath%
2023-02-15 03:35:35 -05:00
if ( ErrorLevel ) { ; most likely because the old version hasn't finished exiting yet
2023-07-29 20:15:50 -04:00
SaveOrPostProgress ( Message := " Moving Old Version to Backups " , PostType := " Tooltip,ErrorLoggingTextFile,ErrorSummaryVar " )
2023-02-15 03:35:35 -05:00
sleep , 2000
2024-05-21 21:25:31 -04:00
FileDelete , %PassedInArgument1_Filepath%
2023-02-15 03:35:35 -05:00
if ( ErrorLevel ) {
2024-05-21 21:25:31 -04:00
MsgBox , , Update Successful , Update was successful `, but failed to delete the old version , most likely due to it running . `n Please delete it manually .
2023-02-15 03:35:35 -05:00
}
ToolTip
}
2024-05-21 21:25:31 -04:00
; Change parameter to "LastPost" so last post now gets automatically opened instead of user having to re-select the file again
PassedInArgument1_Filepath = LastPost
2023-02-15 03:35:35 -05:00
}
2024-05-21 21:25:31 -04:00
if ( PassedInArgument1_Filepath = " LastPost " ) {
IniRead , PassedInArgument1_Filepath , %SettingsIniFilepath% , %ScriptSettingsSection% , LastPost , %A_Space%
2023-07-29 20:15:50 -04:00
}
2024-05-21 21:25:31 -04:00
if ( PassedInArgument2_Action = " ShowResults " ) {
IniRead , PassedInArgument1_Filepath , %SettingsIniFilepath% , %ScriptSettingsSection% , LastPost , %A_Space%
2023-07-29 20:15:50 -04:00
}
2024-05-21 21:25:31 -04:00
; Show File Selection Dialogue
; ------------------------------------------------
PassedInArgument1_FilepathLength := StrLen ( PassedInArgument1_Filepath )
if ( PassedInArgument1_FilepathLength < 5 and ! InStr ( PassedInArgument1_Filepath , " .exe " ) ) {
2023-02-12 17:34:03 -05:00
FileSelectFile , BodyTextFilePath , , %RootDirToStartIn% , Please Select ANY File Within the Project Folder
if ( ErrorLevel )
Return
}
else , {
SkipUpdateCheckThisRun := 1
2024-05-21 21:25:31 -04:00
BodyTextFilePath := PassedInArgument1_Filepath
2023-02-12 17:34:03 -05:00
}
2024-05-21 21:25:31 -04:00
; Read Info From Project Files
;------------------------------------------------
; get project directory from the "BodyTextFilePath"
; BodyTextFilePath will be any file from within the update directory
2023-02-12 17:34:03 -05:00
SplitPath , BodyTextFilePath , OutFileName , VideoFolderDir , OutExtension , OutNameNoExt , OutDrive
Loop , files , %VideoFolderDir% \* . * , F ; loop through the files in the directory
{ ; D = Directories, F = Files, R = Recursive
SplitPath , A_LoopFileFullPath , FileNameWExt , FileDir , FileExt , FileNameNoExt ,
if ( FileNameWExt = " title.txt " ) {
FileRead , VideoTitle , %A_LoopFileFullPath%
LBRYURLSlug := VideoTitle
OriginalVideoTitle := VideoTitle
OriginalLBRYURLSlug := LBRYURLSlug
}
if ( FileNameWExt = " body.txt " ) {
FileRead , VideoDescription , %A_LoopFileFullPath%
DescriptionCharCount := StrLen ( VideoDescription )
OriginalVideoDescription := VideoDescription
}
2024-01-27 18:46:58 -05:00
if ( FileNameWExt = " summary.txt " ) {
FileRead , VideoSummary , %A_LoopFileFullPath%
; DescriptionCharCount := StrLen(VideoDescription)
OriginalVideoSummary := VideoSummary
}
2023-02-12 17:34:03 -05:00
if ( FileNameWExt = " keywords.txt " ) {
FileRead , VideoTags , %A_LoopFileFullPath%
FileRead , PodcastTags , %A_LoopFileFullPath%
OriginalVideoTags := VideoTags
2024-05-21 21:25:31 -04:00
OriginalPodcastTags := PodcastTags ; set in case there is no keywords_podcast file
2023-02-12 17:34:03 -05:00
}
if ( FileNameWExt = " keywords_podcast.txt " ) {
FileRead , PodcastTags , %A_LoopFileFullPath%
OriginalPodcastTags := PodcastTags
}
if ( FileExt = " mp4 " ) {
VideoFilepath := A_LoopFileFullPath
SplitPath , A_LoopFileFullPath , , , , VideoFileNameNoExt
FileGetSize , VideoFileSizeInMB , %A_LoopFileFullPath% , M
2024-01-13 12:20:58 -05:00
VideoInfoObj := Filexpro ( VideoFilepath ,
2024-06-22 15:14:44 -04:00
, " System.Video.TotalBitrate "
, " System.Video.FrameHeight "
, " System.Video.FrameWidth " )
try , VideoTotalBitrate := VideoInfoObj [ " System.Video.TotalBitrate " ]
try , VideoHeight := VideoInfoObj [ " System.Video.FrameHeight " ]
try , VideoWidth := VideoInfoObj [ " System.Video.FrameWidth " ]
VideoAspectRatio := getAspectRatio ( VideoWidth , VideoHeight )
2024-01-13 12:20:58 -05:00
2023-02-12 17:34:03 -05:00
}
2024-04-16 22:17:15 -04:00
if ( FileExt = " png " OR FileExt = " jpg " OR FileExt = " jpeg " ) {
2023-02-12 17:34:03 -05:00
VideoThumbFilepath := A_LoopFileFullPath
}
}
; 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.
2023-09-21 20:50:06 -04:00
Loop , files , %VideoFolderDir% \* . flac , F ; loop through the files in the directory
2023-02-12 17:34:03 -05:00
{ ; D = Directories, F = Files, R = Recursive
SplitPath , A_LoopFileFullPath , FileNameWExt , FileDir , FileExt , FileNameNoExt
if ( FileNameNoExt = VideoFileNameNoExt ) {
WavAudioFilepath := A_LoopFileFullPath
}
}
2023-09-21 20:50:06 -04:00
; 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
2023-02-12 17:34:03 -05:00
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
if ( FileNameNoExt = VideoFileNameNoExt ) {
MP3AudioFilepath := A_LoopFileFullPath
}
}
2024-01-13 12:20:58 -05:00
2024-06-22 15:14:44 -04:00
2024-01-13 12:20:58 -05:00
;---Read Info From Previous Run And Set Upload Options---
;--------------------------------------------------------
2023-02-12 17:34:03 -05:00
VideoLinksIniFile = %VideoFolderDir% \VideoLinks . ini
if ( FileExist ( VideoLinksIniFile ) ) {
IniRead , BitChuteURL , %VideoLinksIniFile% , URLs , BitChuteURL , %A_Space%
2024-04-16 22:17:15 -04:00
2023-02-12 17:34:03 -05:00
; LBRY
IniRead , LBRYURLSlug , %VideoLinksIniFile% , Misc , LBRYURLSlug , %A_Space%
if ( LBRYURLSlug = " " ) {
LBRYURLSlug := OriginalLBRYURLSlug ; video title
}
; LBRY Video
IniRead , LBRYVideoURL , %VideoLinksIniFile% , URLs , LBRYVideoURL , %A_Space%
IniRead , LBRYVideoThumb , %VideoLinksIniFile% , Misc , LBRYVideoThumb , %A_Space%
IniRead , LBRYVideoPermanentURL , %VideoLinksIniFile% , URLs , LBRYVideoPermanentURL , %A_Space%
IniRead , OdyseeVideoURL , %VideoLinksIniFile% , URLs , OdyseeVideoURL , %A_Space%
IniRead , OdyseeVideoThumb , %VideoLinksIniFile% , Misc , OdyseeVideoThumb , %A_Space%
OdyseeVideoThumb := StrReplace ( OdyseeVideoThumb , " Thumb: " , " " )
; LBRY Audio
IniRead , LBRYAudioURL , %VideoLinksIniFile% , URLs , LBRYAudioURL , %A_Space%
IniRead , LBRYAudioThumb , %VideoLinksIniFile% , Misc , LBRYAudioThumb , %A_Space%
IniRead , LBRYAudioPermanentURL , %VideoLinksIniFile% , URLs , LBRYAudioPermanentURL , %A_Space%
IniRead , OdyseeAudioURL , %VideoLinksIniFile% , URLs , OdyseeAudioURL , %A_Space%
IniRead , OdyseeAudioThumb , %VideoLinksIniFile% , Misc , OdyseeAudioThumb , %A_Space%
OdyseeAudioThumb := StrReplace ( OdyseeAudioThumb , " Thumb: " , " " )
; Others
IniRead , RumbleURL , %VideoLinksIniFile% , URLs , RumbleURL , %A_Space%
IniRead , BrighteonURL , %VideoLinksIniFile% , URLs , BrighteonURL , %A_Space%
IniRead , DailyMotionURL , %VideoLinksIniFile% , URLs , DailyMotionURL , %A_Space%
IniRead , PodcastNumber , %VideoLinksIniFile% , Misc , PodcastNumber , %A_Space%
IniRead , LocalsURL , %VideoLinksIniFile% , URLs , LocalsURL , %A_Space%
2024-04-16 22:17:15 -04:00
IniRead , PodcastTranscriptURL , %VideoLinksIniFile% , URLs , PodcastTranscriptURL , %A_Space%
2024-04-17 14:13:39 -04:00
IniRead , UnauthorizedTVURL , %VideoLinksIniFile% , URLs , UnauthorizedTVURL , %A_Space%
2024-04-16 22:17:15 -04:00
2023-02-12 17:34:03 -05:00
; MISC
IniRead , ErrorLoggingFilePath , %VideoLinksIniFile% , Misc , ErrorLoggingFilePath , %A_Space%
2024-06-22 15:28:09 -04:00
; I don't remember why I added this, commenting this out on 2024/06/22 for now
; IniRead, TempVideoThumbFilepath, %VideoLinksIniFile%, Misc, VideoThumbFilepath, %A_Space%
/* if(TempVideoThumbFilepath){ ; if Video Thumbnail was saved in last run, overwrite variable path that was grabbed in the file loop above
2024-01-12 20:41:59 -05:00
VideoThumbFilepath := TempVideoThumbFilepath
}
2024-06-22 15:28:09 -04:00
* /
2023-02-12 17:34:03 -05:00
}
2023-07-29 20:34:19 -04:00
; Create a directory for errorlogging if this is the first time working on this project
2023-02-12 17:34:03 -05:00
if ( ErrorLoggingFilePath = " " ) {
FormatTime , TodayDate , YYYYMMDDHH24MISS , yyyyMMdd_hhmmss
2024-05-21 21:25:31 -04:00
ErrorLoggingDirectory := ErrorLoggingFolder . " \ " . TodayDate . " _ " . ScriptNameAcronym
2023-02-12 17:34:03 -05:00
FileCreateDir , %ErrorLoggingDirectory%
2024-05-21 21:25:31 -04:00
ErrorLoggingFilePath := ErrorLoggingFolder . " \ " . TodayDate . " _ " . ScriptNameAcronym . " \ErrorLogging.txt " ; Set locaiton where error logging text will go
2023-02-12 17:34:03 -05:00
2024-05-21 21:25:31 -04:00
; Save ErrorLoggingFilePath to project settings file so it can be reused if doing multiple runs
2023-02-12 17:34:03 -05:00
IniWrite , %ErrorLoggingFilePath% , %VideoLinksIniFile% , Misc , ErrorLoggingFilePath
}
if ( PodcastNumber = " " ) {
PodcastNumber := StrSplit ( VideoFileNameNoExt , " _ " )
PodcastNumber := PodcastNumber [ 2 ]
}
2024-05-21 21:25:31 -04:00
; Set Websites to Upload to
; ------------------------------------------------
2023-02-12 17:34:03 -05:00
; Set the checkmark status of each item based on the variable status
2024-05-21 21:25:31 -04:00
( B i t C h u t e U R L ) ? ( B i t C h u t e : = 0 ) : ( B i t C h u t e : = 1 )
( R u m b l e U R L ) ? ( R u m b l e : = 0 ) : ( R u m b l e : = 1 )
( D a i l y M o t i o n U R L ) ? ( D a i l y M o t i o n : = 0 ) : ( D a i l y M o t i o n : = 1 )
2023-02-12 17:34:03 -05:00
2024-05-21 21:25:31 -04:00
; if user tried to upload to locals already and still needs to grab the url
if ( LocalsURL = " " OR LocalsURL = " LocalsUploadStartedNeedToGrabURL " ) {
Locals := 1
2023-02-12 17:34:03 -05:00
}
2024-05-21 21:25:31 -04:00
else ,
Locals := 0
2023-02-12 17:34:03 -05:00
2024-05-21 21:25:31 -04:00
( O d y s e e V i d e o U R L ) ? ( O d y s e e V i d e o : = 0 ) : ( O d y s e e V i d e o : = 1 )
( O d y s e e A u d i o U R L | | W a v A u d i o F i l e p a t h = " " ) ? ( O d y s e e A u d i o : = 0 ) : ( O d y s e e A u d i o : = 1 )
2023-02-12 17:34:03 -05:00
2024-05-21 21:25:31 -04:00
; Brighteon has 6GB video file size limit
( B r i g h t e o n U R L ) ? ( B r i g h t e o n : = 0 ) : ( B r i g h t e o n : = 1 )
if ( VideoFileSizeInMB > 6144 ) {
VideoFileSizeOver6GB := 1
Brighteon := 0
}
2023-02-12 17:34:03 -05:00
2024-06-22 15:14:44 -04:00
; Brighteon will fail if video does not have one of the following aspect ratios
BrighteonAcceptedAspectRatios := [ " 4:3 " , " 3:4 " , " 16:9 " , " 9:16 " ]
; Msgbox % "VideoAspectRatio: " VideoAspectRatio
VideoHasBrighteonCompatibleAspectRatio := HasVal ( BrighteonAcceptedAspectRatios , VideoAspectRatio )
2023-02-12 17:34:03 -05:00
2024-05-21 21:25:31 -04:00
; Override Website statuses if this is a schedule post based on Argument3
; ------------------------------------------------
if ( PassedInArgument2_Action = " Scheduled " ) {
; if(PassedInArgument3_Details){
( I n S t r ( P a s s e d I n A r g u m e n t 3 _ D e t a i l s , " L o c a l s " ) ) ? ( L o c a l s : = 1 ) : ( L o c a l s : = 0 )
( I n S t r ( P a s s e d I n A r g u m e n t 3 _ D e t a i l s , " B i t c h u t e " ) ) ? ( B i t c h u t e : = 1 ) : ( B i t c h u t e : = 0 )
( I n S t r ( P a s s e d I n A r g u m e n t 3 _ D e t a i l s , " O d y s e e V i d e o " ) ) ? ( O d y s e e V i d e o : = 1 ) : ( O d y s e e V i d e o : = 0 )
( I n S t r ( P a s s e d I n A r g u m e n t 3 _ D e t a i l s , " O d y s e e A u d i o " ) ) ? ( O d y s e e A u d i o : = 1 ) : ( O d y s e e A u d i o : = 0 )
( I n S t r ( P a s s e d I n A r g u m e n t 3 _ D e t a i l s , " R u m b l e " ) ) ? ( R u m b l e : = 1 ) : ( R u m b l e : = 0 )
( I n S t r ( P a s s e d I n A r g u m e n t 3 _ D e t a i l s , " B r i g h t e o n " ) ) ? ( B r i g h t e o n : = 1 ) : ( B r i g h t e o n : = 0 )
( I n S t r ( P a s s e d I n A r g u m e n t 3 _ D e t a i l s , " D a i l y M o t i o n " ) ) ? ( D a i l y M o t i o n : = 1 ) : ( D a i l y M o t i o n : = 0 )
2024-06-08 18:26:22 -04:00
; }
goto , StartScheduledPost
}
2024-06-21 22:50:44 -04:00
/*
* /
2023-02-12 17:34:03 -05:00
2024-06-21 22:50:44 -04:00
;---/Read Info From Previous Run And Set Upload Options---
;--------------------------------------------------------
2023-02-12 17:34:03 -05:00
2024-06-21 22:50:44 -04:00
if ( PassedInArgument2_Action = " ShowResults " ) {
goto , DisplayResults
}
2024-05-21 21:25:31 -04:00
2023-02-12 17:34:03 -05:00
2024-06-21 22:50:44 -04:00
; Main GUI Window
; ------------------------------------------------
; Write current project to ini file for easy reloading
IniWrite , %BodyTextFilePath% , %SettingsIniFilepath% , %ScriptSettingsSection% , LastPost
2023-02-12 17:34:03 -05:00
2024-06-21 22:50:44 -04:00
gosub , SetAndShowMainGUI
2023-04-03 00:04:18 -04:00
2024-06-21 22:50:44 -04:00
RunTimeToShowGui := round ( ( ( A_TickCount - UStartTime ) / 1000 ) , 2 )
2023-09-16 22:45:52 -04:00
2024-06-21 22:50:44 -04:00
Return
2023-02-12 17:34:03 -05:00
2024-06-21 22:50:44 -04:00
; -------------------------------GUI GoSubs-------------------------------
; Kill the script if user clicks on cancel button
KillScript:
; GuiClose:
ExitApp
Return
2023-02-12 17:34:03 -05:00
2024-06-21 22:50:44 -04:00
PauseScript:
Pause , Toggle
Return
2023-02-12 17:34:03 -05:00
2024-06-21 22:50:44 -04:00
CancelPost:
GuiClose:
; ExitApp
Gui , Submit ,
Return
2023-02-12 17:34:03 -05:00
2024-06-21 22:50:44 -04:00
ReloadScript:
Reload
Return
2023-02-12 17:34:03 -05:00
2024-06-21 22:50:44 -04:00
; 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
2023-02-12 17:34:03 -05:00
2024-06-21 22:50:44 -04:00
SubmitDescription:
Gui , Submit , NoHide
DescriptionCharCount := StrLen ( VideoDescription )
GuiControl , , DescriptionCharCount , %DescriptionCharCount%
Return
2023-02-12 17:34:03 -05:00
2024-06-21 22:50:44 -04:00
; 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
2023-02-12 17:34:03 -05:00
2024-06-21 22:50:44 -04:00
ClearVideoLinks:
FileDelete , %VideoLinksIniFile%
Return
2023-02-12 17:34:03 -05:00
2024-06-21 22:50:44 -04:00
ToggleTestingMode:
ToggleTestingMode ( )
run , " %A_ScriptFullPath% " " LastPost "
Return
2023-02-12 17:34:03 -05:00
2024-06-21 22:50:44 -04:00
ToggleDevMode:
ToggleDevMode ( )
run , " %A_ScriptFullPath% " " LastPost "
Return
2023-02-12 17:34:03 -05:00
2024-06-08 18:26:22 -04:00
/*
2023-02-12 17:34:03 -05:00
OpenGiteaPage:
2023-12-11 13:38:51 -05:00
run , https : / / freedomain . dev / yuriy / video - uploader
2023-02-12 17:34:03 -05:00
Return
2024-06-08 18:26:22 -04:00
OpenErrorLog:
run , %ErrorLoggingFilePath%
Return
* /
2024-05-21 21:25:31 -04:00
UncheckAllPlatforms:
GuiControl , , Bitchute , 0
GuiControl , , Locals , 0
GuiControl , , OdyseeVideo , 0
GuiControl , , OdyseeAudio , 0
GuiControl , , Rumble , 0
GuiControl , , DailyMotion , 0
GuiControl , , Brighteon , 0
Return
2023-02-12 17:34:03 -05:00
SelectVideoFilepath:
FileSelectFile , VideoFilepath , , %FileDir% , Select Video File
GuiControl , , VideoFilepath , %VideoFilepath%
Return
SelectWAVFilepath:
FileSelectFile , WavAudioFilepath , , %FileDir% , Select WAV File
GuiControl , , WavAudioFilepath , %WavAudioFilepath%
GuiControl , , OdyseeAudio , 1
GuiControl , , OdyseeAudioThumb , 1
Return
SelectMP3Filepath:
FileSelectFile , MP3AudioFilepath , , %FileDir% , Select MP3 File
if ( ! InStr ( MP3AudioFilepath , " .mp3 " ) ) {
msgbox , 4096 , Error , Selected File is not an . mp3 file . `n Please try again .
Return
}
GuiControl , , MP3AudioFilepath , %MP3AudioFilepath%
Return
SelectVideoThumbFilepath:
FileSelectFile , VideoThumbFilepath , , %FileDir% , Select Thumbnail File
if ( ! InStr ( VideoThumbFilepath , FileDir ) ) {
TimedToolTip ( " Thumbnail Copied to Project Folder " , , , 1000 )
SplitPath , VideoThumbFilepath , OutFileName , OutDir , OutExtension , OutNameNoExt , OutDrive
FileCopy , %VideoThumbFilepath% , %FileDir% \* , 1
VideoThumbFilepath = %FileDir% \%OutFileName%
; Msgbox % "VideoThumbFilepath: " VideoThumbFilepath
}
GuiControl , , VideoThumbFilepath , %VideoThumbFilepath%
; GuiControl,, ImageThumbnail,%VideoThumbFilepath%
Return
; Download updates from google drive and save it to the location of the script and then reload the script
UpdateScript:
UpdateScript ( )
; @todo: Save any changes made to the script before installing update
Return
2023-09-21 00:44:20 -04:00
/*
* /
2023-02-12 17:34:03 -05:00
2023-09-21 00:44:20 -04:00
; -------------------------------Upload Video Functionality-------------------------------
StartScript:
WinGetPos , XPosition , YPosition , , , A
IniWrite , %XPosition% , %SettingsIniFilepath% , General , XPosition
IniWrite , %YPosition% , %SettingsIniFilepath% , General , YPosition
2023-02-12 17:34:03 -05:00
2024-05-21 21:25:31 -04:00
Gui , Submit , NoHide
2023-02-12 17:34:03 -05:00
2024-05-21 21:25:31 -04:00
if ( VideoFilepath = " " ) {
Msgbox , 4096 , Error , No Video Filepath Found . `n Please Input Video Filepath to Upload a Video .
Return
2023-09-21 00:44:20 -04:00
}
2023-02-12 17:34:03 -05:00
2024-05-21 21:25:31 -04:00
; Destroy GUI after checking everything is working
Gui , Destroy
2023-09-21 00:44:20 -04:00
; Save Video Info
;------------------------------------------------
; if changes made, delete the original file and save the new content to it
2023-02-12 17:34:03 -05:00
2023-09-21 00:44:20 -04:00
if ( VideoTitle != OriginalVideoTitle ) {
VideoTitleFilepath = %VideoFolderDir% \title . txt
2023-02-12 17:34:03 -05:00
2023-09-21 00:44:20 -04:00
FileDelete , %VideoTitleFilepath%
FileAppend , %VideoTitle% , %VideoTitleFilepath%
}
2023-02-12 17:34:03 -05:00
2023-09-21 00:44:20 -04:00
if ( VideoTags != OriginalVideoTags ) {
VideoTagsFilepath = %VideoFolderDir% \keywords . txt
2023-02-12 17:34:03 -05:00
2023-09-21 00:44:20 -04:00
FileDelete , %VideoTagsFilepath%
FileAppend , %VideoTags% , %VideoTagsFilepath%
}
2023-02-12 17:34:03 -05:00
2023-09-21 00:44:20 -04:00
if ( PodcastTags != OriginalPodcastTags ) {
PodcastTagsFilepath = %VideoFolderDir% \keywords_podcast . txt
2023-02-12 17:34:03 -05:00
2023-09-21 00:44:20 -04:00
FileDelete , %PodcastTagsFilepath%
FileAppend , %PodcastTags% , %PodcastTagsFilepath%
}
2023-02-12 17:34:03 -05:00
2023-09-21 00:44:20 -04:00
if ( VideoDescription != OriginalVideoDescription ) {
VideoBodyFilepath = %VideoFolderDir% \body . txt
2023-02-12 17:34:03 -05:00
2023-09-21 00:44:20 -04:00
FileDelete , %VideoBodyFilepath%
FileAppend , %VideoDescription% , %VideoBodyFilepath%
}
2023-02-12 17:34:03 -05:00
2024-05-21 21:25:31 -04:00
; Save Script Settings to File
; ------------------------------------------------
2023-09-21 00:44:20 -04:00
; Save settings to config file
IniWrite , %ShowTooltipProgress% , %SettingsIniFilepath% , General , ShowTooltipProgress
IniWrite , %AutoUpdateCheck% , %SettingsIniFilepath% , General , AutoUpdateCheck
IniWrite , %AutoLogin% , %SettingsIniFilepath% , General , AutoLogin
2024-05-21 21:25:31 -04:00
IniWrite , %ErrorLogToDiscord% , %SettingsIniFilepath% , %ScriptSettingsSection% , ErrorLogToDiscord
IniWrite , %DiscordPingOnCompletion% , %SettingsIniFilepath% , %ScriptSettingsSection% , DiscordPingOnCompletion
2023-09-21 00:44:20 -04:00
IniWrite , %KillLBRYAfterUpload% , %SettingsIniFilepath% , General , KillLBRYAfterUpload
2024-05-21 21:25:31 -04:00
IniWrite , %ConfirmBeforeSubmit% , %SettingsIniFilepath% , %ScriptSettingsSection% , ConfirmBeforeSubmit
2023-02-12 17:34:03 -05:00
2024-05-21 21:25:31 -04:00
; Used by Post Scheduler, filepath changes between script updates
IniWrite , %A_ScriptFullPath% , %SettingsIniFilepath% , Filepaths , VideoUploaderFilepath
2023-02-12 17:34:03 -05:00
2024-05-21 21:25:31 -04:00
StartScheduledPost:
2023-02-12 17:34:03 -05:00
2023-09-21 00:44:20 -04:00
; 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 )
2023-02-12 17:34:03 -05:00
2023-09-21 00:44:20 -04:00
; 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
2024-01-12 20:35:45 -05:00
IniWrite , %VideoThumbFilepath% , %VideoLinksIniFile% , Misc , VideoThumbFilepath
2023-02-12 17:34:03 -05:00
2024-05-21 21:25:31 -04:00
; -------------------------------Log Info To Text-------------------------------s
( B i t c h u t e ) ? ( P o s t e d W e b s i t e s . = " B i t c h u t e | " ) : ( )
( L o c a l s ) ? ( P o s t e d W e b s i t e s . = " L o c a l s | " ) : ( )
( R u m b l e ) ? ( P o s t e d W e b s i t e s . = " R u m b l e | " ) : ( )
( B r i g h t e o n ) ? ( P o s t e d W e b s i t e s . = " B r i g h t e o n | " ) : ( )
( D a i l y M o t i o n ) ? ( P o s t e d W e b s i t e s . = " D a i l y M o t i o n | " ) : ( )
( O d y s e e V i d e o ) ? ( P o s t e d W e b s i t e s . = " O d y s e e V i d e o | " ) : ( )
( O d y s e e A u d i o ) ? ( P o s t e d W e b s i t e s . = " O d y s e e A u d i o | " ) : ( )
2023-02-12 17:34:03 -05:00
2023-09-21 00:44:20 -04:00
; Log Basic info to the errorlogging file
2024-01-27 18:46:58 -05:00
Message = Starting Upload with %ScriptName% v %ScriptVersion% : `n For : * * %VideoTitle% * * `n To : %PostedWebsites%
2023-09-21 00:44:20 -04:00
SaveOrPostProgress ( Message := Message , PostType := " Tooltip,ErrorLoggingTextFile,DiscordErrorLogging " )
Message := " VideoTitle: " VideoTitle
SaveOrPostProgress ( Message := Message , PostType := " ,ErrorLoggingTextFile " )
Message := " VideoDescription: `n " VideoDescription
SaveOrPostProgress ( Message := Message , PostType := " ,ErrorLoggingTextFile " )
Message := " VideoTags: " VideoTags
SaveOrPostProgress ( Message := Message , PostType := " ,ErrorLoggingTextFile " )
Message := " VideoFilepath: " VideoFilepath
SaveOrPostProgress ( Message := Message , PostType := " ,ErrorLoggingTextFile " )
Message := " VideoThumbFilepath: " VideoThumbFilepath
SaveOrPostProgress ( Message := Message , PostType := " ,ErrorLoggingTextFile " )
Message := " TotalVideosUploaded: " TotalVideosUploaded
SaveOrPostProgress ( Message := Message , PostType := " ,ErrorLoggingTextFile " )
2023-02-12 17:34:03 -05:00
2024-06-22 15:14:44 -04:00
Message := " Video Information:`n VideoTotalBitrate: " . VideoTotalBitrate . " `n VideoAspectRatio: " . VideoAspectRatio
SaveOrPostProgress ( Message := Message , PostType := " Tooltip,ErrorLoggingTextFile " )
2023-10-22 00:06:55 -04:00
; Convert Video Title and Description into javascript formatting for sending to pages through js instead of plain selenium
2023-09-21 00:44:20 -04:00
JSVideoTitle := FormatTextToJSText ( VideoTitle )
2023-10-22 00:06:55 -04:00
JSVideoDescription := FormatTextToJSText ( VideoDescription )
2024-01-27 18:46:58 -05:00
JSVideoSummary := FormatTextToJSText ( VideoSummary )
2023-02-12 17:34:03 -05:00
2023-09-21 00:44:20 -04:00
; -------------------------------/Log Info To Text-------------------------------
2023-02-12 17:34:03 -05:00
2024-01-16 06:35:42 -05:00
; Cleanup Tag Formatting
; ------------------------------------------------
2024-01-12 22:02:42 -05:00
; @todo: note: it would be better to replace accented chars w/ their pure latin equivalents but that seems a bit
; beyond the scope of this change. here's a link talking about how to do that tho
; https://www.autohotkey.com/boards/viewtopic.php?t=61626
2023-02-12 17:34:03 -05:00
2024-01-12 22:02:42 -05:00
; Create an array out of the keywords to be used in different places
2024-01-16 06:35:42 -05:00
ArrayOfVideoTags := [ ]
ArrayOfPodcastTags := [ ]
2023-02-12 17:34:03 -05:00
2024-01-12 22:02:42 -05:00
; VIDEO Tags
For index , val in StrSplit ( VideoTags , " , " ) {
; for each element in the split videotags array, trim leading & trailing spaces
val := Trim ( val )
2023-02-12 17:34:03 -05:00
2024-01-12 22:02:42 -05:00
; and remove any chars that are not a letter, number, or space (i = case-insensitive)
val := RegexReplace ( val , " i)[^a-z0-9 ] " , " " )
2024-01-16 06:35:42 -05:00
ArrayOfVideoTags . InsertAt ( index , val )
2024-01-12 22:02:42 -05:00
}
; PODCAST Tags
For index , val in StrSplit ( PodcastTags , " , " ) {
2024-01-13 01:52:26 +00:00
; for each element in the split videotags array, trim leading & trailing spaces
val := Trim ( val )
2024-01-12 22:02:42 -05:00
2024-01-13 01:52:26 +00:00
; and remove any chars that are not a letter, number, or space (i = case-insensitive)
val := RegexReplace ( val , " i)[^a-z0-9 ] " , " " )
2024-01-16 06:35:42 -05:00
ArrayOfPodcastTags . InsertAt ( index , val )
2024-01-13 01:52:26 +00:00
}
2024-01-12 22:02:42 -05:00
2024-01-13 01:52:26 +00:00
; update VideoTags with sanitized keywords list
2024-01-16 06:35:42 -05:00
VideoTags := Join ( " , " , ArrayOfVideoTags * )
2024-01-12 22:02:42 -05:00
; update PodcastTags with sanitized keywords list
2024-01-16 06:35:42 -05:00
PodcastTags := Join ( " , " , ArrayOfPodcastTags * )
2023-02-12 17:34:03 -05:00
2024-01-16 06:35:42 -05:00
; // Cleanup Tag Formatting
; ------------------------------------------------
2023-02-12 17:34:03 -05:00
2023-09-16 23:32:37 -04:00
2024-01-16 06:35:42 -05:00
; Upload to Sites
; ------------------------------------------------
; Call each submodule one by one
; if errors occur then an upload for that site will be stopped and the next upload will then proceed
2023-09-21 00:44:20 -04:00
2023-09-16 23:32:37 -04:00
if ( Locals )
gosub , LocalsUpload
if ( BitChute )
Gosub , BitChuteUpload
2023-02-12 17:34:03 -05:00
2023-07-29 20:15:50 -04:00
if ( OdyseeVideo ) {
LBRYUploadType := " Video "
Gosub , LBRYVideoUpload
}
2023-09-16 23:32:37 -04:00
2023-07-29 20:15:50 -04:00
if ( OdyseeAudio ) {
LBRYUploadType := " Audio "
Gosub , LBRYAudioUpload
}
2023-02-12 17:34:03 -05:00
2023-09-16 23:32:37 -04:00
if ( Rumble )
Gosub , RumbleUpload
2023-02-12 17:34:03 -05:00
2023-09-16 23:32:37 -04:00
if ( Brighteon )
Gosub , BrighteonUpload
if ( DailyMotion )
Gosub , DailyMotionUpload
2023-02-12 17:34:03 -05:00
2023-07-29 20:15:50 -04:00
; grab the LBRY Video/Audio URLs
if ( OdyseeVideo ) {
LBRYUploadType := " Video "
Gosub , LBRYGetURL
}
if ( OdyseeAudio ) {
LBRYUploadType := " Audio "
Gosub , LBRYGetURL
}
2023-02-12 17:34:03 -05:00
2023-09-21 00:44:20 -04:00
if ( LocalsGrabURL ) {
2023-09-16 23:32:37 -04:00
Gosub , LocalsGrabURL
}
2024-01-16 06:35:42 -05:00
; // Upload to Sites
; ------------------------------------------------
2024-05-21 21:25:31 -04:00
if ( URLOfLastErrorPage ) {
2023-09-16 23:32:37 -04:00
Message = Activating Tab of last failed post .
SaveOrPostProgress ( Message := Message , PostType := " Tooltip " )
2023-02-12 17:34:03 -05:00
2023-09-16 23:32:37 -04:00
; @todo: replaceme with working funciton to activate tab
; FindAndActivateTab(URLOfLastErrorPage)
2023-02-17 00:29:41 -05:00
}
2023-09-16 23:32:37 -04:00
CurrentSite := " "
2023-02-12 17:34:03 -05:00
2023-09-16 23:32:37 -04:00
if ( URLOfLastErrorPage )
2023-02-12 17:34:03 -05:00
Message = Video Uploading Finished WITH Some Failures
2023-09-16 23:32:37 -04:00
else ,
Message = All Videos Uploaded Successfully
2023-02-12 17:34:03 -05:00
2024-05-21 21:25:31 -04:00
if ( DiscordPingOnCompletion )
2023-02-12 17:34:03 -05:00
Message = < @ %DiscordUsernameID% > : %Message%
else ,
Message = %Message%
SaveOrPostProgress ( Message := Message , PostType := " Tooltip,ErrorLoggingTextFile,DiscordErrorLogging " )
2023-09-21 20:50:06 -04:00
2024-01-16 06:35:42 -05:00
; Read Info for Results Window GUI
; ------------------------------------------------
DisplayResults:
2023-02-12 17:34:03 -05:00
Tooltip ; Remove all tooltips
2023-09-17 14:26:44 -04:00
Gui , Destroy ; destroy GUI in case we're going from the main screen to results without uploading.
IniRead , MouseClicksSaved , %SettingsIniFilepath% , General , MouseClicksSaved , %A_Space%
2023-02-12 17:34:03 -05:00
IniRead , TotalVideosUploaded , %SettingsIniFilepath% , General , TotalVideosUploaded , %A_Space%
IniRead , BitChuteURL , %VideoLinksIniFile% , URLs , BitChuteURL , %A_Space%
IniRead , OdyseeVideoURL , %VideoLinksIniFile% , URLs , OdyseeVideoURL , %A_Space%
IniRead , OdyseeVideoThumb , %VideoLinksIniFile% , Misc , OdyseeVideoThumb , %A_Space%
OdyseeVideoThumb := StrReplace ( OdyseeVideoThumb , " Thumb: " , " " )
IniRead , OdyseeAudioURL , %VideoLinksIniFile% , URLs , OdyseeAudioURL , %A_Space%
IniRead , OdyseeAudioThumb , %VideoLinksIniFile% , Misc , OdyseeAudioThumb , %A_Space%
OdyseeAudioThumb := StrReplace ( OdyseeAudioThumb , " Thumb: " , " " )
IniRead , LocalsURL , %VideoLinksIniFile% , URLs , LocalsURL , %A_Space%
IniRead , RumbleURL , %VideoLinksIniFile% , URLs , RumbleURL , %A_Space%
IniRead , BrighteonURL , %VideoLinksIniFile% , URLs , BrighteonURL , %A_Space%
IniRead , DailyMotionURL , %VideoLinksIniFile% , URLs , DailyMotionURL , %A_Space%
IniRead , PodcastNumber , %VideoLinksIniFile% , Misc , PodcastNumber , %A_Space%
if ( PodcastNumber = " " ) {
SplitPath , VideoFilepath , , , , VideoNameNoExt
; Remove the FDR_#### from video title for LBRY URL
if ( InStr ( VideoNameNoExt , " FDR_ " ) ) {
FoundPos := InStr ( VideoNameNoExt , " _ " , , , 2 ) ; get position of second instance of an "_"
if ( FoundPos < 11 ) {
; FoundPos += 1
; Msgbox % "FoundPos: " FoundPos
PodcastNumber := SubStr ( VideoNameNoExt , 1 , FoundPos )
PodcastNumber := StrReplace ( PodcastNumber , " FDR " , " " )
PodcastNumber := StrReplace ( PodcastNumber , " _ " , " " )
; Msgbox % "PodcastNumber: " PodcastNumber
}
}
}
2024-01-16 06:35:42 -05:00
; Show Results GUI Window
; ------------------------------------------------
2024-05-21 21:25:31 -04:00
gosub , SetGUIVariables
gosub , SetAndShowResultsGUI
; #include %A_scriptDir%\Modules\GUI-Results-Window.ahk
2023-02-12 17:34:03 -05:00
SaveCurrentChromeVersionToIniFile ( )
Return
2024-05-21 21:25:31 -04:00
; GoTo's
; ------------------------------------------------
SubmitScheduler:
Gui , Submit
; format and combine date and time
FormatTime , ScheduledDateOnly , %ScheduledDate% , yyyyMMdd
FormatTime , ScheduledTimeOnly , %ScheduledTime% , HHmmss
TimeStamp := ScheduledDateOnly . ScheduledTimeOnly
; create schedule post ini file
ScheduleFileFilepath = %A_scriptDir% / Scheduled - Posts
if ( ! FileExist ( ScheduleFileFilepath ) ) {
FileCreateDir , %ScheduleFileFilepath%
}
ScheduleFileFilepath = %ScheduleFileFilepath% \%TimeStamp% . ini
IniWrite , %TimeStamp% , %ScheduleFileFilepath% , Schedule - Info , Timestamp
IniWrite , %BodyTextFilePath% , %ScheduleFileFilepath% , Schedule - Info , ProjectFilepath
IniWrite , Video , %ScheduleFileFilepath% , Schedule - Info , PostType
IniWrite , %VideoTitle% , %ScheduleFileFilepath% , Schedule - Info , Title
; Generate variable with each of the checked ON sites
( B i t C h u t e ) ? ( V i d e o S i t e s . = " B i t c h u t e " . " | " ) : ( )
( L o c a l s ) ? ( V i d e o S i t e s . = " L o c a l s " . " | " ) : ( )
( O d y s e e V i d e o ) ? ( V i d e o S i t e s . = " O d y s e e V i d e o " . " | " ) : ( )
( O d y s e e A u d i o ) ? ( V i d e o S i t e s . = " O d y s e e A u d i o " . " | " ) : ( )
( B r i g h t e o n ) ? ( V i d e o S i t e s . = " B r i g h t e o n " . " | " ) : ( )
( D a i l y M o t i o n ) ? ( V i d e o S i t e s . = " D a i l y M o t i o n " . " | " ) : ( )
( R u m b l e ) ? ( V i d e o S i t e s . = " R u m b l e " . " | " ) : ( )
IniWrite , %VideoSites% , %ScheduleFileFilepath% , Schedule - Info , Sites
2024-06-08 18:26:22 -04:00
if ( ! FileExist ( PostSchedulerFilepath ) ) {
gosub , UpdatePostScheduler
}
else ,
run , %PostSchedulerFilepath%
2024-05-21 21:25:31 -04:00
Return
2023-02-12 17:34:03 -05:00
OpenLBRYBlobFilesFolder:
2023-09-16 23:32:37 -04:00
try ,
2023-02-12 17:34:03 -05:00
run , C : \Users \%A_UserName% \AppData \Local \lbry \lbrynet \blobfiles
2023-09-16 23:32:37 -04:00
catch e {
msgbox , Unable to open lbrynet blobfiles folder . `n Is LBRY installed ?
}
2023-02-12 17:34:03 -05:00
Return
StartSocialMediaPoster:
; IniRead, SocialMediaPosterFilepath, %SettingsIniFilepath%, General, FDRRadioUN, %A_Space%
IniRead , SocialMediaPosterFilepath , %SettingsIniFilepath% , SocialMediaPoster , SocialMediaPosterFilepath , %A_Space%
2024-05-21 21:25:31 -04:00
if ( ! SocialMediaPosterFilepath or ! FileExist ( SocialMediaPosterFilepath ) ) {
2023-02-12 17:34:03 -05:00
OnMessage ( 0x44 , " OnMsgBoxSocialMediaPoster " )
2023-09-20 20:45:57 -04:00
MsgBox 0x21 , Filepath Not Found , Unable to find filepath for Social Media Poster `n Would you like to add it ?
2023-02-12 17:34:03 -05:00
OnMessage ( 0x44 , " " )
IfMsgBox OK , {
2023-09-16 23:32:37 -04:00
FileSelectFile , SocialMediaPosterFilepath , , , Please Select Social Media Poster Filepath
2023-02-12 17:34:03 -05:00
if ( ErrorLevel )
Return
2023-09-20 20:45:57 -04:00
if ( ! InStr ( SocialMediaPosterFilepath , " .exe " ) )
Return
2023-02-12 17:34:03 -05:00
} Else IfMsgBox Cancel , {
Return
}
2024-05-21 21:25:31 -04:00
IniWrite , %SocialMediaPosterFilepath% , %SettingsIniFilepath% , Filepaths , SocialMediaPosterFilepath
2023-02-12 17:34:03 -05:00
}
run , %SocialMediaPosterFilepath% " %VideoLinksIniFile% "
Return
2023-09-16 23:32:37 -04:00
/*
* /
2023-02-12 17:34:03 -05:00
2024-01-16 06:35:42 -05:00
; Copy Info from GUI to Clipboard
; ------------------------------------------------
; @todo: this can be converted into 1 gosub, with if/else statements based on the button clicked
2024-04-16 22:17:15 -04:00
CopyPodcastTranscriptURL:
Clipboard := PodcastTranscriptURL
Message := PodcastTranscriptURL . " `n Copied to Clipboard "
SaveOrPostProgress ( Message := Message , PostType := " Tooltip,ErrorLoggingTextFile " )
2023-09-16 23:32:37 -04:00
sleep , 1000
ToolTip
Return
2023-02-12 17:34:03 -05:00
2023-09-16 23:32:37 -04:00
CopyVideoTitle:
Clipboard := VideoTitle
SaveOrPostProgress ( Message := VideoTitle " `n Copied to Clipboard " , PostType := " Tooltip,ErrorLoggingTextFile " )
sleep , 1000
ToolTip
Return
2023-02-12 17:34:03 -05:00
2023-09-16 23:32:37 -04:00
CopyBitChuteURL:
Clipboard := BitChuteURL
SaveOrPostProgress ( Message := BitChuteURL " `n Copied to Clipboard " , PostType := " Tooltip,ErrorLoggingTextFile " )
sleep , 1000
ToolTip
Return
2023-02-12 17:34:03 -05:00
2023-09-16 23:32:37 -04:00
CopyBrighteonURL:
Clipboard := BrighteonURL
SaveOrPostProgress ( Message := BrighteonURL " `n Copied to Clipboard " , PostType := " Tooltip,ErrorLoggingTextFile " )
sleep , 1000
ToolTip
Return
2023-02-12 17:34:03 -05:00
2023-09-16 23:32:37 -04:00
CopyDailyMotionURL:
Clipboard := DailyMotionURL
SaveOrPostProgress ( Message := DailyMotionURL " `n Copied to Clipboard " , PostType := " Tooltip,ErrorLoggingTextFile " )
sleep , 1000
ToolTip
Return
2023-02-12 17:34:03 -05:00
2023-09-16 23:32:37 -04:00
CopyOdyseeVideoURL:
Clipboard := OdyseeVideoURL
SaveOrPostProgress ( Message := OdyseeVideoURL " `n Copied to Clipboard " , PostType := " Tooltip,ErrorLoggingTextFile " )
sleep , 1000
ToolTip
Return
2023-02-12 17:34:03 -05:00
2023-09-16 23:32:37 -04:00
CopyOdyseeAudioURL:
Clipboard := OdyseeAudioURL
SaveOrPostProgress ( Message := OdyseeAudioURL " `n Copied to Clipboard " , PostType := " Tooltip,ErrorLoggingTextFile " )
sleep , 1000
ToolTip
Return
2023-02-12 17:34:03 -05:00
2023-09-16 23:32:37 -04:00
CopyRumbleURL:
Clipboard := RumbleURL
SaveOrPostProgress ( Message := RumbleURL " `n Copied to Clipboard " , PostType := " Tooltip,ErrorLoggingTextFile " )
sleep , 1000
ToolTip
Return
2023-02-12 17:34:03 -05:00
CopyVideoTags:
Clipboard := VideoTags
SaveOrPostProgress ( Message := VideoTags " `n Copied to Clipboard " , PostType := " Tooltip,ErrorLoggingTextFile " )
sleep , 1000
ToolTip
Return
CopyPodcastTags:
Clipboard := PodcastTags
SaveOrPostProgress ( Message := PodcastTags " `n Copied to Clipboard " , PostType := " Tooltip,ErrorLoggingTextFile " )
sleep , 1000
ToolTip
Return
CopyVideoDescription:
Clipboard := VideoDescription
SaveOrPostProgress ( Message := " Video Description`nCopied to Clipboard " , PostType := " Tooltip,ErrorLoggingTextFile " )
sleep , 1000
ToolTip
Return
; @todo: Add thumbnail status to this
; @todo: add podcast tags to this
UpdateINI:
2024-04-17 14:13:39 -04:00
IniWrite , %UnauthorizedTVURL% , %VideoLinksIniFile% , URLs , UnauthorizedTVURL
2024-04-16 22:17:15 -04:00
IniWrite , %PodcastTranscriptURL% , %VideoLinksIniFile% , URLs , PodcastTranscriptURL
2023-02-12 17:34:03 -05:00
IniWrite , %VideoTitle% , %VideoLinksIniFile% , Misc , VideoTitle
2023-09-16 23:32:37 -04:00
IniWrite , %LocalsURL% , %VideoLinksIniFile% , URLs , LocalsURL
IniWrite , %RumbleURL% , %VideoLinksIniFile% , URLs , RumbleURL
IniWrite , %DailyMotionURL% , %VideoLinksIniFile% , URLs , DailyMotionURL
IniWrite , %BrighteonURL% , %VideoLinksIniFile% , URLs , BrighteonURL
IniWrite , %BitChuteURL% , %VideoLinksIniFile% , URLs , BitChuteURL
2023-02-12 17:34:03 -05:00
2023-09-16 23:32:37 -04:00
; LBRY/Odysee:
2023-02-12 17:34:03 -05:00
IniWrite , %LBRYVideoURL% , %VideoLinksIniFile% , URLs , LBRYVideoURL
IniWrite , %LBRYAudioURL% , %VideoLinksIniFile% , URLs , LBRYAudioURL
IniWrite , %OdyseeVideoURL% , %VideoLinksIniFile% , URLs , OdyseeVideoURL
OdyseeVideoThumb := StrReplace ( OdyseeVideoThumb , " Thumb: " , " " )
IniWrite , %OdyseeVideoThumb% , %VideoLinksIniFile% , Misc , OdyseeVideoThumb
IniWrite , %OdyseeAudioURL% , %VideoLinksIniFile% , URLs , OdyseeAudioURL
OdyseeAudioThumb := StrReplace ( OdyseeAudioThumb , " Thumb: " , " " )
IniWrite , %OdyseeAudioThumb% , %VideoLinksIniFile% , Misc , OdyseeAudioThumb
if ( VideoDescription != OriginalVideoDescription ) {
VideoBodyFilepath = %VideoFolderDir% \body . txt
FileDelete , %VideoBodyFilepath%
FileAppend , %VideoDescription% , %VideoBodyFilepath%
}
if ( PodcastTags != OriginalPodcastTags ) {
PodcastTagsFilepath = %VideoFolderDir% \keywords_podcast . txt
FileDelete , %PodcastTagsFilepath%
FileAppend , %PodcastTags% , %PodcastTagsFilepath%
}
msgbox , 4096 , Updated ! , VideoLinks . ini file updated with any edits that you 've made . `n `n %VideoLinksIniFile%
Return
RetryUpload:
run , " %A_ScriptFullPath% " " LastPost "
ExitApp
ReloadToResults:
run , " %A_ScriptFullPath% " " ShowResults "
ExitApp
SendErrorLoggingThroughTelegram:
2024-01-16 06:35:42 -05:00
msgbox , I don 't do nothin atm
2023-02-12 17:34:03 -05:00
Return
2023-09-16 21:37:26 -04:00
; Post-To-Telegram
;------------------------------------------------
#Include %A_ScriptDir% \Modules \Post - To - Telegram . ahk
2023-09-16 23:32:37 -04:00
; Post-Video-To-Telegram
;------------------------------------------------
#Include %A_ScriptDir% \Modules \Post - Video - To - Telegram . ahk
2023-09-16 21:37:26 -04:00
; Post-To-Discord
;------------------------------------------------
#Include %A_ScriptDir% \Modules \Post - To - Discord . ahk
2023-08-20 00:08:15 -04:00
; BitChute
;------------------------------------------------
#Include %A_ScriptDir% \Modules \Bitchute - Upload . ahk
2023-02-17 00:29:41 -05:00
2023-08-20 00:08:15 -04:00
; Brighteon
;------------------------------------------------
#Include %A_ScriptDir% \Modules \Brighteon - Upload . ahk
2023-02-17 00:29:41 -05:00
2023-08-20 00:08:15 -04:00
; DailyMotion
;------------------------------------------------
#Include %A_ScriptDir% \Modules \DailyMotion - Upload . ahk
2023-02-17 00:29:41 -05:00
2023-08-20 00:08:15 -04:00
; LBRY
;------------------------------------------------
#Include %A_ScriptDir% \Modules \LBRY - Upload . ahk
2023-02-17 00:29:41 -05:00
2023-08-20 00:08:15 -04:00
; Rumble
;------------------------------------------------
#Include %A_ScriptDir% \Modules \Rumble - Upload . ahk
2023-02-17 00:29:41 -05:00
2023-08-20 00:08:15 -04:00
; Locals
;------------------------------------------------
#Include %A_ScriptDir% \Modules \Locals - Upload . ahk
2023-02-17 00:29:41 -05:00
2023-08-20 00:08:15 -04:00
; Podcast
;------------------------------------------------
#Include %A_ScriptDir% \Modules \Podcast - Upload . ahk
2023-02-17 00:29:41 -05:00
2024-05-09 15:33:22 -04:00
; Update Functionality
; ------------------------------------------------
2024-05-21 21:25:31 -04:00
#Include %A_ScriptDir% \Lib \Freedomain - Posters - Shared - Functions \Shared - GoTos . ahk
2024-06-21 22:50:44 -04:00
; Special Website Functions
; ------------------------------------------------
#Include %A_ScriptDir% \Lib \Freedomain - Posters - Shared - Functions \Locals - Functions . ahk
2024-05-21 21:25:31 -04:00
; GUI Windows
; ------------------------------------------------
#include C : \Users \%A_Username% \Syncthing \Git \Freedomain - Video - Uploader \Modules \GUI - Main - Window . ahk