exiftool-vendored
Advanced tools
Comparing version 18.3.0 to 18.4.0
@@ -28,2 +28,12 @@ # Changelog/Versioning | ||
### v18.4.0 | ||
- ✨ Binary fields are now parsed to a new `BinaryField` object which parses | ||
out the length of the binary field | ||
- 🐞/📦 Added more required tag fields to `mktags`, including | ||
`SubSecModifyDate` (which fell off of the Tags.ts API in v18.3.0, oops!) | ||
- 📦 `ExifTime` now retains the raw value to be consistent with `ExifDate` and `ExifDateTime` | ||
### v18.3.0 | ||
@@ -44,3 +54,5 @@ | ||
const { ExifTool } = require("exiftool-vendored") | ||
const exiftool = new ExifTool({ geoToTz: (lat, lon) => geoTz.find(lat, lon)[0] }) | ||
const exiftool = new ExifTool({ | ||
geoToTz: (lat, lon) => geoTz.find(lat, lon)[0], | ||
}) | ||
``` | ||
@@ -60,3 +72,3 @@ | ||
- 📦 The `GPSPosition` tag is no longer included in the default set of numeric tags, as this results in ExifTool returning two floats, whitespace-separated. Use `GPSLatitude` and `GPSLongitude` instead. | ||
- 📦 The `GPSPosition` tag is no longer included in the default set of numeric tags, as this results in ExifTool returning two floats, whitespace-separated. Use `GPSLatitude` and `GPSLongitude` instead. | ||
@@ -63,0 +75,0 @@ ### v18.0.0 |
@@ -11,5 +11,6 @@ import { DateTime } from "luxon"; | ||
readonly millisecond?: number | undefined; | ||
readonly rawValue?: string | undefined; | ||
static fromEXIF(text: string): Maybe<ExifTime>; | ||
static fromDateTime(dt: DateTime): Maybe<ExifTime>; | ||
constructor(hour: number, minute: number, second: number, millisecond?: number | undefined); | ||
static fromDateTime(dt: DateTime, rawValue?: string): Maybe<ExifTime>; | ||
constructor(hour: number, minute: number, second: number, millisecond?: number | undefined, rawValue?: string | undefined); | ||
get millis(): number | undefined; | ||
@@ -26,4 +27,5 @@ private subsec; | ||
millisecond: number | undefined; | ||
rawValue: string | undefined; | ||
}; | ||
static fromJSON(json: ReturnType<ExifTime["toJSON"]>): ExifTime; | ||
} |
@@ -11,3 +11,3 @@ "use strict"; | ||
class ExifTime { | ||
constructor(hour, minute, second, millisecond) { | ||
constructor(hour, minute, second, millisecond, rawValue) { | ||
this.hour = hour; | ||
@@ -17,2 +17,3 @@ this.minute = minute; | ||
this.millisecond = millisecond; | ||
this.rawValue = rawValue; | ||
} | ||
@@ -23,8 +24,8 @@ static fromEXIF(text) { | ||
text = (0, String_1.toS)(text).trim(); | ||
return (0, Maybe_1.first)(["HH:mm:ss.uZZ", "HH:mm:ssZZ", "HH:mm:ss.u", "HH:mm:ss"], (fmt) => (0, Maybe_1.map)(luxon_1.DateTime.fromFormat(text, fmt), (dt) => this.fromDateTime(dt))); | ||
return (0, Maybe_1.first)(["HH:mm:ss.uZZ", "HH:mm:ssZZ", "HH:mm:ss.u", "HH:mm:ss"], (fmt) => (0, Maybe_1.map)(luxon_1.DateTime.fromFormat(text, fmt), (dt) => this.fromDateTime(dt, text))); | ||
} | ||
static fromDateTime(dt) { | ||
static fromDateTime(dt, rawValue) { | ||
return dt == null || !dt.isValid | ||
? undefined | ||
: new ExifTime(dt.hour, dt.minute, dt.second, dt.millisecond); | ||
: new ExifTime(dt.hour, dt.minute, dt.second, dt.millisecond, rawValue); | ||
} | ||
@@ -55,6 +56,7 @@ get millis() { | ||
millisecond: this.millisecond, | ||
rawValue: this.rawValue, | ||
}; | ||
} | ||
static fromJSON(json) { | ||
return new ExifTime(json.hour, json.minute, json.second, json.millisecond); | ||
return new ExifTime(json.hour, json.minute, json.second, json.millisecond, json.rawValue); | ||
} | ||
@@ -61,0 +63,0 @@ } |
@@ -16,2 +16,3 @@ /// <reference types="node" /> | ||
import { Version } from "./Version"; | ||
export { BinaryField as BinaryDataField } from "./BinaryField"; | ||
export { ExifDate } from "./ExifDate"; | ||
@@ -18,0 +19,0 @@ export { ExifDateTime } from "./ExifDateTime"; |
@@ -29,3 +29,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.exiftool = exports.ExifTool = exports.DefaultExifToolOptions = exports.DefaultMaxProcs = exports.DefaultExiftoolArgs = exports.DefaultExifToolPath = exports.UnsetZoneOffsetMinutes = exports.UnsetZoneName = exports.UnsetZone = exports.offsetMinutesToZoneName = exports.defaultVideosToUTC = exports.parseJSON = exports.ExifToolTask = exports.ExifTime = exports.ExifDateTime = exports.ExifDate = void 0; | ||
exports.exiftool = exports.ExifTool = exports.DefaultExifToolOptions = exports.DefaultMaxProcs = exports.DefaultExiftoolArgs = exports.DefaultExifToolPath = exports.UnsetZoneOffsetMinutes = exports.UnsetZoneName = exports.UnsetZone = exports.offsetMinutesToZoneName = exports.defaultVideosToUTC = exports.parseJSON = exports.ExifToolTask = exports.ExifTime = exports.ExifDateTime = exports.ExifDate = exports.BinaryDataField = void 0; | ||
const bc = __importStar(require("batch-cluster")); | ||
@@ -49,2 +49,4 @@ const _cp = __importStar(require("child_process")); | ||
const WriteTask_1 = require("./WriteTask"); | ||
var BinaryField_1 = require("./BinaryField"); | ||
Object.defineProperty(exports, "BinaryDataField", { enumerable: true, get: function () { return BinaryField_1.BinaryField; } }); | ||
var ExifDate_1 = require("./ExifDate"); | ||
@@ -51,0 +53,0 @@ Object.defineProperty(exports, "ExifDate", { enumerable: true, get: function () { return ExifDate_1.ExifDate; } }); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseJSON = void 0; | ||
const BinaryField_1 = require("./BinaryField"); | ||
const ExifDate_1 = require("./ExifDate"); | ||
@@ -8,2 +9,3 @@ const ExifDateTime_1 = require("./ExifDateTime"); | ||
const Revivers = { | ||
BinaryField: (ea) => BinaryField_1.BinaryField.fromJSON(ea), | ||
ExifDateTime: (ea) => ExifDateTime_1.ExifDateTime.fromJSON(ea), | ||
@@ -10,0 +12,0 @@ ExifDate: (ea) => ExifDate_1.ExifDate.fromJSON(ea), |
import { Maybe } from "./Maybe"; | ||
export declare function isNumber(n: any): n is number; | ||
export declare function toF(n: any): Maybe<number>; | ||
export declare function toI(n: any): Maybe<number>; | ||
export declare function toFloat(n: any): Maybe<number>; | ||
export declare function toInt(n: any): Maybe<number>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toI = exports.toF = exports.isNumber = void 0; | ||
const Maybe_1 = require("./Maybe"); | ||
exports.toInt = exports.toFloat = exports.isNumber = void 0; | ||
function isNumber(n) { | ||
@@ -9,3 +8,3 @@ return typeof n === "number" && isFinite(n); | ||
exports.isNumber = isNumber; | ||
function toF(n) { | ||
function toFloat(n) { | ||
if (n == null) | ||
@@ -16,3 +15,3 @@ return; | ||
try { | ||
return parseFloat(String(n)); | ||
return parseFloat(String(n).trim()); | ||
} | ||
@@ -23,7 +22,18 @@ catch { | ||
} | ||
exports.toF = toF; | ||
function toI(n) { | ||
return (0, Maybe_1.map)(toF(n), (f) => Math.round(f)); | ||
exports.toFloat = toFloat; | ||
function toInt(n) { | ||
if (n == null) | ||
return; | ||
if (isNumber(n)) { | ||
// we don't round here, because parsing floats also doesn't round. | ||
return Math.floor(n); | ||
} | ||
try { | ||
return parseInt(String(n).trim()); | ||
} | ||
catch { | ||
return undefined; | ||
} | ||
} | ||
exports.toI = toI; | ||
exports.toInt = toInt; | ||
//# sourceMappingURL=Number.js.map |
@@ -35,2 +35,3 @@ "use strict"; | ||
const _path = __importStar(require("path")); | ||
const BinaryField_1 = require("./BinaryField"); | ||
const ExifDate_1 = require("./ExifDate"); | ||
@@ -167,3 +168,3 @@ const ExifDateTime_1 = require("./ExifDateTime"); | ||
const ref = this._tags[tagName + "Ref"]; | ||
const result = (0, Number_1.toF)(tagValue); | ||
const result = (0, Number_1.toFloat)(tagValue); | ||
if (result == null) { | ||
@@ -264,2 +265,5 @@ return; | ||
if (typeof value === "string") { | ||
const b = BinaryField_1.BinaryField.fromRawValue(value); | ||
if (b != null) | ||
return b; | ||
const tz = isUtcTagName(tagName) ? "UTC" : this.tz; | ||
@@ -266,0 +270,0 @@ if (tagName === "When" || |
{ | ||
"name": "exiftool-vendored", | ||
"version": "18.3.0", | ||
"version": "18.4.0", | ||
"description": "Efficient, cross-platform access to ExifTool", | ||
@@ -5,0 +5,0 @@ "main": "./dist/ExifTool.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
433050
117
7608