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 an Item object (representing an <item> tag). Unlike script, 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 id: Optional[str]

The Story ID (if present in the XML)

property items: Optional[List[Item]]

List of Item elements found within the story (can be None if not available in the XML)

property offset: Optional[float]

The time offset of the story in seconds (if 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.

property slug: Optional[str]

The Story slug (if present in the XML)

property start_time: Optional[datetime]

The transmission start time of the story (if present in the XML)

property xml: Element

The XML element

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 a Story. 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

property id: Optional[str]

The Item ID (if present in the XML)

property mos_id: Optional[str]

The Item’s MOS ID (if present in the XML)

property note: Optional[str]

The item note text (if present in the XML)

property object_id: Optional[str]

The Item’s Object ID (if present in the XML)

property slug: Optional[str]

The Item slug (if present in the XML)

property type: Optional[str]

The Item’s object type (if present in the XML)

property xml: Element

The XML element

Base classes

MosElement

class mosromgr.moselements.MosElement[source]

Abstract base class for MOS elements

__str__()[source]

The XML string

property id: Optional[str]

The element ID (if present in the XML)

property slug: Optional[str]

The element slug (if present in the XML)

property xml: Element

The XML element