Beispiel #1
0
def play(url, name, pdialogue=None):
    from resources.modules import resolvers
    import xbmcgui

    url = url.strip()

    url = resolvers.resolve(url)
    if url == 'False':
        xbmcgui.Dialog().notification('A', 'This Link is Down, Try Another')
    if url.endswith('m3u8'):
        from resources.root import iptv
        iptv.listm3u(url)
    else:

        liz = xbmcgui.ListItem(name,
                               iconImage=iconimage,
                               thumbnailImage=iconimage)
        liz.setInfo(type='Video', infoLabels={'Title': name})
        liz.setProperty("IsPlayable", "true")
        liz.setPath(url)

        if url.lower().startswith('plugin') and 'youtube' not in url.lower():
            xbmc.executebuiltin('XBMC.PlayMedia(' + url + ')')
            for i in range(8):
                xbmc.sleep(500)  ##sleep for 10 seconds, half each time
                try:
                    #print 'condi'
                    if xbmc.getCondVisibility(
                            "Player.HasMedia") and xbmc.Player().isPlaying():
                        return True
                except:
                    pass
            print 'returning now'
            return False
        elif url.endswith('.ts'):
            playf4m(url, name)
            from resources.modules import CustomPlayer
            import time

            player = CustomPlayer.MyXBMCPlayer()
            if (xbmc.Player().isPlaying() == 0):
                quit()
            try:

                if player.urlplayed:
                    print 'yes played'
                    return
                if time.time() - beforestart > 4: return False
            #xbmc.sleep(1000)
            except:
                pass

            print 'returning now'
            return False
        from resources.modules import CustomPlayer
        import time

        player = CustomPlayer.MyXBMCPlayer()
        player.pdialogue = pdialogue
        start = time.time()
        #xbmc.Player().play( liveLink,listitem)
        print 'going to play'
        import time
        beforestart = time.time()
        player.play(url, liz)
        if (xbmc.Player().isPlaying() == 0):
            quit()
        try:
            while player.is_active:
                xbmc.sleep(400)

                if player.urlplayed:
                    print 'yes played'
                    return
                if time.time() - beforestart > 4: return False
                #xbmc.sleep(1000)
        except:
            pass
        print 'not played', url
        xbmc.Player().stop()
        return
Beispiel #2
0
elif mode == 5006:
    #from resources.root import android
    #android.cat()
    xbmc.executebuiltin(
        'ActivateWindow(10025,"plugin://script.rsmaintenance/?mode=maint",return)'
    )

elif mode == 5007:
    #from resources.root import android
    #android.cat()
    xbmc.executebuiltin(
        'ActivateWindow(10025,"plugin://script.rsmaintenance",return)')

elif mode == 5008:
    #from resources.root import android
    #android.cat()
    xbmc.executebuiltin('ActivateWindow(10025,"",return)')

elif mode == 9999:
    import xbmcgui, xbmcplugin
    from resources.modules import resolvers
    url = resolvers.resolve(url)
    liz = xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage=iconimage)
    liz.setInfo(type='Video', infoLabels='')
    liz.setProperty("IsPlayable", "true")
    liz.setPath(url)
    xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, liz)

import xbmcplugin
xbmcplugin.endOfDirectory(int(sys.argv[1]))