API - MOS Elements¶
This part of the module provides a collection of classes used to provide easy
access to certain elements within a MosFile
object,
such as a list of stories within a running order, and the items within a story.
Although usually not required directly, the MOS Element classes can be imported as follows:
from mosromgr.moselements import Story
Element classes¶
Story¶
- class mosromgr.moselements.Story[source]¶
Bases:
mosromgr.moselements.MosElement
This class represents a Story element within any
MosFile
object, providing data relating to the story. The Story ID, Story slug, duration and more are exposed as properties, and the parent XML element is provided for further introspection.- __str__()¶
The XML string
- property body¶
A list of elements found in the story body. Each item in the list is either a string (representing a
<p>
tag) or anItem
object (representing an<item>
tag). Unlikescript
, this does not exclude empty paragraph tags.
- property duration¶
The story duration (the sum of the text time and media time found within
mosExternalMetadata->mosPayload
), in seconds (float
)
- property end_time¶
The transmission end time of the story (
datetime.datetime
orNone
if not available in the XML)
- property items¶
List of
Item
elements found within the story (can beNone
if not available in the XML)
- property offset¶
The time offset of the story in seconds (
float
orNone
if not available in the XML)
- property script¶
A list of strings found in paragraph tags within the story body, excluding any empty paragraphs or technical notes in brackets.
- property start_time¶
The transmission start time of the story (
datetime.datetime
orNone
if not available in the XML)
- property xml¶
The parent XML element (
xml.etree.ElementTree.Element
)
Item¶
- class mosromgr.moselements.Item[source]¶
Bases:
mosromgr.moselements.MosElement
This class represents an Item element within any
MosFile
object, providing data relating to the item within aStory
. The Item ID and Item slug are exposed as properties, and the parent XML element is provided for further introspection.- __str__()¶
The XML string
- property xml¶
The parent XML element (
xml.etree.ElementTree.Element
)