Kirjoittaja Aihe: Miten kuvien numeroin webcam bach script:issä ubuntu 12.04lts[RATKAISTU]  (Luettu 2414 kertaa)

jar1969

  • Käyttäjä
  • Viestejä: 212
    • Profiili
Miten muokkaan bach script,jotta webcam  script:iä tulostaa  juoksevan numeroinin?

#!/bin/bash
 
#A short script to download timed snapshots of a file that undergoes regular updates.
 
#The url of the file
url="http://192.168.1.***:**/snapshot.cgi?user****s&pwd=*******&next_url=kamera2.jpg"
#This expression extracts the suffix part of the url from the url
suffixpart=${url##*.}
#The interval at which the file is fetched.
#N.B. Some sites may not take kindly to short intervals.
interval=5s
 
#Determine which command should be used for downloading given the current platform.
systemname=`uname -s || uname`
case $systemname in
    *Linux)
        cmd="wget $url -O"
        ;;
    *Darwin)
        cmd="curl $url -o"
        ;;
    *)
        cmd="wget $url -O"
        ;;
esac
#send file direction.
cd /home/webcam/web_camera/
#Infinite loop that does the downloading.
#The script must manually be interrupted to halt.
while [ 1 ]

do
    datepart=`date "+webcam"`
    $cmd $datepart.$suffixpart
exit
done


tai miten muokkaan tätä copy.bach tiestoa jotta kopio kuvissa on juoksevat numerot

#!/bin/bash
 
image=( mattiulko.jpg )
MAX=${#image
  • }

for i in ${image
  • }

do
   num=${i:5:3} # grab the digits
   compliment=$(printf '%00d' $(echo $MAX-$num | bc))
   ln $i copy_of_image$compliment.jpg
done

 jari169
« Viimeksi muokattu: 03.09.13 - klo:18.59 kirjoittanut jar1969 »

jekku

  • Käyttäjä
  • Viestejä: 2624
    • Profiili
Minulla on näköjään jossain ikuvanhassa skriptissä jotain tuollaista:

Koodia: [Valitse]

laskuri=$(ls ${TARGET_DIR}/kuvat/tmp/${aikaleima}_full/*.${loppu,,} 2>/dev/null| wc -l)
while [ ${#laskuri} -lt 3 ]
do
        laskuri='0'${laskuri}
done   


Olen näköjään luottanut ettei juurikaan ole tuhatta kuvaa yhdessä hakemistossa, koska tyytynyt komeen numeroon ;)

En tutkinut tuota malliasi sen enempää, mutta tuossa yksi tapa ottaa numero esiin..


jar1969

  • Käyttäjä
  • Viestejä: 212
    • Profiili
ajan tämän koodin  kuva timelapsista -->numero sarjoiksi kerran 6 tunnissa ja  sitten ffmpeg .flv videon =>
tattis!
#!/bin/bash
RAYMIIWALL=1

#convert everything to lowercase - you need the rename command.
rename 'y/A-Z/a-z/' *

#Do the magic
for i in {*.jpg,*.jpeg};
do mv -f -v "$i" "$RAYMIIWALL.jpg";
let "RAYMIIWALL += 1"
done
exit 0
« Viimeksi muokattu: 03.09.13 - klo:19.02 kirjoittanut jar1969 »