A wrapper class for C++ SectionFile. More...
Public Member Functions | |
def | __init__ (self, duck) |
Constructor. More... | |
def | binarySize (self) |
Get the size in bytes of all sections. More... | |
def | clear (self) |
Clear the content of the SectionFile, erase all sections. More... | |
def | delete (self) |
Explicitly free the underlying C++ object. More... | |
def | fromBinary (self, data) |
Load a binary section file from a memory buffer. More... | |
def | loadBinary (self, file) |
Load a binary section file. More... | |
def | loadXML (self, file) |
Load an XML file. More... | |
def | reorganizeEITs (self, year=0, month=0, day=0) |
Reorganize all EIT sections according to ETSI TS 101 211. More... | |
def | saveBinary (self, file) |
Save a binary section file. More... | |
def | saveJSON (self, file) |
Save a JSON file after automated XML-to-JSON conversion. More... | |
def | saveXML (self, file) |
Save an XML file. More... | |
def | sectionsCount (self) |
Get the total number of sections in the file. More... | |
def | setCRCValidation (self, mode) |
Set the CRC32 processing mode when loading binary sections. More... | |
def | tablesCount (self) |
Get the total number of full tables in the file. More... | |
def | toBinary (self) |
Get the binary content of a section file. More... | |
def | toJSON (self) |
Serialize as JSON text. More... | |
def | toXML (self) |
Serialize as XML text. More... | |
Static Public Attributes | |
int | CRC32_CHECK = 1 |
Check that the value of the CRC32 of the section is correct and fail if it isn't. | |
int | CRC32_COMPUTE = 2 |
Recompute a fresh new CRC32 value based on the content of the section. | |
int | CRC32_IGNORE = 0 |
Ignore the section CRC32 when loading a binary section. More... | |
A wrapper class for C++ SectionFile.
def tsduck.SectionFile.__init__ | ( | self, | |
duck | |||
) |
Constructor.
duck | The tsduck.DuckContext object to use. |
def tsduck.SectionFile.delete | ( | self | ) |
Explicitly free the underlying C++ object.
After this call, the object becomes unusable. Most usages are unpredictable but most likely will do nothing.
Reimplemented from tsduck.NativeObject.
def tsduck.SectionFile.clear | ( | self | ) |
Clear the content of the SectionFile, erase all sections.
def tsduck.SectionFile.binarySize | ( | self | ) |
Get the size in bytes of all sections.
This would be the size of the corresponding binary file.
def tsduck.SectionFile.sectionsCount | ( | self | ) |
Get the total number of sections in the file.
def tsduck.SectionFile.tablesCount | ( | self | ) |
Get the total number of full tables in the file.
Orphan sections are not included.
def tsduck.SectionFile.setCRCValidation | ( | self, | |
mode | |||
) |
Set the CRC32 processing mode when loading binary sections.
mode | For binary files, how to process the CRC32 of the input sections. Must be one of the CRC32_* values. |
def tsduck.SectionFile.fromBinary | ( | self, | |
data | |||
) |
Load a binary section file from a memory buffer.
The loaded sections are added to the content of this object.
data | A bytearray containing the binary data to load. |
def tsduck.SectionFile.toBinary | ( | self | ) |
Get the binary content of a section file.
def tsduck.SectionFile.loadBinary | ( | self, | |
file | |||
) |
Load a binary section file.
The loaded sections are added to the content of this object.
file | Binary file name. If the file name is empty or "-", the standard input is used. |
def tsduck.SectionFile.saveBinary | ( | self, | |
file | |||
) |
Save a binary section file.
[in] | file | Binary file name. If the file name is empty or "-", the standard output is used. |
def tsduck.SectionFile.loadXML | ( | self, | |
file | |||
) |
Load an XML file.
The loaded tables are added to the content of this object.
file | XML file name. If the file name starts with "<?xml", this is considered as "inline XML content". If the file name is empty or "-", the standard input is used. |
def tsduck.SectionFile.saveXML | ( | self, | |
file | |||
) |
Save an XML file.
[in] | file | XML file name. If the file name is empty or "-", the standard output is used. |
def tsduck.SectionFile.saveJSON | ( | self, | |
file | |||
) |
Save a JSON file after automated XML-to-JSON conversion.
[in] | file | JSON file name. If the file name is empty or "-", the standard output is used. |
def tsduck.SectionFile.toXML | ( | self | ) |
Serialize as XML text.
def tsduck.SectionFile.toJSON | ( | self | ) |
Serialize as JSON text.
def tsduck.SectionFile.reorganizeEITs | ( | self, | |
year = 0 , |
|||
month = 0 , |
|||
day = 0 |
|||
) |
Reorganize all EIT sections according to ETSI TS 101 211.
Only one EITp/f subtable is kept per service. It is split in two sections if two events (present and following) are specified. All EIT schedule are kept. But they are completely reorganized. All events are extracted and spread over new EIT sections according to ETSI TS 101 211 rules.
The "last midnight" according to which EIT segments are assigned is derived from parameters year, month and day. If any of them is out or range, the start time of the oldest event in the section file is used as "reference date".
year | Year of the reference time for EIT schedule. This is the "last midnight" according to which EIT segments are assigned. |
month | Month (1..12) of the reference time for EIT schedule. |
day | Day (1..31) of the reference time for EIT schedule. |
|
static |
Ignore the section CRC32 when loading a binary section.
This is the default.