def _init_existing_kodi_playlist(playqueue): """ Will take the playqueue's kodi_pl with MORE than 1 element and initiate playback (without adding trailers) """ LOG.debug('Kodi playlist size: %s', playqueue.kodi_pl.size()) for i, kodi_item in enumerate(js.playlist_get_items(playqueue.playlistid)): if i == 0: item = PL.init_Plex_playlist(playqueue, kodi_item=kodi_item) else: item = PL.add_item_to_PMS_playlist(playqueue, i, kodi_item=kodi_item) item.force_transcode = state.FORCE_TRANSCODE LOG.debug('Done building Plex playlist from Kodi playlist')
def _add_remaining_items_to_playlist(playqueue): """ Adds all but the very first item of the Kodi playlist to the Plex playqueue """ items = js.playlist_get_items(playqueue.playlistid) if not items: LOG.error('Could not retrieve Kodi playlist items') return # Remove first item items.pop(0) try: for i, item in enumerate(items): PL.add_item_to_PMS_playlist(playqueue, i + 1, kodi_item=item) except PL.PlaylistError: LOG.info('Could not build Plex playlist for: %s', items)
def run(self): stopped = self.stopped suspended = self.suspended LOG.info("----===## Starting PlayqueueMonitor ##===----") while not stopped(): while suspended(): if stopped(): break sleep(1000) with LOCK: for playqueue in PLAYQUEUES: kodi_pl = js.playlist_get_items(playqueue.playlistid) if playqueue.old_kodi_pl != kodi_pl: # compare old and new playqueue self._compare_playqueues(playqueue, kodi_pl) playqueue.old_kodi_pl = list(kodi_pl) sleep(200) LOG.info("----===## PlayqueueMonitor stopped ##===----")
def run(self): stopped = self.stopped suspended = self.suspended LOG.info("----===## Starting PlayqueueMonitor ##===----") while not stopped(): while suspended(): if stopped(): break sleep(1000) with LOCK: for playqueue in PLAYQUEUES: kodi_pl = js.playlist_get_items(playqueue.playlistid) if playqueue.old_kodi_pl != kodi_pl: if playqueue.id is None and (not state.DIRECT_PATHS or state.CONTEXT_MENU_PLAY): # Only initialize if directly fired up using direct # paths. Otherwise let default.py do its magic LOG.debug('Not yet initiating playback') else: # compare old and new playqueue self._compare_playqueues(playqueue, kodi_pl) playqueue.old_kodi_pl = list(kodi_pl) sleep(200) LOG.info("----===## PlayqueueMonitor stopped ##===----")