MOS Types

This part of the module provides the classes required for classifying and managing MOS files.

MOS Type classes are typically imported like so:

from mosromgr.mostypes import MosFile

MOS objects are constructed using one of three classmethods. Either from a file path:

ro = RunningOrder.from_file('roCreate.mos.xml')

from an XML string:

with open('roCreate.mos.xml') as f:
    xml = f.read()

ro = RunningOrder.from_string(xml)

or from an S3 file key:

ro = RunningOrder.from_s3(bucket_name='newsnight', mos_file_key='20200101/roCreate.mos.xml')

Similarly, objects constructed using these classmethods on the MosFile base class will be automatically classified and an instance of the relevant class will be created:

>>> ro = MosFile.from_file('roCreate.mos.xml')
>>> ro
<RunningOrder 1000>
>>> ss = MosFile.from_file('roStorySend.mos.xml')
>>> ss
<StorySend 1001>
>>> ro = MosFile.from_string(xml1)
>>> ro
<RunningOrder 1000>
>>> ss = MosFile.from_string(xml2)
>>> ss
<StorySend 1001>

Even roElementAction files, which require a number of different subclasses, can be classified this way:

>>> ea1 = MosFile.from_file('roElementAction1.mos.xml')
>>> ea1
<EAStorySwap 1012>
>>> ea2 = MosFile.from_string(xml)
>>> ea2
<EAItemMove 1013>

Note

Your AWS credentials must be configured to construct using the from_s3() classmethod. See https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html

MOS message classes

The following classes are used to parse and manage specific types of MOS messages.

RunningOrder

class mosromgr.mostypes.RunningOrder[source]

Bases: MosFile

A RunningOrder object is created from a roCreate MOS file and can be constructed using classmethods from_file(), from_string() or from_s3().

Specification: Create Running Order

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-32

__add__(other: MosFile)[source]

RunningOrder objects can be merged with other MOS files which implement a merge method by using the + operator, for example:

ro = RunningOrder.from_file('roCreate.mos.xml')
ss = StorySend.from_file('roStorySend.mos.xml')
ro += ss
__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property body: List[Union[Item, str]]

A list of elements found in the story bodies. 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.

property completed: bool

Whether or not the running order has had a RunningOrderEnd merged

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property duration: Optional[float]

Total running order duration in seconds

property end_time: Optional[datetime]

Transmission end time (if present in the XML)

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property ro_slug: str

The running order slug

property script: List[str]

A list of strings found in paragraph tags within the story bodies, excluding any empty paragraphs or technical notes in brackets.

property start_time: Optional[datetime]

Transmission start time (if present in the XML)

property stories: List[Story]

A list of Story objects within the running order

property xml: Element

The XML element of the MOS file

StorySend

class mosromgr.mostypes.StorySend[source]

Bases: MosFile

A StorySend object is created from a roStorySend MOS file and can be constructed using classmethods from_file(), from_string() or from_s3().

StorySend objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Send Story information, including Body of the Story

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-49

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property story: Story

The Story object being sent

property xml: Element

The XML element of the MOS file

StoryReplace

class mosromgr.mostypes.StoryReplace[source]

Bases: MosFile

A StoryReplace object is created from a roStoryReplace MOS file and can be constructed using classmethods from_file(), from_string() or from_s3().

StoryReplace objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Replace a Story with Another in a Running Order

The roStoryReplace message replaces the referenced story with another story or stories. This messages also replaces all items associated with the original story or stories.

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOS_Protocol_Version_2.8.5_Final.htm#roStoryReplace

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property stories: List[Story]

A list of replacement Story objects

property story: Story

The Story object being replaced

property xml: Element

The XML element of the MOS file

StoryInsert

class mosromgr.mostypes.StoryInsert[source]

Bases: MosFile

A StoryInsert object is created from a roStoryInsert MOS file and can be constructed using classmethods from_file(), from_string() or from_s3().

StoryInsert objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Insert Stories in Running Order

This message inserts stories and all of their defined items before the referenced story in a Running Order.

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOS_Protocol_Version_2.8.5_Final.htm#roStoryInsert

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property source_stories: List[Story]

A list of Story objects to be inserted

property target_story: Story

The Story object above which the source stories are to be inserted

property xml: Element

The XML element of the MOS file

StoryAppend

class mosromgr.mostypes.StoryAppend[source]

Bases: MosFile

A StoryAppend object is created from a roStoryAppend MOS file and can be constructed using classmethods from_file(), from_string() or from_s3().

StoryAppend objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Append Stories to Running Order

The roStoryAppend message appends stories and all of their defined items at the end of a running order.

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOS_Protocol_Version_2.8.5_Final.htm#roStoryAppend

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property stories: List[Story]

A list of Story objects to be appended

property xml: Element

The XML element of the MOS file

StoryMove

class mosromgr.mostypes.StoryMove[source]

Bases: MosFile

A StoryMove object is created from a roStoryMove MOS file and can be constructed using classmethods from_file(), from_string() or from_s3().

StoryMove objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Move a story to a new position in the Playlist

This message allows a story to be moved to a new location in a playlist. The first storyID is the ID of the story to be moved. The second storyID is the ID of the story above which the first story is to be moved.

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOS_Protocol_Version_2.8.5_Final.htm#roStoryMove

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property source_story: Optional[Story]

The Story object to be moved

property target_story: Optional[Story]

The Story object above which the source story is to be moved

property xml: Element

The XML element of the MOS file

StoryDelete

class mosromgr.mostypes.StoryDelete[source]

Bases: MosFile

A StoryDelete object is created from a roStoryDelete MOS file and can be constructed using classmethods from_file(), from_string() or from_s3().

StoryDelete objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Delete Stories from Running Order

The roStoryDelete message deletes the referenced Stories and all associated Items from the Running Order.

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOS_Protocol_Version_2.8.5_Final.htm#roStoryDelete

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property stories: List[Story]

A list of Story objects to be deleted

property xml: Element

The XML element of the MOS file

MetaDataReplace

class mosromgr.mostypes.MetaDataReplace[source]

Bases: MosFile

A MetaDataReplace object is created from a roMetadataReplace MOS file and can be constructed using classmethods from_file(), from_string() or from_s3().

MetaDataReplace objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Replace RO metadata without deleting the RO structure

If metadata tags in the roMetadataReplace message already exist in the target RO, values within the RO will be replaced by the values in the roMetadataReplace message.

If the metadata tags do not already exist in the target RO they will be added.

If a mosExternalMetadata block is included in the roMetadataReplace message, it will replace an existing mosExternalMetadata block only if the values of mosSchema in the two blocks match. Otherwise the mosExternalMetadata block will be added to the target RO.

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-34

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property ro_slug: str

The running order slug

property xml: Element

The XML element of the MOS file

ItemDelete

class mosromgr.mostypes.ItemDelete[source]

Bases: MosFile

An ItemDelete object is created from a roItemDelete MOS file and can be constructed using classmethods from_file(), from_string() or from_s3().

ItemDelete objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Delete Items in Story

The roItemDelete message deletes one or more items in a story.

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOS_Protocol_Version_2.8.5_Final.htm#roItemDelete

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property items: List[Item]

A list of the Item objects being deleted

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property story: Story

The Story object containing the items being deleted

property xml: Element

The XML element of the MOS file

ItemInsert

class mosromgr.mostypes.ItemInsert[source]

Bases: MosFile

An ItemInsert object is created from a roItemInsert MOS file and can be constructed using classmethods from_file(), from_string() or from_s3().

ItemInsert objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Insert Items in Story

This message allows one or more items to be inserted before a referenced item in a story in the playlist. The first itemID is the ID of the item before which to insert the new items. If the first itemID is blank, the items are inserted at the end of the story.

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOS_Protocol_Version_2.8.5_Final.htm#roItemInsert

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property item: Item

The Item object above which the items are to be inserted

property items: List[Item]

A list of Item objects to be inserted

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property story: Story

The Story object into which the items are to be inserted

property xml: Element

The XML element of the MOS file

ItemMoveMultiple

class mosromgr.mostypes.ItemMoveMultiple[source]

Bases: MosFile

An ItemMoveMultiple object is created from a roItemMoveMultiple MOS file and can be constructed using classmethods from_file(), from_string() or from_s3().

ItemMoveMultiple objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Move one or more Items to a specified position within a Story

The roItemMoveMultiple message allows one or more items in a story to be moved to a new location in the story. The last itemID is the ID of the item before which to insert the new items. All remaining itemIDs identify items to insert at that location. The resulting story has all the moved items appearing before the reference item in the order specified in the command. If the last itemID is blank, the items are moved to the end of the story.

There may be no duplicates in the list of itemIDs. This prevents the move from being ambiguous; if two itemIDs are the same, it is unclear where in the story the item with that ID must be placed.

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOS_Protocol_Version_2.8.5_Final.htm#roItemMoveMultiple

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property item: Optional[Item]

The Item object above which the items will be moved (if the last itemID tag is not empty)

property items: List[Item]

A list of Item objects to be moved

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property story: Story

The Story object containing the items being moved

property xml: Element

The XML element of the MOS file

ItemReplace

class mosromgr.mostypes.ItemReplace[source]

Bases: MosFile

An ItemReplace object is created from a roItemReplace MOS file and can be constructed using classmethods from_file(), from_string() or from_s3().

ItemReplace objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Replace an Item with one or more Items in a Story

The roItemReplace message replaces the referenced item in a story with one or more items.

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOS_Protocol_Version_2.8.5_Final.htm#roItemReplace

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property item: Item

The Item object being replaced

property items: List[Item]

A list of replacement Item objects

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property story: Story

The Story object containing the item being replaced

property xml: Element

The XML element of the MOS file

ReadyToAir

class mosromgr.mostypes.ReadyToAir[source]

Bases: MosFile

A ReadyToAir object is created from a roReadyToAir MOS file and can be constructed using classmethods from_file(), from_string() or from_s3().

ReadyToAir objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Identify a Running Order as Ready to Air

The roReadyToAir message allows the NCS to signal the MOS that a Running Order has been editorially approved ready for air.

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-41

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

Currently unimplemented - has no effect on the running order. TODO: #18

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property xml: Element

The XML element of the MOS file

EAStoryReplace

class mosromgr.mostypes.EAStoryReplace[source]

Bases: ElementAction

An EAStoryReplace object is created from a roElementAction MOS file containing a story replacement, and can be constructed using classmethods from_file(), from_string() or from_s3().

EAStoryReplace objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Replacing a story

In element_target: A storyID specifying the story to be replaced

In element_source: One or more stories to put in its place

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-43

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property stories: List[Story]

A list of replacement Story objects

property story: Story

The Story object being replaced

property xml: Element

The XML element of the MOS file

EAItemReplace

class mosromgr.mostypes.EAItemReplace[source]

Bases: ElementAction

An EAItemReplace object is created from a roElementAction MOS file containing an item replacement, and can be constructed using classmethods from_file(), from_string() or from_s3().

EAItemReplace objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Replacing an item

In element_target: A storyID and itemID specifying the item to be replaced

In element_source: One or more items to put in its place

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-43

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property item: Item

The Item object being replaced

property items: List[Item]

A list of replacement Item objects

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property story: Story

The Story object containing the item being replaced

property xml: Element

The XML element of the MOS file

EAStoryDelete

class mosromgr.mostypes.EAStoryDelete[source]

Bases: ElementAction

An EAStoryDelete object is created from a roElementAction MOS file containing a story deletion, and can be constructed using classmethods from_file(), from_string() or from_s3().

EAStoryDelete objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Deleting stories

In element_target: Not needed, since deletes don’t happen relative to another story

In element_source: One or more storyIDs specifying the stories to be deleted

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-43

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property stories: List[Story]

A list of Story objects to be deleted

property xml: Element

The XML element of the MOS file

EAItemDelete

class mosromgr.mostypes.EAItemDelete[source]

Bases: ElementAction

An EAItemDelete object is created from a roElementAction MOS file containing an item deletion, and can be constructed using classmethods from_file(), from_string() or from_s3().

EAItemDelete objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Deleting items

In element_target: A storyID specifying the story containing the items to be deleted

In element_source: One or more itemIDs specifying the items in the story to be deleted

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-43

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property items: List[Item]

A list of Item objects being deleted

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property story: Story

The Story object containing the items being deleted

property xml: Element

The XML element of the MOS file

EAStoryInsert

class mosromgr.mostypes.EAStoryInsert[source]

Bases: ElementAction

An EAStoryInsert object is created from a roElementAction MOS file containing a story insertion, and can be constructed using classmethods from_file(), from_string() or from_s3().

EAStoryInsert objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Inserting stories

In element_target: A storyID specifying the story before which the source stories are inserted

In element_source: One or more stories to insert

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-43

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property stories: List[Story]

The Story objects to be inserted

property story: Story

The Story object above which the source story will be inserted

property xml: Element

The XML element of the MOS file

EAItemInsert

class mosromgr.mostypes.EAItemInsert[source]

Bases: ElementAction

An EAItemInsert object is created from a roElementAction MOS file containing an item insertion, and can be constructed using classmethods from_file(), from_string() or from_s3().

EAItemInsert objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Inserting items

In element_target: A storyID and itemID specifying the item before which the source items are inserted

In element_source: One or more items to insert

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-43

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property item: Item

The Item object above which the source item is to be be inserted

property items: List[Item]

A list of Item objects to be inserted

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property story: Story

The Story object into which the item is to be inserted

property xml: Element

The XML element of the MOS file

EAStorySwap

class mosromgr.mostypes.EAStorySwap[source]

Bases: ElementAction

An EAStorySwap object is created from a roElementAction MOS file containing a story swap, and can be constructed using classmethods from_file(), from_string() or from_s3().

EAStorySwap objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Swapping stories

In element_target: An empty storyID tag, or the element_target tag itself is absent

In element_source: Exactly two storyIDs specifying the stories to be swapped

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-43

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property stories: Tuple[Story]

A tuple of the two Story objects to be swapped

property xml: Element

The XML element of the MOS file

EAItemSwap

class mosromgr.mostypes.EAItemSwap[source]

Bases: ElementAction

An EAItemSwap object is created from a roElementAction MOS file containing an item swap, and can be constructed using classmethods from_file(), from_string() or from_s3().

EAItemSwap objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Swapping items

In element_target: A storyID specifying the story containing the items to be swapped

In element_source: Exactly two itemIDs specifying the items to be swapped

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-43

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property items: Tuple[Item]

A tuple of the two Item objects to be swapped

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property story: Story

The Story object containing the items being swapped

property xml: Element

The XML element of the MOS file

EAStoryMove

class mosromgr.mostypes.EAStoryMove[source]

Bases: ElementAction

An EAStoryMove object is created from a roElementAction MOS file containing a story move, and can be constructed using classmethods from_file(), from_string() or from_s3().

EAStoryMove objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Moving stories

In element_target: A storyID specifying the story before which the source stories are moved

In element_source: One or more storyIDs specifying the stories to be moved

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-43

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property stories: List[Story]

A list of Story objects being moved

property story: Story

The Story object above which the other stories will be moved

property xml: Element

The XML element of the MOS file

EAItemMove

class mosromgr.mostypes.EAItemMove[source]

Bases: ElementAction

An EAItemMove object is created from a roElementAction MOS file containing an item move, and can be constructed using classmethods from_file(), from_string() or from_s3().

EAItemMove objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Moving items

In element_target: A storyID and itemID specifying the item before which the source items are moved

In element_source: One or more itemIDs specifying the items in the story to be moved

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-43

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property item: Item

The Item object above which the source items will be moved

property items: List[Item]

A list of Item objects to be moved

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property story: Story

The Story object containing the item being replaced

property xml: Element

The XML element of the MOS file

RunningOrderReplace

class mosromgr.mostypes.RunningOrderReplace[source]

Bases: RunningOrder

An RunningOrderReplace object is created from a roReplace MOS file and can be constructed using classmethods from_file(), from_string() or from_s3().

RunningOrderReplace objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class.

Specification: Replace Running Order

Replaces an existing Running Order definition in the MOS with another one sent from the NCS.

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-33

__add__(other: MosFile)

RunningOrder objects can be merged with other MOS files which implement a merge method by using the + operator, for example:

ro = RunningOrder.from_file('roCreate.mos.xml')
ss = StorySend.from_file('roStorySend.mos.xml')
ro += ss
__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property body: List[Union[Item, str]]

A list of elements found in the story bodies. 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.

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property duration: Optional[float]

Total running order duration in seconds

property end_time: Optional[datetime]

Transmission end time (if present in the XML)

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property ro_slug: str

The running order slug

property script: List[str]

A list of strings found in paragraph tags within the story bodies, excluding any empty paragraphs or technical notes in brackets.

property start_time: Optional[datetime]

Transmission start time (if present in the XML)

property stories: List[Story]

A list of Story objects within the running order

property xml: Element

The XML element of the MOS file

RunningOrderEnd

class mosromgr.mostypes.RunningOrderEnd[source]

Bases: MosFile

A RunningOrderEnd object is created from a roDelete MOS file and can be constructed using classmethods from_file(), from_string() or from_s3().

RunningOrderEnd objects can be merged with a RunningOrder by using the + operator. This behaviour is defined in the merge() method in this class. Once a RunningOrderEnd object has been merged into a RunningOrder, the running order is considered “completed” and no further messages can be merged.

Specification: Delete Running Order

http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-35

__lt__(other) bool

Sort by message_id i.e. ro < ss or sorted([ro, ss])

__str__()

The XML string of the MOS file

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

inspect()[source]

Print an outline of the key file contents

merge(ro: RunningOrder) RunningOrder[source]

Merge into the RunningOrder object provided.

Adds a mosromgrmeta tag containing the roDelete tag from the roDelete message to the roCreate tag in the running order.

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property xml: Element

The XML element of the MOS file

Base classes

Since some logic is shared between MOS file management, some inheritance is used in the implementation:

../_images/class_hierarchy.svg

MosFile

class mosromgr.mostypes.MosFile[source]

Base class for all MOS files

classmethod from_file(mos_file_path: Union[Path, str])[source]

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)[source]

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)[source]

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name

The base tag (xml.etree.ElementTree.Element) within the xml, as determined by base_tag_name

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property xml: Element

The XML element of the MOS file

ElementAction

class mosromgr.mostypes.ElementAction[source]

Base class for various roElementAction MOS files.

Specification: Performs specific Action on a Running Order

https://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-43

classmethod from_file(mos_file_path: Union[Path, str])

Construct from a path to a MOS file

Parameters

mos_file_path (Union[pathlib.Path, str]) – The MOS file path

classmethod from_s3(bucket_name: str, mos_file_key: str)

Construct from a MOS file in an S3 bucket

Parameters
  • bucket_name (str) – The name of the S3 bucket

  • mos_file_key (str) – A MOS file key within the S3 bucket

classmethod from_string(mos_xml_string: str)

Construct from an XML string of a MOS document

Parameters

mos_xml_string (str) – The XML string of the MOS document

property base_tag: Element

The base tag within the xml, as determined by base_tag_name

property base_tag_name: str

The name of the base XML tag for this file type

property dict: OrderedDict

Convert XML to dictionary using xmltodict library. Useful for testing.

property message_id: int

The MOS file’s message ID

property ro_id: str

The running order ID

property xml: Element

The XML element of the MOS file