コード例 #1
0
tid2 = "/DAzAAAAAAAA///wBQb+AAAAAAAdAhtDVUVJAAAAA3+/BwxNVjAwMDQxNDY0MDARAAB2a6fC"
airid = "/DBhAAAAAAAA///wBQb+qM1E7QBLAhdDVUVJSAAArX+fCAgAAAAALLLXnTUCAAIXQ1VFSUgAACZ/nwgIAAAAACyy150RAAACF0NVRUlIAAAnf58ICAAAAAAsstezEAAAihiGnw=="
adi = "/DBEAAAAAAAA///wBQb+AFJlwAAuAixDVUVJYgAFin+/CR1TSUdOQUw6My1zUTROZ0ZUME9qUHNHNFdxVVFvdzUAAEukzlg="
eidr = (
    "/DA4AAAAAAAA///wBQb+AAAAAAAiAiBDVUVJAAAAA3//AAApPWwKDBR4+FrhALBoW4+xyBAAAGij1lQ="
)
atsc = (
    "/DA4AAAAAAAA///wBQb+AAAAAAAiAiBDVUVJAAAAA3//AAApPWwLDADx7/9odW1hbjAxMhAAALdaWG4="
)
airid_mpu = "/DCSAAAAAAAAAP/wBQb/RgeVUgB8AhdDVUVJbs6+VX+/CAgAAAAABy0IxzELGQIXQ1VFSW7MmIh/vwgIAAABGDayFhE3AQECHENVRUluzw0If/8AABvLoAgIAAAAAActVhIwDBkCKkNVRUluzw02f78MG1JUTE4xSAEAAAAAMTM3NjkyMDI1NDQ5NUgxAAEAAGnbuXg="
mid = "/DA9AAAAAAAAAACABQb+0fha8wAnAiVDVUVJSAAAv3/PAAD4+mMNEQ4FTEEzMDkICAAAAAAuU4SBNAAAPIaCPw=="
ads2 = "/DBUAAAAAAAA///wBQb+AAAAAAA+AjxDVUVJAAAAC3+/Di1BRFMtVVBJRDphYTg1YmJiNi01YzQzLTRiNmEtYmViYi1lZTNiMTNlYjc5OTkRAACV15uV"
uri = "/DBZAAAAAAAA///wBQb+AAAAAABDAkFDVUVJAAAACn//AAApMuAPLXVybjp1dWlkOmFhODViYmI2LTVjNDMtNGI2YS1iZWJiLWVlM2IxM2ViNzk5ORAAAFz7UQA="

dmesg = [adid, umid, isan, tid2, airid, adi, eidr, atsc, airid_mpu, mid, ads2, uri]

ids = []


def stuff(t, upid):
    if t not in ids:
        ids.append(t)
        print(f"\033[92m{hex(t)}\033[0m : {upid}")


for m in dmesg:
    tf = threefive.Cue(m)
    tf.decode()
    tf.encode()
    [stuff(d.segmentation_upid_type, d.segmentation_upid) for d in tf.descriptors]
コード例 #2
0
            break
        if l.startswith("#EXT-X-CUE-OUT:"):
            cue_out = hls_time
            duration = float(l.split(":")[1])
            cue_in = hls_time + duration
            print(f"hls time: {hls_time}")
            print(f"cue out: {cue_out}")
            print(f"duration: {duration}")
            print(f"cue in: {cue_in}")
        ##EXTINF:4.000000,
        if l.startswith("#EXTINF:"):
            t = l.split(":")[1].split(",")[0]
            t = float(t)
            hls_time += t
            next_segment = manifest.readline()[:-1]
            print(f"Segment:  {next_segment} @ {hls_time}")
        if l.startswith("#EXT-X-SCTE35"):
            mesg = l.split("CUE=")[1]
            do(mesg)
        if l.startswith("#EXT-OATCLS-SCTE35:"):
            mesg = l.split("#EXT-OATCLS-SCTE35:")[1]
            do(mesg)
        ##EXT-X-DATERANGE:ID="splice-6FFFFFF0",START-DATE="2014-03-05T11:15:00Z",PLANNED-DURATION=59.993,SCTE35-OUT=0xFC002F0000000000FF000014056FFFFFF000E011622DCAFF000052636200000000000A000829896F50000008700000000
        if l.startswith("#EXT-X-DATERANGE:"):
            for chunk in line.split(","):
                k, v = chunk.split("=")
                if k.startswith("SCTE35"):
                    cue = threefive.Cue(v)
                    cue.decode()
                    cue.show()
コード例 #3
0
def do(mesg):
    print(f"cue: {mesg}")
    tf = threefive.Cue(mesg)
    tf.decode()
    tf.show()
コード例 #4
0
ファイル: Upid_Combo.py プロジェクト: vladdoster/threefive
import threefive
"""
Combination Segmentation Upid Example

    "segmentation_upid": "MID:['ADS Info:LA309', 'AiringID:0x2e538481']"

"""

combo = "/DA9AAAAAAAAAACABQb+0fha8wAnAiVDVUVJSAAAv3/PAAD4+mMNEQ4FTEEzMDkICAAAAAAuU4SBNAAAPIaCPw=="

cuep = threefive.Cue(combo)
cuep.decode()
cuep.show()
コード例 #5
0
body_log = open(LOG_FILE, "r").read().strip().splitlines()

triggers = []
for item in body_log:
    if item[0].isnumeric():
        splitted = item.split(":")
        if len(splitted) == 3:
            newInputTrigger = str(
                splitted[0]) + " " + "IN:" + splitted[1].split(
                    '_POISID_')[0] + ":" + splitted[1].split(
                        '_POISID_')[1] + ":" + splitted[2] + ":PTS-"
            newOutputTrigger = str(
                splitted[0]) + " " + "OUT:" + splitted[1].split(
                    '_POISID_')[0] + ":" + splitted[1].split(
                        '_POISID_')[1] + ":" + splitted[2] + ":PADDED"
            triggers.append(newInputTrigger)
            triggers.append(newOutputTrigger)
        else:
            triggers.append(item)

# pair all the triggers if applicable [ { timestamp, input_trigger, output_trigger }, ... ]
pairs = pair_up(triggers)

print(pairs)
# for trigger in triggers:
#     open("./logs/MTV-triggers.log", "a").write(str(trigger) + "\n")

stcebase64 = "/DA1AAAAAAAAAP/wFAUAAAABf+/+i/UBJX4AUkKY//8AAAAOAQxDVUVJUN8xMjMqMTEAAJHgAZA="

threefive.Cue(stcebase64).show()
コード例 #6
0
ファイル: Multi_Upid.py プロジェクト: vladdoster/threefive
import threefive
"""

Multiple Segmentation Upid Descriptors Example

Three AiringID and One MPU

"""

airid_mpu = "/DCSAAAAAAAAAP/wBQb/RgeVUgB8AhdDVUVJbs6+VX+/CAgAAAAABy0IxzELGQIXQ1VFSW7MmIh/vwgIAAABGDayFhE3AQECHENVRUluzw0If/8AABvLoAgIAAAAAActVhIwDBkCKkNVRUluzw02f78MG1JUTE4xSAEAAAAAMTM3NjkyMDI1NDQ5NUgxAAEAAGnbuXg="

cuep = threefive.Cue(airid_mpu)
cuep.decode()
cuep.show()
コード例 #7
0
Custom MPU Parser Example

Create a function that takes a bytearray containing the MPU bytes and its length.
The return value is how the MPU will be represented in the JSON output.

Each custom MPU parser function needs to be registered in the format_identifier_map.
The function will be called if the format_identifier matches the received MPU.

"""

SBSB_mpu = "FC305700000000000000FFF00506FE1E3E6FBE0041023F43554549000000007FBF0C3053425342360C014C12C933BA0000006EFF1000000000007A71507777734567327335000000000000000000000000000001000065F06E76"


def parse_private_upid_SBSB(bites, upid_length):
    bitbin = BitBin(bites)
    return {
        "private_cni": hex(bitbin.asint(16)),
        "private_version": bitbin.asint(8),
        "private_transmission_id": struct.unpack("<Q", bitbin.asbites(64))[0],
        "private_product_code": struct.unpack("<Q", bitbin.asbites(64))[0],
        "private_web_publication_key": bitbin.astext(25 * 8),
    }


# format_identifier, name, function
mpu_format_identifier_map[0x53425342] = ["SBSB", parse_private_upid_SBSB]

cuep = threefive.Cue(SBSB_mpu)
cuep.decode()
cuep.show()
"""
Example from the specification 

14.1. Time_Signal–Placement_Opportunity_Start
"""

import threefive

Base64 = "/DA0AAAAAAAA///wBQb+cr0AUAAeAhxDVUVJSAAAjn/PAAGlmbAICAAAAAAsoKGKNAIAmsnRfg=="

tf = threefive.Cue(Base64)
tf.decode()
tf.show()