def loadEpisodes(self): epListCmd = { "jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"tvshowid": self.tvshowid}, "id": "epList" } epsResult = executeLogCommand(epListCmd) current_eps = epsResult["result"]["episodes"] self._playlist = [('episodeid', ep["episodeid"]) for ep in current_eps] if self.shuffle: shuffle(self._playlist)
def tvshowid(self): if not self._tvshowid: # TODO: write tvshowid on save as well loaded_id = self.data.get('tvshowid', None) if loaded_id is not None: self._tvshowid = loaded_id elif not self.label: # TODO: add error handling here once it exists return else: showsResult = executeLogCommand(GET_ALL_SHOWS_COMMAND) shows = showsResult["result"]["tvshows"] current_show = next(show for show in shows if show["label"] == self.label) self._tvshowid = current_show['tvshowid'] return self._tvshowid