У меня есть текстовый файл, содержащий:
[{
"Subtitle": {
"Search": {
"Burn": false,
"Default": false,
"Enable": false,
"Forced": false
},
"SubtitleList": [
{
"Burn": false,
"Default": false,
"Forced": false,
"ID": 1,
"Offset": 0,
"Track": 0
},
{
"Burn": false,
"Default": false,
"Forced": false,
"ID": 2,
"Offset": 0,
"Track": 1
},
{
"Burn": false,
"Default": false,
"Forced": false,
"ID": 3,
"Offset": 0,
"Track": 2
}]
}
}]
Однако эту же структуру можно повторять несколько раз по всему файлу, всегда следуя одной и той же структуре.
Под "SubtitleList" , я хочу убедиться, что всегда "По умолчанию": true , тогда как "ID": 1 и "Track": 0 .
Иначе Если ID и Track совпадают с чем-либо еще (например," ID ": 2 и" Track ": 1 или что-то подобное), то по умолчанию должно быть false.
Я думаю, что для этого нужен цикл for или if if else.
Вот пример всего файла:
[
{
"Job": {
"Audio": {
"AudioList": [
{
"Bitrate": 448,
"DRC": 0.0,
"Encoder": "ac3",
"Gain": 0.0,
"Mixdown": 7,
"NormalizeMixLevel": false,
"Samplerate": 0,
"Track": 0,
"DitherMethod": 0
}
],
"CopyMask": [
"copy:aac",
"copy:mp3"
],
"FallbackEncoder": "ac3"
},
"Destination": {
"ChapterList": [
{
"Name": "00:00:00.000"
},
{
"Name": "00:03:43.723"
},
{
"Name": "00:10:31.756"
},
{
"Name": "00:13:25.847"
},
{
"Name": "00:17:38.641"
},
{
"Name": "00:19:35.841"
},
{
"Name": "00:25:12.302"
},
{
"Name": "00:28:01.305"
},
{
"Name": "00:35:09.065"
},
{
"Name": "00:43:07.084"
},
{
"Name": "00:49:29.592"
},
{
"Name": "00:52:14.214"
},
{
"Name": "00:59:24.978"
},
{
"Name": "01:02:53.728"
},
{
"Name": "01:15:50.921"
},
{
"Name": "01:21:28.801"
},
{
"Name": "01:24:23.183"
},
{
"Name": "01:31:45.875"
},
{
"Name": "01:35:52.664"
},
{
"Name": "01:44:06.282"
}
],
"ChapterMarkers": true,
"AlignAVStart": false,
"File": "C:\\Temp\\ExampleFixed.mkv",
"Mp4Options": {
"IpodAtom": false,
"Mp4Optimize": false
},
"Mux": "mkv"
},
"Filters": {
"FilterList": [
{
"ID": 4,
"Settings": {
"mode": "7"
}
},
{
"ID": 3,
"Settings": {
"block-height": "16",
"block-thresh": "40",
"block-width": "16",
"filter-mode": "2",
"mode": "3",
"motion-thresh": "1",
"spatial-metric": "2",
"spatial-thresh": "1"
}
},
{
"ID": 11,
"Settings": {
"crop-bottom": "0",
"crop-left": "0",
"crop-right": "0",
"crop-top": "0",
"height": "404",
"width": "720"
}
},
{
"ID": 6,
"Settings": {
"mode": "0"
}
}
]
},
"PAR": {
"Num": 202,
"Den": 195
},
"Metadata": {},
"SequenceID": 0,
"Source": {
"Angle": 1,
"Range": {
"Type": "chapter",
"Start": 1,
"End": 20
},
"Title": 1,
"Path": "C:\\Temp\\Example.mkv"
},
"Subtitle": {
"Search": {
"Burn": false,
"Default": false,
"Enable": false,
"Forced": false
},
"SubtitleList": [
{
"Burn": false,
"Default": false,
"Forced": false,
"ID": 1,
"Offset": 0,
"Track": 0
},
{
"Burn": false,
"Default": false,
"Forced": false,
"ID": 2,
"Offset": 0,
"Track": 1
},
{
"Burn": false,
"Default": false,
"Forced": false,
"ID": 3,
"Offset": 0,
"Track": 2
}
]
},
"Video": {
"Encoder": "x265",
"Level": "auto",
"TwoPass": false,
"Turbo": false,
"ColorMatrixCode": 0,
"Options": "level=41",
"Preset": "fast",
"Profile": "auto",
"Quality": 19.0,
"QSV": {
"Decode": false,
"AsyncDepth": 0
}
}
}
},
{
"Job": {
"Audio": {
"AudioList": [
{
"Bitrate": 448,
"DRC": 0.0,
"Encoder": "ac3",
"Gain": 0.0,
"Mixdown": 7,
"NormalizeMixLevel": false,
"Samplerate": 0,
"Track": 0,
"DitherMethod": 0
}
],
"CopyMask": [
"copy:aac",
"copy:mp3"
],
"FallbackEncoder": "ac3"
},
"Destination": {
"ChapterList": [
{
"Name": "00:00:00.000"
},
{
"Name": "00:03:43.723"
},
{
"Name": "00:10:31.756"
},
{
"Name": "00:13:25.847"
},
{
"Name": "00:17:38.641"
},
{
"Name": "00:19:35.841"
},
{
"Name": "00:25:12.302"
},
{
"Name": "00:28:01.305"
},
{
"Name": "00:35:09.065"
},
{
"Name": "00:43:07.084"
},
{
"Name": "00:49:29.592"
},
{
"Name": "00:52:14.214"
},
{
"Name": "00:59:24.978"
},
{
"Name": "01:02:53.728"
},
{
"Name": "01:15:50.921"
},
{
"Name": "01:21:28.801"
},
{
"Name": "01:24:23.183"
},
{
"Name": "01:31:45.875"
},
{
"Name": "01:35:52.664"
},
{
"Name": "01:44:06.282"
}
],
"ChapterMarkers": true,
"AlignAVStart": false,
"File": "C:\\Temp\\SecondExample.mkv",
"Mp4Options": {
"IpodAtom": false,
"Mp4Optimize": false
},
"Mux": "mkv"
},
"Filters": {
"FilterList": [
{
"ID": 4,
"Settings": {
"mode": "7"
}
},
{
"ID": 3,
"Settings": {
"block-height": "16",
"block-thresh": "40",
"block-width": "16",
"filter-mode": "2",
"mode": "3",
"motion-thresh": "1",
"spatial-metric": "2",
"spatial-thresh": "1"
}
},
{
"ID": 11,
"Settings": {
"crop-bottom": "0",
"crop-left": "0",
"crop-right": "0",
"crop-top": "0",
"height": "404",
"width": "720"
}
},
{
"ID": 6,
"Settings": {
"mode": "0"
}
}
]
},
"PAR": {
"Num": 202,
"Den": 195
},
"Metadata": {},
"SequenceID": 0,
"Source": {
"Angle": 1,
"Range": {
"Type": "chapter",
"Start": 1,
"End": 20
},
"Title": 1,
"Path": "C:\\Temp\\SecondExample.mkv"
},
"Subtitle": {
"Search": {
"Burn": false,
"Default": false,
"Enable": false,
"Forced": false
},
"SubtitleList": [
{
"Burn": false,
"Default": false,
"Forced": false,
"ID": 1,
"Offset": 0,
"Track": 0
},
{
"Burn": false,
"Default": false,
"Forced": false,
"ID": 2,
"Offset": 0,
"Track": 1
},
{
"Burn": false,
"Default": false,
"Forced": false,
"ID": 3,
"Offset": 0,
"Track": 2
}
]
},
"Video": {
"Encoder": "x265",
"Level": "auto",
"TwoPass": false,
"Turbo": false,
"ColorMatrixCode": 0,
"Options": "level=41",
"Preset": "fast",
"Profile": "auto",
"Quality": 19.0,
"QSV": {
"Decode": false,
"AsyncDepth": 0
}
}
}
}
]
"Значение по умолчанию " должно равняться 'true", тогда как "ID": 1 и "Track": 0 , в противном случае оно всегда должно быть "false".
Спасибо, если кто-нибудь может помочь с тем, как структурировать файл .bat для этого?