def get_main_menu():

    listing = [
        MenuItem(title="Fetch external IP", action='ip'),
        MenuItem(title="List available endpoints", action='list'),
        MenuItem(title="Show current status", action='status'),
        MenuItem(title="Terminate active connections", action='stop')
    ]

    return listing
def get_endpoints():

    listing = []

    endpoints = utils.command(['vpn', 'list'], silent=True).split("\n")

    for endpoint in endpoints:

        nb, title = endpoint.split(": ", 2)
        listing.append(MenuItem(title=title, nb=nb, action='start'))

    return listing
Exemplo n.º 3
0
def get_categories():
    # Implement first level here, ex:
    # data = json.loads(fetch_url(config.CATEGORIES_URL))

    listing = []

    for category in range(1, 9):

        menu_item = MenuItem()
        menu_item.title = 'Random videos %d' % category
        menu_item.description = 'Description for %s' % menu_item.title
        menu_item.icon = 'https://picsum.photos/300/200?r=%d' % random.randint(
            0, 10000)
        menu_item.thumb = menu_item.icon

        listing.append(menu_item)

    return listing
Exemplo n.º 4
0
def get_videos(params):

    # Use this if you need to create pages
    page = int(params.get('page', 0))
    start = page * config.PAGE_SIZE
    end = start + config.PAGE_SIZE

    # Implement second level here, ex:
    # data = json.loads(fetch_url(config.VIDEOS_URL.format(params['category'])))

    listing = []

    for video in config.PUBLIC_TEST_VIDEOS[start:end]:

        menu_item = MenuItem(playable=True)
        menu_item.title = video['title']
        menu_item.url = video['source']
        menu_item.description = video['description']
        menu_item.thumb = video['thumb']
        menu_item.icon = video['thumb']

        listing.append(menu_item)

    return listing
Exemplo n.º 5
0
                 Ingredient(name=u"Mjölk, laktosfri",
                            quantity=1 * units.liter),
                 Ingredient(name=u"Filmjölk, laktosfri",
                            quantity=1 * units.liter),
                 Ingredient(name=u"Yoghurt, laktosfri",
                            quantity=1 * units.liter),
             ],
             u"mjölkfri": [
                 Ingredient(name=u"Sojamjölk", quantity=1 * units.liter),
             ],
         }),
])

menu = [
    MenuItem(dish=dishes[u"Fänkål och kycklingsallad"],
             day=u"måndag",
             variants={"veg": vegetarians}),
    MenuItem(dish=dishes[u"Pasta & köttfärssås"],
             day=u"måndag",
             variants={"veg": vegetarians}),
    MenuItem(dish=dishes[u"Korv stroganoff"],
             day=u"tisdag",
             variants={"veg": vegetarians}),
    MenuItem(dish=dishes[u"Blomkålssoppa"], day=u"tisdag"),
    MenuItem(dish=dishes[u"2 x Indisk curry"], day=u"onsdag", variants={}),
    MenuItem(dish=dishes[u"Porterstek"],
             day=u"onsdag",
             variants={"veg": vegetarians}),
    MenuItem(dish=dishes[u"Kassler med potatissallad"],
             day=u"torsdag",
             variants={"veg": vegetarians}),
Exemplo n.º 6
0
def make_menu(objects, next='', sort=False):
    try:
        listing = []

        for item in objects:

            li = xbmcgui.ListItem(label=item.get('title'),
                                  iconImage=item.get('icon'),
                                  thumbnailImage=item.get('thumb'))
            url = '{0}?action={1}&{2}'.format(_url, next, item.to_kodi_url())

            if item.playable:
                li.setProperty('IsPlayable', 'true')

            if item.has('description'):
                li.setInfo('video', {
                    'plot': item.description,
                    'plotoutline': item.description
                })

            if item.has('duration'):
                li.setInfo('video', {'duration': item.duration})

            if item.has('date'):
                li.setInfo('video', {'date': item.date, 'aired': item.date})

            if item.has('mpaa'):
                li.setInfo('video', {'mpaa': item.mpaa})

            if item.has('season'):
                li.setInfo('video', {'season': item.season})

            if item.has('episode'):
                li.setInfo('video', {'episode': item.episode})

            if item.has('genre'):
                li.setInfo('video', {'genre': item.genre})

            if item.has('fanart'):
                li.setArt({'fanart': item.fanart})

            if item.has('banner'):
                li.setArt({'banner': item.banner})

            listing.append((url, li, not item.playable))

        if len(objects) == config.PAGE_SIZE:
            pager = MenuItem()
            pager.from_kodi_url(sys.argv[2])
            pager.page = int(pager.page) + 1 if hasattr(pager, 'page') else 1

            url = '{0}?action={1}&{2}'.format(_url, next, pager.to_kodi_url())
            li = xbmcgui.ListItem('Next page')
            listing.append((url, li, True))

        if len(objects) and objects[0].has('content'):
            xmbcplugin.setContent(_handle, objects[0].content)

        if sort:
            xbmcplugin.addSortMethod(_handle,
                                     xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)

        xbmcplugin.addDirectoryItems(_handle, listing, len(listing))
        xbmcplugin.endOfDirectory(_handle)

    except Exception:
        utils.handle_error("Unable to make menu")
Exemplo n.º 7
0
                    Ingredient(name=u"Yoghurt, laktosfri", quantity=1*units.liter),
                              ],
                u"mjölkfri": [
                    Ingredient(name=u"Sojamjölk", quantity=1*units.liter),
                              ],                    
                }),
])

# laktosfri
# mjölkfri
# glutenfri
# veg
# vegan

menu = [
    MenuItem(dish=dishes[u"Fänkål och kycklingsallad"], day=u"måndag"),
    MenuItem(dish=dishes[u"Pasta & köttfärssås"],       day=u"måndag"),
    MenuItem(dish=dishes[u"Korv stroganoff"],           day=u"tisdag"),
#    MenuItem(dish=dishes[u"Lax"], day=u"tisdag"),
    MenuItem(dish=dishes[u"Fisksoppa"],                 day=u"tisdag",  variants={"laktosfri": 1, "vegetarian": 3}),
    MenuItem(dish=dishes[u"2 x Indisk curry"],          day=u"onsdag",  variants={"laktosfri": 1, "vegetarian": 3}),
    MenuItem(dish=dishes[u"Porterstek"],                day=u"onsdag",  variants={"laktosfri": 1, "vegetarian": 3}),
    MenuItem(dish=dishes[u"Kassler med potatissallad"], day=u"torsdag", variants={"laktosfri": 1, "vegetarian": 3}),
    MenuItem(dish=dishes[u"Kycklinggryta med fetaost"], day=u"torsdag", variants={"laktosfri": 1, "vegetarian": 3}),
    MenuItem(dish=dishes[u"Sill och potatis"],          day=u"fredag",  variants={"laktosfri": 1, "vegetarian": 3}),
    MenuItem(dish=dishes[u"Brunch"],                    day=u"lördag",  variants={"laktosfri": 1, "vegetarian": 3}),
    MenuItem(dish=dishes[u"Gulasch"],                   day=u"lördag",  variants={"laktosfri": 1, "vegetarian": 3}),
    MenuItem(dish=dishes[u"Pytt-i-panna"],              day=u"söndag",  variants={"laktosfri": 1, "vegetarian": 3}),    
    MenuItem(dish=dishes[u"Frukost/fika"],              day=None,       variants={"laktosfri": 1, u"mjölkfri": 0, "glutenfri": 1}),
    MenuItem(dish=dishes[u"Extras"],                    day=None),
    MenuItem(dish=dishes[u"Chili"],                     day=None,       variants={"laktosfri": 1, "vegetarian": 3 }),
Exemplo n.º 8
0
]

# start from 0
# this way, it also acts as the index into
# the global menu_item array
id = 0
for info in menu_items:
	# if item is sized
	if info[-1]:
		for size in ['Small', 'Medium', 'Large', 'Giant']:
			item = MenuItem(
				id = id,
				name = info[0],
				text = info[1],
				img = info[2],
				price = info[3],
				options = info[4],
				category = info[5],
				cook_time = info[6],
				size = size
			)

			db.session.add(item)
			id += 1
	else:
		item = MenuItem(
			id = id,
			name = info[0],
			text = info[1],
			img = info[2],
			price = info[3],