Exemple #1
0
                'label': station['name'],
                'label2': station['label'],
                'info': {'title': station['name'], 'size': int(station['bitrate'])},
                'path': plugin.url_for('startplay', id=station['url']),
                'icon': station['img'],
                'thumbnail': station['img'],
                'is_playable': False,
                'info_type': 'music',
            })
        except Exception, e:
            print e
            print station

    finish_kwargs = {'sort_methods': [('TITLE', '%X'), ('SIZE', '%X')]}

    return plugin.finish(items, **finish_kwargs)


@plugin.route('/live/<id>')
def startplay(id):
    station = filter(lambda x: x['url'] == id, postaje)[0]
    li = xbmcgui.ListItem(station['name'], station[
                          'name'], station['img'], station['img'])
    li.setInfo('music', {'Title': station['name']})
    xbmc.Player(xbmc.PLAYER_CORE_MPLAYER).play(station['url'], li)
    item = [{
        'label': station['name'],
        'label2': station['label'],
        'info': {'title': station['name'], 'size': int(station['bitrate'])},
        'path': plugin.url_for('startplay', id=station['url']),
        'icon': station['img'],
Exemple #2
0
                       'media/media_1000.m3u8'),
    },
)

plugin = Plugin()


@plugin.route('/')
def show_streams():
    items = [{
        'label': stream['title'],
        'thumbnail': get_logo(stream['logo']),
        'path': stream['stream_url'],
        'is_playable': True,
    } for stream in STATIC_STREAMS]
    return plugin.finish(items)


def get_logo(logo):
    addon_id = plugin._addon.getAddonInfo('id')
    return 'special://home/addons/%s/resources/media/%s' % (addon_id, logo)


def _(string_id):
    if string_id in STRINGS:
        return plugin.get_string(STRINGS[string_id])
    else:
        plugin.log.warning('String is missing: %s' % string_id)
        return string_id