mini updates

This commit is contained in:
Hannes
2026-07-13 17:37:25 +02:00
parent 791b34e7e4
commit 07a798ac00
3 changed files with 134 additions and 15 deletions
+3 -1
View File
@@ -12,7 +12,7 @@ hl.on("hyprland.start", function ()
hl.exec_cmd("tmux new-session -d -s ydotool 'ydotoold'") hl.exec_cmd("tmux new-session -d -s ydotool 'ydotoold'")
hl.exec_cmd("tmux new-session -d -s ollama '/usr/bin/ollama serve'") hl.exec_cmd("tmux new-session -d -s ollama '/usr/bin/ollama serve'")
hl.exec_cmd("tmux new-session -d -s fah 'cd ~/.local/share/fah && fah-client'") hl.exec_cmd("tmux new-session -d -s fah 'cd ~/.local/share/fah && fah-client'")
hl.exec_cmd("tmux new-session -d -s carla 'carla -n /home/honney/Downloads/test.carxp'") hl.exec_cmd("tmux new-session -d -s carla 'carla -n /home/honney/Music/1Player.carxp'")
hl.exec_cmd("bash -c '~/.config/hypr/scripts/goxlr/goxlr-start.sh > ~/.config/hypr/scripts/goxlr/goxlr-start.log'") hl.exec_cmd("bash -c '~/.config/hypr/scripts/goxlr/goxlr-start.sh > ~/.config/hypr/scripts/goxlr/goxlr-start.log'")
hl.exec_cmd("bash -c 'sleep 2 && ~/.config/hypr/scripts/wallpapers/random_wallpaper.sh > ~/.config/hypr/scripts/wallpapers/random_wallpaper.log'") hl.exec_cmd("bash -c 'sleep 2 && ~/.config/hypr/scripts/wallpapers/random_wallpaper.sh > ~/.config/hypr/scripts/wallpapers/random_wallpaper.log'")
@@ -26,6 +26,8 @@ hl.on("hyprland.start", function ()
hl.exec_cmd("tmux new-session -d -s ollama '/usr/bin/ollama serve'") hl.exec_cmd("tmux new-session -d -s ollama '/usr/bin/ollama serve'")
hl.exec_cmd("nextcloud") hl.exec_cmd("nextcloud")
hl.exec_cmd("discord") hl.exec_cmd("discord")
elseif HOSTNAME == "honney-opencode" then
hl.exec_cmd("tmux new-session -d -s oc 'cd ~/Projects && opencode web --hostname 0.0.0.0 --port 4096'")
end end
hl.exec_cmd("bash -c '~/.config/hypr/scripts/autostart/autostart.sh > ~/.config/hypr/scripts/autostart/autostart.log'") hl.exec_cmd("bash -c '~/.config/hypr/scripts/autostart/autostart.sh > ~/.config/hypr/scripts/autostart/autostart.log'")
+94
View File
@@ -0,0 +1,94 @@
#!/bin/bash
set -x
tmdbid() {
local type q url
type="$1"
shift
q=$(printf '%s' "$*" | jq -sRr @uri)
echo "tmdbid: type=$type encoded query: $q" >&2
if [ "$type" = "tv" ]; then
url="https://www.themoviedb.org/search/tv?query=$q"
else
url="https://www.themoviedb.org/search/movie?query=$q"
fi
echo "tmdbid: url: $url" >&2
local result
result=$(curl -sL -A 'Mozilla/5.0' "$url" \
| grep -oE '/(movie|tv)/[0-9]+' \
| head -1 \
| cut -d/ -f3)
echo "tmdbid: result: $result" >&2
echo "$result"
}
clean_title() {
local s="$1"
echo "clean_title: input: $s" >&2
s=$(echo "$s" | sed -E 's/ *\([^)]*[0-9]{4}[^)]*\)//')
echo "clean_title: after year removal: $s" >&2
s="${s//ä/ae}"; s="${s//ö/oe}"; s="${s//ü/ue}"
s="${s//Ä/Ae}"; s="${s//Ö/Oe}"; s="${s//Ü/Ue}"
echo "clean_title: after umlauts: $s" >&2
s=$(echo "$s" | tr -d '0-9')
echo "clean_title: after number removal: $s" >&2
s=$(echo "$s" | tr -cd '[:alpha:] [:space:]')
echo "clean_title: after special char removal: $s" >&2
s=$(echo "$s" | tr -s ' ')
echo "clean_title: final: $s" >&2
echo "$s"
}
ws="${1:-3}"
title=$(hyprctl clients -j | jq ".[] | select(.workspace.id == $ws)" | grep "The Movie Database" | sed 's/ — The Movie Database.*//' | sed 's/ "title": "//' | sed 's/"$//')
echo "title: $title" >&2
search_title=$(echo "$title" | sed -E 's/ *\([^)]*\) *//g')
echo "search_title: $search_title" >&2
if echo "$title" | grep -qi "TV [Ss]eries"; then
type="tv"
else
type="movie"
fi
echo "detected type: $type" >&2
tmdbid=$(tmdbid "$type" "$search_title")
echo "tmdbid: $tmdbid" >&2
if [ -z "$tmdbid" ]; then
if [ "$type" = "tv" ]; then
echo "retrying as movie" >&2
tmdbid=$(tmdbid "movie" "$search_title")
else
echo "retrying as tv" >&2
tmdbid=$(tmdbid "tv" "$search_title")
fi
echo "tmdbid (retry): $tmdbid" >&2
fi
if [[ $title =~ ([0-9]{4}) ]]; then
year="${BASH_REMATCH[1]}"
else
year=""
fi
echo "year: $year" >&2
clean=$(clean_title "$title")
echo "clean: $clean" >&2
result="$clean ($year) [tmdb-$tmdbid]"
echo "final wtype input: $result" >&2
wtype "$result"
+37 -14
View File
@@ -1,15 +1,20 @@
#!/bin/bash #!/bin/bash
tmdbid() { tmdbid() {
local q url local type q url
type="$1"
shift
# encode query safely
q=$(printf '%s' "$*" | jq -sRr @uri) q=$(printf '%s' "$*" | jq -sRr @uri)
url="https://www.themoviedb.org/search/movie?query=$q" if [ "$type" = "tv" ]; then
url="https://www.themoviedb.org/search/tv?query=$q"
else
url="https://www.themoviedb.org/search/movie?query=$q"
fi
curl -sL -A 'Mozilla/5.0' "$url" \ curl -sL -A 'Mozilla/5.0' "$url" \
| grep -oE '/movie/[0-9]+' \ | grep -oE '/(movie|tv)/[0-9]+' \
| head -1 \ | head -1 \
| cut -d/ -f3 | cut -d/ -f3
} }
@@ -17,8 +22,8 @@ tmdbid() {
clean_title() { clean_title() {
local s="$1" local s="$1"
# remove (year) style parentheses # remove (year) or (TV Series year) style parentheses
s=$(echo "$s" | sed -E 's/ *\([0-9]{4}\)//') s=$(echo "$s" | sed -E 's/ *\([^)]*[0-9]{4}[^)]*\)//')
# umlaut replacement # umlaut replacement
s="${s//ä/ae}"; s="${s//ö/oe}"; s="${s//ü/ue}" s="${s//ä/ae}"; s="${s//ö/oe}"; s="${s//ü/ue}"
@@ -36,16 +41,34 @@ clean_title() {
echo "$s" echo "$s"
} }
title=$(hyprctl clients -j | jq '.[] | select(.workspace.id == 3)' | grep "The Movie Database" | sed 's/ — The Movie Database.*//' | sed 's/ "title": "//g') ws="${1:-3}"
tmdbid=$(tmdbid "$title")
year="${title: -6}" title=$(hyprctl clients -j | jq ".[] | select(.workspace.id == $ws)" | grep "The Movie Database" | sed 's/ — The Movie Database.*//' | sed 's/ "title": "//' | sed 's/"$//')
if [ -z "$tmdbid" ]; then search_title=$(echo "$title" | sed -E 's/ *\([^)]*\) *//g')
new_title="${title//\ ([0-9][0-9][0-9][0-9])/}"
tmdbid=$(tmdbid "$new_title") if echo "$title" | grep -qi "TV [Ss]eries"; then
type="tv"
else
type="movie"
fi fi
clean=$(clean_title "$title") tmdbid=$(tmdbid "$type" "$search_title")
wtype "$clean $year [tmdb-$tmdbid]" if [ -z "$tmdbid" ]; then
if [ "$type" = "tv" ]; then
tmdbid=$(tmdbid "movie" "$search_title")
else
tmdbid=$(tmdbid "tv" "$search_title")
fi
fi
if [[ $title =~ ([0-9]{4}) ]]; then
year="${BASH_REMATCH[1]}"
else
year=""
fi
clean=$(clean_title "$title")
wtype "$clean ($year) [tmdb-$tmdbid]"