I'm trying to write a program to scan videos, find what languages the audio and subtitles are available in, and then use those findings for input.
Currently, I'm generating the output with this:
with open('output.txt', 'wt') as output_f:
p = subprocess.Popen(command, stdout=output_f, stderr=output_f)
Here's the bit of text from my scan that I need.
+ audio tracks:
+ 1, Japanese (aac) (2.0 ch) (iso639-2: jpn)
+ subtitle tracks:
+ 1, English (iso639-2: eng) (Text)(SSA)
So I need to find out what number is in front of Japanese, but only after it comes after "audio tracks"
Similarly, I need to find what number is in front of English, but only after it comes after "subtitle tracks"
I'm pretty sure I need to use Regular Expressions to do this, but I'm lost on where to begin.
subprocesscall?audio tracks:andsubtitle tracks:. This shouldn't be a problem, you simply have to do a lookbehind foraudio tracksorsubtitle tracksor use some groups.