Esempio n. 1
0
def PlayVideo(id):
    import xbmcgui
    import sys
    import utils

    busy = utils.showBusy()

    video, links = GetVideoInformation(id)

    if busy:
        busy.close()

    if 'best' not in video:
        return False

    url = video['best']
    title = video['title']
    image = video['thumbnail']

    liz = xbmcgui.ListItem(title, iconImage=image, thumbnailImage=image)

    liz.setInfo(type="Video", infoLabels={"Title": title})

    if len(sys.argv) < 2 or int(sys.argv[1]) == -1:
        import xbmc
        pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        pl.clear()
        pl.add(url, liz)
        xbmc.Player().play(pl)
    else:
        import xbmcplugin
        liz.setPath(url)
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)

    return True
Esempio n. 2
0
def PlayVideo(id):
    import xbmcgui
    import sys
    import utils

    busy = utils.showBusy()

    video, links = GetVideoInformation(id)

    if busy:
        busy.close()

    if 'best' not in video:
        return False

    url   = video['best']          
    title = video['title']
    image = video['thumbnail']

    liz = xbmcgui.ListItem(title, iconImage=image, thumbnailImage=image)

    liz.setInfo( type="Video", infoLabels={ "Title": title} )

    if len(sys.argv) < 2 or int(sys.argv[1]) == -1:
        import xbmc
        pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        pl.clear()
        pl.add(url, liz)
        xbmc.Player().play(pl)
    else:
        import xbmcplugin
        liz.setPath(url)
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)

    return True
Esempio n. 3
0
def VPN(label, abrv, server):
    if not validToRun():
        utils.log('Login Error via Context Menu')
        return False

    authPath = os.path.join(PROFILE, 'temp')
    cfgPath  = os.path.join(PROFILE, 'cfg.ovpn')

    KillVPN(silent=True)

    WriteAuthentication(authPath)
    WriteConfiguration(server, cfgPath, authPath)

    busy = utils.showBusy()

    response = OpenVPN(cfgPath)

    if busy:
        busy.close()

    success = True

    if response:
        label = label.rsplit(' (', 1)[0]
        if IsEnabled(response):
            # if utils.platform() == "android":
            #     xbmc.sleep(10000)
            message = '%s %s now enabled' % (label, TITLE)
            utils.notify(message)         
            xbmcgui.Window(10000).setProperty('VPNICITY_LABEL',  label)
            xbmcgui.Window(10000).setProperty('VPNICITY_ABRV',   abrv)
            xbmcgui.Window(10000).setProperty('VPNICITY_SERVER', server)
            ipcheck.Network()

        else:
            KillVPN(silent=True)
            if utils.platform() == "android":
                xbmc.sleep(5000)
            message = '%s %s failed to start. Please check your settings.' % (label, TITLE)
            utils.notify(message)
            ipcheck.Network() 
            success = False

    #DeleteFile(authPath)
    #DeleteFile(cfgPath)
    #DeleteFile(RESPONSE)

    return success
Esempio n. 4
0
def VPN(label, abrv, server):
    authPath = os.path.join(PROFILE, 'temp')
    cfgPath = os.path.join(PROFILE, 'cfg.ovpn')

    KillVPN(silent=True)

    WriteAuthentication(authPath)
    WriteConfiguration(server, cfgPath, authPath)

    busy = utils.showBusy()

    response = OpenVPN(cfgPath)

    if busy:
        busy.close()

    success = True

    if response:
        label = label.rsplit(' (', 1)[0]
        if IsEnabled(response):
            if utils.platform() == "android":
                xbmc.sleep(10000)
            utils.dialogOK('%s %s now enabled' % (label, TITLE))
            xbmcgui.Window(10000).setProperty('VPNICITY_LABEL', label)
            xbmcgui.Window(10000).setProperty('VPNICITY_ABRV', abrv)
            xbmcgui.Window(10000).setProperty('VPNICITY_SERVER', server)
            ipcheck.Network()

        else:
            KillVPN(silent=True)
            if utils.platform() == "android":
                xbmc.sleep(5000)
            utils.dialogOK('%s %s failed to start' % (label, TITLE),
                           'Please check your settings', 'and try again')
            ipcheck.Network()
            success = False

    #DeleteFile(authPath)
    #DeleteFile(cfgPath)
    #DeleteFile(RESPONSE)

    return success
Esempio n. 5
0
def VPN(label, abrv, server):
    authPath = os.path.join(PROFILE, 'temp')
    cfgPath  = os.path.join(PROFILE, 'cfg.ovpn')

    KillVPN(silent=True)

    WriteAuthentication(authPath)
    WriteConfiguration(server, cfgPath, authPath)

    busy = utils.showBusy()

    response = OpenVPN(cfgPath)

    if busy:
        busy.close()

    success = True

    if response:
        label = label.rsplit(' (', 1)[0]
        if IsEnabled(response):
            # if utils.platform() == "android":
            #     xbmc.sleep(10000)
            utils.dialogOK('%s %s now enabled' % (label, TITLE))            
            xbmcgui.Window(10000).setProperty('VPNICITY_LABEL',  label)
            xbmcgui.Window(10000).setProperty('VPNICITY_ABRV',   abrv)
            xbmcgui.Window(10000).setProperty('VPNICITY_SERVER', server)
            ipcheck.Network()

        else:
            KillVPN(silent=True)
            if utils.platform() == "android":
                xbmc.sleep(5000)
            utils.dialogOK('%s %s failed to start' % (label, TITLE), 'Please check your settings', 'and try again')
            ipcheck.Network() 
            success = False

    #DeleteFile(authPath)
    #DeleteFile(cfgPath)
    #DeleteFile(RESPONSE)

    return success
Esempio n. 6
0
def VPN(label, abrv, server):
    authPath = os.path.join(PROFILE, 'temp')
    cfgPath  = os.path.join(PROFILE, 'cfg.opvn')

    KillVPN(silent=True)

    WriteAuthentication(authPath)
    WriteConfiguration(server, cfgPath, authPath)

    busy = utils.showBusy()

    response = OpenVPN(cfgPath)

    if busy:
        busy.close()

    if response:
        label = label.rsplit(' (', 1)[0]
        if IsEnabled(response):
            utils.dialogOK('%s %s now enabled' % (label, utils.TITLE))
            xbmcgui.Window(10000).setProperty('VPNICITY_RUNNING', 'True')
        else:
            KillVPN()
            utils.dialogOK('%s %s failed to start' % (label, utils.TITLE), 'Please check your settings', 'and try again')