.blend file info?

I want to write a Nautilus blender-render script similar to my Synfig and Anime Studio render scripts.

For this I would need to get info from the blend files on which scenes there are within and the length of these, etc.
The .blend file format doesn’t seem to be in plain text so I can’t get the info by a simple grep on the files.

How can I get this info?

http://www.blender.org/development/architecture/blender-file-format/

Thank you. That wrinkled my brain quite a bit. I guess this is very useful information but I cant figure out how to use it to get the information I want. (My programming knowledge is limited to bash-scripts which is mostly hacked together by trial and error…)

i haven’t managed yet to understand how it works jet. You can look at
http://www.blender.org/development/architecture/notes-on-sdna/
http://www.blender.org/development/architecture/blender-file-reading/
http://www.blender.org/development/architecture/architecture-overview/

And than look at the source. But you’ll need to know C

Ps: if you only know bash-scripting, how would you like to use this informations? I mean, bash-scripts can’t do much stuff when it comes to programming, they are designed for other purposes…

Thank’s. I’ll look into those.
Yes, bash scripts can’t do much but thats just enough for simple render scripts. Click a .blend in Nautilus, and if possible get a list of scenes, set start/end-frame and send to Blender for render. Easy and convenient. I’ve done different render scripts for Anime Studio and Synfig, linked to in the first post in this thread. Want to do a similar thing for Blender.

So you’ll need to be able to read binary files :wink: (don’t know if bash scripts can do that, if so, than good luck with your idea :smiley: )

As Makers_F has implied, you are not going to have much luck trying to use things like grep in a bash script to extract information from a .blend file - the format of the file is basically a dump C structs, which is great for fast reading and writing but lousy for your purpose.

If I were trying to do what you are trying to do, I’d write a little help script in Python that uses the Blender Python API to get the information you want and print it on standard output. Then I’d call Blender from the script giving the “-P script” option to run it at startup time, and capture the output in a bash variable.

Thank’s howardt!
I had already started thinking along those lines ,seems like the easiest way.
I don’t know any Python but have wanted to learn. Now I got a reason! :slight_smile: