Skip to content

Latest commit

 

History

History
319 lines (242 loc) · 6.27 KB

mostypes.rst

File metadata and controls

319 lines (242 loc) · 6.27 KB

MOS Types

mosromgr.mostypes

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 ~MosFile.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

RunningOrder()

StorySend

StorySend()

StoryReplace

StoryReplace()

StoryInsert

StoryInsert()

StoryAppend

StoryAppend()

StoryMove

StoryMove()

StoryDelete

StoryDelete()

MetaDataReplace

MetaDataReplace()

ItemDelete

ItemDelete()

ItemInsert

ItemInsert()

ItemMoveMultiple

ItemMoveMultiple()

ItemReplace

ItemReplace()

ReadyToAir

ReadyToAir()

EAStoryReplace

EAStoryReplace()

EAItemReplace

EAItemReplace()

EAStoryDelete

EAStoryDelete()

EAItemDelete

EAItemDelete()

EAStoryInsert

EAStoryInsert()

EAItemInsert

EAItemInsert()

EAStorySwap

EAStorySwap()

EAItemSwap

EAItemSwap()

EAStoryMove

EAStoryMove()

EAItemMove

EAItemMove()

RunningOrderReplace

RunningOrderReplace()

RunningOrderEnd

RunningOrderEnd()

Base classes

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

MosFile

MosFile()

ElementAction

ElementAction()