Beispiel #1
0
def main_menu():
    """Populate the menu with the main menu items."""
    data_path = translatePath('special://userdata/addon_data/plugin.video.cbc')
    if not os.path.exists(data_path):
        os.makedirs(data_path)
    if not os.path.exists(getAuthorizationFile()):
        authorize()

    handle = plugin.handle
    xbmcplugin.setContent(handle, 'videos')
    for key, value in GEMS.items():
        xbmcplugin.addDirectoryItem(handle, plugin.url_for(layout_menu, key),
                                    xbmcgui.ListItem(value), True)
    xbmcplugin.addDirectoryItem(handle, plugin.url_for(live_channels_menu),
                                xbmcgui.ListItem(LIVE_CHANNELS), True)
    xbmcplugin.addDirectoryItem(handle, plugin.url_for(search),
                                xbmcgui.ListItem(SEARCH), True)
    xbmcplugin.endOfDirectory(handle)
Beispiel #2
0
from resources.lib.liveprograms import *
from resources.lib.shows import *
from resources.lib.cbc import *
from urllib import urlencode
import xbmc, xbmcplugin, xbmcgui, xbmcaddon, os, urlparse

getString = xbmcaddon.Addon().getLocalizedString

LIVE_CHANNELS = getString(30004)
LIVE_PROGRAMS = getString(30005)
SHOWS = getString(30006)

# handle logout before using argv[1] as the addon handle
if sys.argv[1] == 'logout':
    log('Logging out... {}'.format(sys.argv[1]), True)
    os.remove(getAuthorizationFile())
    sys.exit(0)

addon_handle = int(sys.argv[1])


def authorize():
    prog = xbmcgui.DialogProgress()
    prog.create(getString(30001))
    cbc = CBC()

    username = xbmcaddon.Addon().getSetting("username")
    if len(username) == 0:
        username = None

    password = xbmcaddon.Addon().getSetting("password")
Beispiel #3
0
def logout():
    """Remove authorization stuff."""
    log('Logging out...', True)
    os.remove(getAuthorizationFile())
    os.remove(get_cookie_file())