• Neuer Gutscheincode unseres Partners Schutzfolien24:
    DSLR-Forum2025
    Dauerhaft 10% Rabatt auf alle Displayschutzfolien und Schutzgläser der Eigenmarken
    "Upscreen", "Screenleaf", BROTECT" und "Savvies".
    Der Code ist für alle Geräteklassen gültig.
  • Stimmt ab über die Sieger des DSLR-Forum Fotowettbewerbs Juli 2025.
    Thema: "Unscharf"

    Nur noch bis zum 31.07.2025 23:59!
    Jeder darf abstimmen!
    Zur Abstimmung und Bewertung hier lang
  • In eigener Sache!

    Liebe Mitglieder, liebe Besucher und Gäste
    ich weiß, es ist ein leidiges Thema, aber ich muss es ansprechen: Werbung, Werbeblocker und Finanzierung des Forums.
    Bitte hier weiterlesen ...

  • Nicht erreichbare Adressen im Benutzerkonto
    Wir bekommen zurzeit eine große Anzahl an E-Mails, die das System zum Beispiel als Benachrichtigungen an Nutzer verschickt,
    als unzustellbar zurück, weil z.B. die Adressen nicht erreichbar sind oder das Postfach gar nicht existiert.
    Stellt doch bitte sicher, dass die Benachrichtigungen, die ihr vom System erwartet, auch zugestellt werden können.
    Nicht erreichbare E-Mail-Adressen sind dazu wenig hilfreich.
    Danke!
WERBUNG

Script für Transcend WiFi SD

maxpax

Themenersteller
Hallo zusammen,

es geht um die Transcend WiFi SD Karten, für die es keinen automatische downloader gibt. Ich hab mir ein für meine Bedürfnisse passendes Skript zusammengeschustert.
Getestet auf einer 16GB Version mit Firmawre 1.8 auf einem iMac mit OS 10.8.5

Das Skript sollte auf einem Mac ohne weiteres laufen, unter Linux vermutlich auch wenn curl drauf ist. Unter Windows weis ichs nicht.
Schreibt doch ob und wie es bei euch funktioniert!

Das ganze geschieht naturlich auf euer eigenes Risiko!

Use at your own risk!

Es enthält sicherlich noch einige Fehler!

Ich hab normalerweise nicht viel mit Bash oder Programmierung an sich am Hut, das ganze lässt sich sicherlich schöner und besser lösen.

Nun zum Skript, es überprüft in einer endlosschleife die SD Karten auf neue Bilder und lädt diese mit curl runter. Für alles weitere lest euch am besten kurz die Kommentare im Skript durch.
Inspiriert wurde das ganze von diesem Thread von Sven_A
https://www.dslr-forum.de/showthread.php?t=1260967
Ich habe allerdings komplett neu angefangen und keinen Teil übernommen, wobei es aber die "Shoot&View" Option nicht nutzt.
Keine Ahnung was das dauernde Abfragen mit curl für einen einfluss auf die Batterielebensdauer hat.
Verbessert es wenn ihr wollt und postet es dann am besten wieder hier!

Einfach den kompletten zweiten Post in eine Text-Datei kopieren und per Terminal ausführen

Also, viel Spass, aber nochmal, benutzt es auf euer eigenes Risiko!
 
Zuletzt bearbeitet:
#!/bin/bash


#by maxpax

#USE AT YOUR OWN RISK
# userinput


SlideshowTimer=5 #Time in seconds, how long the script will wait between each download (perfect for an automatic slideshow),
#set it to zero for downloading as soon as available

LoopTimer=1 #Time in seconds, how long the script will wait between in restarts the while-loop

EXT_ARRAY=(jpg JPEG jpeg JPG) #The file extensions it will download, divided by 1 space

IP="192.168.11.254" #The IP of the WiFi SD Card, usually 192.168.11.254

User="admin" #The username of the WiFi SD Card, usually "admin"

Password="admin" #The password of the WiFi SD Card, usually "admin"

SaveTo=${0%/*} #The directory where the script saves the Folder with the pictures, use ${0%/*} if it should save it to its own location



#######################################################
LastFile="Empty"
echo "Saving pictures to: $SaveTo/From Wi-Fi SD"




#checks if there is already a log of downloaded pictures, if yes it loads the filenames into an array and prints the names in the terminal, if no it creates the "From Wi-Fi SD" Folder
if [ -e "$SaveTo"/From\ Wi-Fi\ SD/DownloadedLog.txt ]
then
DOWNLOADED=( $( cat "$SaveTo"/From\ Wi-Fi\ SD/DownloadedLog.txt ) )
if [ ${#DOWNLOADED[@]} -eq 1 ]
then
echo -e "\nDownloadedLog.txt found, excluding ${#DOWNLOADED[@]} listed picture:\n"
else
echo -e "\nDownloadedLog.txt found, excluding ${#DOWNLOADED[@]} listed pictures:\n"
fi
printf -- '%s\n' "${DOWNLOADED[@]}"
echo -e "\nDownloading NEW Pictures with following extensions from Wi-Fi SD:\n\n${EXT_ARRAY[@]}\n"

else
mkdir -p "$SaveTo"/From\ Wi-Fi\ SD/
DOWNLOADED=()
echo -e "\nDownloading ALL Pictures with following extensions from Wi-Fi SD:\n\n${EXT_ARRAY[@]}\n"

fi

#start of the infinite while-loop
while [ 1 ]
do

Timer=false #for first picture in download loop

#some terminal outputs
echo -ne "\033]0;"Slideshow Timer deactivated, first picture..."\007"
echo -e "Slideshow Timer deactivated, first picture..."
echo -e "Waiting for connection to SD-Card..."

#checks the index.html file in the DCIM folder for subfolders and loads them into an array
DIR_TEMP=($(curl -s http://$User:$Password@$IP/sd/DCIM/))
DIR_TEMP=(${DIR_TEMP[@]/#*href=\"/DIR})
DIR_TEMP=(${DIR_TEMP[@]/%\">*/})
DIRS=()
for DT in "${DIR_TEMP[@]}"
do
if [ "${DT:0:3}" = "DIR" ] && [ "${DT:3:3}" != "../" ]
then
DIRS+=("${DT/#DIR/}")
fi
done

echo -e "${#DIRS[@]} directories in /sd/DCIM/" #prints found subfolders in terminal

#checks the index.html file in each subfolder for pictures and loads them into an array
for D in "${DIRS[@]}"
do
echo -e "\nSearching in /sd/DCIM/$D\n"

FILE_TEMP=($(curl -s http://$User:$Password@$IP/sd/DCIM/"$D"))

FILE_TEMP=(${FILE_TEMP[@]/#*href=\"/FILE})
FILE_TEMP=(${FILE_TEMP[@]/%\">*/})
FILES=()
for FT in "${FILE_TEMP[@]}"
do
#checks if the fileextension fits
AllowedExtension=false
for Ext in "${EXT_ARRAY[@]}"
do
if [ "$Ext" = "${FT#*.}" ]
then
AllowedExtension=true
fi
done

#checks if the picture was already downloaded
NewFile=true
for Dl in "${DOWNLOADED[@]}"
do
if [ "${FT/#FILE/}" = "$Dl" ]
then
NewFile=false
echo "Picture already downloaded: $Dl"

fi

done

#loads all new and files with the right extension into an array
if [ "${FT:0:4}" = "FILE" ] && [ $AllowedExtension = true ] && [ $NewFile = true ]
then
FILES+=("${FT/#FILE/}")
fi



done

#downloads all files in the array
for F in "${FILES[@]}"
do
echo "Downloading: $F"



#deactivates the timer if the picture has the same name as the previous one but has another extension (if you shoot RAW and JPG)
if [ "${F%%.*}" = "${LastFile%%.*}" ]
then
Timer=false
echo "Slideshow Timer deactivated, same picture in different file format, "
echo -ne "\033]0;"Slideshow Timer deactivated, same picture..."\007"


fi

LastFile="$F"


if [ $Timer = true ]
then
watt=false
curl -o "$SaveTo"//From\ Wi-Fi\ SD/$F.tmp http://$User:$Password@$IP/sd/DCIM/$D$F &
curlpid=$!
T=$SlideshowTimer


#Slideshow Timer, starts the curl download in the background and then the timer,
#if the timer finishes before the picture is downloaded, it waits for the download to finish
echo -ne "\nSlideshow Timer, next picture in: "
while [ $T -ge 0 ]
do

sleep 1

case $T in
0) echo -ne "\033]0;"\ \ \ \ \ \ \ \ \ \ \ Waiting for download to finish...\ \ \ \ \ \ \ \ \ \ \ "\007";;
1) echo -ne "\033]0;"Slideshow Timer, next picture in 0$T second\ \ "\007";;
[2-9]*) echo -ne "\033]0;"Slideshow Timer, next picture in 0$T seconds"\007";;
*) echo -ne "\033]0;"Slideshow Timer, next picture in $T seconds"\007";;
esac

let T--
done
wait $curlpid
mv "$SaveTo"//From\ Wi-Fi\ SD/$F.tmp "$SaveTo"//From\ Wi-Fi\ SD/$F

else #if there is no timer, it starts the download directly
curl -o "$SaveTo"//From\ Wi-Fi\ SD/$F.tmp http://$User:$Password@$IP/sd/DCIM/$D$F
mv "$SaveTo"//From\ Wi-Fi\ SD/$F.tmp "$SaveTo"//From\ Wi-Fi\ SD/$F

fi

Timer=true




DOWNLOADED+=("$F")

done






done






#saves the downloaded files including the one it loaded from the log back in the log by overwriting it
printf -- '%s\n' "${DOWNLOADED[@]}" > "$SaveTo"/From\ Wi-Fi\ SD/DownloadedLog.txt

#just the timer until the loop starts again
L=$LoopTimer
echo -ne "\nLoop Timer, restart in: "
while [ $L -ge 0 ]
do

sleep 1
case $L in
0) echo -e "\rLoop Timer, restart in: 0$L seconds"
echo -ne "\033]0;"\ \ \ \ \ \ \ \ \ \ \ Loop Timer, restart in: 0$L seconds\ \ \ \ \ \ \ \ \ \ \ "\007";;
1) echo -ne "\rLoop Timer, restart in: 0$L second "
echo -ne "\033]0;"\ \ \ \ \ \ \ \ \ \ \ Loop Timer, restart in: 0$L second\ \ \ \ \ \ \ \ \ \ \ \ \ "\007";;
[2-9]*) echo -ne "\rLoop Timer, restart in: 0$L seconds"
echo -ne "\033]0;"\ \ \ \ \ \ \ \ \ \ \ Loop Timer, restart in: 0$L seconds\ \ \ \ \ \ \ \ \ \ \ "\007";;
*) echo -ne "\033]0;"Loop Timer, restart in: $L seconds"\007"
echo -ne "\033]0;"\ \ \ \ \ \ \ \ \ \ \ Loop Timer, restart in: $L seconds\ \ \ \ \ \ \ \ \ \ \ "\007";;
esac

let L--
done



done
 
Ich warte nur noch auf meine Transcend WiFi Karte ;) dann kann ich testen ...
 
WERBUNG
Zurück
Oben Unten