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
Note
Note that these classes should not normally be constructed by the user, but
instances of them can be found within MosFile
objects, so the following documentation is provided as a reference to how
they can be used.
Element classes
Story
- class mosromgr.moselements.Story[source]
Bases:
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 XML element is provided for further introspection.- __str__()
The XML string
- property body: List[Union[Item, str]]
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, which will be represented by empty strings.
- property duration: float
The story duration (the sum of the text time and media time found within
mosExternalMetadata->mosPayload
), in seconds
- property end_time: Optional[datetime]
The transmission end time of the story (if present in the XML)
- property items: Optional[List[Item]]
List of
Item
elements found within the story (can beNone
if not available in the XML)
- property script: List[str]
A list of strings found in paragraph tags within the story body, excluding any empty paragraphs or technical notes in brackets.
Item
- class mosromgr.moselements.Item[source]
Bases:
MosElement
This class represents an Item element within any
MosFile
object, providing data relating to an item within aStory
. The Item ID and Item slug (and more) are exposed as properties, and the XML element is provided for further introspection.- __str__()
The XML string