def generate_pairing_code(): monitor = Monitor() progress = DialogProgress() progress.create(get_string(32000), get_string(32001)) chromecast = YoutubeCastV1() pairing_code = chromecast.pair() i = 0 progress.update(i, get_string(32002), pairing_code) start_time = time.time() while not monitor.abortRequested() and not chromecast.has_client and not progress.iscanceled() and not (time.time() - start_time) > (60 * 1): i += 10 if i > 100: i = 0 progress.update(i, get_string(32002), pairing_code) monitor.waitForAbort(2) progress.close()
def remote_disconnected(name): utils.notification(message="{} {}!".format(name, utils.get_string(32007)))
# -*- coding: utf-8 -*- from resources.lib.kodi.utils import get_string, yes_no from resources.lib.tubecast.youtube.pairing import generate_pairing_code if __name__ == "__main__": dg = yes_no(get_string(32008), yeslabel=get_string(32009), nolabel=get_string(32010)) if dg: generate_pairing_code()