Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)

        def save_new_key(new_key, destination_path):
    key_filename = os.path.join(destination_path, os.path.basename(new_key.uri))
    iv_filename = os.path.join(destination_path, os.path.basename(new_key.iv.uri))

    if not os.path.exists(key_filename):
        with open(key_filename, 'wb') as f:
            f.write(new_key.key_value)

        with open(iv_filename, 'wb') as f:
            f.write(new_key.iv.iv)

    else:
        # change modification time so the file is not removed by hlsclient.cleaner.clean
        os.utime(key_filename, None)
        os.utime(iv_filename, None)
        


src/h/l/hlsclient-0.5.3/hlsclient/consumer.py   hlsclient(Download)
    playlist.basepath = build_intermediate_path(m3u8_uri)
    if new_key:
        crypto.save_new_key(new_key, full_path)
        playlist.version = "2"
        playlist.key = new_key