CogentRedTester / mpv-sub-select

An advanced conditional subtitle track selector for mpv player
MIT License
89 stars 8 forks source link

Can't blacklist a certain term that uses "S&S" as a label #29

Closed Mav3r1ckHL closed 8 months ago

Mav3r1ckHL commented 8 months ago

Having trouble doing a specific blacklisting "s&s" from a force subtitle condition. Not sure how to properly escape this, I would assume that within the double quotations it would read everything as is.

Currently this is how I setup the blacklist in the json:

{ "alang": ["jpn", "ja"], "slang": "eng?", "blacklist": [ "sign", "s&s" ], "condition": "sub.forced" }

CogentRedTester commented 8 months ago

What is the error message?

Mav3r1ckHL commented 8 months ago

These are what the logs show related to the sub_select portion. This after opening the video then closing after the fact.

Line 150: [ 0.006][d][sub_select] Loading lua script D:/mpv/portable_config/scripts/sub-select.lua... Line 155: [ 0.007][d][sub_select] loading mp.defaults Line 168: [ 0.007][d][sub_select] loading file D:/mpv/portable_config/scripts/sub-select.lua Line 178: [ 0.007][d][sub_select] reading options for sub_select Line 180: [ 0.008][v][sub_select] Opened config file script-opts/sub_select.conf. Line 377: [ 0.016][v][sub_select] predicted audio track is 2 Line 378: [ 0.016][d][sub_select] select subtitle for {"title" = "", "type" = "audio", "src-id" = 3, "image" = false, "id" = 2, "ff-index" = 2, "visual-impaired" = false, "hearing-impaired" = false, "external" = false, "selected" = false, "lang" = "jpn", "audio-channels" = 2, "demux-channel-count" = 2, "demux-channels" = "unknown2", "demux-samplerate" = 48000, "codec" = "opus", "albumart" = false, "dependent" = false, "forced" = false, "default" = false} Line 379: [ 0.016][d][sub_select] Checking for valid audio: jpn Line 380: [ 0.016][v][sub_select] valid audio preference found: {"jpn", "ja"} Line 381: [ 0.016][d][sub_select] checking for valid sub: eng? Line 382: [ 0.016][d][sub_select] evaluating string return sub.forced Line 383: [ 0.016][d][sub_select] Checking for valid audio: jpn Line 384: [ 0.016][v][sub_select] valid audio preference found: {"jpn", "ja"} Line 385: [ 0.016][d][sub_select] checking for valid sub: jpn Line 386: [ 0.016][d][sub_select] checking for valid sub: ja Line 387: [ 0.016][d][sub_select] Checking for valid audio: jpn Line 388: [ 0.016][v][sub_select] valid audio preference found: {"jpn", "ja"} Line 389: [ 0.016][d][sub_select] checking for valid sub: eng? Line 390: [ 0.016][v][sub_select] setting sid to 1 Line 3239: [ 0.802][i][sub_select] detected audio change - reselecting subtitles Line 3245: [ 0.802][d][sub_select] select subtitle for {"title" = "", "type" = "audio", "src-id" = 3, "image" = false, "id" = 2, "ff-index" = 2, "visual-impaired" = false, "hearing-impaired" = false, "external" = false, "selected" = false, "lang" = "jpn", "audio-channels" = 2, "demux-channel-count" = 2, "demux-channels" = "unknown2", "demux-samplerate" = 48000, "codec" = "opus", "albumart" = false, "dependent" = false, "forced" = false, "default" = false} Line 3247: [ 0.802][d][sub_select] Checking for valid audio: jpn Line 3248: [ 0.802][v][sub_select] valid audio preference found: {"jpn", "ja"} Line 3249: [ 0.802][d][sub_select] checking for valid sub: eng? Line 3250: [ 0.802][d][sub_select] evaluating string return sub.forced Line 3251: [ 0.802][d][sub_select] Checking for valid audio: jpn Line 3252: [ 0.802][v][sub_select] valid audio preference found: {"jpn", "ja"} Line 3253: [ 0.802][d][sub_select] checking for valid sub: jpn Line 3254: [ 0.802][d][sub_select] checking for valid sub: ja Line 3255: [ 0.802][d][sub_select] Checking for valid audio: jpn Line 3256: [ 0.802][v][sub_select] valid audio preference found: {"jpn", "ja"} Line 3257: [ 0.802][d][sub_select] checking for valid sub: eng? Line 3258: [ 0.802][v][sub_select] setting sid to 1 Line 6653: [ 7.026][d][sub_select] Exiting...

CogentRedTester commented 8 months ago

Are you sure you're using the latest version of sub-select? It looks like you may not be. Also please upload the logs again, but this time use --msg-level=sub_select='trace'.

Mav3r1ckHL commented 8 months ago

Well I am using the one available on this page. When running mpv and executing the command from the console it says ---msg-level=sub_select='trace' is not found

But checking the logs I did find more details being shown:

Line 153: [ 0.007][d][sub_select] Loading lua script D:/mpv/portable_config/scripts/sub-select.lua... Line 155: [ 0.007][d][sub_select] loading mp.defaults Line 166: [ 0.008][d][sub_select] loading file D:/mpv/portable_config/scripts/sub-select.lua Line 178: [ 0.008][d][sub_select] reading options for sub_select Line 184: [ 0.008][v][sub_select] Opened config file script-opts/sub_select.conf. Line 377: [ 0.016][v][sub_select] predicted audio track is 2 Line 378: [ 0.016][d][sub_select] select subtitle for {"forced" = false, "src-id" = 3, "default" = false, "image" = false, "albumart" = false, "dependent" = false, "type" = "audio", "hearing-impaired" = false, "external" = false, "selected" = false, "audio-channels" = 2, "demux-channel-count" = 2, "demux-channels" = "unknown2", "demux-samplerate" = 48000, "codec" = "opus", "lang" = "jpn", "visual-impaired" = false, "title" = "", "id" = 2, "ff-index" = 2} Line 379: [ 0.016][d][sub_select] checking pref: {"alang" = {"jpn", "ja"}, "condition" = "sub.forced", "blacklist" = {"sign", "s&s"}, "slang" = "eng?"} Line 380: [ 0.017][d][sub_select] checking pref: {"alang" = {"jpn", "ja"}, "blacklist" = {"sign"}, "slang" = {"jpn", "ja"}} Line 381: [ 0.017][d][sub_select] checking pref: {"alang" = {"jpn", "ja"}, "blacklist" = {"force", "sign", "song"}, "slang" = "eng?"} Line 382: [ 0.017][v][sub_select] valid audio preference found: {"jpn", "ja"} Line 383: [ 0.017][v][sub_select] valid subtitle preference found: "eng?" Line 384: [ 0.017][v][sub_select] setting sid to 1 Line 3233: [ 0.808][i][sub_select] detected audio change - reselecting subtitles Line 3240: [ 0.808][d][sub_select] select subtitle for {"forced" = false, "src-id" = 3, "default" = false, "image" = false, "albumart" = false, "dependent" = false, "type" = "audio", "hearing-impaired" = false, "external" = false, "selected" = false, "audio-channels" = 2, "demux-channel-count" = 2, "demux-channels" = "unknown2", "demux-samplerate" = 48000, "codec" = "opus", "lang" = "jpn", "visual-impaired" = false, "title" = "", "id" = 2, "ff-index" = 2} Line 3241: [ 0.808][d][sub_select] checking pref: {"alang" = {"jpn", "ja"}, "condition" = "sub.forced", "blacklist" = {"sign", "s&s"}, "slang" = "eng?"} Line 3242: [ 0.808][d][sub_select] checking pref: {"alang" = {"jpn", "ja"}, "blacklist" = {"sign"}, "slang" = {"jpn", "ja"}} Line 3243: [ 0.808][d][sub_select] checking pref: {"alang" = {"jpn", "ja"}, "blacklist" = {"force", "sign", "song"}, "slang" = "eng?"} Line 3244: [ 0.808][v][sub_select] valid audio preference found: {"jpn", "ja"} Line 3245: [ 0.808][v][sub_select] valid subtitle preference found: "eng?" Line 3246: [ 0.808][v][sub_select] setting sid to 1

CogentRedTester commented 8 months ago

Sorry I added an extra hyphen, it should be --msg-level=sub_select='trace'. And it's a commandline argument to pass to mpv, not a command.

Mav3r1ckHL commented 8 months ago

Ok, had to correct the CLI it is trace without the single quotes. Here is the logs parsed specifically for sub_select:

Line 149: [ 0.008][d][sub_select] Loading lua script D:/mpv/portable_config/scripts/sub-select.lua... Line 172: [ 0.009][d][sub_select] loading file D:/mpv/portable_config/scripts/sub-select.lua Line 182: [ 0.009][d][sub_select] reading options for sub_select Line 186: [ 0.010][v][sub_select] Opened config file script-opts/sub_select.conf. Line 379: [ 0.017][t][sub_select] formatted track info: 000-1-01 Line 155: [ 0.008][d][sub_select] loading mp.defaults Line 380: [ 0.018][t][sub_select] formatted track info: 002-0-00 Line 381: [ 0.018][v][sub_select] predicted audio track is 2 Line 382: [ 0.018][d][sub_select] select subtitle for {"default" = false, "title" = "", "src-id" = 3, "image" = false, "albumart" = false, "dependent" = false, "visual-impaired" = false, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 2, "id" = 2, "lang" = "jpn", "type" = "audio", "demux-samplerate" = 48000, "audio-channels" = 2, "forced" = false, "demux-channel-count" = 2, "demux-channels" = "unknown2", "codec" = "opus"} Line 383: [ 0.019][d][sub_select] checking pref: {"slang" = "eng?", "condition" = "sub.forced", "blacklist" = {"sign", "s&s"}, "alang" = {"jpn", "ja"}} Line 384: [ 0.019][t][sub_select] Checking for valid audio: jpn Line 385: [ 0.020][t][sub_select] valid audio preference found: {"jpn", "ja"} Line 386: [ 0.020][t][sub_select] checking for valid sub: eng? Line 387: [ 0.021][t][sub_select] checking sub eng? against track {"id" = 0} Line 388: [ 0.021][t][sub_select] checking sub eng? against track {"default" = false, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 3, "id" = 1, "lang" = "eng", "type" = "sub", "codec" = "ass", "visual-impaired" = false, "title" = "S&S", "src-id" = 4, "forced" = true, "image" = false, "albumart" = false, "dependent" = false} Line 389: [ 0.022][t][sub_select] S&S passed whitelist: nil | failed blacklist: {"sign", "s&s"} Line 390: [ 0.022][t][sub_select] checking sub eng? against track {"default" = true, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 4, "id" = 2, "lang" = "eng", "type" = "sub", "codec" = "ass", "visual-impaired" = false, "title" = "Dialog - ENG", "src-id" = 5, "forced" = false, "image" = false, "albumart" = false, "dependent" = false} Line 391: [ 0.023][t][sub_select] Dialog - ENG passed whitelist: nil | passed blacklist: {"sign", "s&s"} Line 392: [ 0.023][t][sub_select] evaluating string return sub.forced Line 393: [ 0.023][t][sub_select] checking sub eng? against track {"default" = false, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 5, "id" = 3, "title" = "[Tenrai-Sensei/NepSubs-modified] No Honorifics", "type" = "sub", "lang" = "und", "codec" = "ass", "visual-impaired" = false, "src-id" = 6, "forced" = false, "image" = false, "albumart" = false, "dependent" = false} Line 394: [ 0.024][d][sub_select] checking pref: {"slang" = {"jpn", "ja"}, "blacklist" = {"sign"}, "alang" = {"jpn", "ja"}} Line 395: [ 0.026][t][sub_select] Checking for valid audio: jpn Line 396: [ 0.026][t][sub_select] valid audio preference found: {"jpn", "ja"} Line 397: [ 0.027][t][sub_select] checking for valid sub: jpn Line 398: [ 0.027][t][sub_select] checking sub jpn against track {"id" = 0} Line 399: [ 0.028][t][sub_select] checking sub jpn against track {"default" = false, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 3, "id" = 1, "lang" = "eng", "type" = "sub", "codec" = "ass", "visual-impaired" = false, "title" = "S&S", "src-id" = 4, "forced" = true, "image" = false, "albumart" = false, "dependent" = false} Line 400: [ 0.028][t][sub_select] checking sub jpn against track {"default" = true, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 4, "id" = 2, "lang" = "eng", "type" = "sub", "codec" = "ass", "visual-impaired" = false, "title" = "Dialog - ENG", "src-id" = 5, "forced" = false, "image" = false, "albumart" = false, "dependent" = false} Line 401: [ 0.029][t][sub_select] checking sub jpn against track {"default" = false, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 5, "id" = 3, "title" = "[Tenrai-Sensei/NepSubs-modified] No Honorifics", "type" = "sub", "lang" = "und", "codec" = "ass", "visual-impaired" = false, "src-id" = 6, "forced" = false, "image" = false, "albumart" = false, "dependent" = false} Line 402: [ 0.029][t][sub_select] checking for valid sub: ja Line 403: [ 0.029][t][sub_select] checking sub ja against track {"id" = 0} Line 404: [ 0.030][t][sub_select] checking sub ja against track {"default" = false, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 3, "id" = 1, "lang" = "eng", "type" = "sub", "codec" = "ass", "visual-impaired" = false, "title" = "S&S", "src-id" = 4, "forced" = true, "image" = false, "albumart" = false, "dependent" = false} Line 405: [ 0.030][t][sub_select] checking sub ja against track {"default" = true, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 4, "id" = 2, "lang" = "eng", "type" = "sub", "codec" = "ass", "visual-impaired" = false, "title" = "Dialog - ENG", "src-id" = 5, "forced" = false, "image" = false, "albumart" = false, "dependent" = false} Line 406: [ 0.031][t][sub_select] checking sub ja against track {"default" = false, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 5, "id" = 3, "title" = "[Tenrai-Sensei/NepSubs-modified] No Honorifics", "type" = "sub", "lang" = "und", "codec" = "ass", "visual-impaired" = false, "src-id" = 6, "forced" = false, "image" = false, "albumart" = false, "dependent" = false} Line 407: [ 0.031][d][sub_select] checking pref: {"slang" = "eng?", "blacklist" = {"force"}, "alang" = {"jpn", "ja"}} Line 408: [ 0.032][t][sub_select] Checking for valid audio: jpn Line 409: [ 0.032][t][sub_select] valid audio preference found: {"jpn", "ja"} Line 410: [ 0.033][t][sub_select] checking for valid sub: eng? Line 411: [ 0.033][t][sub_select] checking sub eng? against track {"id" = 0} Line 412: [ 0.033][t][sub_select] checking sub eng? against track {"default" = false, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 3, "id" = 1, "lang" = "eng", "type" = "sub", "codec" = "ass", "visual-impaired" = false, "title" = "S&S", "src-id" = 4, "forced" = true, "image" = false, "albumart" = false, "dependent" = false} Line 413: [ 0.034][t][sub_select] S&S passed whitelist: nil | passed blacklist: {"force"} Line 414: [ 0.036][v][sub_select] valid audio preference found: {"jpn", "ja"} Line 415: [ 0.036][v][sub_select] valid subtitle preference found: "eng?" Line 416: [ 0.037][v][sub_select] setting sid to 1 Line 3265: [ 0.817][i][sub_select] detected audio change - reselecting subtitles Line 3272: [ 0.818][d][sub_select] select subtitle for {"default" = false, "title" = "", "src-id" = 3, "image" = false, "albumart" = false, "dependent" = false, "visual-impaired" = false, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 2, "id" = 2, "lang" = "jpn", "type" = "audio", "demux-samplerate" = 48000, "audio-channels" = 2, "forced" = false, "demux-channel-count" = 2, "demux-channels" = "unknown2", "codec" = "opus"} Line 3273: [ 0.819][d][sub_select] checking pref: {"slang" = "eng?", "condition" = "sub.forced", "blacklist" = {"sign", "s&s"}, "alang" = {"jpn", "ja"}} Line 3274: [ 0.819][t][sub_select] Checking for valid audio: jpn Line 3275: [ 0.820][t][sub_select] valid audio preference found: {"jpn", "ja"} Line 3278: [ 0.820][t][sub_select] checking for valid sub: eng? Line 3280: [ 0.821][t][sub_select] checking sub eng? against track {"id" = 0} Line 3281: [ 0.822][t][sub_select] checking sub eng? against track {"default" = false, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 3, "id" = 1, "lang" = "eng", "type" = "sub", "codec" = "ass", "visual-impaired" = false, "title" = "S&S", "src-id" = 4, "forced" = true, "image" = false, "albumart" = false, "dependent" = false} Line 3282: [ 0.822][t][sub_select] S&S passed whitelist: nil | failed blacklist: {"sign", "s&s"} Line 3284: [ 0.823][t][sub_select] checking sub eng? against track {"default" = true, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 4, "id" = 2, "lang" = "eng", "type" = "sub", "codec" = "ass", "visual-impaired" = false, "title" = "Dialog - ENG", "src-id" = 5, "forced" = false, "image" = false, "albumart" = false, "dependent" = false} Line 3286: [ 0.824][t][sub_select] Dialog - ENG passed whitelist: nil | passed blacklist: {"sign", "s&s"} Line 3287: [ 0.824][t][sub_select] evaluating string return sub.forced Line 3288: [ 0.825][t][sub_select] checking sub eng? against track {"default" = false, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 5, "id" = 3, "title" = "[Tenrai-Sensei/NepSubs-modified] No Honorifics", "type" = "sub", "lang" = "und", "codec" = "ass", "visual-impaired" = false, "src-id" = 6, "forced" = false, "image" = false, "albumart" = false, "dependent" = false} Line 3290: [ 0.827][d][sub_select] checking pref: {"slang" = {"jpn", "ja"}, "blacklist" = {"sign"}, "alang" = {"jpn", "ja"}} Line 3292: [ 0.828][t][sub_select] Checking for valid audio: jpn Line 3296: [ 0.828][t][sub_select] valid audio preference found: {"jpn", "ja"} Line 3297: [ 0.829][t][sub_select] checking for valid sub: jpn Line 3300: [ 0.829][t][sub_select] checking sub jpn against track {"id" = 0} Line 3301: [ 0.830][t][sub_select] checking sub jpn against track {"default" = false, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 3, "id" = 1, "lang" = "eng", "type" = "sub", "codec" = "ass", "visual-impaired" = false, "title" = "S&S", "src-id" = 4, "forced" = true, "image" = false, "albumart" = false, "dependent" = false} Line 3302: [ 0.831][t][sub_select] checking sub jpn against track {"default" = true, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 4, "id" = 2, "lang" = "eng", "type" = "sub", "codec" = "ass", "visual-impaired" = false, "title" = "Dialog - ENG", "src-id" = 5, "forced" = false, "image" = false, "albumart" = false, "dependent" = false} Line 3303: [ 0.831][t][sub_select] checking sub jpn against track {"default" = false, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 5, "id" = 3, "title" = "[Tenrai-Sensei/NepSubs-modified] No Honorifics", "type" = "sub", "lang" = "und", "codec" = "ass", "visual-impaired" = false, "src-id" = 6, "forced" = false, "image" = false, "albumart" = false, "dependent" = false} Line 3304: [ 0.832][t][sub_select] checking for valid sub: ja Line 3305: [ 0.833][t][sub_select] checking sub ja against track {"id" = 0} Line 3306: [ 0.834][t][sub_select] checking sub ja against track {"default" = false, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 3, "id" = 1, "lang" = "eng", "type" = "sub", "codec" = "ass", "visual-impaired" = false, "title" = "S&S", "src-id" = 4, "forced" = true, "image" = false, "albumart" = false, "dependent" = false} Line 3308: [ 0.834][t][sub_select] checking sub ja against track {"default" = true, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 4, "id" = 2, "lang" = "eng", "type" = "sub", "codec" = "ass", "visual-impaired" = false, "title" = "Dialog - ENG", "src-id" = 5, "forced" = false, "image" = false, "albumart" = false, "dependent" = false} Line 3310: [ 0.835][t][sub_select] checking sub ja against track {"default" = false, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 5, "id" = 3, "title" = "[Tenrai-Sensei/NepSubs-modified] No Honorifics", "type" = "sub", "lang" = "und", "codec" = "ass", "visual-impaired" = false, "src-id" = 6, "forced" = false, "image" = false, "albumart" = false, "dependent" = false} Line 3314: [ 0.837][d][sub_select] checking pref: {"slang" = "eng?", "blacklist" = {"force"}, "alang" = {"jpn", "ja"}} Line 3315: [ 0.838][t][sub_select] Checking for valid audio: jpn Line 3317: [ 0.838][t][sub_select] valid audio preference found: {"jpn", "ja"} Line 3318: [ 0.839][t][sub_select] checking for valid sub: eng? Line 3320: [ 0.839][t][sub_select] checking sub eng? against track {"id" = 0} Line 3327: [ 0.840][t][sub_select] checking sub eng? against track {"default" = false, "hearing-impaired" = false, "external" = false, "selected" = false, "ff-index" = 3, "id" = 1, "lang" = "eng", "type" = "sub", "codec" = "ass", "visual-impaired" = false, "title" = "S&S", "src-id" = 4, "forced" = true, "image" = false, "albumart" = false, "dependent" = false} Line 3330: [ 0.842][t][sub_select] S&S passed whitelist: nil | passed blacklist: {"force"} Line 3331: [ 0.842][v][sub_select] valid audio preference found: {"jpn", "ja"} Line 3333: [ 0.843][v][sub_select] valid subtitle preference found: "eng?" Line 3334: [ 0.844][v][sub_select] setting sid to 1

CogentRedTester commented 8 months ago

The blacklist and the forced condition both seem to be working, what exactly is the issue? What combination of audio and subtitle tracks are you expecting to be selected?

Mav3r1ckHL commented 8 months ago

Here is my current JSON setup, but from the video it had 3 subtitles, the forced one which just S&S (signs and songs) and the 2nd one had the [eng] with Dialog in the text. My assumption was that the forced subs would see the blacklist and move onto the next set of subs.

[ { "alang": ["jpn", "ja"], "slang": "eng?", "blacklist": [ "sign", "s&s" ], "condition": "sub.forced" }, { "alang": ["jpn", "ja"], "slang": ["jpn", "ja"], "blacklist": [ "sign" ] }, { "alang": ["jpn", "ja"], "slang": "eng?", "blacklist": [ "force" ] }, { "alang": ["jpn", "ja"], "slang": "eng?", "blacklist": [ "sign" ] }, { "alang": ["jpn", "ja"], "slang": "eng?", "blacklist": [ "song" ] }, { "alang": ["jpn", "ja"], "slang": "eng?", "whitelist": [ "full" ], }, { "alang": ["jpn", "ja"], "slang": "eng?", "whitelist": [ "honorific" ] }, { "alang": ["jpn", "ja"], "slang": "eng?", "whitelist": [ "dialog" ] }, { "alang": ["jpn", "ja"], "slang": "eng?", "whitelist": [ "english" ] }, { "alang": "*", "slang": [ "eng?", "und" ] }, { "alang": "no", "slang": "no" } ]

CogentRedTester commented 8 months ago

"blacklist": [ "force" ] doesn't work, it only searches for subtitles with force in the name. It looks like you want to be using "conditon": "not sub.forced".

What is currently happening is that the first condition is failing to match any subtitles because there are none that are both forced, and lack the S&S text in the title. The second condition fails because there are no Japanese subtitle tracks. But the third condition looks at the first track and finds that it is english, and it lacks forced anywhere in the title. Hence it selects it.

Mav3r1ckHL commented 8 months ago

I kind of get the logic now with the way you explained it. I will go back and adjust accordingly. By the way is there way to filter between two of the same [eng] tracks but have no title? If not, I will have to fix the video files since they are reading another reference the Language reference point based on what I see from mkvtoolnix.

CogentRedTester commented 8 months ago

Any property listed as a sub-property of the track-list property can be used as a value in the condition field, such as sub.forced or sub.default.

Mav3r1ckHL commented 8 months ago

Was looking at the said track-list property, but I am not sure how to set the JSON to select a track based on the sub.title condition. Here is what I setup, but it looks like it will only select the first available [eng] track on the list of empty ones. { "alang": "*", "slang": "eng?", "condition": "sub.title == ' ' and sub.sid==2" },

From what I observed every second [eng] track is the one that has the full subtitles but since neither of them has titles, I want to enforce blindly selecting the second [eng] track in order to "assume" it is correct.

CogentRedTester commented 8 months ago

If there is genuinely no title, you may need to do not sub.title.

Mav3r1ckHL commented 8 months ago

Thanks that worked, covered about 95% of the use cases after doing some testing. There is a question I have about the blacklist and whitelist. Is there anyway to define an order within the lists and use that as the criteria to filter before moving to the next criteria?

Example: [eng] Full English [ABC] [eng] Full English [XYZ]

{ "alang": "*", "slang": "eng?", "whitelist": [ "xyz", "abc", "full", "english"] },

What I noticed is that "full" would determine the subtitle and not based on the order the white list is set which is "xyz", "abc". I expected the second subtitle be selected first because "xyz" was the first in the whitelist (reading left to right).

CogentRedTester commented 8 months ago

You can do them as four separate items:

{
    "alang": "*",
    "slang": "eng?",
    "whitelist": [ "xyz"]
},
{
    "inherit": "^",
    "whitelist": [ "abc"]
},
{
    "inherit": "^",
    "whitelist": [ "full"]
},
{
    "inherit": "^",
    "whitelist": [ "english"]
},

"inherit: "^" copies all of the filters for the above item unless overwritten.

Mav3r1ckHL commented 7 months ago

Rather than opening a new thread for diagnosing most likely my misinterpretation of the code I will just post in this old thread as I assume it is not a bug. I have already updated to the latest lua script from last week and adjusted my json to be a bit more "optimized" but I can't seem to filter out PGS subtitles from the Japanese subtitle track to force to move to the English track check.

Here is the way I structured the json. Also let me know of "or" statement actually is valid, it appears to work based on how the English track filter behaves.

The file in question has the following alang slang properties:

Audio: jpn Subtitles:

  1. [eng] English (Fansub)
  2. [jpn] English (PGS)

I checked the properties and only the jpn subtitles has sub.codec == 'pgs'. This is what I wanted to filter out to force to move to the English filters but it seems to be caught by the lowest filter.

[ { "inherit": "jpnfilter", "condition": "not sub.codec == 'pgs' or not sub.codec ~= 'pgs'" }, { "inherit": "jpnfilter", "blacklist": [ "no honor" ], "whitelist": [ "honor" ] }, { "inherit": "jpnfilter", "whitelist": [ "col" ] }, { "inherit": "^", "whitelist": [ "full" ] }, { "inherit": "^", "whitelist": [ "dialog" ]
}, { "inherit": "^", "whitelist": [ "eng" ]
}, { "inherit": "jpnfilter", "blacklist": [ "sign", "song", "s&s", "force", "no honor" ], }, { "alang": "*", "slang": ["jpn", "ja" ], "condition": "sub.codec == 'ass' or sub.codec ~= 'ass'", "id": "jpnfilter" }, ]

I also tried replacing the "condition": "sub.codec == 'ass' or sub.codec ~= 'ass'", with the "condition": "not sub.codec == 'pgs' or not sub.codec ~= 'pgs'" but it will still insist on selecting the [jpn] subtitle.

CogentRedTester commented 7 months ago

Your very first subtitle preference is selecting Japanese subtitles if they are or aren't PGS. That essentially cancels the condition out, so japanese subtitles will be selected by default.