Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Mappabeallitas (ahol a media fajlok vannak)
- MEDIA_DIR="/home/dd/Desktop/kepek/"
- DEFAULT_DURATION=3 # Alapertelmezett kep megjelenesi ido (mp)
- PLAYLIST_FILE="/tmp/mpv_playlist.m3u"
- # mpv opciók
- MPV_OPTS="--fs --no-border --no-window-dragging --ontop --force-window=yes --osd-level=0 --loop"
- # Leallitashoz: ESC eseten a script kilep
- trap "killall mpv; exit" SIGINT SIGTERM
- # Dinamikus kepernyo felbontas lekerdezese
- SCREEN_WIDTH=$(xdpyinfo | awk '/dimensions:/ {print $2}' | cut -d"x" -f1)
- SCREEN_HEIGHT=$(xdpyinfo | awk '/dimensions:/ {print $2}' | cut -d"x" -f2)
- echo "Detected screen resolution: ${SCREEN_WIDTH}x${SCREEN_HEIGHT}"
- # Lejátszási lista létrehozása
- echo "Generating playlist..."
- > "$PLAYLIST_FILE"
- for FILE in "$MEDIA_DIR"/*; do
- if [[ ! -f "$FILE" ]]; then
- continue
- fi
- EXT="${FILE##*.}"
- FILENAME="$(basename -- "$FILE")"
- if [[ "$EXT" =~ ^(png|jpg|jpeg|gif)$ ]]; then
- # Kep eseten fix idotartam
- DURATION=$(echo "$FILENAME" | grep -oE "^[0-9]+" || echo "$DEFAULT_DURATION")
- echo "Adding image: $FILE (Duration: $DURATION)"
- echo "file '$FILE'" >> "$PLAYLIST_FILE"
- echo "duration $DURATION" >> "$PLAYLIST_FILE"
- elif [[ "$EXT" =~ ^(mp4|avi|mkv|mov)$ ]]; then
- echo "Adding video: $FILE"
- echo "file '$FILE'" >> "$PLAYLIST_FILE"
- fi
- done
- echo "Playlist generated: $PLAYLIST_FILE"
- # mpv elinditasa a lejátszási listával
- mpv $MPV_OPTS --playlist="$PLAYLIST_FILE"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement