https://github.com/cben/odf_fixlinks
Change external media hrefs in OpenDocument format files to relative links
https://github.com/cben/odf_fixlinks
Last synced: 9 months ago
JSON representation
Change external media hrefs in OpenDocument format files to relative links
- Host: GitHub
- URL: https://github.com/cben/odf_fixlinks
- Owner: cben
- Created: 2014-01-10T12:06:56.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2020-01-04T22:52:12.000Z (over 6 years ago)
- Last Synced: 2025-08-28T08:32:52.338Z (9 months ago)
- Language: Python
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Change linked media in OpenDocument files to relative links
This script helps with managing *linked* (not embedded) media in LibreOffice/OpenOffice files.
(This is important with big video files, as embedding them would inflate the document to impractical size.)
LibreOffice tends to record *absolute paths* when you insert linked media, which breaks as soon as you move the document and media around your filesystem / to different computers :-(
This script modifies links to files that it finds in the **same directory as the ODF document** to be relative links.
It doesn't matter if the original link works, so you can run this after moving the directory with document(s) and media around.
- It'd be easy to support other conventions, e.g. having media in a subdirectory relative to document.
Let me know if you want any such support...
# Safety
Links whose target does not exist in current directory are left alone for safety.
It prints a report of all links and what it did to stdout.
It never modifies the original file but creates a new one e.g. `foo.odp` -> `foo_fixlinks.odp`.
## What works
Specifically tested with ODP presentations created by Impress but should work on any kind of OpenDocument format files.
Doens't work with PowerPoint 2010(?) — while it has buitin support for ODP import and export, its export seems to interpret the href field differently and I couldn't get its import to show linked videos at all - even from an ODP file exported by same PowerPoint!
## License
MIT license.