def get_episode_by_show(show_id): query = { 'url': "Shows/%s/Episodes" % show_id, 'params': { 'EnableUserData': True, 'EnableImages': True, 'UserId': "{UserId}", 'Fields': api.info() } } for items in _get_items(query): yield items
def run(self): with requests.Session() as s: while True: try: item_ids = self.queue.get(timeout=1) except Queue.Empty: self.is_done = True LOG.info("--<[ q:download/%s ]", id(self)) return request = { 'type': "GET", 'handler': "Users/{UserId}/Items", 'params': { 'Ids': ','.join(str(x) for x in item_ids), 'Fields': api.info() } } try: result = self.server.http.request(request, s) for item in result['Items']: if item['Type'] in self.output: self.output[item['Type']].put(item) except HTTPException as error: LOG.error("--[ http status: %s ]", error.status) if error.status == 'ServerUnreachable': self.is_done = True break except Exception as error: LOG.exception(error) self.queue.task_done() if window('jellyfin_should_stop.bool'): break
def get_items(parent_id, item_type=None, basic=False, params=None): query = { 'url': "Users/{UserId}/Items", 'params': { 'ParentId': parent_id, 'IncludeItemTypes': item_type, 'SortBy': "SortName", 'SortOrder': "Ascending", 'Fields': api.basic_info() if basic else api.info(), 'CollapseBoxSetItems': False, 'IsVirtualUnaired': False, 'EnableTotalRecordCount': False, 'LocationTypes': "FileSystem,Remote,Offline", 'IsMissing': False, 'Recursive': True } } if params: query['params'].update(params) for items in _get_items(query): yield items