Skip to content

Commit 7811162

Browse files
committed
Support extracting Libre office documents
1 parent db9dd08 commit 7811162

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/extractcode/extract.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,14 @@ def extract_files(
230230
logger.debug('extract:walk:recurse:extraction event: %(xevent)r' % locals())
231231
yield xevent
232232

233+
def extract_libre_office_document(location, target):
234+
""" Extract Libre Office documents (e.g., .ods files) as ZIP archives. """
235+
if not zipfile.is_zipfile(location):
236+
return
237+
with zipfile.ZipFile(location, 'r') as zip_ref:
238+
zip_ref.extractall(target)
239+
print(f"Extracted Libre Office document from {location} to {target}")
240+
233241

234242
def extract_file(
235243
location,

0 commit comments

Comments
 (0)