quickview

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

quickview

#1 Post by jpeps »

Finds and views recent downloaded image file (searches for current day)
Edit download directory and viewer at top of script. Deletes image when program closes.

I run this from a tray icon with my text browser. When I want to view an image, I download and click on the icon. (Links browser downloads with "I" <return>).

Code: Select all

#!/bin/sh

## view/delete current downloaded image file 
## for use with text browser


## edit: working directory
DESK="/mnt/sda2/Desktop"
## edit: viewer
VW="viewnior"



[ -f /tmp/jpgs ] && rm /tmp/jpgs

cd "$DESK"

DAY="$(date +%d)"


ls -l | egrep '(\.jpg|\.gif|\.png|\.bmp|\.tiff)' >>/tmp/jpgs

while read line; do
  JPG="$(echo $line | cut -d' ' -f8-)"
  JDAY="$(echo $line | cut -d' ' -f6-  | cut -d\- -f3 | cut -d' ' -f1)"  
        [ "$JDAY" == "$DAY" ] && "$VW"  "$JPG"   && VAR=$JPG
        
done < /tmp/jpgs

sleep 1 
wait
[ "$VAR" ] && rm "$VAR" 
[ -f /tmp/jpgs ] && rm /tmp/jpgs


Post Reply