You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
149 lines
6.0 KiB
Plaintext
149 lines
6.0 KiB
Plaintext
7 months ago
|
|
||
|
CheckLBRYProcess(){
|
||
|
; Check if LBRY Process exists
|
||
|
Process, Exist,LBRY.exe
|
||
|
if(ErrorLevel = 0) ; if doesn't exist
|
||
|
{
|
||
|
Message = Not Running. Starting up LBRY.exe
|
||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||
|
|
||
|
LBRYExeFilepath = C:\Program Files\LBRY\LBRY.exe
|
||
|
if(!FileExist(LBRYExeFilepath)){
|
||
|
Message = Failed to Find LBRY.exe executable. LBRY not installed?
|
||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||
|
Return
|
||
|
}
|
||
|
|
||
|
Message = Checking LBRY daemon_settings.yml file for Odysee Wallet Servers
|
||
|
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile,DiscordErrorLogging")
|
||
|
|
||
|
; FileRead, daemon_settingsFileContent, C:\Users\%A_UserName%\AppData\Local\lbry\lbrynet\daemon_settings.yml
|
||
|
|
||
|
; if(!InStr(daemon_settingsFileContent, "a-hub1.odysee.com")){
|
||
|
; Message = Odysee wallet server is not in daemon_settings.yml. Replacing File with required settings.
|
||
|
; SaveOrPostProgress(Message:=Message,PostType:=",DiscordErrorLogging")
|
||
|
|
||
|
; LBRYDaemonSettingsFP = C:\Users\%A_UserName%\AppData\Local\lbry\lbrynet\daemon_settings.yml
|
||
|
; LBRYDaemonSettingsBackupFP = C:\Users\%A_UserName%\AppData\Local\lbry\lbrynet\daemon_settings_BU.yml
|
||
|
|
||
|
|
||
|
; ; Msgbox % "daemon_settingsText: " daemon_settingsText
|
||
|
; FileMove, %LBRYDaemonSettingsFP%, %LBRYDaemonSettingsBackupFP%, 1 ; Dest [, Flag (1 = overwrite)]
|
||
|
|
||
|
; UrlDownloadToFile, https://freedomain.dev/yuriy/video-uploader/raw/branch/main/Assets/daemon_settings.yml , %LBRYDaemonSettingsFP%
|
||
|
|
||
|
; sleep, 1000
|
||
|
|
||
|
; if(!FileExist(LBRYDaemonSettingsFP)){
|
||
|
; Message = Failed to download the custom daemon_settings.yml file from git. Restoring Original File
|
||
|
; SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile,DiscordErrorLogging")
|
||
|
; FileMove,%LBRYDaemonSettingsBackupFP%,%LBRYDaemonSettingsFP%, 1
|
||
|
; }
|
||
|
; }
|
||
|
|
||
|
|
||
|
try run, "%LBRYExeFilepath%"
|
||
|
Message = Waiting 1 Minute for LBRY to start up
|
||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
|
||
|
Sleep, 60000 ; 1 minute
|
||
|
|
||
|
Process, Exist,LBRY.exe
|
||
|
if(ErrorLevel = 0) ; if doesn't exist
|
||
|
{
|
||
|
Message = Failed to Start LBRY.exe after 60 seconds of waiting
|
||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||
|
Return
|
||
|
}
|
||
|
WinMinimize, LBRY
|
||
|
}
|
||
|
Return
|
||
|
}
|
||
|
|
||
|
|
||
|
GetPermanentLBRYURL(UploadResult){
|
||
|
SingleQuotationmark = "
|
||
|
|
||
|
UploadResult := StrSplit(UploadResult, "`n") ; split results by new line
|
||
|
|
||
|
; Iterate through the array of the results
|
||
|
Loop % UploadResult.Length() {
|
||
|
PermanentURL := UploadResult[A_Index]
|
||
|
if(InStr(PermanentURL, "permanent_url"))
|
||
|
Break
|
||
|
}
|
||
|
|
||
|
; Starting Result: "permanent_url": "lbry://Test-Video-161-Numbered#c9ad9afe54c7178d6f870b59bbe129aef8efc3ff",
|
||
|
PermanentURL := StrSplit(PermanentURL, "lbry:")
|
||
|
PermanentURL := "lbry:" . PermanentURL[2]
|
||
|
PermanentURL := StrReplace(PermanentURL, ",", "")
|
||
|
PermanentURL := StrReplace(PermanentURL, SingleQuotationmark, "")
|
||
|
PermanentURL := StrReplace(PermanentURL, "`n", "")
|
||
|
PermanentURL := StrReplace(PermanentURL, "`r", "")
|
||
|
|
||
|
; End Result lbry://Test-Video-161-Numbered#c9ad9afe54c7178d6f870b59bbe129aef8efc3ff
|
||
|
Return PermanentURL
|
||
|
}
|
||
|
|
||
|
|
||
|
GetLBRYCanonicalURL(LBRYJSONObject){ ; input json string
|
||
|
; ResolveURL := StrSplit(LBRYResolveAPICommand, "lbry://")
|
||
|
; ResolveURL := "lbry://" . ResolveURL[2]
|
||
|
; StrReplace(Haystack, SearchText [, ReplaceText, OutputVarCount, Limit := -1])
|
||
|
LBRYPermanentURLJsonOBJ := StrReplace(LBRYJSONObject, LBRYPermanentURL, "LBRYPermanentURL")
|
||
|
; clipboard := LBRYPermanentURLJsonOBJ
|
||
|
; DevModeMsgBox(LBRYPermanentURLJsonOBJ)
|
||
|
|
||
|
try parsed := JSON.Load(LBRYPermanentURLJsonOBJ)
|
||
|
try LBRYCanonicalURL := parsed.LBRYPermanentURL.canonical_url
|
||
|
|
||
|
; DevModeMsgBox(LBRYCanonicalURL)
|
||
|
|
||
|
if(LBRYCanonicalURL = ""){
|
||
|
Return "" ; return blank
|
||
|
}
|
||
|
|
||
|
; otherwise return the LBRY url
|
||
|
LBRYCanonicalURL := StrReplace(LBRYCanonicalURL, "lbry://", "https://lbry.tv/")
|
||
|
Return LBRYCanonicalURL
|
||
|
}
|
||
|
|
||
|
|
||
|
LBRYCMDTextReplacement(LBRYURLSlug){
|
||
|
SingleQUote = "
|
||
|
LBRYURLSlug := StrReplace(LBRYURLSlug, " ", "_") ; replace all spaces with dashes
|
||
|
LBRYURLSlug := StrReplace(LBRYURLSlug, ":", "_") ; replace all colons with dashes
|
||
|
LBRYURLSlug := StrReplace(LBRYURLSlug, ",", "_") ; replace all colons with dashes
|
||
|
LBRYURLSlug := StrReplace(LBRYURLSlug, "?", "") ; replace all colons with dashes
|
||
|
LBRYURLSlug := StrReplace(LBRYURLSlug, "!", "") ; replace all colons with dashes
|
||
|
LBRYURLSlug := StrReplace(LBRYURLSlug, "`;", "_") ; replace all colons with dashes
|
||
|
LBRYURLSlug := StrReplace(LBRYURLSlug, "/", "_") ; replace all colons with dashes
|
||
|
; LBRYURLSlug := StrReplace(LBRYURLSlug, "?", "") ; replace all colons with dashes
|
||
|
LBRYURLSlug := StrReplace(LBRYURLSlug, "<", "_") ; replace all colons with dashes
|
||
|
LBRYURLSlug := StrReplace(LBRYURLSlug, ">", "_") ; replace all colons with dashes
|
||
|
LBRYURLSlug := StrReplace(LBRYURLSlug, SingleQUote, "") ; replace all colons with dashes
|
||
|
LBRYURLSlug := StrReplace(LBRYURLSlug, "'", "") ; replace all colons with dashes
|
||
|
LBRYURLSlug := StrReplace(LBRYURLSlug, "=", "") ; replace all colons with dashes
|
||
|
LBRYURLSlug := StrReplace(LBRYURLSlug, ";", "") ; replace all colons with dashes
|
||
|
LBRYURLSlug := StrReplace(LBRYURLSlug, ")", "") ; replace all colons with dashes
|
||
|
LBRYURLSlug := StrReplace(LBRYURLSlug, "(", "") ; replace all colons with dashes
|
||
|
LBRYURLSlug := StrReplace(LBRYURLSlug, "___", "_") ; replace all colons with dashes
|
||
|
LBRYURLSlug := StrReplace(LBRYURLSlug, "__", "_") ; replace all colons with dashes
|
||
|
LBRYURLSlug := StrReplace(LBRYURLSlug, "__", "_") ; replace all colons with dashes
|
||
|
Return LBRYURLSlug
|
||
|
}
|
||
|
|
||
|
GetLBRYAPIErrorFromString(UploadResult){
|
||
|
UploadResultArray := StrSplit(UploadResult, "message")
|
||
|
LBRYAPIError := UploadResultArray[2]
|
||
|
; LBRYAPIErrorStrLen := StrLen(LBRYAPIError)
|
||
|
|
||
|
; LBRYAPIErrorStrToTrim := LBRYAPIErrorStrLen - 3
|
||
|
; Msgbox % "LBRYAPIErrorStrToTrim: " LBRYAPIErrorStrToTrim
|
||
|
LBRYAPIError := SubStr(LBRYAPIError, 4)
|
||
|
LBRYAPIError := StrReplace(LBRYAPIError, "}", "")
|
||
|
|
||
|
|
||
|
; Msgbox % "LBRYAPIError: " LBRYAPIError
|
||
|
Return LBRYAPIError
|
||
|
|
||
|
}
|