def STREAM(name, iconimage, url, protocol, sch_ch_id, ch_id):
  addon_log("stream")
  if(url == None):
    # try: xbmc.executebuiltin("Dialog.Close(all,true)")
    # except: pass
    return False

  # if (sch_ch_id != None) and (SETTINGS.DISABLE_SCHEDULE != 'true'):
  #   epgObj = epg()
  #   epgObj.grab_schedule(sch_ch_id, name)

  #addon_log(name)
  #addon_log(iconimage)

  if not iconimage or iconimage == "": iconimage="DefaultVideo.png"
  listitem = xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
  #listitem.setLabel(name)
  listitem.setInfo('video', {'Title': name})

  player = streamplayer(name=name, protocol=protocol, ch_id=ch_id)

  #play sopcast stream
  if protocol == "sop":
    addon_log("sop")
    if(SETTINGS.USE_PLEXUS_SOP == 'true'):
      addon_log("sop play plexus")
      try:
        addon_log('plexus')
        xbmc.executebuiltin('XBMC.RunPlugin(plugin://program.plexus/?mode=2&url='+url+'&name='+name+'&iconimage='+iconimage+')')
      except Exception as inst:
        addon_log(inst)
        xbmc.executebuiltin("Notification(%s,%s,%i)" % (addon.getLocalizedString(30303), "", 10000))
    else:
      addon_log("sop play")
      sop = sopcast(player=player, url=url, listitem=listitem)
      sop.start()

  #play acestream
  elif protocol=='acestream':
    if(SETTINGS.ACE_ENGINE_TYPE == 1): #use plexus
      try:
        addon_log('plexus')
        xbmc.executebuiltin('XBMC.RunPlugin(plugin://program.plexus/?mode=1&url='+url+'&name='+name+'&iconimage='+iconimage+')')
      except Exception as inst:
        addon_log(inst)
        xbmc.executebuiltin("Notification(%s,%s,%i)" % (addon.getLocalizedString(30303), "", 10000))
    elif(SETTINGS.ACE_ENGINE_TYPE == 0): #use external
      #play with acestream engine started on another machine or on the localhost
      ace = acestream(player=player, url=url, listitem=listitem)
      ace.engine_connect()
  else: #play direct stream
    try:
      player.play(url, listitem)
    except Exception as inst:
      xbmcgui.Dialog().ok(addon.getLocalizedString(30060), str(type(inst)),str(inst),"")
Beispiel #2
0
def STREAM(name, iconimage, url, protocol, sch_ch_id, ch_id):
    if (url == None):
        try:
            xbmc.executebuiltin("Dialog.Close(all,true)")
        except:
            pass
        return False

    if (sch_ch_id != None) and (SETTINGS.DISABLE_SCHEDULE != 'true'):
        grab_schedule(sch_ch_id, name)

    #addon_log(name)
    #addon_log(iconimage)

    if not iconimage or iconimage == "": iconimage = "DefaultVideo.png"
    listitem = xbmcgui.ListItem(name,
                                iconImage="DefaultVideo.png",
                                thumbnailImage=iconimage)
    #listitem.setLabel(name)
    listitem.setInfo('video', {'Title': name})

    player = streamplayer(xbmc.PLAYER_CORE_AUTO,
                          name=name,
                          protocol=protocol,
                          ch_id=ch_id)

    #play sopcast stream
    if protocol == "sop":
        sop = sopcast(player=player, url=url, listitem=listitem)
        sop.start()

    #play acestream
    elif protocol == 'acestream':
        ace = acestream(player=player, url=url, listitem=listitem)
        ace.engine_connect()

    #play direct stream
    else:
        try:
            player.play(url, listitem)
        except Exception as inst:
            xbmcgui.Dialog().ok(addon.getLocalizedString(30060),
                                str(type(inst)), str(inst), "")
            try:
                xbmc.executebuiltin("Dialog.Close(all,true)")
            except:
                pass
def STREAM(name, iconimage, url, protocol, sch_ch_id, ch_id):
  if(url == None):
    try: xbmc.executebuiltin("Dialog.Close(all,true)")
    except: pass
    return False

  if (sch_ch_id != None) and (SETTINGS.DISABLE_SCHEDULE != 'true'):
    grab_schedule(sch_ch_id, name)

  #addon_log(name)
  #addon_log(iconimage)

  if not iconimage or iconimage == "": iconimage="DefaultVideo.png"
  listitem = xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
  #listitem.setLabel(name)
  listitem.setInfo('video', {'Title': name})

  player = streamplayer(xbmc.PLAYER_CORE_AUTO, name=name, protocol=protocol, ch_id=ch_id)

  #play sopcast stream
  if protocol == "sop":
    sop = sopcast(player=player, url=url, listitem=listitem)
    sop.start()

  #play acestream
  elif protocol=='acestream':
    ace = acestream(player=player, url=url, listitem=listitem)
    ace.engine_connect()

  #play direct stream
  else:
    try:
      player.play(url, listitem)
    except Exception as inst:
      xbmcgui.Dialog().ok(addon.getLocalizedString(30060), str(type(inst)),str(inst),"")
      try: xbmc.executebuiltin("Dialog.Close(all,true)")
      except: pass
def STREAM(name, iconimage, url, protocol, sch_ch_id, ch_id):
  if(url == None):
    try: xbmc.executebuiltin("Dialog.Close(all,true)")
    except: pass
    return False

  if (sch_ch_id != None) and (SETTINGS.DISABLE_SCHEDULE != 'true'):
    epgObj = epg()
    epgObj.grab_schedule(sch_ch_id, name)

  #addon_log(name)
  #addon_log(iconimage)

  if not iconimage or iconimage == "": iconimage="DefaultVideo.png"
  listitem = xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
  #listitem.setLabel(name)
  listitem.setInfo('video', {'Title': name})

  player = streamplayer(name=name, protocol=protocol, ch_id=ch_id)

  #play sopcast stream
  if protocol == "sop":
    if(SETTINGS.USE_PLEXUS_SOP == 'true'):
      try:
        addon_log('plexus')
        xbmc.executebuiltin('XBMC.RunPlugin(plugin://program.plexus/?mode=2&url='+url+'&name='+name+'&iconimage='+iconimage+')')
      except Exception as inst:
        addon_log(inst)
        xbmc.executebuiltin("Notification(%s,%s,%i)" % (addon.getLocalizedString(30303), "", 10000))
    else:
      sop = sopcast(player=player, url=url, listitem=listitem)
      sop.start()

  #play acestream
  elif protocol=='acestream':
    if(SETTINGS.ACE_ENGINE_TYPE == 2): #use plexus
      try:
        addon_log('plexus')
        xbmc.executebuiltin('XBMC.RunPlugin(plugin://program.plexus/?mode=1&url='+url+'&name='+name+'&iconimage='+iconimage+')')
      except Exception as inst:
        addon_log(inst)
        xbmc.executebuiltin("Notification(%s,%s,%i)" % (addon.getLocalizedString(30303), "", 10000))
    elif(SETTINGS.ACE_ENGINE_TYPE == 1): #use external
      #play with acestream engine started on another machine or on the localhost
      ace = acestream(player=player, url=url, listitem=listitem)
      ace.engine_connect()
    # else: #use internal
    #   if xbmc.getCondVisibility('System.Platform.Android'):
    #       #xbmc.executebuiltin("Notification(%s,%s,%i)" % ("android", "", 3000))
    #       ace = acestream(player=player, url=url, listitem=listitem)
    #       ace.engine_connect()
    #   elif xbmc.getCondVisibility('system.platform.linux'):
    #       #xbmc.executebuiltin("Notification(%s,%s,%i)" % ("linux", "", 3000))
    #       addon_log('linux')
    #       addon_log(os.uname())
    #       if "aarch" in os.uname()[4]:
    #           addon_log('aarch')
    #           #xbmc.executebuiltin("Notification(%s,%s,%i)" % ("aarch", "", 3000))
    #           if not os.path.isfile(os.path.join(fileslist,"acestream","chroot")):
    #               arch = '64' if sys.maxsize > 2**32 else '32'
    #               acestream_pack = "https://raw.githubusercontent.com/viorel-m/kingul-repo/master/acestream/acestream_arm%s.tar.gz" % arch
    #               acekit(acestream_pack)
    #           import acestream as ace
    #           ace.acestreams_builtin(name,iconimage,url)
    #       elif "arm" in os.uname()[4]:
    #           addon_log('arm')
    #           if not os.path.isfile(os.path.join(fileslist,"acestream","chroot")):
    #               acestream_pack = "https://raw.githubusercontent.com/viorel-m/kingul-repo/master/acestream/acestream_arm32.tar.gz"
    #               acekit(acestream_pack)
    #           import acestream as ace
    #           ace.acestreams_builtin(name,iconimage,url)

  #play direct stream
  else:
    try:
      player.play(url, listitem)
    except Exception as inst:
      xbmcgui.Dialog().ok(addon.getLocalizedString(30060), str(type(inst)),str(inst),"")
      try: xbmc.executebuiltin("Dialog.Close(all,true)")
      except: pass