Skip to main content

QueryBuilder

Struct QueryBuilder 

Source
pub struct QueryBuilder<'et> { /* private fields */ }
Expand description

查询构建器

Implementations§

Source§

impl<'et> QueryBuilder<'et>

Source

pub fn include_unknown(self, yes: bool) -> Self

包含未知标签

Source

pub fn include_duplicates(self, yes: bool) -> Self

包含重复标签

Source

pub fn raw_values(self, yes: bool) -> Self

显示原始数值(而非格式化后的值)

Source

pub fn group_by_category(self, yes: bool) -> Self

按类别分组(-g1 选项)

Source

pub fn no_composite(self, yes: bool) -> Self

禁用复合标签生成

使用 -e 选项禁用复合标签(Composite tags)的生成。 复合标签是由 ExifTool 根据其他标签计算得出的派生标签。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 只读取原始标签,不生成复合标签
let metadata = exiftool.query("photo.jpg")
    .no_composite(true)
    .execute()?;
Source

pub fn extract_embedded(self, level: Option<u8>) -> Self

提取嵌入文件信息

使用 -ee 选项从文件中提取嵌入的文件信息。 例如从 RAW 文件中提取 JPEG 预览图的元数据。

§级别
  • None - 不提取嵌入文件(默认)
  • Some(1) - -ee 提取直接嵌入的文件
  • Some(2) - -ee2 提取所有层级的嵌入文件
  • Some(3+) - -ee3 及以上更深入的提取
§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 提取嵌入文件信息
let metadata = exiftool.query("photo.raw")
    .extract_embedded(Some(1))
    .execute()?;
Source

pub fn extension(self, ext: impl Into<String>) -> Self

设置文件扩展名过滤

使用 -ext 选项只处理指定扩展名的文件。 可以使用多次来指定多个扩展名。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 只处理 jpg 文件
let metadata = exiftool.query("/photos")
    .extension("jpg")
    .recursive(true)
    .execute()?;

// 处理多个扩展名
let metadata = exiftool.query("/photos")
    .extension("jpg")
    .extension("png")
    .extension("raw")
    .recursive(true)
    .execute()?;
Source

pub fn ignore(self, dir: impl Into<String>) -> Self

设置要忽略的目录

使用 -i 选项忽略指定的目录名称。 在递归处理时,匹配的目录将被跳过。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 忽略 .git 和 node_modules 目录
let metadata = exiftool.query("/project")
    .ignore(".git")
    .ignore("node_modules")
    .recursive(true)
    .execute()?;
Source

pub fn recursive(self, yes: bool) -> Self

递归处理子目录

使用 -r 选项递归处理目录中的所有文件。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 递归处理整个目录树
let metadata = exiftool.query("/photos")
    .recursive(true)
    .extension("jpg")
    .execute()?;
Source

pub fn progress( self, interval: Option<u32>, title: Option<impl Into<String>>, ) -> Self

启用进度显示

使用 -progress 选项在处理文件时显示进度信息。 可以指定间隔(每隔多少文件显示一次)和标题。

§参数
  • interval - 每隔多少文件显示一次进度(None 表示每个文件都显示)
  • title - 进度信息的标题(可选)
§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 每 10 个文件显示一次进度
let metadata = exiftool.query("/photos")
    .recursive(true)
    .progress(Some(10), Some("Processing"))
    .execute()?;
Source

pub fn tag(self, tag: impl Into<String>) -> Self

添加特定标签查询

Source

pub fn tags(self, tags: &[impl AsRef<str>]) -> Self

添加多个标签查询

Source

pub fn tag_id(self, tag: TagId) -> Self

添加特定标签查询(使用 TagId)

Source

pub fn exclude(self, tag: impl Into<String>) -> Self

排除特定标签

Source

pub fn excludes(self, tags: &[impl AsRef<str>]) -> Self

排除多个标签

Source

pub fn exclude_id(self, tag: TagId) -> Self

排除特定标签(使用 TagId)

Source

pub fn charset(self, charset: impl Into<String>) -> Self

使用特定编码

Source

pub fn lang(self, lang: impl Into<String>) -> Self

使用特定语言

Source

pub fn coord_format(self, format: impl Into<String>) -> Self

设置 GPS 坐标格式

使用 -c 选项设置 GPS 坐标的输出格式

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 使用小数度格式
let metadata = exiftool.query("photo.jpg")
    .coord_format("%.6f")
    .execute()?;

// 使用度分秒格式
let metadata = exiftool.query("photo.jpg")
    .coord_format("%d deg %d' %.2f\"")
    .execute()?;
Source

pub fn date_format(self, format: impl Into<String>) -> Self

设置日期/时间格式

使用 -d 选项设置日期/时间值的输出格式

§预设格式
  • "%Y:%m:%d %H:%M:%S" - 标准 EXIF 格式(默认)
  • "%Y-%m-%d" - ISO 日期格式
  • "%c" - 本地时间格式
  • "%F %T" - ISO 8601 格式
§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 使用 ISO 格式
let metadata = exiftool.query("photo.jpg")
    .date_format("%Y-%m-%d %H:%M:%S")
    .execute()?;
Source

pub fn arg(self, arg: impl Into<String>) -> Self

添加原始参数(高级用法)

Source

pub fn args_file(self, path: impl Into<String>) -> Self

从文件读取参数

对应 ExifTool 的 -@ 选项,从指定文件中读取命令行参数, 每行一个参数。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

let metadata = exiftool.query("photo.jpg")
    .args_file("args.txt")
    .execute()?;
Source

pub fn csv_delimiter(self, delim: impl Into<String>) -> Self

设置 CSV 分隔符

对应 ExifTool 的 -csvDelim 选项,设置 CSV 输出中使用的分隔符字符。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

let output = exiftool.query("photo.jpg")
    .csv_delimiter("\t")
    .execute_text()?;
Source

pub fn alternate_file(self, num: u8, path: impl Into<String>) -> Self

加载替代文件的标签信息

对应 ExifTool 的 -fileNUM 选项,从替代文件中加载标签。 num 为文件编号(1-9),path 为替代文件路径。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

let metadata = exiftool.query("photo.jpg")
    .alternate_file(1, "other.jpg")
    .execute()?;
Source

pub fn recursive_hidden(self) -> Self

递归处理子目录(包含隐藏目录)

对应 ExifTool 的 -r. 选项,递归处理时包含以 . 开头的隐藏目录。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

let metadata = exiftool.query("/photos")
    .recursive_hidden()
    .execute()?;
Source

pub fn source_file(self, fmt: impl Into<String>) -> Self

设置源文件格式

对应 ExifTool 的 -srcfile 选项,指定处理时使用的源文件格式字符串。 支持使用 %d%f%e 等占位符来匹配不同的源文件。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 从 XMP sidecar 文件读取标签
let metadata = exiftool.query("photo.jpg")
    .source_file("%d%f.xmp")
    .execute()?;
Source

pub fn unknown_binary(self) -> Self

提取未知二进制标签

对应 ExifTool 的 -U 选项,提取未知的二进制标签值。 比 -u 更激进,会尝试解码未知的二进制数据。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

let metadata = exiftool.query("photo.jpg")
    .unknown_binary()
    .execute()?;
Source

pub fn use_module(self, module: impl Into<String>) -> Self

加载 ExifTool 插件模块

对应 ExifTool 的 -use 选项,加载指定的 ExifTool 插件模块。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

let metadata = exiftool.query("photo.jpg")
    .use_module("MWG")
    .execute()?;
Source

pub fn print_format(self, format: impl Into<String>) -> Self

设置自定义打印格式

使用 -p 选项按指定格式打印输出。 使用 $TAGNAME 语法引用标签值。

§格式语法
  • $TAGNAME - 插入标签值
  • $TAGNAME# - 插入原始数值(无格式化)
  • ${TAGNAME:FMT} - 使用指定格式
  • $$ - 插入 $ 字符
§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 自定义输出格式
let output = exiftool.query("photo.jpg")
    .print_format("$FileName: $DateTimeOriginal ($Make $Model)")
    .execute_text()?;

println!("{}", output);
Source

pub fn no_print_conv(self) -> Self

禁用打印转换

使用 -n 选项禁用所有打印转换,显示原始数值。 与 raw_values() 功能相同,但提供更直观的命名。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 禁用打印转换,获取原始数值
let metadata = exiftool.query("photo.jpg")
    .no_print_conv()
    .execute()?;
Source

pub fn binary(self) -> Self

二进制输出

使用 -b 选项以二进制格式输出标签值。 通常用于提取缩略图、预览图等二进制数据。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 以二进制格式输出
let output = exiftool.query("photo.jpg")
    .binary()
    .tag("ThumbnailImage")
    .execute_text()?;
Source

pub fn group_headings(self, num: Option<u8>) -> Self

按组分类输出

使用 -g 选项按组分类显示标签。 可选参数指定分组级别(0-7),默认为 0。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 按默认分组级别显示
let metadata = exiftool.query("photo.jpg")
    .group_headings(None)
    .execute()?;

// 按指定分组级别显示
let metadata = exiftool.query("photo.jpg")
    .group_headings(Some(1))
    .execute()?;
Source

pub fn group_headings_multi(self, groups: &[u8]) -> Self

按多个组级别分类输出

使用 -gNUM:NUM:... 选项按多个组级别分类显示标签。 例如 group_headings_multi(&[0, 1]) 生成 -g0:1

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 按多组级别分类显示(-g0:1:2)
let metadata = exiftool.query("photo.jpg")
    .group_headings_multi(&[0, 1, 2])
    .execute()?;
Source

pub fn short(self, level: Option<u8>) -> Self

短输出格式

使用 -s 选项以短格式输出标签名。 可选参数指定短格式级别:

  • NoneSome(1) - -s 使用标签名而非描述
  • Some(2) - -s2 更短的输出
  • Some(3) - -s3 最短输出
§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

let metadata = exiftool.query("photo.jpg")
    .short(Some(2))
    .execute()?;
Source

pub fn short_format_level(self, level: u8) -> Self

显式指定短格式级别

使用 -sNUM 选项显式指定短格式级别,支持 -s1-s2-s3

§参数
  • level - 短格式级别(1、2 或 3)
§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 使用 -s1 显式指定级别 1
let metadata = exiftool.query("photo.jpg")
    .short_format_level(1)
    .execute()?;

// 使用 -s3 最短格式
let metadata = exiftool.query("photo.jpg")
    .short_format_level(3)
    .execute()?;
Source

pub fn very_short(self) -> Self

极短输出格式

使用 -S 选项以极短格式输出(仅标签名和值)

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

let output = exiftool.query("photo.jpg")
    .very_short()
    .execute_text()?;
Source

pub fn allow_duplicates(self) -> Self

允许重复标签

使用 -a 选项允许输出中包含重复的标签。 与 include_duplicates(true) 功能相同。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

let metadata = exiftool.query("photo.jpg")
    .allow_duplicates()
    .execute()?;
Source

pub fn unknown(self) -> Self

提取未知标签

使用 -u 选项提取未知标签。 与 include_unknown(true) 功能相同。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

let metadata = exiftool.query("photo.jpg")
    .unknown()
    .execute()?;
Source

pub fn xml_format(self) -> Self

XML 格式输出

使用 -X 选项以 XML/RDF 格式输出。 通常与 execute_text() 配合使用获取 XML 文本。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

let xml = exiftool.query("photo.jpg")
    .xml_format()
    .execute_text()?;
Source

pub fn ignore_minor_errors(self) -> Self

忽略次要错误

使用 -m 选项忽略次要错误和警告,继续处理。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

let metadata = exiftool.query("photo.jpg")
    .ignore_minor_errors()
    .execute()?;
Source

pub fn sort(self, yes: bool) -> Self

按字母顺序排序输出

使用 -sort 选项对标签进行字母排序

Source

pub fn separator(self, sep: impl Into<String>) -> Self

设置列表项分隔符

使用 -sep 选项设置列表项的分隔符字符串

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 使用逗号分隔列表项
let metadata = exiftool.query("photo.jpg")
    .separator(", ")
    .execute()?;
Source

pub fn fast(self, level: Option<u8>) -> Self

启用快速模式

使用 -fast 选项提高元数据提取速度。 这会跳过某些处理步骤,可能遗漏某些信息。

§级别
  • None - 不使用快速模式(默认)
  • Some(1) - -fast 基础快速模式
  • Some(2) - -fast2 更激进的快速模式
§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 使用快速模式处理大量文件
let metadata = exiftool.query("photo.jpg")
    .fast(Some(1))
    .execute()?;
Source

pub fn scan_for_xmp(self, yes: bool) -> Self

强制扫描 XMP 数据

使用 -scanForXMP 选项暴力扫描文件中的 XMP 数据

Source

pub fn api_option( self, opt: impl Into<String>, value: Option<impl Into<String>>, ) -> Self

设置 API 选项

使用 -api 选项设置 ExifTool API 选项。 常见选项包括:QuickTimeUTC, SystemTags, largefilesupport

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 启用 QuickTimeUTC
let metadata = exiftool.query("video.mp4")
    .api_option("QuickTimeUTC", None::<&str>)
    .execute()?;
Source

pub fn api_option_empty( self, opt: impl Into<String>, value: Option<impl Into<String>>, ) -> Self

设置 API 选项(使用 ^= 赋值语义)

使用 -api OPT^=VAL 设置 API 选项。 与 = 赋值的区别:省略值时 = 设为 undef,^= 设为空字符串。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 设置 API 选项为空字符串(-api OPT^=)
let metadata = exiftool.query("photo.jpg")
    .api_option_empty("LargeFileSupport", None::<&str>)
    .execute()?;
Source

pub fn user_param( self, param: impl Into<String>, value: Option<impl Into<String>>, ) -> Self

设置用户参数

使用 -userParam 选项设置用户参数,可在配置文件中使用

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 设置自定义参数
let metadata = exiftool.query("photo.jpg")
    .user_param("MyParam", Some("value"))
    .execute()?;
Source

pub fn user_param_empty( self, param: impl Into<String>, value: Option<impl Into<String>>, ) -> Self

设置用户参数(使用 ^= 赋值语义)

使用 -userParam PARAM^=VAL 设置用户参数。 与 = 赋值的区别:省略值时 = 设为 undef,^= 设为空字符串。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 设置用户参数为空字符串
let metadata = exiftool.query("photo.jpg")
    .user_param_empty("MyParam", None::<&str>)
    .execute()?;
Source

pub fn password(self, passwd: impl Into<String>) -> Self

设置密码

使用 -password 选项处理受密码保护的文件

§安全性警告

密码将以纯文本形式传递给 ExifTool 进程。 在多用户系统中使用时请注意安全性。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 读取受密码保护的 PDF
let metadata = exiftool.query("protected.pdf")
    .password("secret123")
    .execute()?;
Source

pub fn decimal(self, yes: bool) -> Self

十进制显示标签 ID

使用 -D 选项以十进制格式显示标签 ID 编号

Source

pub fn escape(self, format: EscapeFormat) -> Self

转义格式

使用 -E-ex-ec 选项转义标签值

Source

pub fn escape_html(self) -> Self

HTML 转义输出

使用 -E 选项对标签值进行 HTML 实体转义。 这是 escape(EscapeFormat::Html) 的快捷方法。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

let metadata = exiftool.query("photo.jpg")
    .escape_html()
    .execute()?;
Source

pub fn escape_xml(self) -> Self

XML 转义输出

使用 -ex 选项对标签值进行 XML 转义。 这是 escape(EscapeFormat::Xml) 的快捷方法。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

let metadata = exiftool.query("photo.jpg")
    .escape_xml()
    .execute()?;
Source

pub fn escape_c(self) -> Self

C 语言转义输出

使用 -ec 选项对标签值进行 C 语言风格转义。 这是 escape(EscapeFormat::C) 的快捷方法。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

let metadata = exiftool.query("photo.jpg")
    .escape_c()
    .execute()?;
Source

pub fn force_print(self, yes: bool) -> Self

强制打印

使用 -f 选项强制打印所有指定标签

Source

pub fn group_names(self, level: Option<u8>) -> Self

打印组名

使用 -G 选项打印每个标签的组名。 单个级别参数,生成 -G-GN

Source

pub fn group_names_multi(self, groups: &[u8]) -> Self

打印多个组级别的组名

使用 -GNUM:NUM:... 选项打印多组级别的组名。 例如 group_names_multi(&[0, 1]) 生成 -G0:1

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 按多组级别打印组名(-G0:1:2)
let metadata = exiftool.query("photo.jpg")
    .group_names_multi(&[0, 1, 2])
    .execute()?;
Source

pub fn html_format(self, yes: bool) -> Self

HTML 格式

使用 -h 选项以 HTML 格式输出

Source

pub fn hex(self, yes: bool) -> Self

十六进制显示

使用 -H 选项以十六进制显示标签 ID

Source

pub fn long_format(self, yes: bool) -> Self

长格式输出

使用 -l 选项以长格式(2行)输出

Source

pub fn latin(self, yes: bool) -> Self

Latin1 编码

使用 -L 选项使用 Windows Latin1 编码

Source

pub fn short_format(self, level: Option<u8>) -> Self

短格式输出

使用 -s-S 选项以短格式输出

Source

pub fn tab_format(self, yes: bool) -> Self

Tab 分隔格式

使用 -t 选项以 Tab 分隔格式输出

Source

pub fn table_format(self, yes: bool) -> Self

表格格式

使用 -T 选项以表格格式输出

Source

pub fn text_out(self, ext: impl Into<String>) -> Self

文本输出到文件

使用 -w 选项将输出写入文件

Source

pub fn tag_out(self, format: impl Into<String>) -> Self

标签输出到文件

使用 -W 选项为每个标签创建输出文件

Source

pub fn tag_out_ext(self, ext: impl Into<String>) -> Self

标签输出扩展名过滤

使用 -Wext 选项指定 -W 输出的文件类型

Source

pub fn list_item(self, index: u32) -> Self

提取列表项

使用 -listItem 选项提取列表中的特定项

Source

pub fn list_dir(self) -> Self

列出目录而非文件

使用 -list_dir 选项让 ExifTool 列出目录名而非处理文件。 与 -r 递归选项配合使用时,输出目录树结构。

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 列出目录而非文件
let output = exiftool.query("/photos")
    .list_dir()
    .recursive(true)
    .execute_text()?;
Source

pub fn file_order(self, tag: impl Into<String>, descending: bool) -> Self

文件处理顺序

使用 -fileOrder 选项设置文件处理顺序

Source

pub fn quiet(self, yes: bool) -> Self

静默模式

使用 -q 选项减少输出信息

Source

pub fn html_dump(self, offset: Option<u32>) -> Self

HTML 二进制转储

使用 -htmlDump 选项生成 HTML 格式的二进制转储。 可以指定可选的偏移量。

§参数
  • offset - 可选的起始偏移量。None 表示无偏移(纯 -htmlDump), Some(n) 表示带偏移量(-htmlDumpN
Source

pub fn html_dump_offset(self, offset: u32) -> Self

HTML 二进制转储(带指定偏移量)

使用 -htmlDumpOFFSET 选项生成带偏移量的 HTML 二进制转储。 这是 html_dump(Some(offset)) 的便捷方法。

Source

pub fn php_format(self, yes: bool) -> Self

PHP数组格式输出

使用 -php 选项导出为PHP数组格式

Source

pub fn plot_format(self, yes: bool) -> Self

SVG plot格式输出

使用 -plot 选项输出为SVG plot文件

Source

pub fn args_format(self, yes: bool) -> Self

格式化为exiftool参数

使用 -args 选项将元数据格式化为exiftool参数格式

Source

pub fn common_args(self, args: &[impl AsRef<str>]) -> Self

设置公共参数

使用 -common_args 选项定义在多个命令之间共享的参数

Source

pub fn echo( self, text: impl Into<String>, target: Option<impl Into<String>>, ) -> Self

输出文本到stdout或stderr

使用 -echo 选项在处理期间输出文本

  • text: 要输出的文本
  • target: 输出目标,None表示stdout,Some(“stderr”)表示stderr
Source

pub fn echo_level(self, level: u8, text: impl Into<String>) -> Self

指定级别的echo输出

使用 -echoNUM 选项在处理期间输出文本到指定级别的输出流。

  • 级别 1: stdout (等价于 -echo)
  • 级别 2: stderr (等价于 -echo2)
  • 级别 3: 额外输出级别3
  • 级别 4: 额外输出级别4
§参数
  • level - echo级别 (1-4)
  • text - 要输出的文本
§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

// 使用 -echo3 输出到级别3
let metadata = exiftool.query("photo.jpg")
    .echo_level(3, "Processing...")
    .execute()?;
Source

pub fn efile(self, filename: impl Into<String>) -> Self

保存错误文件名到文件

使用 -efile 选项将处理失败的文件名保存到指定文件

Source

pub fn efile_variant( self, filename: impl Into<String>, num: Option<u8>, force: bool, ) -> Self

保存错误文件名到文件(带级别和强制标志)

使用 -efileNUM-efile!-efileNUM! 变体。

§参数
  • filename - 输出文件路径
  • num - 可选级别(2、3 等),None 表示默认级别
  • force - 是否使用 ! 后缀(强制覆盖)
Source

pub fn verbose(self, level: Option<u8>) -> Self

详细模式

使用 -v-vNUM 选项设置详细输出级别(0-5)。

§参数
  • level - 详细级别,None 表示 -v(默认级别 1), Some(n) 表示 -vN
Source

pub fn extension_add(self, ext: impl Into<String>) -> Self

追加扩展名过滤

使用 -ext+ 选项追加文件扩展名过滤(而非替换已有列表)。 与 extension() 不同,此方法会在已有扩展名列表基础上追加。

Source

pub fn file_order_secondary( self, num: u8, tag: impl Into<String>, descending: bool, ) -> Self

次级文件处理顺序

使用 -fileOrderNUM 选项设置次级排序。 num 为排序优先级(如 2 表示 -fileOrder2)。

Source

pub fn condition_num(self, num: u8, expr: impl Into<String>) -> Self

条件过滤(带编号)

使用 -ifNUM 选项设置条件过滤。 -if2 在第一个条件失败时仍然继续检查。 -if3 及更高编号用于更细粒度的控制。

§参数
  • num - 条件编号(如 2 表示 -if2
  • expr - 条件表达式
Source

pub fn tag_out_append(self, format: impl Into<String>) -> Self

标签输出到文件(追加模式)

使用 -W+ 选项为每个标签创建输出文件,追加到已有文件。

Source

pub fn tag_out_create(self, format: impl Into<String>) -> Self

标签输出到文件(仅创建新文件)

使用 -W! 选项为每个标签创建输出文件,但不覆盖已有文件。

Source

pub fn text_out_append(self, ext: impl Into<String>) -> Self

文本输出到文件(追加模式)

使用 -w+ 选项将输出追加到已有文件。

Source

pub fn text_out_create(self, ext: impl Into<String>) -> Self

文本输出到文件(仅创建新文件)

使用 -w! 选项将输出写入新文件,但不覆盖已有文件。

Source

pub fn print_format_no_newline(self, format: impl Into<String>) -> Self

自定义打印格式(不追加换行符)

使用 -p- 选项按指定格式打印输出,但不在每行末尾追加换行符。 与 print_format() 的区别在于输出不会自动追加换行。

Source

pub fn json_import(self, path: impl Into<String>) -> Self

导入 JSON 文件中的标签

使用 -j=JSONFILE 选项从 JSON 文件中导入标签数据。

Source

pub fn json_append(self, path: impl Into<String>) -> Self

追加导入 JSON 文件中的标签

使用 -j+=JSONFILE 选项从 JSON 文件中追加导入标签数据。

Source

pub fn csv_import(self, path: impl Into<String>) -> Self

导入 CSV 文件中的标签

使用 -csv=CSVFILE 选项从 CSV 文件中导入标签数据。

Source

pub fn csv_append(self, path: impl Into<String>) -> Self

追加导入 CSV 文件中的标签

使用 -csv+=CSVFILE 选项从 CSV 文件中追加导入标签数据。

Source

pub fn fix_base(self, offset: Option<i64>) -> Self

修复 MakerNotes 基准偏移

使用 -F 选项修复 MakerNotes 的基准偏移。 不带参数时自动修复,带偏移量时使用指定偏移。

§参数
  • offset - 可选的偏移量修正值。None 表示自动修复(-F), Some(n) 表示指定偏移(-Fn
Source

pub fn fix_base_offset(self, offset: i64) -> Self

修复 MakerNotes 基准偏移(带指定偏移量)

使用 -FOFFSET 选项修复 MakerNotes 偏移。 这是 fix_base(Some(offset)) 的便捷方法。

Source

pub fn execute(self) -> Result<Metadata>

执行查询

Source

pub fn execute_json(self) -> Result<Value>

执行查询并返回 JSON

Source

pub fn execute_as<T: DeserializeOwned>(self) -> Result<T>

执行查询并反序列化为自定义类型

Source

pub fn execute_text(self) -> Result<String>

执行查询并返回纯文本

当使用 -p (print_format) 选项时, 使用此方法获取纯文本输出而非 JSON

§示例
use exiftool_rs_wrapper::ExifTool;

let exiftool = ExifTool::new()?;

let output = exiftool.query("photo.jpg")
    .print_format("$FileName: $DateTimeOriginal")
    .execute_text()?;

println!("{}", output);

Auto Trait Implementations§

§

impl<'et> Freeze for QueryBuilder<'et>

§

impl<'et> RefUnwindSafe for QueryBuilder<'et>

§

impl<'et> Send for QueryBuilder<'et>

§

impl<'et> Sync for QueryBuilder<'et>

§

impl<'et> Unpin for QueryBuilder<'et>

§

impl<'et> UnsafeUnpin for QueryBuilder<'et>

§

impl<'et> UnwindSafe for QueryBuilder<'et>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more