def mode_podcasts():
    podcasts = requests.get('https://www.bbc.co.uk/podcasts.json')
    podcasts_json = podcasts.json()['podcasts']
    podcasts_ordered = sorted(podcasts_json, key=(lambda x: x['title']))
    for podcast in podcasts_ordered:
        url = build_url({'mode': 'podcast', 'pid': podcast['shortTitle']})
        li = xbmcgui.ListItem(podcast['title'])
        li.setInfo('video', {'plot': podcast['description']})
        if ('imageUrl' in podcast):
            li.setThumbnailImage(podcast['imageUrl'].replace('{recipe}', '624x624'))
        xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)
    xbmcplugin.endOfDirectory(addon_handle)
def mode_podcasts():
    podcasts = requests.get('https://www.bbc.co.uk/podcasts.json')
    podcasts_json = podcasts.json()['podcasts']
    podcasts_ordered = sorted(podcasts_json, key=(lambda x: x['title']))
    for podcast in podcasts_ordered:
        url = build_url({'mode': 'podcast', 'pid': podcast['shortTitle']})
        li = xbmcgui.ListItem(podcast['title'])
        li.setInfo('video', {'plot': podcast['description']})
        if ('imageUrl' in podcast):
            li.setThumbnailImage(podcast['imageUrl'].replace('{recipe}', '624x624'))
        xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True)
    xbmcplugin.endOfDirectory(addon_handle)