Compare commits
10 commits
c6cab93f4d
...
1c5a3ba8e8
Author | SHA1 | Date | |
---|---|---|---|
1c5a3ba8e8 | |||
55019903a7 | |||
6a462556a2 | |||
74c37f0a2a | |||
5521f3de6c | |||
1e73c34288 | |||
3559b1c113 | |||
40153d6e10 | |||
e602d788b0 | |||
b9af444e74 |
9 changed files with 135 additions and 74 deletions
23
.Brewfile
Normal file
23
.Brewfile
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
brew "cmake"
|
||||||
|
brew "exiv2"
|
||||||
|
brew "ffmpeg"
|
||||||
|
brew "git-filter-repo"
|
||||||
|
brew "go"
|
||||||
|
brew "jpeg"
|
||||||
|
brew "leveldb"
|
||||||
|
brew "neovim"
|
||||||
|
brew "nmap"
|
||||||
|
brew "node"
|
||||||
|
brew "pass"
|
||||||
|
brew "podman"
|
||||||
|
brew "python@3.12"
|
||||||
|
brew "restic"
|
||||||
|
brew "samba"
|
||||||
|
brew "subfinder"
|
||||||
|
brew "yarn"
|
||||||
|
brew "yt-dlp"
|
||||||
|
brew "zoxide"
|
||||||
|
cask "amethyst"
|
||||||
|
cask "amorphousdiskmark"
|
||||||
|
cask "android-platform-tools"
|
||||||
|
cask "iterm2"
|
|
@ -1 +1,2 @@
|
||||||
TUBE_TOKEN_NAME_IN_STORE="tube.lan"
|
TUBE_TOKEN_NAME_IN_STORE="tube.lan"
|
||||||
|
TUBE_DEFAULT_USERS=("a" "b")
|
|
@ -29,8 +29,9 @@ fi
|
||||||
|
|
||||||
mdl () {
|
mdl () {
|
||||||
cwd=$(pwd)
|
cwd=$(pwd)
|
||||||
share_on_nas="192.168.84.3/media"
|
share_on_nas="$NAS_IP/media"
|
||||||
path_on_nas="Music/__INBOX"
|
path_on_nas="Music/__INBOX"
|
||||||
|
jelly_wait=150
|
||||||
check_smb_mount() {
|
check_smb_mount() {
|
||||||
mount | grep -q "$mount_point"
|
mount | grep -q "$mount_point"
|
||||||
}
|
}
|
||||||
|
@ -66,23 +67,45 @@ fi
|
||||||
|
|
||||||
echo "Unmounting SMB share..."
|
echo "Unmounting SMB share..."
|
||||||
sleep 1
|
sleep 1
|
||||||
umount "$mount_point"
|
/sbin/umount -f "$mount_point"
|
||||||
cd $cwd
|
cd $cwd
|
||||||
open "http://bliss.lan/"
|
if declare -f jelly_rescan > /dev/null; then
|
||||||
|
echo "Waiting $jelly_wait secs before triggering automatic library scan..."
|
||||||
|
sleep $jelly_wait
|
||||||
|
jelly_rescan
|
||||||
|
echo "done"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
d () {
|
d () {
|
||||||
local url="${1:-$(pbpaste)}"
|
local url="${1:-$(pbpaste)}"
|
||||||
if [[ -z "$url" ]]
|
local used_clipboard=0
|
||||||
then
|
|
||||||
|
if [[ -z "$url" ]]; then
|
||||||
echo "No URL provided and clipboard is empty."
|
echo "No URL provided and clipboard is empty."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check if URL came from clipboard
|
||||||
|
if [[ -z "$1" ]]; then
|
||||||
|
echo "started via clipboard"
|
||||||
|
used_clipboard=1
|
||||||
|
fi
|
||||||
|
|
||||||
case "$url" in
|
case "$url" in
|
||||||
(*youtube*|*youtu.be*) echo "Detected YouTube URL: $url"
|
(*youtube*|*youtu.be*)
|
||||||
ytr "$url" ;;
|
echo "Detected YouTube URL: $url"
|
||||||
(*qobuz*) echo "Detected Qobuz URL: $url"
|
ytr "$url"
|
||||||
mdl "$url" ;;
|
;;
|
||||||
(*) echo "Unknown URL: $url" ;;
|
(*qobuz*)
|
||||||
|
echo "Detected Qobuz URL: $url"
|
||||||
|
mdl "$url"
|
||||||
|
if [[ $used_clipboard -eq 1 ]]; then
|
||||||
|
osascript -e "display dialog \"Done with Qobuz: $url\" buttons {\"OK\"}"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
(*)
|
||||||
|
echo "Unknown URL: $url"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
function insta() {
|
insta () {
|
||||||
local cwd=$(pwd)
|
local cwd=$(pwd)
|
||||||
|
check_smb_mount () {
|
||||||
check_smb_mount() {
|
|
||||||
/sbin/mount | grep -q "$insta_mount_point"
|
/sbin/mount | grep -q "$insta_mount_point"
|
||||||
}
|
}
|
||||||
|
|
||||||
local stories_only=false
|
local stories_only=false
|
||||||
local user_list=()
|
local user_list=()
|
||||||
|
while [[ $# -gt 0 ]]
|
||||||
# Parse arguments
|
do
|
||||||
while [[ $# -gt 0 ]]; do
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--cron)
|
--cron)
|
||||||
local random_wait=$((RANDOM % 1800))
|
local random_wait=$((RANDOM % 1800))
|
||||||
|
@ -27,32 +25,37 @@ function insta() {
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "-----$(date)------"
|
echo "-----$(date)------"
|
||||||
|
|
||||||
|
local is_local_nas=false
|
||||||
|
if [[ "$NAS_IP" == "127.0.0.1" || "$NAS_IP" == "localhost" ]]; then
|
||||||
|
is_local_nas=true
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -d "$insta_mount_point" ]; then
|
if [ ! -d "$insta_mount_point" ]; then
|
||||||
echo "Creating mount point directory..."
|
echo "Creating mount point directory..."
|
||||||
mkdir -p "$insta_mount_point"
|
mkdir -p "$insta_mount_point"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ! $is_local_nas; then
|
||||||
if ! check_smb_mount; then
|
if ! check_smb_mount; then
|
||||||
echo "Mounting SMB share..."
|
echo "Mounting SMB share..."
|
||||||
/sbin/mount_smbfs "smb://janolehuebner:$(pass sudo-lana)@$insta_share_on_nas" "$insta_mount_point"
|
/sbin/mount_smbfs "smb://janolehuebner:$(pass sudo-lana 2>/dev/null)@$insta_share_on_nas" "$insta_mount_point"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! check_smb_mount; then
|
if ! check_smb_mount; then
|
||||||
echo "Failed to mount SMB share. Exiting."
|
echo "Failed to mount SMB share. Exiting."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
cd "$insta_mount_point/$insta_path_on_nas" || return 1
|
cd "$insta_mount_point/$insta_path_on_nas" || return 1
|
||||||
|
|
||||||
# Use default users if no user was specified
|
|
||||||
if [[ ${#user_list[@]} -eq 0 ]]; then
|
if [[ ${#user_list[@]} -eq 0 ]]; then
|
||||||
user_list=("${insta_default_users[@]}")
|
user_list=("${insta_default_users[@]}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build the instaloader command
|
local cmd=(uvx --with browser_cookie3 instaloader -b Safari "${user_list[@]}" --fast-update --abort-on=302,400,401,429)
|
||||||
local cmd=(uvx --with browser_cookie3 instaloader -b Safari -B "$insta_cookiefile" "${user_list[@]}" --fast-update)
|
|
||||||
|
|
||||||
if $stories_only; then
|
if $stories_only; then
|
||||||
cmd+=(--stories --no-profile-pic --no-posts)
|
cmd+=(--stories --no-profile-pic --no-posts)
|
||||||
else
|
else
|
||||||
|
@ -61,8 +64,12 @@ function insta() {
|
||||||
|
|
||||||
"${cmd[@]}"
|
"${cmd[@]}"
|
||||||
|
|
||||||
|
if ! $is_local_nas; then
|
||||||
echo "Unmounting SMB share..."
|
echo "Unmounting SMB share..."
|
||||||
sleep 3
|
sleep 3
|
||||||
/sbin/umount -f "$insta_mount_point"
|
/sbin/umount -f "$insta_mount_point"
|
||||||
|
fi
|
||||||
|
|
||||||
cd "$cwd"
|
cd "$cwd"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
8
.zsh_functions/jellyfin.zsh
Normal file
8
.zsh_functions/jellyfin.zsh
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
jelly_rescan(){
|
||||||
|
JELLYFIN_URL="http://$NAS_IP:8096"
|
||||||
|
API_KEY="$(pass jelly)"
|
||||||
|
LIBRARY_ID="8a05b0252259a1dbd62df97522638439"
|
||||||
|
|
||||||
|
curl -X POST -H "X-Emby-Token: $API_KEY" \
|
||||||
|
"$JELLYFIN_URL/Library/VirtualFolders/$LIBRARY_ID/Refresh"
|
||||||
|
}
|
|
@ -29,7 +29,7 @@ ytr () {
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local token="$(pass $TUBE_TOKEN_NAME_IN_STORE)"
|
local token="$(pass $TUBE_TOKEN_NAME_IN_STORE 2>/dev/null)"
|
||||||
local json_data=$(jq -n --arg youtube_id "$youtube_id" '{
|
local json_data=$(jq -n --arg youtube_id "$youtube_id" '{
|
||||||
data: [
|
data: [
|
||||||
{
|
{
|
||||||
|
@ -58,7 +58,7 @@ yts() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set the token and URL
|
# Set the token and URL
|
||||||
local token="$(pass $TUBE_TOKEN_NAME_IN_STORE)"
|
local token="$(pass $TUBE_TOKEN_NAME_IN_STORE 2>/dev/null)"
|
||||||
|
|
||||||
# Initialize an empty array to store video data
|
# Initialize an empty array to store video data
|
||||||
local video_data="[]"
|
local video_data="[]"
|
||||||
|
@ -67,7 +67,7 @@ yts() {
|
||||||
while read -r youtube_id; do
|
while read -r youtube_id; do
|
||||||
# Add each video ID to the array of data (accumulating in $video_data)
|
# Add each video ID to the array of data (accumulating in $video_data)
|
||||||
video_data=$(echo "$video_data" | jq --arg youtube_id "$youtube_id" '. + [{youtube_id: $youtube_id, status: "pending"}]')
|
video_data=$(echo "$video_data" | jq --arg youtube_id "$youtube_id" '. + [{youtube_id: $youtube_id, status: "pending"}]')
|
||||||
done < <(yt-dlp "https://www.youtube.com/@$1/shorts" --flat-playlist --print "%(id)s")
|
done < <(uvx yt-dlp "https://www.youtube.com/@$1/shorts" --flat-playlist --print "%(id)s")
|
||||||
|
|
||||||
# Check if video_data is still an empty array (meaning no videos were found)
|
# Check if video_data is still an empty array (meaning no videos were found)
|
||||||
if [[ "$video_data" == "[]" ]]; then
|
if [[ "$video_data" == "[]" ]]; then
|
||||||
|
@ -90,13 +90,7 @@ yts() {
|
||||||
#
|
#
|
||||||
|
|
||||||
check_shorts() {
|
check_shorts() {
|
||||||
# List of channels to check (you can hardcode them or pass them as arguments)
|
channels=("${TUBE_DEFAULT_USERS[@]}")
|
||||||
channels=(
|
|
||||||
"DarkBlondii"
|
|
||||||
"littlesiha"
|
|
||||||
"lenaindica"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Loop through each channel and call yts
|
# Loop through each channel and call yts
|
||||||
for channel in "${channels[@]}"; do
|
for channel in "${channels[@]}"; do
|
||||||
echo "Checking shorts for channel: $channel"
|
echo "Checking shorts for channel: $channel"
|
||||||
|
|
4
.zshrc
4
.zshrc
|
@ -30,7 +30,7 @@ autosource milan
|
||||||
autosource nas
|
autosource nas
|
||||||
autosource fuck
|
autosource fuck
|
||||||
autosource download
|
autosource download
|
||||||
|
autosource jellyfin
|
||||||
|
|
||||||
#test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
|
eval "$(zoxide init --cmd cd zsh)"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,11 @@ install_dotfiles () {
|
||||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#----uv
|
||||||
|
command -v uv >/dev/null 2>&1 || curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
|
||||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue