Example #1
0
 def parseBoards(self):
     p = json.dumps({
         'query': libbrgraphqlqueries.getCats(),
         'variables': {
             'nodes': self.boards
         }
     })
     j = requests.post(graphqlUrl, headers=headers, data=p).json()
     for node in j['data']['nodes']:
         d = {
             'type': 'dir',
             'params': {
                 'mode': 'libBrListBoard'
             },
             'metadata': {
                 'art': {}
             }
         }
         d['metadata']['name'] = node['title'].title()
         if 'shortDescription' in node and node[
                 'shortDescription'] is not None:
             d['metadata']['plotoutline'] = node['shortDescription']
             d['metadata']['plot'] = node['shortDescription']
         if 'description' in node and node['description'] is not None:
             d['metadata']['plot'] = node['description']
         d['params']['boardId'] = node['id']
         self.result['items'].append(d)
     return self.result
Example #2
0
def parseBoards():
    boards = [
        'Board:http://ard.de/ontologies/mangoLayout#entdecken-film-krimi',
        'Board:http://ard.de/ontologies/mangoLayout#entdecken-kabarett-comedy',
        'Board:http://ard.de/ontologies/mangoLayout#entdecken-doku-reportage',
        'Board:http://ard.de/ontologies/mangoLayout#entdecken-news-politik',
        'Board:http://ard.de/ontologies/mangoLayout#entdecken-natur-tiere',
        'Board:http://ard.de/ontologies/mangoLayout#entdecken-wissen',
        'Board:http://ard.de/ontologies/mangoLayout#entdecken-berge',
        'Board:http://ard.de/ontologies/mangoLayout#entdecken-kultur',
        'Board:http://ard.de/ontologies/mangoLayout#entdecken-heimat',
        'Board:http://ard.de/ontologies/mangoLayout#discover2',
        'Board:http://ard.de/ontologies/mangoLayout#discover1',
        'Board:http://ard.de/ontologies/mangoLayout#entdecken-kinder',
    ]

    variables = {'nodes': boards}
    p = json.dumps({
        'query': libbrgraphqlqueries.getCats(),
        'variables': variables
    })
    response = libMediathek.getUrl(graphqlUrl, header, post=p)
    libMediathek.log(response)
    j = json.loads(response)
    l = []
    for node in j['data']['nodes']:
        d = {}
        d['name'] = node['title'].title()
        if 'shortDescription' in node and node['shortDescription'] != None:
            d['_plotoutline'] = node['shortDescription']
            d['plot'] = node['shortDescription']
        if 'description' in node and node['description'] != None:
            d['plot'] = node['description']
        d['boardId'] = node['id']
        d['_type'] = 'dir'
        d['mode'] = 'libBrListBoard'
        l.append(d)
    return l