前言
本人使用的是尼康D750,自带wifi功能,奈何配套的Android App太难用了,至于怎么难用,我这里就不细说了,用过的都懂。总不能白瞎了wifi功能吧。找了一阵子发现了两个第三方通过逆向工程制作的工具。一个是qDslrDashboard这个app,功能很强大,可以通过手机控制相机,也可以浏览下载相机的照片,还可以协助拍摄延时摄影。另一个就是Airnef,一个python脚本。对PC端有封装GUI。可以实现照片拷贝下载,将指定时间点之后的照片下载下来,不会重复下载已删除的照片,可以实时同步拍摄的照片。完全可以替代原厂渣渣的配套App。所以我就通过Termux搭建Python环境来运行Airnef
上面介绍的两个工具索尼和佳能带有wifi功能的相机也能使用
这样我在手机上就非常轻松的实现了同步单反中jpeg照片功能。这里简单的做一下使用介绍
1. 使用Termux搭建Python运行环境
建议安装oh-my-zsh,不想安装的可以跳过
sh -c "$(curl -fsSL https://github.com/Cabbagec/termux-ohmyzsh/raw/master/install.sh)"
pkg update
pkg install python
2. 下载解压Airnef到Android手机中
下载地址:http://www.testcams.com/airnef/Version_1.1/airnef_v1.1_Source.zip
我将脚本放在 /sdcard/scripts/airnef/airnefcmd.py
cd /sdcard
mkdir scripts
cd scripts
wget http://www.testcams.com/airnef/Version_1.1/airnef_v1.1_Source.zip
unzip airnef_v1.1_Source.zip
rm airnef_v1.1_Source.zip
3. 帮助说明
$ python /sdcard/scripts/airnef/airnefcmd.py -h
airnef v1.1 - Wireless transfer of images/movies for Nikon cameras [GPL v3]
Copyright (c) TestCams.com, Time: 01/18/19 22:55:06, Py: 3.7.2, OS: Linux
usage: airnefcmd.py [-h] [--ipaddress addr]
[--action {getfiles,getsmallthumbs,getlargethumbs,listfiles}]
[--realtimedownload {disabled,afternormal,only}]
[--extlist extension [extension ...]] [--startdate date]
[--enddate date] [--outputdir path]
[--ifexists {uniquename,skip,overwrite,prompt,exit}]
[--downloadhistory {skipfiles,ignore,clear}]
[--onlyfolders camera_folder [camera_folder ...]]
[--excludefolders camera_folder [camera_folder ...]]
[--filenamespec spec] [--dirnamespec spec]
[--transferorder {oldestfirst,newestfirst}]
[--slot {firstfound,first,second,both}]
[--cameratransferlist {useifavail,exitifnotavail,ignore}]
[--downloadexec executable [arguments ...]]
[--downloadexec_extlist extension [extension ...]]
[--downloadexec_options option [option ...]]
[--realtimepollsecs seconds]
[--logginglevel {normal,verbose,debug}]
Wifi image transfer utility for Nikon cameras (airnef@hotmail.com)
optional arguments:
-h, --help show this help message and exit
--ipaddress addr IP address of camera. Default is "192.168.1.1"
--action {getfiles,getsmallthumbs,getlargethumbs,listfiles}
Program action. Default is "getfiles"
--realtimedownload {disabled,afternormal,only}
Download images from camera in realtime as they're
taken. 'afternormal' means realtime capture starts
after regular image download. 'only' skips normal
download and only captures realtime images. Default is
"disabled"
--extlist extension [extension ...]
Type of image/file(s) to download. Ex: "--extlist
NEF". Multiple extensions can be specified. Use
"<NOEXT>" to include files that don't have extensions.
Default is to download all file types
--startdate date Only include image/file(s) captured on or later than
date. Date-only Ex: --startdate 12/05/14. Date+Time
Example: --startdate "12/05/14 15:30:00"
--enddate date Only include image/file(s) captured on or earlier than
date or date+time. Date without a specified time is
inclusive, so for example --enddate 06/12/14 is
interpreted as 06/12/14 23:59:59
--outputdir path Directory to store image/file(s) to. Default is
current directory. No ending backslash is necessary.
If path contains any spaces enclose it in double
quotes. Example: --outputdir "c:\My Documents"
--ifexists {uniquename,skip,overwrite,prompt,exit}
Action to take if file with same name already exists.
Default is "uniquename"
--downloadhistory {skipfiles,ignore,clear}
'skipfiles' means that files in history (ie,
previously downloaded) will be skipped and not
downloaded. Default is "skipfiles"
--onlyfolders camera_folder [camera_folder ...]
Only include image/file(s) existing in specified
camera folders.. Ex: "--onlyfolders 100D7200
101D7200". Default is to include all folders
--excludefolders camera_folder [camera_folder ...]
Exclude image/file(s) existing in specified camera
folders.. Ex: "--excludefolders 103D7200". Default is
no exclusions.
--filenamespec spec Optionally rename files using dynamic renaming engine.
See online help for documentation on 'spec'
--dirnamespec spec Optionally name directories using dynamic renaming
engine. See online help for documentation on 'spec'
--transferorder {oldestfirst,newestfirst}
Transfer oldest or newest files first. Default is
"oldestfirst"
--slot {firstfound,first,second,both}
Card slot on camera to read from. Default is
"firstfound", which means first populated slot
--cameratransferlist {useifavail,exitifnotavail,ignore}
Decide how to handle images selected on camera.
Default is "useifavail"
--downloadexec executable [arguments ...]
Launch application for each file downloaded
--downloadexec_extlist extension [extension ...]
Type of files(s) by extension on wich to perform
--downloadexec on. Default is all file types
--downloadexec_options option [option ...]
Options for launcing application. For example 'wait'
waits for launched app to exit before proceeding to
next download. See online help for more options
--realtimepollsecs seconds
How often camera is polled for new images in realtime
mode, in seconds. Default is every 3 seconds
--logginglevel {normal,verbose,debug}
Sets how much information is saved to the result log.
Default is "normal"
Options can also be specified from a file. Use !<filename>. Each word in the
file must be on its own line.
You can abbreviate any argument name provided you use enough characters to
uniquely distinguish it from other argument names.
Command-Line Examples:
airnefcmd.py --extlist NEF MOV (download only raw images and MOV files)
airnefcmd.py --downloadhistory ignore (dont skip files previously downloaded)
4. 使用别名简化脚本使用
~/.zshrc 文件中加入(如果不是使用zsh作为默认shell的话,则在~/.bashrc中加入)
#获取今天的日期,这里只拷贝今天的
date=`date +'%m/%d/%y'`
#实时拷贝拍摄的照片到手机
alias airnef_realtime="python /sdcard/scripts/airnef/airnefcmd.py --action getfiles --ipaddress 192.168.1.1 --realtimedownload only --logginglevel normal --extlist NEF JPG --outputdir /sdcard/DCIM/NIKON --ifexists skip --slot second --transferorder oldestfirst --cameratransferlist ignore --downloadexec sh /sdcard/scripts/airnef/previewImage.sh \"@pf@\""
#拷贝今天拍摄的照片到手机
alias airnef_copy_today="python /sdcard/scripts/airnef/airnefcmd.py --action getfiles --ipaddress 192.168.1.1 --realtimedownload disabled --logginglevel normal --extlist NEF JPG --outputdir /sdcard/DCIM/NIKON --ifexists skip --slot second --transferorder oldestfirst --startdate ${date} --cameratransferlist ignore --downloadexec sh /sdcard/scripts/airnef/scanner.sh \"@pf@\""
#拷贝所有新照片
alias airnef_copy="python /sdcard/scripts/airnef/airnefcmd.py --action getfiles --ipaddress 192.168.1.1 --realtimedownload disabled --logginglevel normal --extlist NEF JPG --outputdir /sdcard/DCIM/NIKON --ifexists skip --slot second --transferorder oldestfirst --cameratransferlist ignore --downloadexec sh /sdcard/scripts/airnef/scanner.sh \"@pf@\""
#拷贝所有新照片,并将监听实时拍摄的照片
alias airnef_copy_realtime="airnef_copy && airnef_realtime"
实现图片预览的脚本
/sdcard/scripts/airnef/previewImage.sh
#!/system/bin/sh
echo "Preview Image"
#媒体扫描
am broadcast -a android.intent.action.MEDIA_SCANNER_SCAN_FILE -d file://$1 > /dev/null 2>&1 &
am start -a android.intent.action.VIEW -t image/jpeg -d file://$1 > /dev/null 2>&1 &
媒体扫描脚本
/sdcard/scripts/airnef/scanner.sh
#!/system/bin/sh
am broadcast -a android.intent.action.MEDIA_SCANNER_SCAN_FILE -d file://$1 > /dev/null 2>&1 &
5. 使用
连接相机wifi,然后打开termux,运行命令