Open luvwinnie opened 7 months ago
Hmm, looks like a part (file in the .pptx zip archive) is not getting instantiated as a MediaPart
(which is what has the .sha1
property) and is defaulting back to the generic Part
class.
This is where the Part
subclass is determined: https://github.com/scanny/python-pptx/blob/master/pptx/__init__.py#L51-L60
This is where membership in _MediaParts
is determined: https://github.com/scanny/python-pptx/blob/master/pptx/__init__.py#L51-L60
You can see those determine what counts as a media-part differently.
So I think there's a type that needs to be added to the first list above. Also, in retrospect, it would probably be worth thinking through how to use the same single mechanism for determining what's a media part and what isn't.
@scanny Thank for replying. I'm adding the audio wav file by using the add_movie method. From your reference, it seems like it works on like mp4, mov and etc. of the movie file.
By adding the audio with mime_type="audio/x-wav" would cause this errors maybe?
Yep, could be. Try adding that type to the first file and see if that fixes it. Interestingly there is no audio/x-wav
entry in pptx.opc.constants.CONTENT_TYPES
, so you might want to add it there.
I think root cause here is that audio was not considered when adding that feature so we didn't add audio content types or test cases at the time, but I expect much of the implementation is the same between audio and video, not sure about player behavior etc.
I have a pptx which used the add_video function to added a audio file.
I delete the audio file with normal Powerpoint apps, and then If I try to add an video again to the same slide, It shows the following errors.
Which part should I check for it?