scanny / python-pptx

Create Open XML PowerPoint documents in Python
MIT License
2.35k stars 510 forks source link

How to get the file extension and blob for a `shapes.picture.Movie` instance #801

Open jtschoonhoven opened 2 years ago

jtschoonhoven commented 2 years ago

I'm using this library to parse PPTX files and it's already been really helpful.

I'm already able to use the library to extract GIFs like this:

if hasattr(shape, 'image') and shape.image.content_type == 'image/gif':
  gif_path = os.path.join(tmpdir, uuid.uuid4())
    with open(gif_path, 'wb') as fileobj:
      fileobj.write(shape.image.blob)

Now I want to do the same thing for instances of shapes.picture.Movie. But after an hour of digging through the source code and manually inspecting objects in my REPL, I've found no way to access the movie's file extension, content type, or blob.

I'm hoping I've just missed something obvious. Help is much appreciated!

jtschoonhoven commented 2 years ago

If this is possible, but it isn't currently implemented, I could submit a PR if you point me in the right direction.