iphoto的命令行接口

iphoto的Python项目详细描述


用于管理iphoto库的命令行实用程序。

警告:除了我自己的iphoto之外,没有任何版本的iphoto进行测试,这是 目前为V9.5.1。使用风险自负。

目前需要Python3.4。不是因为什么严重的原因,但这是唯一 我测试过的版本。

安装

pip install iphoto

命令行用法

警告:exec是一个危险的潜在破坏性命令,它直接 在你的iphoto数据库上操作。继续之前备份库。

警告:如果运行exec并通过iphoto同时进行更改,则 结果不可预测。你至少可以预料到 在iphoto中的操作和命令行上可观察到的更改,但是 意识到数据丢失的可能性,因为应用程序可以从 最近更改的过时缓存。iphoto没有合理的预期 其他应用程序正在使用其数据库。

exec命令依赖于iphoto对象模型的一些知识, 这在下面的章节中有描述。

# If you don't specify any specific actions, the `exec` script defaults to
# `print(master)`:
$ iphoto exec
The Badlands / DSC_0240
... snip ...
Unnamed event (10/30/2014) / 20141030_150848

# Unless you specify the `--commit` flag, everything is executed in
# "dry-run" mode. For instance, this lists the photos that would be
# modified by the `--reset-time` action:
$ iphoto exec --reset-time

# Different filters are available for constraining which photos `exec`
# applies to. For instance, this resets the v1 time to match the master
# time for photos in the Mayhem album:
$ iphoto exec --album='Mayhem' --reset-time --commit

# This subtracts an hour from flagged photos in the Mayhem album:
$ iphoto exec --album='Mayhem' --flagged --offset-time='-3600' --commit

# You can specify a generic python script which executes in the context of
# a single photo. For instance, this unflags everything from events
# containing photos from 10/14/2014:
$ iphoto exec --event='2014-10-14' --commit 'v1.isFlagged = 0'# This prints the name and image path for every photo from the event of
# 10/14/2014:
$ iphoto exec --event '2014-10-14'\
'print("%s\t%s" % (master.name, master.imagePath))'# This prints the file sizes of all flagged photos:
$ iphoto exec --flagged 'print(master.fileSize)'

对象模型

iphoto不会对最初导入的“master”应用任何图像调整 形象。相反,它将每个图像的ExIF数据拷贝到SQLite数据库中。 事实上,它实际上保留了三个副本——master、v0和v1记录,以及 所有这些都是在导入时创建的。您在ui中看到的属性都是 从v1记录。我建议你坚持同样的方法:编辑v1, 并且,如果需要,通过从v0或master复制属性来还原它。

从iphoto导出照片时,v1的属性将自动 应用于导出的照片。

专辑类型

唱片集有三种类型:

  1. events:如果您使用了ui,您会怎么想。每张照片都是 只与一个事件相册关联,主相册和 版本记录通过projectUuid
  2. 智能相册:带有动态查询定义内容的自定义相册。 查询隐藏在一个密钥存档文件中,该文件本身存储 在相册的二进制plist文件中。当前不支持此相册类型 由iphoto.py编写,因为我没有找到或编写用于键控的解析器 存档格式。它在技术上类似于bplist解析器,但更多 很复杂。
  3. 常规相册:带有静态用户管理图像的自定义相册 列表包含图像的v1 uuid列在相册的二进制文件中 plist文件。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java GridBagLayout不填充区域   java Memozied Fibonacci未运行与常规Fibonacci解决方案   Java Web启动未启动问题   Java中异常和if-then的区别   java从命令提示符运行批处理文件获取错误   socket在Java中验证SSL证书的公共名称   如何在JAVA中检查字符串数组中的相等字   用java语言将音频文件转换成文本文件的语音识别   java为什么foo(1,2,3)没有传递给varargs方法foo(对象…)作为整数[]   java通过蓝牙将奇怪的数据从Arduino传输到Android   java ContainerRequestFilter获取空entitystream   java如何从安卓 studio中删除不兼容类型错误   基本Java错误   在Spring引导中使用REST API时发生java错误   javascript通过从SQL查询派生的URL打开页面