[Tutor] Grabbing Information from txt files

Steven D'Aprano steve at pearwood.info
Sat Nov 13 08:16:23 CET 2010


Michael Stover wrote:
> My apologies for my last email, admittedly I was more tired that I thought as 
> after re-reading it and the emails coming in, I found that I did not provided 
> "proper" information.
> 
> 1. I have a script that is detecting multiple various bits of information of a 
> video file using MediaInfo and putting that information into a txt file with the 
> format of:
> (Example:)
> num_vid_track=?
> num_aud_track=?
> num_sub_track=?
> 
> Granted that is only part of the information being obtained but it's all in the 
> same format.
> I have been trying multiple ways of grabbing this information for re-use, 
> including using this snippet, suggested to me by fellow users of the #python irc 
> channel..
[snip]
> only issue is, I can barely understand the documentation I kept getting pointed 
> to for retrieving the information captured from stdout. Which is why I went with 
> another friends suggestion of outputting all of the information to a text file. 
> Sorry if this seems to have veered off course, but which method would be more 
> recommended to implement?

There's absolutely nothing wrong with an "assembly line" of components:

Use MediaInfo to write data to a text file;
Use Python to read the text file and process it;
Use <some tool> to modify the video according to the text file;
etc.

You don't need a single monolithic script to do everything... if you 
have an easy way of calling MediaInfo and getting it to write its data 
to text files, stick with that.


-- 
Steven



More information about the Tutor mailing list