2 KiB
GLAM Wiki schedule parser
Overview
The GLAM Wiki Schedule Parser (parse.py
) is a Python script designed to convert event schedules from a specific format used in Wikimedia's wiki pages into XML. It's tailored for the GLAM Wiki 2023 event, focusing on Galleries, Libraries, Archives, and Museums. The script is adept at handling complex schedules involving multiple days, sessions, and speakers.
Features
- Parses wiki-formatted schedule pages.
- Converts schedule data into a structured XML format.
- Handles multiple days, rooms, and sessions.
- Generates unique identifiers for events and speakers.
Requirements
- Python 3
lxml
library for XML handling.
Ensure that your Python environment has the lxml
package installed. You can install it using pip:
pip install lxml
Usage
To use the script, simply pass the filename of the wiki-formatted schedule page as an argument:
./parse.py [filename]
Replace [filename]
with the path to your schedule file.
Functionality
md5sum
: Generates a hex MD5 sum for a given string.content_to_url
: Converts a wiki link to a full URL.minutes_to_duration
: Converts minutes to a duration string.build_event
: Constructs an XML element for an event.read_wikitext
: Parses the wiki-formatted schedule file.generate_schedule
: Creates the complete schedule in XML format.main
: Entry point for the script. Parses the given file and prints the XML.
Limitations
- The script is specifically designed for the GLAM Wiki 2023 format and may not work with other event formats without modification.
- Error handling is minimal, assuming well-formatted input.
Contributions
Feel free to contribute to this project by submitting issues or pull requests to https://git.4angle.com/edward/glam-wiki-schedule.
License
This script is open-source and is available under the MIT license - see the LICENSE file
Contact
For any queries or contributions, please contact Edward Betts at edward@4angle.com.