UploadPodcast: ;------------------------------------------------ CurrentSite := "Podcast" PodcastTags := StrReplace(PodcastTags, " ,", ",") PodcastTags := StrReplace(PodcastTags, ", ", ",") PodcastTags := StrReplace(PodcastTags, " ", "-") PodcastTags := StrReplace(PodcastTags, "--", "-") PodcastTags := StrReplace(PodcastTags, "--", "-") ; Msgbox % "PodcastTags: " PodcastTags Message = Starting Podcast Upload SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") IniRead, FDRRadioURL, %SettingsIniFilepath%, General, FDRRadioURL, %A_Space% if(FDRRadioURL = ""){ Message = FDRRadioURL is blank.`nPlease add URL to Settings.ini file under:`n`n[General]`nFDRRadioURL= SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") MsgBox 0x10,, %Message% Return } if(!InStr(FDRRadioURL, "/Podcasts/New")){ Message = FDRRadioURL is not formatted properly. Please make sure it ends with "https://....../manage/#/Podcasts/New" SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") } IniRead, Username, %SettingsIniFilepath%, General, FDRRadioUN, %A_Space% IniRead, Password, %SettingsIniFilepath%, General, FDRRadioPW, %A_Space% if(Username = "" or Password = ""){ Message = Username and/or Password are blank.`nPlease add Login to Settings.ini file under:`n`n[General]`nFDRRadioUN=`nFDRRadioPW= SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") } if(MP3AudioFilepath = ""){ MsgBox 0x33, Unable to Upload Podcast, No MP3 File Was Found/Selected. `nWould you like to select one now? IfMsgBox Yes, { FileSelectFile, MP3AudioFilepath,, %RootDirToStartIn%, Please Select MP3 File if(ErrorLevel) Return } Else IfMsgBox No, { Return } Else IfMsgBox Cancel, { Return } } /* Sublime Indentation Reset */ if(!InStr(MP3AudioFilepath, ".mp3")){ Message = Unable to upload podcast, no mp3 file was selected. MsgBox 0x40, Error, %Message% Return } ; Message = Grabbing MP3 file data ; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") ; https://www.autohotkey.com/boards/viewtopic.php?t=59882 Message = Calculating MP3 File Size and Length SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") Obj := Filexpro(MP3AudioFilepath,, , "Length" , "Size" ) MP3AudioFilesize := obj["Size"] MP3AudioLength := obj["Length"] ; MsgBox % obj["Size"] AudioLengthArray := StrSplit(MP3AudioLength,":") Message = MP3 Audio Length: %MP3AudioLength% SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging") ; AudioLength_Seconds := ((AudioLengthArray[1] * 60 ) * 60) + (AudioLengthArray[2] * 60) + AudioLengthArray[3] ; Message = MP3 Audio Length in Seconds: %AudioLength_Seconds% ; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") AudioLength_Hours := AudioLengthArray[1] AudioLength_Minutes := AudioLengthArray[2] AudioLength_Seconds := AudioLengthArray[3] ; Message = AudioLength_Hours: %AudioLength_Hours%`nAudioLength_Minutes: %AudioLength_Minutes%`nAudioLength_Seconds: %AudioLength_Seconds% ; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") ; AudioLength_SecondsOriginal := AudioLength_Seconds ; AudioLength_Seconds := (AudioLength_Minutes * 60) + ((AudioLength_Hours * 60) * 60) + AudioLength_Seconds ; Msgbox % "AudioLength_Hours: " AudioLength_Hours ; Msgbox % "AudioLength_Minutes: " AudioLength_Minutes ; Msgbox % "AudioLength_Seconds: " AudioLength_Seconds ; Msgbox % "AudioLength_SecondsOriginal: " AudioLength_SecondsOriginal FileGetSize, OutputVar, %MP3AudioFilepath%, K ; Retrieve the size in Kbytes. FIlesizeInBytes := OutputVar * 1024 Message = Inputting Podcast Information SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") Status := NavigateFromBaseURLTo(FDRRadioURL) if(Status) Return Status := CheckForAlerts() if(Status){ } Message = Logging in SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") Xpath = //input[@id='email'] Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=Username) if(!Status){ ; if inputting email did NOT fail, then we are on the login page, input the password and then click login. Xpath = //input[@id='password'] Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=Password) Xpath = //a[@id='loginButton'] Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding sleep, 2000 try driver.Get(FDRRadioURL) ;Open selected URL catch e { Message = Upload Failed (E#7295)`nUnable to Navigate to Upload Page`nChrome was closed or Internet down possibly? SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") } } Message = Checking URL for /Podcasts/New string SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") try, CurrentURL := driver.url() if(!InStr(CurrentURL, "/Podcasts/New")){ Message = Re-Navigating to /Podcast/new URL SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") try driver.Get(FDRRadioURL) } Message = Waiting for Page to Load SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") Xpath = //input[@id='num'] Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=60,SleepLength:=1000) if(Status){ Message = New Podcast Page did not load after 60 seconds. Check Login Status SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") Return } Message = Inputting Podcast Info SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") ; Click the "Is Active?" Checkbox Xpath = //input[@id='isActive'] Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) ; Input Podcast Number Xpath = //input[@id='num'] Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=PodcastNumber) ; Input Podcast Title Xpath = //input[@id='title'] Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=VideoTitle) ; INput Audio URL Xpath = //input[@id='url-audio'] SplitPath, MP3AudioFilepath, MP3AudioNameWithExt Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=MP3AudioNameWithExt) ; INput thumbnail URL Xpath = //input[@id='url-thumbnail'] SplitPath, VideoThumbFilepath, VideoThumbnailFilenameWithExt ThumbnailURL = https://cdn.freedomainradio.com/%VideoThumbnailFilenameWithExt% Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=ThumbnailURL) ; Input BitChute URL Xpath = //input[@id='url-bitchute'] Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=BitChuteURL) ; Input Brighteon URL Xpath = //input[@id='url-brighteon'] Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=BrighteonURL) ; Input DailyMotion URL Xpath = //input[@id='url-dailymotion'] Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=DailyMotionURL) ; Input LBRY URL Xpath = //input[@id='url-lbry'] Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=OdyseeVideoURL) ; Input LBRY URL Xpath = //input[@id='url-locals'] Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=LocalsURL) ; Input Rumble URL Xpath = //input[@id='url-rumble'] Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=RumbleURL) ; Soundcloud but actually LBRY Audio URL Xpath = //input[@id='url-lbry-audio'] Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=OdyseeAudioURL) ; INput filesize Xpath = //input[@id='fileSize'] Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=FIlesizeInBytes) Xpath = //input[@id='lengthHours'] Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=AudioLength_Hours) Xpath = //input[@id='lengthMinutes'] Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=AudioLength_Minutes) Xpath = //input[@id='lengthSeconds'] Status := Selenium_LoopToSendValueToXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000,StringTextContent:=AudioLength_Seconds) ; Message = Audio Length in Seconds that got input: %AudioLength_Seconds% ; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging") Message = Inputting Description SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") Xpath = //textarea[@id='description'] Status := Selenium_LoopToClickXpath(Xpath:=Xpath,NumOfLoops:=2,SleepLength:=1000) ; Input Description JSVideoDescription := FormatTextToJSText(VideoDescription) js = document.getElementById('description').value = "%JSVideoDescription%"; try driver.executeScript(js) ;Executes a Javascript on the webpage, mostly used for buttons. Message = Inputting Tags SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile") Podcasttags := StrReplace(Podcasttags, " , ", ",") Podcasttags := StrReplace(Podcasttags, " ,", ",") Podcasttags := StrReplace(Podcasttags, ", ", ",") ArrayOfPodcastTags := StrSplit(Podcasttags,",") LengthOfArrayOfPodcastTags := ArrayOfPodcastTags.Length() ; Save total number of items in the array try pagehtml := driver.pagesource ; Msgbox % "pagehtml: " pagehtml Loop, %LengthOfArrayOfPodcastTags% { Tag := ArrayOfPodcastTags[A_Index] ; find value from position in array SpanID = title">%Tag%