コード例 #1
0
    'my_stations': 30108,
    'search_for_station': 30200,
    'enter_name_country_or_language': 30201,
    'add_to_my_stations': 30400,
    'remove_from_my_stations': 30401,
    'edit_custom_station': 30402,
    'mark_autostart': 30403,
    'unmark_autostart': 30404,
    'please_enter': 30500,
    'name': 30501,
    'thumbnail': 30502,
    'stream_url': 30503,
    'add_custom': 30504
}
plugin = Plugin()
radio_api = RadioApi()
my_stations = plugin.get_storage('my_stations.json', file_format='json')


@plugin.route('/')
def show_root_menu():
    items = (
        {'label': _('local_stations'),
         'path': plugin.url_for('show_local_stations')},
        {'label': _('editorials_recommendations'),
         'path': plugin.url_for('show_recommendation_stations')},
        {'label': _('top_100_stations'),
         'path': plugin.url_for('show_top_stations')},
        {'label': _('browse_by_genre'),
         'path': plugin.url_for('show_station_categories',
                                category_type='genre')},
コード例 #2
0
    "my_stations": 30108,
    "search_for_station": 30200,
    "enter_name_country_or_language": 30201,
    "add_to_my_stations": 30400,
    "remove_from_my_stations": 30401,
    "edit_custom_station": 30402,
    "please_enter": 30500,
    "name": 30501,
    "thumbnail": 30502,
    "stream_url": 30503,
    "add_custom": 30504,
}


plugin = Plugin(addon_id="plugin.audio.radio_de")
radio_api = RadioApi()
my_stations = plugin.get_storage("my_stations.json", file_format="json")


@plugin.route("/")
def show_root_menu():
    items = (
        {"label": _("local_stations"), "path": plugin.url_for("show_local_stations")},
        {"label": _("editorials_recommendations"), "path": plugin.url_for("show_recommendation_stations")},
        {"label": _("top_100_stations"), "path": plugin.url_for("show_top_stations")},
        {"label": _("browse_by_genre"), "path": plugin.url_for("show_station_categories", category_type="genre")},
        {"label": _("browse_by_topic"), "path": plugin.url_for("show_station_categories", category_type="topic")},
        {"label": _("browse_by_country"), "path": plugin.url_for("show_station_categories", category_type="country")},
        {"label": _("browse_by_city"), "path": plugin.url_for("show_station_categories", category_type="city")},
        {"label": _("browse_by_language"), "path": plugin.url_for("show_station_categories", category_type="language")},
        {"label": _("search_for_station"), "path": plugin.url_for("search")},
コード例 #3
0
    'name': 30501,
    'thumbnail': 30502,
    'stream_url': 30503,
    'add_custom': 30504,
    'most_popular': 30603,
    'az': 30604,
    'next_page': 30605,
    'by_country': 30606
}

SORT_TYPES = {'popular': 'RANK', 'az': 'STATION_NAME'}

STATIONS_PER_PAGE = 50

plugin = Plugin()
radio_api = RadioApi()
my_stations = plugin.get_storage('my_stations.json', file_format='json')


@plugin.route('/')
def show_root_menu():
    items = (
        {
            'label': _('local_stations'),
            'icon': plugin.icon,
            'fanart': __get_plugin_fanart(),
            'path': plugin.url_for('show_local_stations', page=1),
            'offscreen': True
        },
        {
            'label': _('editorials_recommendations'),
コード例 #4
0
ファイル: addon.py プロジェクト: stombi/plugin.audio.radio_de
        else:
            plugin.open_settings()
        plugin.set_setting('not_first_run', '1')
    lang_id = plugin.get_setting('language') or 0
    return ('english', 'german', 'french')[int(lang_id)]


def __log(text):
    xbmc.log('%s plugin: %s' % (__addon_name__, repr(text)))


def __log_api(text):
    xbmc.log('%s api: %s' % (__addon_name__, repr(text)))


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

if __name__ == '__main__':
    language = __get_language()
    radio_api = RadioApi(language=language, user_agent='XBMC Addon Radio')
    radio_api.log = __log_api
    try:
        plugin.run()
    except RadioApiError:
        plugin.notify(title=__addon_name__, msg=_('network_error'))