Bes*_*esi 9 python macos photography wifi
我正在使用Airnef通过python从佳能DSLR相机下载图片.
我可以没有问题地下载一张图片,所以整个设置似乎都有效.但是,只要我想下载另一个图像,软件就会挂起.我的代码看起来很复杂.
两个月前,我在TestCams.com上发布了一个帖子.由于我没有得到回复,我在此发布这个与python相关的问题.
我从命令行启动airnef.
python airnefcmd.py --ipaddress 192.168.188.84 --action getfiles --realtimedownload only --downloadexec open @pf@ --transferorder newestfirst --outputdir "/Users/besi/Desktop"
Run Code Online (Sandbox Code Playgroud)
我连接相机,我显示了一些有关我的连接的信息:
连接建立到192.168.188.84:15740
相机型号"Canon EOS 200D",S/N"XXXXXXXXX"
现在,airnef告诉我:
等待从相机下载的实时照片.
按退出|
我拍了一张照片并按预期下载了它:
正在下载"IMG_0084.JPG":96%
然后Airnef显示有关此图像的更多信息:
/Users/besi/Desktop/IMG_0084.JPG [size = 4,602,357],1.94秒(2.26 MB/s)
我拍了一些照片,但是他们没有下载,而且软件卡在提示符下:
等待从相机下载的实时照片.按退出\
源代码可在Airnef网站上获得.我创建了一个github存储库来解决这个问题:https://github.com/besi/airnef
代码被卡住的地方是airnefcmd.py:3203
这是testcams.com上论坛帖子的链接
在调试输出中,我可以看到正在拍摄的新照片,但是由于之前的图像已经下载,因此会跳过下载:
filename = DCIM\100CANON\IMG_0183.JPG
captureDateSt = 20180926T071759
modificationDateStr= 20180926T071758
Run Code Online (Sandbox Code Playgroud)
找到了一个名为的新图像IMG_0183.JPG.
Skipping IMG_0182.JPG - already downloaded this session
Run Code Online (Sandbox Code Playgroud)
旧的下载图像似乎阻止了当前图像的进一步处理.
Skipping 100CANON - object is not file - MTP_OBJFORMAT_Assocation (0x3001)
Skipping DCIM - object is not file - MTP_OBJFORMAT_Assocation (0x3001)
Waiting for realtime photos from camera to download. Press <ctrl-c> to exit -execMtpOp: MTP_OP_GetObjectHandles - CmdReq payload:
Run Code Online (Sandbox Code Playgroud)
现在我们再次在循环中等待更多图片.拍摄新照片时,会再次发生相同的过程.
我没有兼容的相机,所以我的答案仅基于论坛上发布的日志(调试模式)。
此外,这是其中一条评论中的尝试和错误建议,因此这不是“科学”方法(确定原因然后修复)。
\n需要团队(@Besi 和我)的努力才能得出这个答案(并且功劳应该相应地分配)。
根据日志,这两个文件的处理方式存在差异:
\n\n\nRun Code Online (Sandbox Code Playgroud)\n...\n\nfilename = DCIM\\100CANON\\IMG_0182.JPG\ncaptureDateSt = 20180926T071747\nmodificationDateStr= 20180926T071748\nDownload history file \xe2\x80\x9c/Users/besi/Library/Application Support/airnef/appdata/Canon EOS 200D-SN59074c1578e347a3bf1f6f85e8dec624-downloadhist\xe2\x80\x9d loaded \xe2\x80\x93 53 entries\n>> MTP_OP_GetObject\nDownloading \xe2\x80\x9cIMG_0182.JPG\xe2\x80\x9d: 0%IMG_0182.JPG \xe2\x80\x93 downloading next piece, offset=0x0, count=0x100000\n\n...\n\nfilename = DCIM\\100CANON\\IMG_0183.JPG\ncaptureDateSt = 20180926T071759\nmodificationDateStr= 20180926T071758\nSkipping IMG_0182.JPG \xe2\x80\x93 already downloaded this session\nSkipping 100CANON \xe2\x80\x93 object is not file \xe2\x80\x93 MTP_OBJFORMAT_Assocation (0x3001)\nSkipping DCIM \xe2\x80\x93 object is not file \xe2\x80\x93 MTP_OBJFORMAT_Assocation (0x3001)\nWaiting for realtime photos from camera to download. Press <ctrl-c> to exit -execMtpOp: MTP_OP_GetObjectHandles \xe2\x80\x93 CmdReq payload:\n\n...\n
正如处理第二个文件 ( IMG_0183.JPG )时所见,第一个文件 ( IMG_0182.JPG )的存在会触发所有内容被放弃。
\n浏览[TestCams]:airnef - 从您的尼康相机无线下载!,其中一个命令行参数(实际上,我建议了更多)引起了我的注意:
--rtd_mtppollingmethod_newobjdetection,我建议指定numobjs(因此,覆盖默认值)。显然,这是(主要)问题。另一部分是--transferorder latestfirst
的存在。默认情况下,在实时下载模式下,它设置为oldfirstfirst(见下文)。删除它(或多余地指定--transferorderoldfirst)就可以了。
结论
\n为了解决这个问题,有两件事是必要的(就airnefcmd.py的cmdline arg而言):
\n根据[GitHub]:besi/airnef -(主)airnef/airnefcmd.py#3403:
\ng.args[\'transferorder\'] = \'oldestfirst\' # so that downloadMtpFileObjects() will properly enumerate through multiple realtime images as we add them\nRun Code Online (Sandbox Code Playgroud)\n我认为这是airnef方面的一个错误(关于--transferorder)。它位于
\n| 归档时间: |
|
| 查看次数: |
224 次 |
| 最近记录: |