API - 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>
MOS message classes¶
The following classes are used to parse and manage specific types of MOS messages.
RunningOrder¶
-
class
mosromgr.mostypes.
RunningOrder
[source]¶ Bases:
mosromgr.mostypes.MosFile
A
RunningOrder
object is created from aroCreate
MOS file and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.Specification: Create Running Order http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-32
-
__add__
(other)[source]¶ RunningOrder
objects can be merged with other MOS files which implement amerge
method by using the+
operator, for example:ro = RunningOrder.from_file('roCreate.mos.xml') ss = StorySend.from_file('roStorySend.mos.xml') ro += ss
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
completed
¶ Whether or not the running order has had a
RunningOrderEnd
merged (bool
)
-
property
end_time
¶ Transmission end time (
datetime.datetime
)
-
property
start_time
¶ Transmission start time (
datetime.datetime
)
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
StorySend¶
-
class
mosromgr.mostypes.
StorySend
[source]¶ Bases:
mosromgr.mostypes.MosFile
A
StorySend
object is created from aroStorySend
MOS file and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.StorySend
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
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
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Replaces the story tag in the running order with the one in the
roStorySend
message.
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
StoryReplace¶
-
class
mosromgr.mostypes.
StoryReplace
[source]¶ Bases:
mosromgr.mostypes.MosFile
A
StoryReplace
object is created from aroStoryReplace
MOS file and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.StoryReplace
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class.Specification: Replace a Story with Another in a Running Order http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOS_Protocol_Version_2.8.5_Final.htm#roStoryReplace
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Replaces the story tag in the running order with the one in the
roStoryReplace
message.
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
StoryInsert¶
-
class
mosromgr.mostypes.
StoryInsert
[source]¶ Bases:
mosromgr.mostypes.MosFile
A
StoryInsert
object is created from aroStoryInsert
MOS file and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.StoryInsert
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class.Specification: Insert Stories in Running Order http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOS_Protocol_Version_2.8.5_Final.htm#roStoryInsert
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Inserts the story tags from the
roStoryInsert
message into the running order.
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
StoryAppend¶
-
class
mosromgr.mostypes.
StoryAppend
[source]¶ Bases:
mosromgr.mostypes.MosFile
A
StoryAppend
object is created from aroStoryAppend
MOS file and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.StoryAppend
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class.Specification: Append Stories to Running Order http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOS_Protocol_Version_2.8.5_Final.htm#roStoryAppend
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Adds the story tag in the
roStoryAppend
message onto the end of the running order.
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
StoryMove¶
-
class
mosromgr.mostypes.
StoryMove
[source]¶ Bases:
mosromgr.mostypes.MosFile
A
StoryMove
object is created from aroStoryMove
MOS file and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.StoryMove
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class.Specification: Move a story to a new position in the Playlist http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOS_Protocol_Version_2.8.5_Final.htm#roStoryMove
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Moves the story given in the
roStoryMove
message to a new position in the running order.
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
StoryDelete¶
-
class
mosromgr.mostypes.
StoryDelete
[source]¶ Bases:
mosromgr.mostypes.MosFile
A
StoryDelete
object is created from aroStoryDelete
MOS file and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.StoryDelete
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class.Specification: Delete Stories from Running Order http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOS_Protocol_Version_2.8.5_Final.htm#roStoryDelete
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Removes any story tags from the running order which are included in the
roStoryDelete
message.
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
MetaDataReplace¶
-
class
mosromgr.mostypes.
MetaDataReplace
[source]¶ Bases:
mosromgr.mostypes.MosFile
A
MetaDataReplace
object is created from aroMetadataReplace
MOS file and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.MetaDataReplace
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class.Specification: Replace RO metadata without deleting the RO structure http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-34
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Replaces the metadata tags in the running order with the ones in the
MetaDataReplace
message.
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
ItemDelete¶
-
class
mosromgr.mostypes.
ItemDelete
[source]¶ Bases:
mosromgr.mostypes.MosFile
An
ItemDelete
object is created from aroItemDelete
MOS file and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.ItemDelete
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class.Specification: Delete Items in Story http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOS_Protocol_Version_2.8.5_Final.htm#roItemDelete
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Deletes any item tags with the IDs specified in the
roItemDelete
message from the running order.
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
ItemInsert¶
-
class
mosromgr.mostypes.
ItemInsert
[source]¶ Bases:
mosromgr.mostypes.MosFile
An
ItemInsert
object is created from aroItemInsert
MOS file and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.ItemInsert
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class.Specification: Insert Items in Story http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOS_Protocol_Version_2.8.5_Final.htm#roItemInsert
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Inserts the item tags from the
roItemInsert
message into the relevant story in the running order.
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
ItemMoveMultiple¶
-
class
mosromgr.mostypes.
ItemMoveMultiple
[source]¶ Bases:
mosromgr.mostypes.MosFile
An
ItemMoveMultiple
object is created from aroItemMoveMultiple
MOS file and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.ItemMoveMultiple
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class.Specification: Move one or more Items to a specified position within a Story http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOS_Protocol_Version_2.8.5_Final.htm#roItemMoveMultiple
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Moves item tags in the
roItemMove
message to a new position within the story.
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
ItemReplace¶
-
class
mosromgr.mostypes.
ItemReplace
[source]¶ Bases:
mosromgr.mostypes.MosFile
An
ItemReplace
object is created from aroItemReplace
MOS file and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.ItemReplace
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class.Specification: Replace an Item with one or more Items in a Story http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOS_Protocol_Version_2.8.5_Final.htm#roItemReplace
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Replaces the story tag in the running order with the one in the
roStorySend
message
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
ReadyToAir¶
-
class
mosromgr.mostypes.
ReadyToAir
[source]¶ Bases:
mosromgr.mostypes.MosFile
A
ReadyToAir
object is created from aroReadyToAir
MOS file and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.ReadyToAir
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class.Specification: Identify a Running Order as Ready to Air http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-41
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Currently unimplemented - has no effect on the running order. TODO: #18
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
EAStoryReplace¶
-
class
mosromgr.mostypes.
EAStoryReplace
[source]¶ Bases:
mosromgr.mostypes.ElementAction
An
EAStoryReplace
object is created from aroElementAction
MOS file containing a story replacement, and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.EAStoryReplace
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class.Specification: Replacing a story http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-43
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Replaces the
element_target
story tag in the running order with any story tags found in theelement_source
in theroElementAction
message.
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
EAItemReplace¶
-
class
mosromgr.mostypes.
EAItemReplace
[source]¶ Bases:
mosromgr.mostypes.ElementAction
An
EAItemReplace
object is created from aroElementAction
MOS file containing an item replacement, and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.EAItemReplace
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class.Specification: Replacing an item http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-43
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Replaces the target item tag in the target story in the running order with any item tags found in the
element_source
in theroElementAction
message.
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
EAStoryDelete¶
-
class
mosromgr.mostypes.
EAStoryDelete
[source]¶ Bases:
mosromgr.mostypes.ElementAction
An
EAStoryDelete
object is created from aroElementAction
MOS file containing a story deletion, and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.EAStoryDelete
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class.Specification: Deleting stories http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-43
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Removes any stories specified in
element_source
in theroElementAction
message from the running order.
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
EAItemDelete¶
-
class
mosromgr.mostypes.
EAItemDelete
[source]¶ Bases:
mosromgr.mostypes.ElementAction
An
EAItemDelete
object is created from aroElementAction
MOS file containing an item deletion, and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.EAItemDelete
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class.Specification: Deleting items http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-43
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Deletes any items specified in the
element_target
in theroStorySend
message from the specified story in the running order.
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
EAStoryInsert¶
-
class
mosromgr.mostypes.
EAStoryInsert
[source]¶ Bases:
mosromgr.mostypes.ElementAction
An
EAStoryInsert
object is created from aroElementAction
MOS file containing a story insertion, and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.EAStoryInsert
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class.Specification: Inserting stories http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-43
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Inserts any story tags found in the
element_source
in theroElementAction
message into the running order.
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
EAItemInsert¶
-
class
mosromgr.mostypes.
EAItemInsert
[source]¶ Bases:
mosromgr.mostypes.ElementAction
An
EAItemInsert
object is created from aroElementAction
MOS file containing an item insertion, and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.EAItemInsert
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class.Specification: Inserting items http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-43
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Inserts any item tags found in the
element_source
in theroElementAction
message into the relevant story in the running order.
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
EAStorySwap¶
-
class
mosromgr.mostypes.
EAStorySwap
[source]¶ Bases:
mosromgr.mostypes.ElementAction
An
EAStorySwap
object is created from aroElementAction
MOS file containing a story swap, and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.EAStorySwap
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class.Specification: Swapping stories http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-43
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Swaps the order of the two story tags specified in
element_source
in theroElementAction
message in the running order.
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
EAItemSwap¶
-
class
mosromgr.mostypes.
EAItemSwap
[source]¶ Bases:
mosromgr.mostypes.ElementAction
An
EAItemSwap
object is created from aroElementAction
MOS file containing an item swap, and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.EAItemSwap
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class.Specification: Swapping items http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-43
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Swaps the order of the two item tags specified in
element_source
in theroElementAction
message in the relevant story in the running order.
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
EAStoryMove¶
-
class
mosromgr.mostypes.
EAStoryMove
[source]¶ Bases:
mosromgr.mostypes.ElementAction
An
EAStoryMove
object is created from aroElementAction
MOS file containing a story move, and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.EAStoryMove
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class.Specification: Moving stories http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-43
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Moves story tags in
element_source
to the specified location in the running order.
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
EAItemMove¶
-
class
mosromgr.mostypes.
EAItemMove
[source]¶ Bases:
mosromgr.mostypes.ElementAction
An
EAItemMove
object is created from aroElementAction
MOS file containing an item move, and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.EAItemMove
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class.Specification: Moving items http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-43
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Moves item tags in
element_source
to the specified location in the story in the running order.
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
RunningOrderReplace¶
-
class
mosromgr.mostypes.
RunningOrderReplace
[source]¶ Bases:
mosromgr.mostypes.RunningOrder
An
RunningOrderReplace
object is created from aroReplace
MOS file and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.RunningOrderReplace
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class.Specification: Replace Running Order http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-33
-
__add__
(other)¶ RunningOrder
objects can be merged with other MOS files which implement amerge
method by using the+
operator, for example:ro = RunningOrder.from_file('roCreate.mos.xml') ss = StorySend.from_file('roStorySend.mos.xml') ro += ss
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Replaces the entire
roCreate
tag in the running order with the one in theroReplace
message.
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
end_time
¶ Transmission end time (
datetime.datetime
)
-
property
start_time
¶ Transmission start time (
datetime.datetime
)
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
RunningOrderEnd¶
-
class
mosromgr.mostypes.
RunningOrderEnd
[source]¶ Bases:
mosromgr.mostypes.MosFile
A
RunningOrderEnd
object is created from aroDelete
MOS file and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.RunningOrderEnd
objects can be merged with aRunningOrder
by using the+
operator. This behaviour is defined in themerge()
method in this class. Once aRunningOrderEnd
object has been merged into aRunningOrder
, the running order is considered “completed” and no further messages can be merged (with the exception ofRunningOrderControl
).Specification: Delete Running Order http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-35
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Adds a
mosromgrmeta
tag containing theroDelete
tag from theroDelete
message to theroCreate
tag in the running order.
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
RunningOrderControl¶
-
class
mosromgr.mostypes.
RunningOrderControl
[source]¶ Bases:
mosromgr.mostypes.MosFile
A
RunningOrderControl
object is created from aroCtrl
MOS file and can be constructed using classmethodsfrom_file()
,from_string()
orfrom_s3()
.Specification: Running Order Control http://mosprotocol.com/wp-content/MOS-Protocol-Documents/MOSProtocolVersion40/index.html#calibre_link-47
TODO: generalise this class #20
-
__gt__
(other)¶ Sort by
message_id
i.e.ss > ro
orsorted([ro, ss])
-
__lt__
(other)¶ Sort by
message_id
i.e.ro < ss
orsorted([ro, ss])
-
__str__
()¶ The XML string of the MOS file
-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
merge
(ro)[source]¶ Merge into the
RunningOrder
object provided.Replaces the story tag in the running order with the one in the
roStorySend
message
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
story
¶ The story to which this roCtrl message relates
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
Base classes¶
Since some logic is shared between MOS file management, some inheritance is used in the implementation:
MosFile¶
-
class
mosromgr.mostypes.
MosFile
[source]¶ Base class for all MOS files
-
classmethod
from_file
(mos_file_path)[source]¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_string
(mos_xml_string)[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
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
base_tag_name
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
classmethod
ElementAction¶
-
class
mosromgr.mostypes.
ElementAction
[source]¶ Base class for various
roElementAction
MOS files-
classmethod
from_file
(mos_file_path)¶ Construct from a path to a MOS file
- Parameters
mos_file_path (str) – The MOS file path
-
classmethod
from_s3
(bucket_name, mos_file_key)¶ Construct from a MOS file in an S3 bucket
-
classmethod
from_string
(mos_xml_string)¶ Construct from an XML string of a MOS document
- Parameters
mos_xml_string (str) – The XML string of the MOS document
-
property
base_tag
¶ The base tag (
xml.etree.ElementTree.Element
) within thexml
, as determined bybase_tag_name
-
property
xml
¶ The XML element of the MOS file (
xml.etree.ElementTree.Element
)
-
classmethod