def setUp(self): library_cache = LibraryCache() self.kodi = KodiInterface(library_cache) self.kodi.update_cache() wait_for_library_index(self.kodi) self.player = CustomPlayer() self.player.set_kodi(self.kodi) self.handler = Handler(self.kodi)
def setUp(self): library_cache = LibraryCache() self.kodi = KodiInterface(library_cache) self.kodi.update_cache() wait_for_library_index(self.kodi) self.player = CustomPlayer() self.player.set_kodi(self.kodi) self.handler = Handler(self.kodi) self.kodi.find_and_play({ 'titles': ['Maze Runner'], })
def main(): """Main function""" logger.debug('Starting') logger.debug(u'pid={}'.format(os.getpid())) try: __once__ = OnlyOnce() logger.debug(str(__once__)) except OnlyOnceException: logger.debug('Tunnel already running, exiting') sys.exit(0) io_loop = IOLoop(make_current=False) library_cache = LibraryCache() kodi = KodiInterface(library_cache) handler = Handler(kodi) monitor = CustomMonitor(kodi) player = CustomPlayer() player.set_io_loop(io_loop) player.set_kodi(kodi) tunnel = Tunnel(io_loop, KODI_CONNECT_URL, kodi, handler) tunnel_thread = TunnelThread(tunnel) tunnel_thread.start() async_tunnel = tunnel.get_async_tunnel() player.set_async_tunnel(async_tunnel) try: while not monitor.abortRequested(): # Sleep/wait for abort for 3 seconds if monitor.waitForAbort(3): # Abort was requested while waiting. We should exit break except KeyboardInterrupt: logger.debug('Interrupted') logger.debug('Stopping __once__') __once__.stop() logger.debug('Stopping Tunnel') tunnel_thread.stop() logger.debug('Joining Tunnel Thread') tunnel_thread.join() logger.debug('Clearing main IOLoop') IOLoop.clear_current() logger.debug('Stopping concurrent ThreadPool') concurrent.futures.thread._python_exit() # pylint: disable=protected-access logger.debug('Exit')
def setUp(self): library_cache = LibraryCache() self.kodi = KodiInterface(library_cache) self.handler = Handler(self.kodi) self.handler.handler({ "type": "command", "commandType": "setVolume", "volume": 50, }) run_one() self.handler.handler({ "type": "command", "commandType": "setMute", "volume": False, }) run_one()
def main(): """Main function""" logger.debug('Starting') logger.debug('pid={}'.format(os.getpid())) try: __once__ = OnlyOnce() logger.debug(str(__once__)) except OnlyOnceException: logger.debug('Tunnel already running, exiting') sys.exit(0) library_cache = LibraryCache() kodi = KodiInterface(library_cache) handler = Handler(kodi) monitor = CustomMonitor(kodi) player = CustomPlayer() player.set_kodi(kodi) client = Client(KODI_CONNECT_URL, kodi, handler) client_thread = ClientThread(client) client_thread.start() try: while not monitor.abortRequested(): # Sleep/wait for abort for 3 seconds if monitor.waitForAbort(3): # Abort was requested while waiting. We should exit break except KeyboardInterrupt: logger.debug('Interrupted') logger.debug('Stopping Tunnel') client_thread.stop() logger.debug('Joining Tunnel Thread') client_thread.join() logger.debug('Exit')
def setUp(self): library_cache = LibraryCache() self.kodi = KodiInterface(library_cache) self.handler = Handler(self.kodi)
def get_library_cache_and_index(): library_cache = LibraryCache() kodi = KodiInterface(library_cache) kodi.update_cache() wait_for_library_index(kodi) return library_cache, kodi.library_index