Skip to content

Instantly share code, notes, and snippets.

@PSingletary
Last active October 19, 2024 17:31
Show Gist options
  • Save PSingletary/bda562902bf6bf8c0f105adfac376121 to your computer and use it in GitHub Desktop.
Save PSingletary/bda562902bf6bf8c0f105adfac376121 to your computer and use it in GitHub Desktop.
OBS-bootstrapper

OBS-Bootstrapper

Goal : Get a basic install of OBS up and running for New Users

# Function to check and install Python
function Install-Python {
if (-not (Get-Command python -ErrorAction SilentlyContinue)) {
Write-Output "Python not found. Installing..."
$pythonInstaller = "https://www.python.org/ftp/python/3.10.2/python-3.10.2-amd64.exe"
$installerPath = "$env:TEMP\python-installer.exe"
Invoke-WebRequest -Uri $pythonInstaller -OutFile $installerPath
Start-Process -FilePath $installerPath -ArgumentList '/quiet InstallAllUsers=1 PrependPath=1' -NoNewWindow -Wait
Remove-Item $installerPath
Write-Output "Python installed."
} else {
Write-Output "Python is already installed."
}
}
# Function to check and install OBS
function Install-OBS {
if (-not (Get-Command obs64 -ErrorAction SilentlyContinue)) {
Write-Output "OBS not found. Installing..."
$obsInstaller = "https://cdn-fastly.obsproject.com/downloads/OBS-Studio-27.1.3-Full-Installer-x64.exe"
$installerPath = "$env:TEMP\obs-installer.exe"
Invoke-WebRequest -Uri $obsInstaller -OutFile $installerPath
Start-Process -FilePath $installerPath -ArgumentList '/S' -NoNewWindow -Wait
Remove-Item $installerPath
Write-Output "OBS installed."
} else {
Write-Output "OBS is already installed."
}
}
# Function to fetch and cache plugins
function Get-Plugins {
$cacheFilePath = "$env:USERPROFILE\OneDrive\obs_plugins_cache.txt"
if (Test-Path $cacheFilePath) {
$lastQuery = Get-Item $cacheFilePath | Select-Object -ExpandProperty LastWriteTime
if ($lastQuery -lt (Get-Date).AddDays(-1)) {
# Fetch new data
}
} else {
# Fetch new data
}
Write-Output "Plugins fetched and cached."
}
# Function to display and select plugins
function Select-Plugins {
# Present paginated menu for selection
Write-Output "Presenting paginated menu for plugin selection..."
}
# Function to update plugins
function Update-Plugins {
# Perform plugin updates
Write-Output "Updating plugins..."
}
# Main Script
Install-Python
Install-OBS
Get-Plugins
Select-Plugins
Update-Plugins
#!/bin/bash
# Function to check and install Python
install_python() {
if ! command -v python3 &>/dev/null; then
echo "Python not found. Installing..."
sudo apt-get update
sudo apt-get install -y python3
echo "Python installed."
else
echo "Python is already installed."
fi
}
# Function to check and install OBS
install_obs() {
if ! command -v obs &>/dev/null; then
echo "OBS not found. Installing..."
sudo add-apt-repository -y ppa:obsproject/obs-studio
sudo apt-get update
sudo apt-get install -y obs-studio
echo "OBS installed."
else
echo "OBS is already installed."
fi
}
# Function to fetch and cache plugins
fetch_plugins() {
local cache_file="$HOME/OneDrive/obs_plugins_cache.txt"
if [ -f "$cache_file" ]; then
local last_query=$(stat -c %Y "$cache_file")
local current_time=$(date +%s)
local time_diff=$(( (current_time - last_query) / 86400 ))
if [ $time_diff -ge 1 ]; then
# Fetch new data
echo "Fetching new plugin data..."
# Add your data fetching logic here
fi
else
# Fetch new data
echo "Fetching plugin data for the first time..."
# Add your data fetching logic here
fi
echo "Plugins fetched and cached."
}
# Function to display and select plugins
select_plugins() {
# Present paginated menu for selection
echo "Presenting paginated menu for plugin selection..."
# Add your menu logic here
}
# Function to update plugins
update_plugins() {
# Perform plugin updates
echo "Updating plugins..."
# Add your update logic here
}
# Main script
install_python
install_obs
fetch_plugins
select_plugins
update_plugins
#!/bin/bash
# Function to check and install Python
function install_python() {
if ! command -v python3 &>/dev/null; then
echo "Python not found. Installing..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install python
echo "Python installed."
else
echo "Python is already installed."
fi
}
# Function to check and install OBS
function install_obs() {
if ! command -v obs &>/dev/null; then
echo "OBS not found. Installing..."
brew install --cask obs
echo "OBS installed."
else
echo "OBS is already installed."
fi
}
# Function to fetch and cache plugins
function fetch_plugins() {
local cache_file="$HOME/OneDrive/obs_plugins_cache.txt"
if [ -f "$cache_file" ]; then
local last_query=$(stat -f "%Sm" -t "%Y-%m-%d %H:%M:%S" "$cache_file")
local current_time=$(date "+%Y-%m-%d %H:%M:%S")
local time_diff=$(( ( $(date -j -f "%Y-%m-%d %H:%M:%S" "$current_time" "+%s") - $(date -j -f "%Y-%m-%d %H:%M:%S" "$last_query" "+%s") ) / 86400 ))
if [ $time_diff -ge 1 ]; then
# Fetch new data
echo "Fetching new plugin data..."
# Add your data fetching logic here
fi
else
# Fetch new data
echo "Fetching plugin data for the first time..."
# Add your data fetching logic here
fi
echo "Plugins fetched and cached."
}
# Function to display and select plugins
function select_plugins() {
# Present paginated menu for selection
echo "Presenting paginated menu for plugin selection..."
# Add your menu logic here
}
# Function to update plugins
function update_plugins() {
# Perform plugin updates
echo "Updating plugins..."
# Add your update logic here
}
# Main script
install_python
install_obs
fetch_plugins
select_plugins
update_plugins
@echo off
powershell -Command "Start-Process powershell -ArgumentList '-NoExit', '-Command', 'winget install --id Python.Python.3 -e'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment