def do(): try: threefive.decode(sys.argv[1]) except: # Handles piped in data try: threefive.decode() except: pass
def do(): if not sys.argv[1:]: threefive.decode() else: try: args = sys.argv[1:] for arg in args: print(f"Next is {arg}\n\n") threefive.decode(arg) except: pass
def clean_list(full_list, spliceCommandType, networkid): ''' This method eliminates all the triggers that are any type other than spliceCommandType and all the triggers that are not of networkid ''' type_list = [] for i in range(0, len(full_list)): item = full_list[i].split(":") if item[1] == networkid: cue = threefive.decode(item[3]).get() if cue["info_section"]["splice_command_type"] == spliceCommandType: type_list.append(full_list[i]) return type_list
""" Example from the specification 14.5. Time_Signal–Program_Overlap_Start """ from threefive import decode Hex = "0xFC302F000000000000FFFFF00506FEAEBFFF640019021743554549480000087F9F0808000000002CA56CF5170000951DB0A8" decode(Hex)
#!/usr/bin/env python3 import sys import threefive ''' example command line tool. pass in a file name or message string to decode example: python cli.py '/DBIAAAAAAAA///wBQb+ek2ItgAyAhdDVUVJSAAAGH+fCAgAAAAALMvDRBEAAAIXQ1VFSUgAABl/nwgIAAAAACyk26AQAACZcuND' or python cli.py /path/to/mpeg.ts ''' threefive.decode(sys.argv[1])
from threefive import decode """ Splice null command example """ decode("Splice_Null.cue")
""" Example from the specification 14.2. Splice_Insert """ import threefive Hex = "0xFC302F000000000000FFFFF014054800008F7FEFFE7369C02EFE0052CCF500000000000A0008435545490000013562DBA30A" Base64 = "/DAvAAAAAAAA///wFAVIAACPf+/+c2nALv4AUsz1AAAAAAAKAAhDVUVJAAABNWLbowo=" """ Using Hex """ htf = threefive.decode(Hex) htf.show() """ Using Base64 auto (output should be the same as above) """ btf = threefive.decode(Base64) btf.show() # Re-encode the info section btf.info_section.encode()
from threefive import decode """ Splice null command example """ hexed = "0xFC301100000000000000FFFFFF0000004F253396" decode(hexed)
""" SCTE35 DTMF Descriptor Example Usage: pypy3 Dtmf_Descriptor.py """ from threefive import decode dtmf = b"/DAsAAAAAAAAAP/wDwUAAABef0/+zPACTQAAAAAADAEKQ1VFSbGfMTIxIxGolm3/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////" decode(dtmf)
import threefive """ Another Splice Insert example """ hexed = "0xFC302100000000000000FFF01005000003DB7FEF7F7E0020F580C0000000000019913DA5" threefive.decode(hexed)
""" Example from the specification 14.3. Time_Signal–Placement_Opportunity_End """ from threefive import decode be_six_four = "/DAvAAAAAAAA///wBQb+dGKQoAAZAhdDVUVJSAAAjn+fCAgAAAAALKChijUCAKnMZ1g=" decode(be_six_four)
""" Example from the specification 14.3. Time_Signal–Placement_Opportunity_End """ from threefive import decode Base64 = "/DAvAAAAAAAA///wBQb+dGKQoAAZAhdDVUVJSAAAjn+fCAgAAAAALKChijUCAKnMZ1g=" decode(Base64)