Auto-update: Tue Jul 30 19:43:50 PDT 2024
This commit is contained in:
parent
2f4467362d
commit
221ea91328
26 changed files with 1 additions and 510 deletions
12
15
12
15
|
@ -1,12 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
tailscale="/Applications/Tailscale.app/Contents/MacOS/Tailscale"
|
||||
|
||||
if $tailscale status | grep -q "100."; then
|
||||
echo "Connected to Tailscale, SSH'ing to 100.64.64.30..."
|
||||
ssh sangye@100.64.64.30
|
||||
else
|
||||
echo "Not connected to Tailscale, SSH'ing to 10.13.37.30..."
|
||||
ssh sangye@10.13.37.30
|
||||
fi
|
||||
|
36
Summarizer
36
Summarizer
|
@ -1,36 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Endpoint URL
|
||||
endpoint="http://localhost:3456/summarize"
|
||||
|
||||
# Function to check if port 3456 is open
|
||||
is_port_open() {
|
||||
nc -z localhost 3456
|
||||
return $?
|
||||
}
|
||||
|
||||
# Check if the FastAPI server is running (port 3456)
|
||||
if ! is_port_open; then
|
||||
echo "Starting BananaPhone.py..."
|
||||
# Start the FastAPI server
|
||||
/Users/sij/AI/banana-phone/BananaPhone.sh &
|
||||
|
||||
# Wait for the server to start
|
||||
echo "Waiting for server to start..."
|
||||
until is_port_open; do
|
||||
sleep 1
|
||||
done
|
||||
echo "Server started."
|
||||
fi
|
||||
|
||||
# Loop through each file dropped onto the droplet
|
||||
for f in "$@"
|
||||
do
|
||||
# POST request using curl
|
||||
curl -X POST -H "Content-Type: multipart/form-data" \
|
||||
-H "Authorization: Bearer sk-NhrtQwCHNdK5sRZC" \
|
||||
-F "file=@$f" \
|
||||
-F "podcast=true" \
|
||||
-F "speed=1.2" \
|
||||
"$endpoint"
|
||||
done
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/bash
|
||||
exec /Applications/VirtualBox.app/Contents/MacOS/VBoxAudioTest "$@"
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/bash
|
||||
exec /Applications/VirtualBox.app/Contents/MacOS/VBoxAutostart "$@"
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/bash
|
||||
exec /Applications/VirtualBox.app/Contents/MacOS/VBoxBalloonCtrl "$@"
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/bash
|
||||
exec /Applications/VirtualBox.app/Contents/MacOS/VBoxBugReport "$@"
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/bash
|
||||
exec /Applications/VirtualBox.app/Contents/MacOS/VBoxHeadless "$@"
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/bash
|
||||
exec /Applications/VirtualBox.app/Contents/MacOS/VBoxManage "$@"
|
2
VBoxVRDP
2
VBoxVRDP
|
@ -1,2 +0,0 @@
|
|||
#!/bin/bash
|
||||
exec /Applications/VirtualBox.app/Contents/MacOS/VBoxHeadless "$@"
|
37
asf
37
asf
|
@ -1,37 +0,0 @@
|
|||
-- Mail Rule - Add messages to DEVONthink
|
||||
-- Created by Christian Grunenberg on Mon Apr 19 2004.
|
||||
-- Copyright (c) 2004-2020. All rights reserved.
|
||||
|
||||
-- this string is used when the message subject is empty
|
||||
property pNoSubjectString : "(no subject)"
|
||||
|
||||
using terms from application "Mail"
|
||||
on perform mail action with messages theMessages for rule theRule
|
||||
tell application "Mail"
|
||||
repeat with theMessage in theMessages
|
||||
try
|
||||
tell theMessage
|
||||
set {theDateReceived, theDateSent, theSender, theSubject, theSource, theReadFlag} to {the date received, the date sent, the sender, subject, the source, the read status}
|
||||
set theMessageURL to "message://%3c" & theMessage's message id & "%3e"
|
||||
end tell
|
||||
if theSubject is equal to "" then set theSubject to pNoSubjectString
|
||||
tell application id "DNtp"
|
||||
set username to do shell script "id -un" -- this will get the current username dynamically
|
||||
set theDatabase to open database ("/Users/" & username & "/Databases/Professional.dtbase2")
|
||||
set theYear to year of theDateReceived
|
||||
set theMonth to texts -2 thru -1 of ("0" & (month of theDateReceived as integer))
|
||||
set theMonthName to month of theDateReceived as string
|
||||
set theDay to texts -2 thru -1 of ("0" & (day of theDateReceived))
|
||||
set theWeekday to weekday of theDateReceived
|
||||
set theGroup to create location ("/Notes/Journal/" & theYear & "/" & theYear & "-" & theMonth & " " & theMonthName & "/" & theYear & "-" & theMonth & "-" & theDay & " " & theWeekday & "/" & "Emails") in theDatabase
|
||||
set theRecord to create record with {name:theSubject & ".eml", type:unknown, creation date:theDateSent, modification date:theDateReceived, URL:theSender, source:(theSource as string), unread:(not theReadFlag)} in theGroup
|
||||
set theConvertedRecord to convert record theRecord to markdown
|
||||
delete record theRecord
|
||||
set URL of theConvertedRecord to theMessageURL
|
||||
perform smart rule trigger import event record theConvertedRecord
|
||||
end tell
|
||||
end try
|
||||
end repeat
|
||||
end tell
|
||||
end perform mail action with messages
|
||||
end using terms from
|
22
asr copy
22
asr copy
|
@ -1,22 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Check if a filename is provided
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Usage: $0 filename"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Assign the first argument to FILENAME
|
||||
FILENAME="$1"
|
||||
|
||||
# Check if the file exists
|
||||
if [ ! -f "$FILENAME" ]; then
|
||||
echo "Error: File not found - $FILENAME"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Perform the curl POST request with the file
|
||||
curl -X POST http://127.0.0.1:3456/v1/asr \
|
||||
-H 'Authorization: bearer sk-NhrtQwCHNdK5sRZC' \
|
||||
-F "file=@$FILENAME"
|
||||
|
3
ccd
3
ccd
|
@ -1,3 +0,0 @@
|
|||
#!/bin/bash
|
||||
cd $1
|
||||
ls -lsa
|
1
chat
1
chat
|
@ -1 +0,0 @@
|
|||
python /usr/local/bin/chat.py
|
47
fixname
47
fixname
|
@ -1,47 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Check if enough arguments are passed
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Usage: $0 <file_path>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Function to truncate filename to a maximum length, preserving the extension
|
||||
truncate_filename() {
|
||||
local filename="$1"
|
||||
local max_length="$2"
|
||||
local extension="${filename##*.}"
|
||||
local base_name="${filename%.*}"
|
||||
|
||||
if [ ${#filename} -gt $max_length ]; then
|
||||
local truncated_base="${base_name:0:($max_length - ${#extension} - 1)}"
|
||||
echo "${truncated_base}.${extension}"
|
||||
else
|
||||
echo "$filename"
|
||||
fi
|
||||
}
|
||||
|
||||
# Read the file paths from the input file
|
||||
while IFS= read -r file_path; do
|
||||
# Extract the directory and filename
|
||||
dir_path=$(dirname "$file_path")
|
||||
file_name=$(basename "$file_path")
|
||||
|
||||
# Define the new filename by replacing or removing illegal characters
|
||||
new_file_name=$(echo "$file_name" | tr -d '<>:"/\\|?*' | tr '[:cntrl:]' '_' | sed 's/[—·]/-/g' | sed 's/"/_/g' | sed "s/'/_/g")
|
||||
|
||||
# Ensure filename does not end with an underscore
|
||||
new_file_name=$(echo "$new_file_name" | sed 's/_$//')
|
||||
|
||||
# Truncate the filename if it is longer than 200 characters, preserving the extension
|
||||
new_file_name=$(truncate_filename "$new_file_name" 200)
|
||||
|
||||
# Construct the new path
|
||||
new_path="$dir_path/$new_file_name"
|
||||
|
||||
# Rename the file if necessary
|
||||
if [ "$new_file_name" != "$file_name" ]; then
|
||||
echo "Renaming '$file_path' to '$new_path'"
|
||||
mv "$file_path" "$new_path"
|
||||
fi
|
||||
done <"$1"
|
27
fuzzy_match
27
fuzzy_match
|
@ -1,27 +0,0 @@
|
|||
#!/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
|
||||
#
|
||||
# This file was generated by RubyGems.
|
||||
#
|
||||
# The application 'fuzzy_match' is installed as part of a gem, and
|
||||
# this file is here to facilitate running it.
|
||||
#
|
||||
|
||||
require 'rubygems'
|
||||
|
||||
version = ">= 0.a"
|
||||
|
||||
str = ARGV.first
|
||||
if str
|
||||
str = str.b[/\A_(.*)_\z/, 1]
|
||||
if str and Gem::Version.correct?(str)
|
||||
version = str
|
||||
ARGV.shift
|
||||
end
|
||||
end
|
||||
|
||||
if Gem.respond_to?(:activate_bin_path)
|
||||
load Gem.activate_bin_path('fuzzy_match', 'fuzzy_match', version)
|
||||
else
|
||||
gem "fuzzy_match", version
|
||||
load Gem.bin_path("fuzzy_match", "fuzzy_match", version)
|
||||
end
|
27
httpclient
27
httpclient
|
@ -1,27 +0,0 @@
|
|||
#!/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
|
||||
#
|
||||
# This file was generated by RubyGems.
|
||||
#
|
||||
# The application 'httpclient' is installed as part of a gem, and
|
||||
# this file is here to facilitate running it.
|
||||
#
|
||||
|
||||
require 'rubygems'
|
||||
|
||||
version = ">= 0.a"
|
||||
|
||||
str = ARGV.first
|
||||
if str
|
||||
str = str.b[/\A_(.*)_\z/, 1]
|
||||
if str and Gem::Version.correct?(str)
|
||||
version = str
|
||||
ARGV.shift
|
||||
end
|
||||
end
|
||||
|
||||
if Gem.respond_to?(:activate_bin_path)
|
||||
load Gem.activate_bin_path('httpclient', 'httpclient', version)
|
||||
else
|
||||
gem "httpclient", version
|
||||
load Gem.bin_path("httpclient", "httpclient", version)
|
||||
end
|
12
llm
12
llm
|
@ -1,12 +0,0 @@
|
|||
#!/bin/bash
|
||||
murder ollama
|
||||
tmux new-session -d -s ollama -n ollamapane
|
||||
|
||||
tmux split-window -h -t ollama
|
||||
tmux select-pane -t 0
|
||||
tmux send-keys -t 0 "source ~/.zshrc" C-m
|
||||
tmux send-keys -t 0 "ollama serve; sleep 1" C-m
|
||||
|
||||
tmux select-pane -t 1
|
||||
tmux send-keys -t 1 "source ~/.zshrc" C-m
|
||||
|
3
master
3
master
|
@ -1,3 +0,0 @@
|
|||
st
|
||||
api
|
||||
comfy
|
68
nukenode
68
nukenode
|
@ -1,68 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Uninstall global npm packages
|
||||
npm ls -gp --depth=0 | awk -F/ '/node_modules/ && !/\/npm$/ {print $NF}' | xargs npm -g rm
|
||||
|
||||
# Uninstall Node.js and npm
|
||||
brew uninstall node
|
||||
brew uninstall npm
|
||||
|
||||
# Remove npm, Node.js, and nvm directories
|
||||
sudo rm -rf /usr/local/lib/node_modules
|
||||
sudo rm -rf ~/.npm
|
||||
sudo rm -rf /usr/local/bin/npm
|
||||
sudo rm -rf /usr/local/share/man/man1/node*
|
||||
sudo rm -rf /usr/local/bin/node
|
||||
sudo rm -rf /usr/local/lib/node_modules/
|
||||
sudo rm -rf /usr/local/include/node/
|
||||
rm -rf ~/.nvm
|
||||
|
||||
# Clean up Node.js and npm related files
|
||||
sudo rm -rf ~/.node*
|
||||
sudo rm -rf ~/.npm*
|
||||
|
||||
# Remove Yarn
|
||||
brew uninstall yarn
|
||||
rm -rf ~/.yarn
|
||||
|
||||
# Clean up Homebrew
|
||||
brew cleanup
|
||||
|
||||
# Remove package manager cache
|
||||
rm -rf ~/.yarn-cache
|
||||
rm -rf ~/.pnpm-store
|
||||
|
||||
# Remove other version managers
|
||||
brew uninstall n
|
||||
rm -rf /usr/local/n
|
||||
rm -rf /usr/local/bin/n
|
||||
|
||||
# Remove temporary directories
|
||||
rm -rf /tmp/npm-*
|
||||
rm -rf /tmp/node-*
|
||||
rm -rf ~/Library/Caches/com.apple.DiagnosticReporting.nettopologyd/node_modules/
|
||||
|
||||
# Remove Browserify and Webpack cache
|
||||
rm -rf ~/.config/browserify
|
||||
rm -rf ~/.config/webpack
|
||||
rm -rf ~/.cache/webpack
|
||||
|
||||
# Remove Electron cache
|
||||
rm -rf ~/.electron
|
||||
|
||||
# Remove npm and Node.js logs
|
||||
rm -rf ~/.npm/_logs
|
||||
rm -rf ~/.node-gyp/*.log
|
||||
|
||||
# Remove miscellaneous directories
|
||||
rm -rf ~/.node_repl_history
|
||||
rm -rf ~/.v8flags*
|
||||
rm -rf ~/.npm-global
|
||||
rm -rf ~/.nvm-global
|
||||
|
||||
# Remove any references to Node.js or npm from shell profile files
|
||||
sed -i '' '/# Node.js/d' ~/.bashrc ~/.bash_profile ~/.zshrc
|
||||
sed -i '' '/export PATH=.*node.*/d' ~/.bashrc ~/.bash_profile ~/.zshrc
|
||||
sed -i '' '/export PATH=.*npm.*/d' ~/.bashrc ~/.bash_profile ~/.zshrc
|
||||
|
||||
echo "Node.js, npm, and nvm have been removed."
|
7
nv_mount
7
nv_mount
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
SESSION_NAME="$1"
|
||||
# Attach to tmux session and activate Conda environment
|
||||
tmux send-keys -t "$SESSION_NAME" "conda activate $SESSION_NAME" C-m
|
||||
tmux attach -t "$SESSION_NAME"
|
||||
|
79
scrape
79
scrape
|
@ -1,79 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Network share URL
|
||||
NETWORK_SHARE="smb://10.13.37.10/Media"
|
||||
|
||||
# Attempt to open the network share using Finder
|
||||
# echo "Attempting to mount the network share..."
|
||||
# open "${NETWORK_SHARE}" || { echo "Failed to access network share."; exit 1; }
|
||||
|
||||
# Optionally, add a sleep command to allow some time for the share to mount before proceeding.
|
||||
# sleep 5
|
||||
|
||||
# First input argument, could be a URL or a variant
|
||||
FIRST_ARG="$1"
|
||||
|
||||
# Function to detect if the input is a URL
|
||||
is_url() {
|
||||
if [[ "$1" =~ ^https?:// ]]; then
|
||||
echo "true"
|
||||
else
|
||||
echo "false"
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to determine the variant based on the URL's domain
|
||||
detect_variant_from_url() {
|
||||
local domain=$(echo "$FIRST_ARG" | awk -F/ '{print $3}' | sed -e 's/^www\.//')
|
||||
|
||||
case "$domain" in
|
||||
*incestflix.com)
|
||||
echo "if"
|
||||
;;
|
||||
*xvideos.com)
|
||||
echo "xv"
|
||||
;;
|
||||
*familyporn.tv)
|
||||
echo "fptv"
|
||||
;;
|
||||
*pornhub.com)
|
||||
echo "ph"
|
||||
;;
|
||||
*motherless.com)
|
||||
echo "ml"
|
||||
;;
|
||||
*xnxx.com)
|
||||
echo "xnxx"
|
||||
;;
|
||||
*9vids.com)
|
||||
echo "9v"
|
||||
;;
|
||||
*)
|
||||
echo "unrecognized"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Determine if the first argument is a URL
|
||||
if [[ $(is_url "$FIRST_ARG") == "true" ]]; then
|
||||
VARIANT=$(detect_variant_from_url)
|
||||
if [ "$VARIANT" = "unrecognized" ]; then
|
||||
echo "Domain not recognized. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
# For URLs, pass the entire set of arguments to the scraper script
|
||||
ARGS="$@"
|
||||
else
|
||||
# For direct variant inputs, the variant is the first argument, and the rest are additional parameters
|
||||
VARIANT="$1"
|
||||
# Shift the first argument off, leaving the rest as $@
|
||||
shift
|
||||
ARGS="$@"
|
||||
fi
|
||||
|
||||
# Activate the Conda environment
|
||||
source /home/sij/miniforge3/bin/activate scrape
|
||||
|
||||
# Run the Python script, adjusting for either URL or direct variant input
|
||||
/home/sij/miniforge3/envs/scrape/bin/python "/home/sij/workshop/.private/videoscraper/videoscraper-$VARIANT.py" $ARGS
|
||||
|
33
temp.txt
33
temp.txt
|
@ -1,33 +0,0 @@
|
|||
List of files in /Users/sij/Nextcloud/notes with nonconforming names:
|
||||
|
||||
/Users/sij/Nextcloud/notes/clippings/Personal — Mac (Metal) support- · Issue #114 · yl4579-StyleTTS2-58274.md
|
||||
/Users/sij/Nextcloud/notes/clippings/Dependencies missing for Insightface · Issue #162 · cubiq-ComfyUI_IPAdapter_plus · GitHub-12313.md
|
||||
/Users/sij/Nextcloud/notes/clippings/Personal — Enable opening from Finder · Issue #102 · warpdotdev-Warp-50868.md
|
||||
/Users/sij/Nextcloud/notes/clippings/Personal — TTS example on colab not working · Issue #113 · mozilla-TTS-32446.md
|
||||
/Users/sij/Nextcloud/notes/unsorted/<% tp.date.now("YYYY-MM-DD dddd", 1, tp.file.title, "YYYY-MM-DD dddd") %>.md
|
||||
/Users/sij/Nextcloud/notes/unsorted/Awareness > Thought.md
|
||||
/Users/sij/Nextcloud/notes/unsorted/Debate on DGR about "colonial veganism".md
|
||||
/Users/sij/Nextcloud/notes/unsorted/Nov 22, 2022 at 11-51 AM— "Transcription Editing Instructions".md
|
||||
/Users/sij/Nextcloud/notes/unsorted/Happy Mother’s Day, .md
|
||||
/Users/sij/Nextcloud/notes/unsorted/May 19, 2023 at 7-05 PM— "The Best Text-to-Speech Tools".md
|
||||
/Users/sij/Nextcloud/notes/unsorted/2023-05-24 — "Job Change Check-in with Sanjay".md
|
||||
/Users/sij/Nextcloud/notes/unsorted/Sangye & Casetext | Zoom Meeting - [[2023-05-31-Wednesday]].md
|
||||
/Users/sij/Nextcloud/notes/unsorted/2023-05-24 — "Bureau authorizes timber sales impacting owls".md
|
||||
/Users/sij/Nextcloud/notes/unsorted/Jan 30, 2023 at 2-46 PM— "Transcribed Raw Voice Recording".md
|
||||
/Users/sij/Nextcloud/notes/unsorted/What can be appealed?.md
|
||||
/Users/sij/Nextcloud/notes/unsorted/I’ve discovered awe... but what was my name?.md
|
||||
/Users/sij/Nextcloud/notes/unsorted/May 25, 2023 at 12-09— "Exciting Buyout News from Michigan".md
|
||||
/Users/sij/Nextcloud/notes/unsorted/Nov 9, 2022 at 3-10 PM— Title suggestion- "North Project Threatens Spotted Owl".md
|
||||
/Users/sij/Nextcloud/notes/unsorted/Call with .md
|
||||
/Users/sij/Nextcloud/notes/unsorted/Nov 9, 2022 at 15-31— Title- "Habitat loss and endangered owls".md
|
||||
/Users/sij/Nextcloud/notes/unsorted/“Hear Me" Trilogy.md
|
||||
/Users/sij/Nextcloud/notes/unsorted/May 27, 2023 at 14-02— "Transcription Editing Tips".md
|
||||
/Users/sij/Nextcloud/notes/unsorted/May 24, 2023 at 08-06— "Consider Avoiding Grocery Stores".md
|
||||
/Users/sij/Nextcloud/notes/unsorted/Human Rights Watch | Defending Human Rights Worldwide.md
|
||||
/Users/sij/Nextcloud/notes/unsorted/Sep 1, 2021 - Clinic Meeting #2.md
|
||||
/Users/sij/Nextcloud/notes/unsorted/May 25, 2023 at 12-08— "Raw Voice Recording Transcript- Technical Issues".md
|
||||
/Users/sij/Nextcloud/notes/unsorted/May 25, 2023 at 19-32— "Taystex Follow-Up on Co-Counsel Request".md
|
||||
/Users/sij/Nextcloud/notes/unsorted/May 27, 2023 at 14-35— "Voice Recording Test with AI".md
|
||||
/Users/sij/Nextcloud/notes/unsorted/May 27, 2023 at 15-11— "Transcript Editing Suggestions".md
|
||||
/Users/sij/Nextcloud/notes/W\&W breakout.md
|
||||
/Users/sij/Nextcloud/notes/obsidian/resources/awesome-selfhosted#note-taking--editors.webarchive
|
1
txt-line-merge-abc
Executable file → Normal file
1
txt-line-merge-abc
Executable file → Normal file
|
@ -34,3 +34,4 @@ if __name__ == "__main__":
|
|||
else:
|
||||
merge_files(file_paths)
|
||||
|
||||
|
||||
|
|
2
vbox-img
2
vbox-img
|
@ -1,2 +0,0 @@
|
|||
#!/bin/bash
|
||||
exec /Applications/VirtualBox.app/Contents/MacOS/vbox-img "$@"
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/bash
|
||||
exec /Applications/VirtualBox.app/Contents/MacOS/vboximg-mount "$@"
|
78
xtts
78
xtts
|
@ -1,78 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Default voice
|
||||
VOICE="m_50_news"
|
||||
|
||||
SERVER="https://api.sij.ai"
|
||||
|
||||
# Initialize ARGUMENT as an empty string
|
||||
ARGUMENT=""
|
||||
|
||||
# Process arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
key="$1"
|
||||
case $key in
|
||||
--voice)
|
||||
VOICE="$2"
|
||||
shift # past argument
|
||||
shift # past value
|
||||
;;
|
||||
--voice=*)
|
||||
VOICE="${key#*=}" # Extracting value after '='
|
||||
shift # past argument
|
||||
;;
|
||||
*)
|
||||
if [ -z "$ARGUMENT" ]; then
|
||||
ARGUMENT="$1"
|
||||
else
|
||||
ARGUMENT="$ARGUMENT $1"
|
||||
fi
|
||||
shift # past argument
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Check if text or file argument is provided
|
||||
if [ -z "$ARGUMENT" ]; then
|
||||
echo "Usage: $0 <file or text> [--voice='voice_name']"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TIMESTAMP=$(date +"%Y%m%d%H%M%S")
|
||||
OUTPUT_FILE="/Users/sij/AI/TTS/${TIMESTAMP}_output.wav"
|
||||
|
||||
# Determine if the argument is a file or a string
|
||||
if [[ "$ARGUMENT" == *".txt" ]]; then
|
||||
# It's a file, use the text_file parameter
|
||||
curl -s -X 'POST' \
|
||||
"$SERVER/tts/speak" \
|
||||
-H 'Authorization: Bearer sk-NhrtQwCHNdK5sRZC' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: multipart/form-data' \
|
||||
-F "file=@$ARGUMENT" \
|
||||
-F "voice=$VOICE" \
|
||||
-F 'speed=0.9' > "$OUTPUT_FILE"
|
||||
else
|
||||
# It's a string, process and use the text parameter
|
||||
SIMPLE_TEXT=$(echo "$ARGUMENT" | tr -d '\n' | tr -d '\r' | sed 's/[^a-zA-Z0-9 .,?!-]//g' | sed 's/ */ /g')
|
||||
|
||||
curl -s -X 'POST' \
|
||||
"$SERVER/tts/speak" \
|
||||
-H 'Authorization: Bearer sk-NhrtQwCHNdK5sRZC' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: multipart/form-data' \
|
||||
-F "text=$SIMPLE_TEXT" \
|
||||
-F "voice=$VOICE" \
|
||||
-F 'speed=0.9' > "$OUTPUT_FILE"
|
||||
fi
|
||||
|
||||
# Check if the output file was created
|
||||
if [ ! -f "$OUTPUT_FILE" ]; then
|
||||
echo "Failed to create audio file."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Output the path and play the file
|
||||
echo "Audio file saved: $OUTPUT_FILE"
|
||||
afplay "$OUTPUT_FILE"
|
||||
|
Loading…
Reference in a new issue