-
I'm using this command to get the subtitle format: local subformat=mp.command_native({ name = "subprocess", capture_stdout = true, args = { "ffprobe", "-loglevel", "error", "-select_streams", "s:0", "-show_entries", "stream=codec_name", "-of", "csv=p=0", file} })
subformat = subformat.stdout And it works, if I print it it says "hdmv_pgs_subtitle" I have another variable: local bitmapsub = "hdmv_pgs_subtitle" They should in this case be identical. So if I use if string.find(bitmapsub, subformat) then The condition should be true, however it isn't. It always fails. If I flip it however and do if string.find(subformat,bitmapsub) then Then the condition is true. But I don't want to do it this way (e.g. I want to know if the subtitle format of the file is in bitmap format, so it should be comparing itself to a list of bitmap formats, rather than comparing the list to the file's subtitle format) This tells me there must be some invisible garbage characters in How could I sanitize the string? I tried a bunch of things like substituting %z but I couldn't figure out a solution since I don't know what characters i'm actually dealing with. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Well, without having tested it, I would totally expect there to be a |
Beta Was this translation helpful? Give feedback.
Well, without having tested it, I would totally expect there to be a
\n
at the end ofsubformat
, courtesy offfprobe
printing one to stdout. If so, that should be trivial to remove.