Last active
August 23, 2020 20:02
-
-
Save ohac/e2ff0be34b4e0fa92755ec28ab238d48 to your computer and use it in GitHub Desktop.
get file ID from Panasonic Lumix DMC-GX8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
result.xml | |
tmp.xml | |
tmp2.txt | |
*.jpg | |
*.mp4 | |
*.ts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mac=fc:db:b3:a0:8b:2a | |
#host=192.168.24.215 | |
seq 200 254 | xargs -P32 -i ping -c1 -W 1 192.168.24.{} | grep icmp_ | |
host=`arp -n | grep ${mac} | cut -d' ' -f1` | |
if [ -z $host ]; then | |
echo not found | |
exit | |
fi | |
echo found $host | |
curl -s "http://${host}/cam.cgi?mode=getstate" | xml2 | |
curl -s \ | |
-H 'SOAPAction: "urn:schemas-upnp-org:service:ContentDirectory:1#Browse"' \ | |
-H 'Content-Type: text/xml; charset="UTF-8"' \ | |
--data-binary @soapbody.xml \ | |
"http://${host}:60606/Server0/CDS_control" \ | |
> result.xml | |
grep Result result.xml | \ | |
sed "s/"/'/g" | \ | |
sed "s/</</g" | \ | |
sed "s/>/>/g" | \ | |
cat > tmp.xml | |
xml2 < tmp.xml | \ | |
egrep -o '(@id|class)=.*$' | \ | |
cut -d= -f2- | \ | |
cat > tmp2.txt | |
while read id; do | |
read class | |
if [ ${#id} -ne 7 ]; then | |
# TODO download .ts (AVCHD) | |
continue | |
fi | |
if [ $class == "object.item.imageItem" ]; then | |
ext="jpg" | |
fi | |
if [ $class == "object.item.videoItem.movie" ]; then | |
ext="mp4" | |
fi | |
filename="DO$id.$ext" | |
if ! [ -a $filename ]; then | |
curl -v "http://${host}:50001/$filename" > $filename | |
fi | |
done <tmp2.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> | |
<s:Body> | |
<u:Browse xmlns:u="urn:schemas-upnp-org:service:ContentDirectory:1"> | |
<ObjectID>0</ObjectID> | |
<BrowseFlag>BrowseDirectChildren</BrowseFlag> | |
<Filter></Filter> | |
<StartingIndex>0</StartingIndex> | |
<RequestedCount>50</RequestedCount> | |
<SortCriteria></SortCriteria> | |
</u:Browse> | |
</s:Body> | |
</s:Envelope> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment