mirror of
https://github.com/ksyasuda/dotfiles.git
synced 2026-02-04 06:36:35 -08:00
update scripts
This commit is contained in:
@@ -10,9 +10,9 @@ import sys
|
|||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
# Configuration
|
|
||||||
OPENROUTER_API_KEY = os.environ.get("OPENROUTER_API_KEY", "")
|
OPENROUTER_API_KEY = os.environ.get("OPENROUTER_API_KEY", "")
|
||||||
MODEL = os.environ.get("OPENROUTER_MODEL", "google/gemini-2.0-flash-001")
|
# MODEL = os.environ.get("OPENROUTER_MODEL", "google/gemini-2.0-flash-001")
|
||||||
|
MODEL = os.environ.get("OPENROUTER_MODEL", "openai/gpt-oss-120b:free")
|
||||||
API_URL = "https://openrouter.ai/api/v1/chat/completions"
|
API_URL = "https://openrouter.ai/api/v1/chat/completions"
|
||||||
|
|
||||||
# Try to load API key from file if not in environment
|
# Try to load API key from file if not in environment
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ shift $((OPTIND - 1))
|
|||||||
|
|
||||||
find_videos() {
|
find_videos() {
|
||||||
find "$PWD" -maxdepth 1 -type f -regextype posix-extended \
|
find "$PWD" -maxdepth 1 -type f -regextype posix-extended \
|
||||||
-iregex ".*\.($VIDEO_EXTENSIONS)$" 2>/dev/null | sort -V
|
-iregex ".*\.($VIDEO_EXTENSIONS)$" 2> /dev/null | sort -V
|
||||||
}
|
}
|
||||||
|
|
||||||
build_rofi_menu() {
|
build_rofi_menu() {
|
||||||
@@ -53,15 +53,15 @@ get_video_thumbnail() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local tmp_thumb="/tmp/rmpv-thumb-$$.jpg"
|
local tmp_thumb="/tmp/rmpv-thumb-$$.jpg"
|
||||||
if command -v ffmpegthumbnailer &>/dev/null; then
|
if command -v ffmpegthumbnailer &> /dev/null; then
|
||||||
ffmpegthumbnailer -i "$video" -o "$tmp_thumb" -s 512 -q 5 2>/dev/null && echo "$tmp_thumb"
|
ffmpegthumbnailer -i "$video" -o "$tmp_thumb" -s 512 -q 5 2> /dev/null && echo "$tmp_thumb"
|
||||||
elif command -v ffmpeg &>/dev/null; then
|
elif command -v ffmpeg &> /dev/null; then
|
||||||
ffmpeg -i "$video" -ss 00:00:30 -vframes 1 -vf "scale=512:-1" "$tmp_thumb" 2>/dev/null && echo "$tmp_thumb"
|
ffmpeg -i "$video" -ss 00:00:30 -vframes 1 -vf "scale=512:-1" "$tmp_thumb" 2> /dev/null && echo "$tmp_thumb"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
selection=$(build_rofi_menu | rofi -dmenu -i -show-icons -theme "$THEME" \
|
selection=$(build_rofi_menu | rofi -dmenu -i -show-icons -theme "$THEME" \
|
||||||
-theme-str 'listview {columns: 1; lines: 15;} window {width: 88%;}' -p "Choose Video ")
|
-theme-str 'configuration {font: "JetBrainsMono Nerd Font 10";} listview {columns: 1; lines: 15;} window {width: 88%;}' -p "Choose Video ")
|
||||||
|
|
||||||
if [[ -z "$selection" ]]; then
|
if [[ -z "$selection" ]]; then
|
||||||
echo "No video selected."
|
echo "No video selected."
|
||||||
|
|||||||
Reference in New Issue
Block a user