2020-06-08 03:29:51 +03:00
|
|
|
/test.mp3:
|
|
|
|
# display
|
2021-08-12 00:51:00 +03:00
|
|
|
> fq -d mp3 '.headers | ., tovalue, type, length?' /test.mp3
|
2020-06-08 03:29:51 +03:00
|
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.headers: [1]
|
|
|
|
0x00|49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00|ID3......#TSSE..| [0]: {} (id3v2)
|
|
|
|
* |until 0x2c.7 (45) | |
|
2021-08-12 00:51:00 +03:00
|
|
|
[
|
|
|
|
{
|
|
|
|
"flags": {
|
|
|
|
"experimental_indicator": false,
|
|
|
|
"extended_header": false,
|
|
|
|
"unsynchronisation": false,
|
|
|
|
"unused": 0
|
|
|
|
},
|
|
|
|
"frames": [
|
|
|
|
{
|
|
|
|
"flags": {
|
|
|
|
"compression": false,
|
|
|
|
"data_length_indicator": false,
|
|
|
|
"encryption": false,
|
|
|
|
"file_alter_preservation": false,
|
|
|
|
"grouping_identity": false,
|
|
|
|
"read_only": false,
|
|
|
|
"tag_alter_preservation": false,
|
|
|
|
"unsync": false,
|
|
|
|
"unused0": 0,
|
|
|
|
"unused1": 0,
|
|
|
|
"unused2": 0
|
|
|
|
},
|
|
|
|
"id": "TSSE",
|
|
|
|
"size": 15,
|
|
|
|
"text": "Lavf58.45.100",
|
|
|
|
"text_encoding": 3
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"magic": "ID3",
|
|
|
|
"padding": null,
|
|
|
|
"revision": 0,
|
|
|
|
"size": 35,
|
|
|
|
"version": 4
|
|
|
|
}
|
|
|
|
]
|
2020-06-08 03:29:51 +03:00
|
|
|
"array"
|
|
|
|
1
|
|
|
|
# index
|
|
|
|
> fq -d mp3 '.headers[0] | ., type, length?' /test.mp3
|
|
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |.headers[0]: {} (id3v2)
|
|
|
|
0x00|49 44 33 |ID3 | magic: "ID3" (Correct)
|
|
|
|
0x00| 04 | . | version: 4
|
|
|
|
0x00| 00 | . | revision: 0
|
|
|
|
0x00| 00 | . | flags: {}
|
|
|
|
0x00| 00 00 00 23 | ...# | size: 35
|
|
|
|
0x00| 54 53 53 45 00 00| TSSE..| frames: [1]
|
|
|
|
0x10|00 0f 00 00 03 4c 61 76 66 35 38 2e 34 35 2e 31|.....Lavf58.45.1|
|
|
|
|
0x20|30 30 00 |00. |
|
|
|
|
0x20| 00 00 00 00 00 00 00 00 00 00 | .......... | padding: Correct (none) (zero padding)
|
|
|
|
"object"
|
|
|
|
7
|
|
|
|
> fq -d mp3 '.headers[-1000] | ., type, length?' /test.mp3
|
|
|
|
null
|
|
|
|
"null"
|
|
|
|
0
|
|
|
|
> fq -d mp3 '.headers[1000] | ., type, length?' /test.mp3
|
|
|
|
null
|
|
|
|
"null"
|
|
|
|
0
|
|
|
|
# slice
|
|
|
|
> fq -d mp3 '.headers[1:3] | ., type, length?' /test.mp3
|
|
|
|
[]
|
|
|
|
"array"
|
|
|
|
0
|
|
|
|
> fq -d mp3 '.headers[0:-1] | ., type, length?' /test.mp3
|
|
|
|
[]
|
|
|
|
"array"
|
|
|
|
0
|
|
|
|
> fq -d mp3 '.headers[-1000:2000] | ., type, length?' /test.mp3
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"flags": {
|
|
|
|
"experimental_indicator": false,
|
|
|
|
"extended_header": false,
|
|
|
|
"unsynchronisation": false,
|
|
|
|
"unused": 0
|
|
|
|
},
|
|
|
|
"frames": [
|
|
|
|
{
|
|
|
|
"flags": {
|
|
|
|
"compression": false,
|
|
|
|
"data_length_indicator": false,
|
|
|
|
"encryption": false,
|
|
|
|
"file_alter_preservation": false,
|
|
|
|
"grouping_identity": false,
|
|
|
|
"read_only": false,
|
|
|
|
"tag_alter_preservation": false,
|
|
|
|
"unsync": false,
|
|
|
|
"unused0": 0,
|
|
|
|
"unused1": 0,
|
|
|
|
"unused2": 0
|
|
|
|
},
|
|
|
|
"id": "TSSE",
|
|
|
|
"size": 15,
|
|
|
|
"text": "Lavf58.45.100",
|
|
|
|
"text_encoding": 3
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"magic": "ID3",
|
|
|
|
"padding": null,
|
|
|
|
"revision": 0,
|
|
|
|
"size": 35,
|
|
|
|
"version": 4
|
|
|
|
}
|
|
|
|
]
|
|
|
|
"array"
|
|
|
|
1
|
|
|
|
# key
|
|
|
|
> fq -d mp3 '.headers["test"] | ., type, length?' /test.mp3
|
|
|
|
exitcode: 5
|
|
|
|
stderr:
|
2021-08-12 00:51:00 +03:00
|
|
|
error: expected an object with key "test" but got: array
|
2020-06-08 03:29:51 +03:00
|
|
|
# each
|
|
|
|
> fq -d mp3 '[.headers[]] | type, length?' /test.mp3
|
|
|
|
"array"
|
|
|
|
1
|
|
|
|
# keys
|
|
|
|
> fq -d mp3 '.headers | keys' /test.mp3
|
|
|
|
[
|
|
|
|
0
|
|
|
|
]
|
|
|
|
# has
|
|
|
|
> fq -d mp3 '.headers | has("a")' /test.mp3
|
|
|
|
exitcode: 5
|
|
|
|
stderr:
|
|
|
|
error: cannot check whether array has a key: a
|
|
|
|
> fq -d mp3 '.headers | has(0)' /test.mp3
|
|
|
|
true
|
|
|
|
# type
|
|
|
|
> fq -d mp3 '.headers | type' /test.mp3
|
|
|
|
"array"
|
|
|
|
# tonumber
|
|
|
|
> fq -d mp3 '.headers | tonumber' /test.mp3
|
|
|
|
exitcode: 5
|
|
|
|
stderr:
|
|
|
|
error: tonumber cannot be applied to: array
|
|
|
|
# tostring
|
|
|
|
> fq -d mp3 '.headers | tostring' /test.mp3
|
|
|
|
exitcode: 5
|
|
|
|
stderr:
|
|
|
|
error: tostring cannot be applied to: array
|
|
|
|
# to gojq
|
|
|
|
> fq -d mp3 '.headers + ""' /test.mp3
|
|
|
|
exitcode: 5
|
|
|
|
stderr:
|
|
|
|
error: cannot add: array ([{"flags":{"experimental_ ...]) and string ("")
|
|
|
|
> fq -d mp3 '.headers + 1' /test.mp3
|
|
|
|
exitcode: 5
|
|
|
|
stderr:
|
|
|
|
error: cannot add: array ([{"flags":{"experimental_ ...]) and number (1)
|
|
|
|
# test _keys
|
|
|
|
> fq -d mp3 '.headers._start | ., type, length?' /test.mp3
|
|
|
|
0
|
|
|
|
"number"
|
|
|
|
0
|
|
|
|
> fq -d mp3 '.headers._stop | ., type, length?' /test.mp3
|
|
|
|
360
|
|
|
|
"number"
|
|
|
|
360
|
|
|
|
> fq -d mp3 '.headers._len | ., type, length?' /test.mp3
|
|
|
|
360
|
|
|
|
"number"
|
|
|
|
360
|
|
|
|
> fq -d mp3 '.headers._name | ., type, length?' /test.mp3
|
|
|
|
"headers"
|
|
|
|
"string"
|
|
|
|
7
|
|
|
|
> fq -d mp3 '.headers._symbol | ., type, length?' /test.mp3
|
|
|
|
""
|
|
|
|
"string"
|
|
|
|
0
|
|
|
|
> fq -d mp3 '.headers._description | ., type, length?' /test.mp3
|
|
|
|
""
|
|
|
|
"string"
|
|
|
|
0
|
|
|
|
> fq -d mp3 '.headers._path | ., type, length?' /test.mp3
|
|
|
|
[
|
|
|
|
"headers"
|
|
|
|
]
|
|
|
|
"array"
|
|
|
|
1
|
|
|
|
> fq -d mp3 '.headers._bits | ., type, length?' /test.mp3
|
|
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
|
|
|
0x00|49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00|ID3......#TSSE..|
|
|
|
|
<360 bits>
|
|
|
|
"buffer"
|
|
|
|
360
|
|
|
|
> fq -d mp3 '.headers._bytes | ., type, length?' /test.mp3
|
|
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f| |
|
|
|
|
0x00|49 44 33 04 00 00 00 00 00 23 54 53 53 45 00 00|ID3......#TSSE..|
|
|
|
|
<45 bytes>
|
|
|
|
"buffer"
|
|
|
|
45
|
|
|
|
> fq -d mp3 '.headers._error | ., type, length?' /test.mp3
|
|
|
|
null
|
|
|
|
"null"
|
|
|
|
0
|
|
|
|
> fq -d mp3 '.headers._unknown | ., type, length?' /test.mp3
|
|
|
|
false
|
|
|
|
"boolean"
|