ig we postin now

This commit is contained in:
PrincessPi committed 2026-10-26 05:02:19 -06:00
1 parent 586e8746be
commit ff76074355
12 files changed
+1019 -636

No files matched your search

-85
View File
@@ -1,85 +0,0 @@
param (
[Parameter(Mandatory = $true, Position = 0)]
[string]$Ext1,
[Parameter(Mandatory = $true, Position = 1)]
[string]$Ext2,
[int]$Jobs = 4 # Number of simultaneous conversions
)
$sourceExt = $Ext1.TrimStart('.')
$targetExt = $Ext2.TrimStart('.')
$audioExts = @('opus', 'ogg', 'flac', 'wav')
$files = Get-ChildItem -File -Recurse -Filter "*.$sourceExt"
if ($files.Count -eq 0) {
Write-Host "No files matching *.$sourceExt found." -ForegroundColor Yellow
return
}
Write-Host "Starting conversion using $Jobs parallel jobs..." -ForegroundColor Green
$files | ForEach-Object -Parallel {
$file = $_
$targetExt = $using:targetExt
$audioExts = $using:audioExts
$outputPath = Join-Path -Path $file.DirectoryName -ChildPath "$($file.BaseName).$targetExt"
$relativePath = Resolve-Path -Path $file.FullName -Relative
Write-Host "Processing: $relativePath" -ForegroundColor Cyan
if ($audioExts -contains $targetExt.ToLower()) {
ffmpeg -y -i $file.FullName -c:a libopus -b:a 128k -vbr on $outputPath 2>$null
} else {
# -preset 8 drastically speeds up SVT-AV1 while maintaining high quality
ffmpeg -y -i $file.FullName -c:v libsvtav1 -crf 26 -preset 8 -c:a libopus -b:a 128k $outputPath 2>$null
}
} -ThrottleLimit $Jobs
Write-Host "Finished processing $($files.Count) file(s)." -ForegroundColor Green
# -------------------------------------------------------------------------
# Step 1: Recursively delete all existing .sha256 files
# -------------------------------------------------------------------------
Write-Host "Deleting existing .sha256 files recursively..." -ForegroundColor Yellow
Get-ChildItem -Path . -Recurse -Filter "*.sha256" -File | Remove-Item -Force
# -------------------------------------------------------------------------
# Step 2: Run checksums in current directory and every subdirectory
# -------------------------------------------------------------------------
Write-Host "Generating checksums in each subfolder..." -ForegroundColor Cyan
# Gather current working directory and all child directories
$allDirs = @((Get-Item .).FullName) + (Get-ChildItem -Path . -Recurse -Directory | Select-Object -ExpandProperty FullName)
foreach ($dir in $allDirs) {
Push-Location $dir
try {
Write-Host "Updating checksums in: $dir" -ForegroundColor Gray
checksum * -o
} finally {
Pop-Location
}
}
# -------------------------------------------------------------------------
# Step 3: Recursively verify checksums in each directory
# -------------------------------------------------------------------------
Write-Host "Verifying checksums in each subfolder..." -ForegroundColor Cyan
foreach ($dir in $allDirs) {
Push-Location $dir
try {
if (Test-Path "checksums.sha256") {
Write-Host "Verifying: $dir" -ForegroundColor Gray
checksum -c checksums.sha256
}
} finally {
Pop-Location
}
}
Write-Host "All conversions, checksum creations, and verifications completed successfully." -ForegroundColor Green
-74
View File
@@ -1,74 +0,0 @@
# `pwsh.exe -c "`"C:\path\to\redundant-backup.ps1`" -logFile `"`" -simpleLogFile `"`""`
# `Start-Process -filepath "C:\path\to\redundant-backup.ps1" -logFile "" -simpleLogFile ""`
# `redundant-backup -logFile "" -simpleLogFile ""`
param([string] $logFile,
[string] $simpleLogFile
)
$startUnixSeconds = get-date -uformat "%s" # unix epoch seconds for duration
$startDateHuman = get-date # human readable begin date
$startDateFilename = get-date -format 'yyyy-MM-dd-hhmm' # filename friendly date format
$warningFile = "C:\Users\human\OneDrive\Desktop\backup_error_$startDateFilename.log" # file to create to notify of a failure
$jobName = "Weekly-Backup-$startDateFilename" # name for job in case wanna restart an interrupted one
$resticRunning = "E:\restic_backups_rolling" # from dir (restic)
$redundantLocal = "D:\restic_backups_redundancy_rolling" # to dir (local drive)
$redundantLocalNetwork = "R:\restics_backups_redundancy_rolling" # to dir (network mapped drive location)
$redundantAirGap = "S:\restic_backups_redundancy_rolling" # set backup usb to use S
$logGuideString = "Verb | Current Date and Time (Current Time Unix Seconds) | Start Date and Time (Start Time Unix Seconds) | Time Elapsed in Seconds | From Directory | To Directory | Job Name | Exit Status"
function appendToLog {
param([string]$verb="INFO", [string]$exitCode="NONE", [string]$log="$logFile", [string]$fromDir="NONE", [string]$toDir="NONE")
$timeCalc = $(Get-Date -uformat "%s")-$startUnixSeconds
# Verb | Current Date and Time (Current Time Unix Seconds) | Start Date and Time (Start Time Unix Seconds) | Time Elapsed in Seconds | From Directory | To Directory | Job Name | Exit Status
$logString = "$verb | $(Get-Date) ($(Get-Date -uformat "%s")) | $startDateHuman ($startUnixSeconds) | $timeCalc | $fromDir | $toDir | $jobName | $exitCode"
echo "$logString"
echo "$logString" >> "$log"
}
function appendToErrorLog {
param ( $exceptionMessage, $part )
$errorString = "`nFAIL on $part`nException: $exceptionMessage`nVars:`n`tstartDateHuman: $startDateHuman`n`tstart: $startUnixSecondsUnixSecons`n`tappendToErrorLog: $appendToErrorLog`n`tlogFile: $logFile`n`twarningFile: $warningFile`n`tresticRunning: $resticRunning`n`tredundantLocal: $redundantLocal`n`tredundantLocalNetwork: $redundantLocalNetwork`n`tjobName: $jobName"
echo "$errorString"
try { echo "$errorString" > "$warningFile" } catch { echo "Error: $warningFile Not Found" }
}
function doBackup {
param ( [string]$fromDir="NONE", [string]$toDir="NONE", [string]$tagString="INFO" )
echo "`n$tagString"
echo "`tFollow log with:`n`t`tGet-Content `"$logFile`" -Wait -Tail 10`n"
appendToLog -verb "START-$tagString" -log "$logFile" -toDir "$toDir" -fromDir "$fromDir"
robocopy "$fromDir" "$toDir" /E /Z /FP /NP /R:2 /W:1 /SAVE:"$jobString" /LOG+:"$logFile"
appendToLog -verb "FINISH-$tagString" -exitCode "$?" -log "$logFile" -toDir "$toDir" -fromDir "$fromDir"
}
echo "Initializing Logs"
touch "$runningFile"
echo "$logGuideString" > "$logFile"
appendToLog -verb "INITIALIZE-LOG-FILES" -exitCode "$?" -log "$logFile"
echo "`n$logGuideString`n"
# run da backupssss
doBackup -fromDir "$resticRunning" -toDir "$redundantLocal" -tagString "COPY-LOCAL" -jobString "$jobName" # local
appendToLog -verb "COPY-LOCAL" -exitCode "$?" -log "$logFile" -fromDir "$resticRunning" -toDir "$redundantLocal"
doBackup -fromDir "$resticRunning" -toDir "$redundantLocalNetwork" -tagString "COPY-LOCAL-NETWORK" -jobString "$jobName" # network
appendToLog -verb "COPY-LOCAL-NETWORK" -exitCode "$?" -log "$logFile" -fromDir "$resticRunning" -toDir "$redundantLocalNetwork"
doBackup -fromDir "$resticRunning" -toDir "$redundantAirGap" -tagString "COPY-AIRGAP" -jobString "$jobName" # airgap
appendToLog -verb "COPY-AIRGAP" -exitCode "$?" -log "$logFile" -fromDir "$resticRunning" -toDir "$redundantAirGap"
appendToLog -verb "DONE" -log "$logFile"
-11
View File
@@ -1,11 +0,0 @@
param(
[string]
$session = 'pi3'
)
while($True) {
ssh $session
echo "Waiting 5 Seconds..."
sleep 5
wait-on-host -hostname $session
}