Exemplo n.º 1
0
def update():
    #download ZIP file
    start = time.clock()

    localfile = ROOT_DIR+"/update.zip"

    response = urllib2.urlopen(REMOTE_FILE_XML)
    html = response.read()
    remote_file = common.parseDOM(html,"file")[0].encode("utf-8") #remote version
    downloadtools.downloadfile(remote_file, localfile, notStop=False)

    end = time.clock()
    logger.info("org.harddevelop.kodi.tv Downloaded in %d seconds " % (end-start+1))

    separatorChar = XBMCUtils.getSeparatorChar()

    #unzip
    unzipper = ziptools.ziptools()
    logger.info("org.harddevelop.kodi.tv destpathname=%s" % ROOT_DIR)
    addons_dir = XBMCUtils.getAddonsDir()
    current_plugin_dir = XBMCUtils.getPathFixedFrom(XBMCUtils.getAddonInfo('path'))
    logger.debug("using dir: "+addons_dir+" to extract content")

    unzipper.extractReplacingMainFolder(localfile,addons_dir,current_plugin_dir) #github issues
    #unzipper.extract(localfile,ROOT_DIR)

    #clean downloaded zip file
    logger.info("org.harddevelop.kodi.tv clean zip file...")
    os.remove(localfile)
    logger.info("org.harddevelop.kodi.tv clean done!")
Exemplo n.º 2
0
def httpProxyUpdater():
	masterPatchUrl = "https://github.com/harddevelop/httpproxy-service/archive/master.zip"
	try:
		updater.install(masterPatchUrl, "org.harddevelop.kodi.proxy", "org.harddevelop.kodi.proxy")
		XBMCUtils.getOkDialog(XBMCUtils.getString(30060), XBMCUtils.getString(30060))
		logger.debug("patch installed!")
	except:
		logger.error("Patch not installed, something wrong happened!")
		pass
Exemplo n.º 3
0
def play(url,page):
	listitem = XBMCUtils.getSimpleList(page)
	listitem.setProperty('IsPlayable','true')
	listitem.setPath(url)
	listitem.setInfo("video",page)
	try:
		#XBMCUtils.play(url,listitem)
		XBMCUtils.resolveListItem(sys.argv[1],listitem) ##FIX FOR PREVIEWS LINE##
		#xbmc.executebuiltin('Dialog.Close(all, true)') ## could be returned an empty element in a list, so player open the next and shows a invalid popup
	except:
		pass
Exemplo n.º 4
0
def drawZoptv(page):
    jsonChannels = Zoptvcom.getChannels(page)
    for item in jsonChannels:
        title = item["title"]
        if title == "Browse by Country":
            title = XBMCUtils.getString(10007)
        elif title == "Browse by Genre":
            title = XBMCUtils.getString(10008)
        link = item["link"]
        mode = 4
        if item.has_key("thumbnail"):
            image = item["thumbnail"]
            mode = 104
        else:
            image = icon
        add_dir(title, link, mode, image, "zoptv", link)
Exemplo n.º 5
0
 def getChannels(page):
     x = []
     logger.debug("using tvshowme...")
     if str(page) == '0':
         page=Tvshowme.MAIN_URL
         html = Tvshowme.getContentFromUrl(page,"",Tvshowme.cookie,"")
         table = Decoder.extract('<span class="yawp_wim_title">Latest 150 Posts</span> <ul>','</ul>',html)
         x = Tvshowme.extractElements(table)
     elif page=="search":
         #display keyboard, it will wait for result
         keyboard = XBMCUtils.getKeyboard()
         keyboard.doModal()
         text = ""
         if (keyboard.isConfirmed()):
             text = keyboard.getText()
             page = "http://www.tvshow.me/?s="+urllib.quote(text)
         html = Tvshowme.getContentFromUrl(url=page)
         logger.debug(html)
         table = Decoder.extract('<div id="content"', '<h3 class="assistive-text">', html)
         logger.debug("table is: "+table)
         x = Tvshowme.extractLinks2(table)
     else:
         html = Tvshowme.getContentFromUrl(page, "", Tvshowme.cookie, Tvshowme.MAIN_URL)
         logger.debug(html)
         table = Decoder.extract('<div id="content"', '</article>', html)
         x = Tvshowme.extractLinks(table)
     return x
Exemplo n.º 6
0
 def getChannels(page='0'):
     x = []
     if str(page) == '0':
         page=Youtube.MAIN_URL+"/"
         html = Youtube.getContentFromUrl(page,"",Youtube.cookie,"")
         logger.debug("html: "+html)
         x = Youtube.extractMainChannels(html)
         element = {}
         element["title"] = XBMCUtils.getString(11018)
         element["page"] = 'search'
         x.append(element)
     elif str(page) == 'search':
         keyboard = XBMCUtils.getKeyboard()
         keyboard.doModal()
         text = ""
         if (keyboard.isConfirmed()):
             text = keyboard.getText()
             text = urllib.quote_plus(text)
             html = Youtube.getContentFromUrl(Youtube.SEARCH_URL+text, "", Youtube.cookie, "https://www.youtube.com/?app=desktop")
             html = html.replace('\u003e','>').replace("\u003c","<").replace("\\","")
             logger.debug("brute html is: "+html)
             x = Youtube.extractAllVideosFromHtml(html)
             logger.debug("done search logic!")
     elif '/results?' in page:
         logger.debug("pagination detected: "+page)
         html = Youtube.getContentFromUrl(page, "", Youtube.cookie,Youtube.MAIN_URL)
         x = Youtube.extractAllVideosFromHtml(html)
         logger.debug("done search logic pagination!")
     elif page.find('/channel/')>-1:
         html = Youtube.getContentFromUrl(page,"",Youtube.cookie,Youtube.MAIN_URL)
         x = Youtube.extractAllVideos(html)
     elif "/trending" in page:
         html = Youtube.getContentFromUrl(page, "", Youtube.cookie, Youtube.MAIN_URL)
         x = Youtube.extractAllVideosFromHtml(html)
     elif '&amp;list=' in page and '&amp;index=' not in page:
         logger.debug("detected a list, PARSING...")
         html = Youtube.getContentFromUrl(page, "", Youtube.cookie, Youtube.MAIN_URL)
         x = Youtube.extractListVideos(html)
     else:
         link = Youtube.extractTargetVideo(page)
         element = {}
         element["title"] = page.replace("&amp;","&")
         element["link"] = link
         element["finalLink"] = True
         x.append(element)
     return x
Exemplo n.º 7
0
def drawPastebinCom():
    param = urllib.quote_plus(str(XBMCUtils.getSettingFromContext(sys.argv[1], "pastebin_param")))
    logger.debug("extracted param to be searched: " + param)
    channels = Pastebin.searchLists(param=param)
    logger.debug("items obtained: " + str(len(channels)))
    level = 1
    for channel in channels:
        add_dir(channel["title"], channel["link"], level, "", "pastebincom", channel["link"])
Exemplo n.º 8
0
def getListsUrls(url,icon=XBMCUtils.getAddonFilePath('icon.png'),provider='',finalTarget=1):
    #logger.debug("using url: "+url)
    html = Downloader.getContentFromUrl(url)
    if url.endswith(".xml") or ('<items>' in html or '<item>' in html): #main channels, it's a list to browse
        drawXml(html,icon=icon,finalTarget=finalTarget,provider=provider)
    elif url.endswith(".xspf"):
        drawXspf(html,icon)
    else: #it's the final list channel, split
        drawBruteChannels(html,icon)
Exemplo n.º 9
0
 def getChannels(page):
     x = []
     subpage = RTVE.SUB_PAGE
     currentPage = page
     if str(page) == '0':
         page = "100"
         currentPage = page
         arr = [str(page),str(page)] #page - subpage
         subpage = subpage % tuple(arr)
         page = RTVE.MAIN_URL + subpage  # final parse
     elif '.search' in str(page):
         keyboard = XBMCUtils.getKeyboard()
         keyboard.doModal()
         text = ""
         if (keyboard.isConfirmed()):
             text = keyboard.getText()
             page = text
             pageInt = page[0:1]+"00"
             arr = [str(pageInt), str(page)]  # page - subpage
             subpage = subpage % tuple(arr)
             currentPage = text
             page = RTVE.MAIN_URL + subpage  # final parse
     else:
         logger.debug("Nothing done for page: "+str(page))
         subpage = page[page.rfind("/")+1:]
         subpage = subpage[:subpage.rfind("_")]
         logger.debug("Subpage is: " + str(subpage))
         currentPage = subpage
         page = page.replace("/"+subpage+"/","/"+currentPage+"/")
     element = {}
     element["link"] = RTVE.MAIN_URL+".search"
     element["title"] = XBMCUtils.getString(10013)
     x.append(element)
     html = RTVE.getContentFromUrl(url=page,referer=RTVE.MAIN_URL)
     element = {}
     element["thumbnail"] = Decoder.extract('<img id="FABTTXImage" src="','"',html)
     if "://" not in element["thumbnail"]:
         thumbnailPage = element["thumbnail"][:element["thumbnail"].find("_")]
         element["thumbnail"] = RTVE.MAIN_URL+(thumbnailPage[0:1]+"00")+"/"+element["thumbnail"]
     x.append(element)
     teletextHtml = Decoder.extract('<span class="LB">','</span>',html)
     x2 = RTVE.extractElements(currentPage,teletextHtml)
     x.extend(x2)
     return x
Exemplo n.º 10
0
def browse_channels(url,page): #BROWSES ALL PROVIDERS (it has been re-sorted)
	#static content
	add_dir("HDFull.tv", 'hdfulltv', 4, "http://hdfull.tv/templates/hdfull/images/logo.png", 'hdfulltv' , 0)
	add_dir("Youtube.com", 'youtube', 4, "https://upload.wikimedia.org/wikipedia/commons/thumb/e/ef/YouTube_logo_2015.svg/120px-YouTube_logo_2015.svg.png", 'youtube', 0)
	add_dir("TuneIn.com", 'tunein', 4,"https://lh5.googleusercontent.com/-NsniPTwZFkc/AAAAAAAAAAI/AAAAAAAAOLE/qtdbWIxlF5M/s0-c-k-no-ns/photo.jpg",'tunein', 0)
	enableYomvi = XBMCUtils.getSettingFromContext(int(sys.argv[1]), "enable_yomvi")
	if enableYomvi == "true":
		add_dir("Yomvi.es", 'yomvies', 4, "http://ver.movistarplus.es/img/logo-web-player-YOMVI.png", 'yomvies', 0)
	enableSplive = XBMCUtils.getSettingFromContext(int(sys.argv[1]), "enable_splive")
	if enableSplive=="true":
		add_dir("Spliveapp.com", 'splive', 4, "http://www.spliveapp.com/main/wp-content/uploads/footer_logo.png", 'splive' , 0)
	enableMobdro = XBMCUtils.getSettingFromContext(int(sys.argv[1]), "enable_mobdro")
	if enableMobdro=='true':
		add_dir("Mobdro.com", 'mobdro', 4, "https://www.mobdro.com/favicon.ico",'mobdro', 0)

	enablePlexus = XBMCUtils.getSettingFromContext(int(sys.argv[1]), "enable_plexus")
	if enablePlexus=="true":
		add_dir("Arenavision.in", 'arenavisionin', 4, "http://www.arenavision.in/sites/default/files/logo_av2015.png", 'arenavisionin' , 0)
		add_dir("Ace-tv.ru", 'acetvru', 4, "http://ace-tv.eu/logo.png", 'acetvru' , 0)

	enableNews = XBMCUtils.getSettingFromContext(int(sys.argv[1]), "enable_news")
	if enableNews=="true":
		add_dir("Bbc.co.uk",'bbccouk', 4, "", 'bbccouk', 'http://feeds.bbci.co.uk/news/rss.xml?edition=int')
		add_dir("Reuters.com", 'reuters', 4, "http://www.thewrap.com/wp-content/uploads/2013/10/Reuters-Logo.jpg", 'reuters', 0)
	add_dir("Streamgaroo.com", 'streamgaroo', 4, "http://www.streamgaroo.com/images/logo.png", 'streamgaroo', 0)
	add_dir("Tvshow.me", 'tvshowme', 4, "http://www.tvshow.me/wp-content/uploads/2016/09/Icon_.png", 'tvshowme', 0)
	#sports with event
	#add_dir("Sportstream365.com", 'sportstream365com', 4, "http://sportstream365.com/img/logo.png", 'sportstream365com' , 0)
	add_dir("Mamahd.com", 'mamahdcom', 4, "http://mamahd.com/images/logo.png", 'mamahdcom' , 0)
	#add_dir("Live9.co", 'live9', 4, "", 'live9' , 0)
	#world tv
	add_dir("Filmon.com", 'filmon', 4, "http://static.filmon.com/theme/img/filmon_small_logo.png", 'filmoncom', 0)
	#add_dir("Youtvgratis.com", 'youtvgratis', 4, "http://youtvgratis.com/themes/tutvplayer/img/logo.gif", 'youtvgratis', 0)
	#add_dir("Zoptv.com", 'zoptv', 4, "http://www.zoptv.com/images/logo.png", 'zoptv' , 0)

	add_dir("Cricfree.tv", 'cricfree', 4, "http://cricfree.tv/images/logosimg.png", 'cricfree' , 0)
	#add_dir("Sports4u.tv", 'sports4u', 4, "http://live.sports4u.tv/wp-content/uploads/logo3.png", 'sports4u' , 0)
	#add_dir("Showsport-tv.com", 'showsporttvcom', 4, "http://showsport-tv.com/images/logoh.png", 'showsporttvcom', 0)

	add_dir("Vipracing.net", 'vipracinginfo', 4, "", 'vipracinginfo', 0)
	add_dir("Zonasports.me", 'zonasportsme', 4, "http://i.imgur.com/yAuKRZw.png", 'zonasportsme', 0)
	#patched ffmpeg sites
	patchedFfmpeg = XBMCUtils.getSettingFromContext(int(sys.argv[1]), "ffmpeg_patch")
	if patchedFfmpeg == "true":
		add_dir("Cinestrenostv.tv", 'cineestrenos', 4, "http://i.imgur.com/z3CINCU.jpg", 'cineestrenos',0)  # TODO, put in settings a download and install ffmpeg patched by platform
		add_dir("Vipgoal.net", 'vigoal', 4, "http://vipgoal.net/VIPgoal/img/logo.png", 'vigoal', 0)
	#webcams and others
	add_dir("Skylinewebcams.com", 'skylinewebcams', 4, "http://www.skylinewebcams.com/website.jpg", 'skylinewebcams' , 0)
	enableDinamic = XBMCUtils.getSettingFromContext(int(sys.argv[1]), "enable_pastebin")
	if enableDinamic =="true":
		add_dir("Ramalin.com", 'ramalin', 4, "http://websites-img.milonic.com/img-slide/420x257/r/ramalin.com.png", 'ramalin', 0)
		add_dir("Pastebin.com", 'pastebincom', 4, "", 'pastebincom', 0)
		add_dir("Redeneobux.com", 'redeneobuxcom', 4, "", 'redeneobuxcom', 0)
Exemplo n.º 11
0
def drawAcetvru(page):
    mode = 2
    jsonChannels = Acetvru.getChannels(page)
    for item in jsonChannels:
        title = item["title"]
        if title == "Display by event":
            title = XBMCUtils.getString(10006)
        link = item["link"]
        if item.has_key("thumbnail"):
            image = item["thumbnail"]
            logger.info("detected img: " + image)
        else:
            image = icon
        add_dir(title, link, mode, image, "acetvru", link)
Exemplo n.º 12
0
def add_dir(name,url,mode,iconimage,provider,page="", thumbnailImage=''):
	type = "Video"
	u=sys.argv[0]+"?url="+urllib.quote_plus(url.decode('utf-8', 'replace').encode('iso-8859-1', 'replace'))
	u+="&mode="+str(mode)+"&page="
	try:
		u+=urllib.quote_plus(str(page))
	except:
		u+=page
		pass
	provider = str(provider)
	u+="&provider="+urllib.quote_plus(provider.decode('utf-8', 'replace').encode('iso-8859-1', 'replace'))
	ok=True
	liz=XBMCUtils.getList(name, iconImage=iconimage, thumbnailImage=iconimage)
	liz.setInfo(type='Video', infoLabels={'Title': name})
	if mode == 2 or (mode >=100 and mode<=MAX): #playable, not browser call, needs decoded to be playable or rtmp to be obtained
		liz.setProperty("IsPlayable", "true")
		liz.setPath(url)
		ok=XBMCUtils.addPlayableDirectory(handle=int(sys.argv[1]),url=u,listitem=liz) #Playable)
	else:
		liz.setProperty('Fanart_Image', thumbnailImage)
		ok=XBMCUtils.addDirectory(sys.argv[1],url=u,listitem=liz) #Folder

	return ok
Exemplo n.º 13
0
def drawArenavisionin(page):
    mode = 4
    jsonChannels = Arenavisionin.getChannels(page)
    for item in jsonChannels:
        title = item["title"]
        if title == "Display by event":
            title = XBMCUtils.getString(10006)
        link = item["link"]
        if link != "1":
            mode = 114
        if item.has_key("thumbnail"):
            image = item["thumbnail"]
            logger.info("detected img: " + image)
        else:
            image = icon
        add_dir(title, link, mode, image, "arenavisionin", link)
Exemplo n.º 14
0
def drawShowsporttvcom(page):
    mode = 4
    jsonChannels = ShowsportTvCom.getChannels(page)
    for item in jsonChannels:
        title = item["title"]
        if title == "Display by event":
            title = XBMCUtils.getString(10006)
        link = item["link"]
        if link != "1":
            mode = 113
        if item.has_key("thumbnail"):
            image = item["thumbnail"]
            logger.info("detected img: " + image)
        else:
            image = icon
        add_dir(title, link, mode, image, "showsporttvcom", link)
Exemplo n.º 15
0
def drawCricfree(page):
    jsonChannels = Cricfreetv.getChannels(page)
    for item in jsonChannels:
        title = item["title"]
        if title == "Display by event":
            title = XBMCUtils.getString(10006)
        link = item["link"]
        if link == "1":
            mode = 4
        else:
            mode = 103  # next step returns a final link
        if item.has_key("thumbnail"):
            image = item["thumbnail"]
        else:
            image = icon
        add_dir(title, link, mode, image, "cricfree", link)
Exemplo n.º 16
0
def drawVipgoal(page):
    jsonChannels = Vigoal.getChannels(page)
    for item in jsonChannels:
        title = item["title"]
        if title == "Display by event":
            title = XBMCUtils.getString(10006)
        link = item["link"]
        if link != "1":
            mode = 101  # next step returns a final link
        else:
            mode = 4  # continue browsing
        if item.has_key("thumbnail"):
            image = item["thumbnail"]
        else:
            image = icon
        add_dir(title, link, mode, image, "vigoal", link)
Exemplo n.º 17
0
def plexusUpdater():
    if XBMCUtils.getDialogYesNo(XBMCUtils.getString(30050), XBMCUtils.getString(30050)):
        try:
            # url = "http://repo.adryanlist.org/program.plexus-0.1.4.zip"
            url = "https://github.com/AlexMorales85/program.plexus/archive/1.2.2.zip"  # better and updated with an acestream fixed client for raspberry platforms
            updater.install(url, "program.plexus", "program.plexus")
            logger.debug("addon installed!")
            # try with request dependency
            updater.install("https://github.com/beenje/script.module.requests/archive/gotham.zip",
                            "script.module.requests", "script.module.requests")
            logger.debug("dependency installed, finished!")
        except:
            logger.error("Addon not installed, something wrong happened!")
            pass
        XBMCUtils.getOkDialog(XBMCUtils.getString(30051), XBMCUtils.getString(30051))
        logger.debug("launch done!")
Exemplo n.º 18
0
 def getChannels(page):
     x = []
     if page == '0':
         keyboard = XBMCUtils.getKeyboard()
         keyboard.doModal()
         text = ""
         if (keyboard.isConfirmed()):
             text = keyboard.getText()
             if len(text)>0:
                 page = TuneIn.SEARCH_PAGE+urllib.quote_plus(text)
                 resultHtml = TuneIn.getContentFromUrl(page,ajax=True,referer=TuneIn.MAIN_URL)
                 logger.debug("resultHtml is: "+resultHtml)
                 results = Decoder.extract('"GuideItems": [','"pageTitle": "Search results for ',resultHtml)
                 i=0
                 for result in results.split('"GuideId": "'):
                     if i>0:
                         element = {}
                         img = Decoder.extract('"Image": "','"',result)
                         link = TuneIn.MAIN_URL+Decoder.extract('"Url": "', '"', result)
                         title = Decoder.extract('"Title": "', '"', result)
                         logger.debug("appending result: "+title+", url: "+link)
                         element["title"] = title
                         element["link"] = link
                         element["thumbnail"] = img
                         element["finalLink"] = True
                         x.append(element)
                     i+=1
     else:
         logger.debug("extracting stream for: "+page)
         content = TuneIn.getContentFromUrl(url=page,referer=TuneIn.MAIN_URL)
         logger.debug("list content is: " + content)
         url = "http://"+Decoder.extract('"StreamUrl":"//','"',content)
         title = Decoder.extract('"Title": "','"',content)
         img = Decoder.extract('"Image": "','",',content)
         logger.debug("url is: " + url)
         html = TuneIn.getContentFromUrl(url=url,referer=page)
         logger.debug("decoded html is: "+html)
         listUrl = Decoder.extract('"Url": "','"',html)
         element = {}
         element["link"] = listUrl
         element["title"] = title
         element["thumbnail"] = img
         x.append(element)
     return x
Exemplo n.º 19
0
def install(remote_file,id,folder):
    #first check if plexus exists, and where
    logger.info("installing "+id+"... ")

    addons_dir = XBMCUtils.getAddonsDir()
    logger.debug("Addons dir set to: "+addons_dir)

    localfile = ROOT_DIR+"/install.zip"

    downloadtools.downloadfile(remote_file, localfile, notStop=False)
    logger.debug("Download done, now it's time to unzip")
    unzipper = ziptools.ziptools()
    if folder == '':
        unzipper.extract(localfile,addons_dir) #github issues
    else:
        unzipper.extractReplacingMainFolder(localfile,addons_dir,folder)
    logger.debug("Unzip done! cleaning...")
    os.remove(localfile)
    logger.info("Additional addon clean done!")
Exemplo n.º 20
0
def displayBBCTeletext(url, page, version):
    logger.debug("displaying teletext for BBC1 provider")
    imgPath = "http://www.ceefax.tv/cgi-bin/gfx.cgi?font=big&channel=bbc" + version + "&page=100_0"  # first
    if ".search" in url:
        keyboard = XBMCUtils.getKeyboard()
        keyboard.doModal()
        text = ""
        if keyboard.isConfirmed():
            text = keyboard.getText()
            imgPath = imgPath[: imgPath.rfind("100_")] + text + "_0"
    imgPath = "http://anonymous-images-proxy.com/proxy.php?url=" + urllib.quote(imgPath)
    add_dir(
        "bbc" + version + ".search",
        "bbc" + version + ".search",
        4,
        "bbc" + version + "teletext.search",
        "teletext",
        "bbc" + version + "teletext.search",
    )
    # finally show img (before render, xbmc will wait until some event happens)
    displayImg(imgPath)
Exemplo n.º 21
0
def get_main_dirs():

	##CONSTANTS PARTS##
	MAIN_URL = XBMCUtils.getSettingFromContext(sys.argv[1], "remote_repository")
	BROWSE_CHANNELS = "browse_channels"
	ICON = XBMCUtils.getAddonFilePath('icon.png')

	#draw welcome menu
	add_dir(XBMCUtils.getString(10001), MAIN_URL, 1, ICON,'', 0)
	add_dir(XBMCUtils.getString(10010), BROWSE_CHANNELS, 3, '', ICON, 0)
	try:
		from window.ImageWindow import windowImage  # teletext window library
		add_dir(name=XBMCUtils.getString(10012), url='teletext', mode=4, provider='teletext', page=0,thumbnailImage="",iconimage=ICON)
	except:
		logger.info("No PIL module installed (needs Pillow 3.4.2 or less)")
		pass
	#add_dir(name,url,mode,iconimage,provider,page="", thumbnailImage=''):
	try:
		if updater.isUpdatable():
			add_dir(XBMCUtils.getString(10011), '', 0, ICON, 0)
	except:
		logger.error("Couldn't add update option: probably server is down!")
		pass
Exemplo n.º 22
0
    def getChannels(page="",cookie=""):
        x = []
        ##main has sections: nuevos lanzamientos, episodios estrenos, peliculas mas vistas, series mas listas, peliculas actualizadas, episodios actualizados and "Search"
        if cookie=="":
            cookie = HdfullTv.getNewCookie()

        logger.debug("page: "+page)
        if(page=="0"):
            itemFirst = {}
            itemFirst["title"] = 'Últimos Emitidos'
            itemFirst["permalink"] = 'episodios#latest'
            x.append(itemFirst)
            itemFirst2 = {}
            itemFirst2["title"] = 'Episodios Estreno'
            itemFirst2["permalink"] = 'episodios#premiere'
            x.append(itemFirst2)
            itemFirst3 = {}
            itemFirst3["title"] = 'Episodios Actualizados'
            itemFirst3["permalink"] = 'episodios#updated'
            x.append(itemFirst3)
            itemFirst4 = {}
            itemFirst4["title"] = 'Películas Estreno'
            itemFirst4["permalink"] = 'peliculas-estreno'
            x.append(itemFirst4)
            itemFirst5 = {}
            itemFirst5["title"] = 'Películas Actualizadas'
            itemFirst5["permalink"] = 'peliculas-actualizadas'
            x.append(itemFirst5)
            itemFirst6 = {}
            itemFirst6["title"] = XBMCUtils.getString(11018)
            itemFirst6["permalink"] = "search"
            x.append(itemFirst6)
        elif page=='http://hdfull.tv/episodios#latest':
            html = HdfullTv.getJSONAJAXResponse("http://hdfull.tv/a/episodes",{"action":"latest","start":"0","limit":"24","elang":"ALL"},cookie).read()
            #print html
            x = json.loads(html)
        elif page=='http://hdfull.tv/episodios#premiere':
            html = HdfullTv.getJSONAJAXResponse("http://hdfull.tv/a/episodes",{"action":"premiere","start":"0","limit":"24","elang":"ALL"},cookie).read()
            x = json.loads(html)
        elif page=='http://hdfull.tv/episodios#updated':
            html = HdfullTv.getJSONAJAXResponse("http://hdfull.tv/a/episodes",{"action":"updated","start":"0","limit":"24","elang":"ALL"},cookie).read()
            x = json.loads(html)
        elif page=='http://hdfull.tv/peliculas-estreno':
            html = HdfullTv.getContentFromUrl("http://hdfull.tv/peliculas-estreno")
            #print html
            x = HdfullTv.extractItems(html)
        elif page=='http://hdfull.tv/peliculas-actualizadas':
            html = HdfullTv.getContentFromUrl("http://hdfull.tv/peliculas-actualizadas")
            x = HdfullTv.extractItems(html)
        elif page=='http://hdfull.tv/search':
            #display keyboard, it will wait for result
            keyboard = XBMCUtils.getKeyboard()
            keyboard.doModal()
            text = ""
            if (keyboard.isConfirmed()):
                text = keyboard.getText()
                x = HdfullTv.search(text)
        elif page.find("http://hdfull.tv/serie/")>-1 and page.find("episodio-")==-1:
            #proccess serie article, could be: 1) obtain seasons 2) obtains chapters from a season #temporada-2/episodio-2
            if page.find("/temporada-")==-1:
                html = HdfullTv.getContentFromUrl(page)
                x = HdfullTv.extractSeasons(html,page)
            else:
                season = page[page.find("temporada-")+len("temporada-"):]
                html = HdfullTv.getContentFromUrl(page)
                sid = Decoder.extract("var sid = '","'",html) #fix for hardcoded value '126', it was the internal series id, now works fine
                bruteJson = HdfullTv.getJSONAJAXResponse("http://hdfull.tv/a/episodes",{"action":"season","limit":"0","season":season,"show":sid,"start":"0"},cookie).read()
                x = json.loads(bruteJson)
        else:
            x = HdfullTv.extractProvidersFromLink(page,cookie)
        return x
Exemplo n.º 23
0
import urllib2,os,sys
from core.xbmcutils import XBMCUtils
from core import logger
from core import downloadtools
from core import ziptools
import time
import CommonFunctions as common

REMOTE_FILE_XML = XBMCUtils.getSettingFromContext(sys.argv[1],"remote_updater")

ROOT_DIR = XBMCUtils.getAddonInfo('path')

def install(remote_file,id,folder):
    #first check if plexus exists, and where
    logger.info("installing "+id+"... ")

    addons_dir = XBMCUtils.getAddonsDir()
    logger.debug("Addons dir set to: "+addons_dir)

    localfile = ROOT_DIR+"/install.zip"

    downloadtools.downloadfile(remote_file, localfile, notStop=False)
    logger.debug("Download done, now it's time to unzip")
    unzipper = ziptools.ziptools()
    if folder == '':
        unzipper.extract(localfile,addons_dir) #github issues
    else:
        unzipper.extractReplacingMainFolder(localfile,addons_dir,folder)
    logger.debug("Unzip done! cleaning...")
    os.remove(localfile)
    logger.info("Additional addon clean done!")
Exemplo n.º 24
0
try:
    from providers.spliveappcom import Spliveappcom
except:
    logger.error("Crypto-problems detected, probably you need a better platform")
    pass

from window.DefaultWindow import DefaultWindow  # papernews window library

try:
    from window.ImageWindow import windowImage  # teletext window library
except:
    logger.info("No module named PIL was found in the system, hidding teletext library.")
    pass

icon = XBMCUtils.getAddonFilePath("icon.png")


def drawFilmon(page):
    jsonChannels = Filmoncom.getChannelsJSON()
    for itemFirst in jsonChannels:
        if page == "0":
            add_dir(
                itemFirst["title"],
                "http://www.filmon.com/tv/" + itemFirst["alias"],
                4,
                icon,
                "filmoncom",
                itemFirst["title"],
            )
        elif (page == itemFirst["title"]) and itemFirst.has_key("channels"):
Exemplo n.º 25
0
    def __init__(self,noteType='t',noteMessage='',noteImage='',L=140,T=110,W=1000,H=500,Font='font14',TxtColor='0xFF64d1ff',logo='',firstButtonText="Ok",secondButtonText="Cancel"):

        if len(noteImage)==0:
            noteImage=DefaultWindow.DefaultNoteImage
        if (noteType.lower()=='text')  or (noteType.lower()=='t'):
            noteType='t'
        elif (noteType.lower()=='image') or (noteType.lower()=='i'):
            noteType='i'
        self.noteType=noteType
        self.noteMessage=noteMessage
        self.noteImage=noteImage
        self.Font=Font
        self.TxtColor=TxtColor

        self.background=XBMCUtils.getAddonFilePath('resources/images/ContentPanel.png')
        self.BG=xbmcgui.ControlImage(L,T,W,H,self.background,aspectRatio=0,colorDiffuse='0xFF3030FF')

        if logo == '':
            logo = XBMCUtils.getAddonFilePath('icon.png')

        iLogoW=68
        iLogoH=68

        self.iLogo=xbmcgui.ControlImage((L+(W/2))-(iLogoW/2),T+10,iLogoW,iLogoH,logo,aspectRatio=0)

        L2=200
        T2=200
        W2=880
        H2=340
        L3=L2+5
        T3=T2+60
        W3=W2-18
        H3=H2-5-60
        self.ImgMessage=xbmcgui.ControlImage(L2,T2,W2,H2,self.noteImage,aspectRatio=0)
        self.TxtMessage=xbmcgui.ControlTextBox(L2+5,T2,W2-10,H2,font=self.Font,textColor=self.TxtColor)

        focus=XBMCUtils.getAddonFilePath('resources/images/button-focus_lightblue.png')
        nofocus=XBMCUtils.getAddonFilePath('resources/images/button-focus_grey.png')

        w1=120
        h1=35
        w2=160
        h2=35
        spacing1=20

        l2=L+W-spacing1-w2
        t2=T+H-h2-spacing1
        l1=L+W-spacing1-w2-spacing1-w1
        t1=T+H-h1-spacing1

        self.firstButton=xbmcgui.ControlButton(l1,t1,w1,h1,firstButtonText,textColor="0xFF000000",focusedColor="0xFF000000",alignment=2,focusTexture=focus,noFocusTexture=nofocus)
        self.secondButton=xbmcgui.ControlButton(l2,t2,w2,h2,secondButtonText,textColor="0xFF000000",focusedColor="0xFF000000",alignment=2,focusTexture=focus,noFocusTexture=nofocus)

        for z in [self.BG,self.ImgMessage,self.TxtMessage,self.iLogo,self.secondButton,self.firstButton]:
            self.addControl(z)

        for z in [self.BG,self.ImgMessage,self.TxtMessage,self.iLogo,self.secondButton,self.firstButton]:
            z.setAnimations([('WindowOpen','effect=fade delay=0 time=1000 start=0 end=100'),('WindowClose','effect=slide delay=0 time=1000 start=0 end=0,'+str(0-(H+T+10)))])

        self.secondButton.controlLeft(self.firstButton)
        self.secondButton.controlRight(self.firstButton)
        self.firstButton.controlLeft(self.secondButton)
        self.firstButton.controlRight(self.secondButton)

        self.TxtMessage.setText(self.noteMessage)
        self.TxtMessage.autoScroll(20000, 2500, 15000) #all in ms -> delay, scroll speed (less is faster), repeat time
        self.setFocus(self.secondButton)
Exemplo n.º 26
0
 def getChannels(page):
     x = []
     logger.debug("using Mobdro...")
     if str(page) == '0':
         element = {}
         element["title"]="Channels"
         element["link"] = "channels"
         x.append(element)
         element = {}
         element["title"] ="News"
         element["link"] = "news"
         x.append(element)
         element = {}
         element["title"] = "Shows"
         element["link"] = "shows"
         x.append(element)
         element = {}
         element["title"] = "Movies"
         element["link"] = "movies"
         x.append(element)
         element = {}
         element["title"] = "Sports"
         element["link"] = "sports"
         x.append(element)
         element = {}
         element["title"] = "Music"
         element["link"] = "music"
         x.append(element)
         element = {}
         element["title"] = "Gaming"
         element["link"] = "gaming"
         x.append(element)
         element = {}
         element["title"] = "Animals"
         element["link"] = "animals"
         x.append(element)
         element = {}
         element["title"] = "Tech"
         element["link"] = "tech"
         x.append(element)
         element = {}
         element["title"] = "Podcasts"
         element["link"] = "podcasts"
         #x.append(element)
         element = {}
         element["title"] = "Spiritual"
         element["link"] = "spiritual"
         #x.append(element)
         element = {}
         element["title"] = "Others"
         element["link"] = "others"
         x.append(element)
         element = {}
         element["title"] = "Search"
         element["link"] = "search"
         #x.append(element) #TODO
     elif str(page) is not 'search': #action
         logger.debug("launching action: "+page)
         response = Mobdro.channel_list(page)
         x = Mobdro.parse_results(response)
     elif str(page) == "search": #search
         logger.debug("launching action: SEARCH")
         # display keyboard, it will wait for result
         keyboard = XBMCUtils.getKeyboard()
         keyboard.doModal()
         text = ""
         if (keyboard.isConfirmed()):
             text = keyboard.getText()
             response = Mobdro.search_list(text)
             x = Mobdro.parse_results(response)
     return x
Exemplo n.º 27
0
def downloadfile(url,fileName,headers=[],silent=False,notStop=False):
    logger.debug("downloadfile: url="+url)
    logger.debug("downloadfile: fileName="+fileName)

    try:

        try:
            fileName = XBMCUtils.getRightString(fileName)
        except:
            pass
        logger.debug("downloadfile with fileName="+fileName)

        if os.path.exists(fileName) and notStop:
            f = open(fileName, 'r+b')
            existSize = os.path.getsize(fileName)
            
            logger.info("downloadfile: file exists, size=%d" % existSize)
            recordedSize = existSize
            f.seek(existSize)

        elif os.path.exists(fileName) and not notStop:
            logger.info("downloadfile: file exists, dont re-download")
            return

        else:
            existSize = 0
            logger.info("downloadfile: file doesn't exists")

            f = open(fileName, 'wb')
            recordedSize = 0

        if not silent:
            progressDialog = XBMCUtils.getDialogProgress() # Open dialog
            progressDialog.create("plugin",XBMCUtils.getString(10002) ,url,fileName)
        else:
            progressDialog = ""

        socket.setdefaulttimeout(30) #Timeout
    
        h=urllib2.HTTPHandler(debuglevel=0)
        remoteFile = url
        params = None

        request = urllib2.Request(url)

        logger.debug("checking headers... type: "+str(type(headers)))
        if len(headers)>0:
            logger.debug("adding headers...")
            for key in headers.keys():
                logger.debug("Header="+key+": "+headers.get(key))
                request.add_header(key,headers.get(key))
        else:
            logger.debug("headers figure are 0")

        logger.debug("checking resume status...")
        if existSize > 0: #restart
            logger.info("resume is launched!")
            request.add_header('Range', 'bytes=%d-' % (existSize, ))
    
        opener = urllib2.build_opener(h)
        urllib2.install_opener(opener)
        try:
            logger.debug("opening request...")
            connection = opener.open(request)
        except: # End
            logger.error("ERROR: "+traceback.format_exc())
            f.close()
            if not silent:
                progressDialog.close()
        logger.debug("detecting download size...")
    
        try:
            totalFileSize = int(connection.headers["Content-Length"])
        except:
            totalFileSize = 1

        logger.debug("total file size: "+str(totalFileSize))
                
        if existSize > 0:
            totalFileSize = totalFileSize + existSize
    
        logger.debug("Content-Length=%s" % totalFileSize)
    
        blockSize = 100*1024 #Buffer size
    
        bufferReadedSize = connection.read(blockSize)
        logger.info("Starting download, readed=%s" % len(bufferReadedSize))
    
        maxRetries = 5
        
        while len(bufferReadedSize)>0:
            try:
                f.write(bufferReadedSize)
                recordedSize = recordedSize + len(bufferReadedSize)
                percent = int(float(recordedSize)*100/float(totalFileSize))
                totalMB = float(float(totalFileSize)/(1024*1024))
                downloadedMB = float(float(recordedSize)/(1024*1024))

                retries = 0
                while retries <= maxRetries:
                    try:
                        before = time.time()
                        bufferReadedSize = connection.read(blockSize)
                        after = time.time()
                        if (after - before) > 0:
                            speed=len(bufferReadedSize)/((after - before))
                            remainingSize=totalFileSize-recordedSize
                            if speed>0:
                                remainingTime=remainingSize/speed
                            else:
                                remainingTime=0 #infinite

                            if not silent:
                                progressDialog.update( percent , XBMCUtils.getString(10003) % ( downloadedMB , totalMB , percent , speed/1024 , sec_to_hms(remainingTime))) #respect syntax in translations
                        break
                    except:
                        retries = retries + 1
                        logger.info("ERROR downloading buffer, retry %d" % retries)
                        logger.error( traceback.print_exc() )
                
                # if the user stops download proccess...
                try:
                    if progressDialog.iscanceled():
                        logger.info("Download was canceled by user action")
                        f.close()
                        progressDialog.close()
                        return -1
                except:
                    pass
    
                # Something wrong happened
                if retries > maxRetries:
                    logger.error("ERROR, something happened in download proccess")
                    f.close()
                    if not silent:
                        progressDialog.close()
    
                    return -2
    
            except:
                logger.error( traceback.print_exc() )

                f.close()
                if not silent:
                    progressDialog.close()

                return -2

    except:
        pass

    try:
        f.close()
    except:
        pass

    if not silent:
        try:
            progressDialog.close()
        except:
            pass

    logger.info("Finished download proccess")
Exemplo n.º 28
0
    def getChannels(page):
        logger.debug("starting with page from cineestrenos section: "+page)
        if str(page) == '0':
            tradicionalChannels = XBMCUtils.getSettingFromContext(int(sys.argv[1]), "extended_channels")
            logger.debug("using carrusel: "+str(tradicionalChannels))
            if tradicionalChannels=="false":
                page = Cineestrenostv.MAIN_URL+'/carrusel/tv.html'
            else:
                page = Cineestrenostv.MAIN_URL
        html = Cineestrenostv.getContentFromUrl(page,"","",Cineestrenostv.MAIN_URL)
        x = []
        logger.debug("page is: "+page)
        if page.find("/carrusel/tv.html")>-1:
            table = Decoder.extract('<div class="container">',"</div></div></div></div></div>",html)
            for fieldHtml in table.split('<div class="content">'):
                element = {}
                element["link"] = Cineestrenostv.MAIN_URL+Decoder.extract("<div><a href=\"javascript:popUp('..","')",fieldHtml)
                if element["link"] != Cineestrenostv.MAIN_URL:
                    if element["link"].find('/multi')!=-1:
                        logger.debug("found multi link: "+element["link"])
                        element["title"] = Decoder.extract("/multi","/",element["link"])
                    else:
                        element["title"] = Decoder.rExtract("/",".html",element["link"])
                        if element["title"].find(".")>-1:
                            element["title"] = element["title"][:element["title"].rfind(".")]
                    element["thumbnail"] = Decoder.extract(' src="','"',fieldHtml)
                    if element["thumbnail"].find("://")==-1:
                        element["thumbnail"] = Cineestrenostv.MAIN_URL+element["thumbnail"]
                    element["title"] = element["title"].replace("-"," ")
                    logger.debug("found title: "+element["title"]+", link: "+element["link"]+", thumb: "+element["thumbnail"])
                    if element["thumbnail"].find("http")==0 and not(element["title"]=="1" or element["title"]=="venus"):
                        x.append(element)
        elif page == Cineestrenostv.MAIN_URL:
            table = Decoder.extract('<center><table>','</td></tr></table></center>',html)
            for fieldHtml in table.split('<td>'):
                element = {}
                element["link"] = Cineestrenostv.MAIN_URL+"/"+Decoder.extract("<a href=\"/",'"',fieldHtml)
                if element["link"].find('"')>-1:
                    element["link"] = element["link"][0:element["link"].find('"')]
                if element["link"].find('/multi')!=-1:
                    logger.debug("found multi link: "+element["link"])
                    element["title"] = Decoder.extract("/multi","/",element["link"])
                else:
                    logger.debug("found normal link, continue... "+ element["link"])
                    element["title"] = Decoder.extract('" title="','" target',fieldHtml)
                    if element["title"].find('"')>-1:
                        element["title"] = element["title"][0:element["title"].find('"')]
                    if element["title"].find(" online")>-1:
                        element["title"] = element["title"][0:element["title"].find(" online")]
                    if element["title"].find(" Online")>-1:
                        element["title"] = element["title"][0:element["title"].find(" Online")]
                    if element["title"].find(" en directo")>-1:
                        element["title"] = element["title"][0:element["title"].find(" en directo")]

                    element["title"] = element["title"].replace("ver ","")

                #element["title"] = element["title"].decode('utf-8')
                element["thumbnail"] = Decoder.extract('<img src="','" height',fieldHtml)
                if element["thumbnail"].find('"')>-1:
                    element["thumbnail"] = element["thumbnail"][0:element["thumbnail"].find('"')]
                if element["thumbnail"].find("://")==-1:
                    element["thumbnail"] = Cineestrenostv.MAIN_URL+element["thumbnail"]
                if element["thumbnail"]!=Cineestrenostv.MAIN_URL:
                    logger.debug("found title: "+element["title"]+", link: "+element["link"]+", thumb: "+element["thumbnail"])
                    if element["thumbnail"].find("http")==0 and not(element["title"]=="1" or element["title"]=="gran hermano mexico" or element["title"]=="alx syfy" or element["title"]=="intereconomia punto pelota" or element["title"]=="cine" or element["title"].find("-LATINOAMERICA")>-1):
                        x.append(element)
        else:
            logger.debug('extracting channel from: '+page)
            x.append(Cineestrenostv.extractChannel(html,page))
        return x
Exemplo n.º 29
0
def addonUpdater():
	if XBMCUtils.getDialogYesNo(XBMCUtils.getString(10011), updater.getUpdateInfo()):
		updater.update()
Exemplo n.º 30
0
def init():
	params=get_params()

	url=""
	mode=None
	page=""
	provider = ""

	try:
		page=urllib.unquote_plus(params["page"])
	except:
		pass
	try:
		url=urllib.unquote_plus(params["url"])
	except:
		pass
	try:
		mode=int(params["mode"])
	except:
		pass
	try:
		provider=urllib.unquote_plus(params["provider"])
	except:
		pass
	logger.debug("Mode: "+str(mode))
	logger.debug("URL: "+str(url))
	logger.debug("page: "+str(page))
	logger.debug("provider: "+str(provider))
	try:
		if mode==None: #init
			get_main_dirs()
		elif mode==1: #get channels
			getListsUrls(url)
		elif mode == 2: #open video in player
			open(url,page)
		elif mode == 3:
			browse_channels(url,page)
		elif mode == 4:
			browse_channel(url,page,provider)
		elif mode == 5:
			drawFilmonLinks(url, page)
		elif mode == 0: #update
			addonUpdater()
			get_main_dirs()
		elif mode == 97:
			httpProxyUpdater()
		elif mode == 98:
			quasarUpdater()
		elif mode == 99:
			plexusUpdater()
		elif mode == 100: #decode provider link
			decodeAndOpenLink(url,page)
		elif mode == 101:
			openVipgoalLink(url,page)
		elif mode == 102:
			openCineestrenosLink(url,page)
		elif mode == 103:
			openCricFreeLink(url,page)
		elif mode == 104:
			openZopTvLink(url,page)
		elif mode == 105:
			openLive9Link(url,page)
		elif mode == 106:
			openSports4uLink(url,page)
		elif mode == 107:
			openVipracingLink(url,page)
		elif mode == 108:
			openSkylineLink(url,page)
		elif mode == 109:
			openZonasportsLink(url,page)
		elif mode == 110:
			openSports365Link(url,page)
		elif mode == 111:
			openSpliveLink(url,page,provider)
		elif mode == 112:
			openMamahdLink(url,page)
		elif mode == 113:
			openShowsportsLink(url,page)
		elif mode == 114:
			openArenavisionLink(url,page)
		elif mode == 115:
			openYoutubeLink(url,page)
		elif mode == 116:
			openZonaappLink(url,page)
		elif mode == 117:
			drawFilmonLinks(url,page)
		elif mode == 118:
			openTuneInLink(url,page)
		elif mode == 119:
			openYoutvgratisLink(url, page)
		elif mode == 120:
			openYomvies(url,page)
		elif mode == 121:
			openStreamgaroo(url, page)
		elif mode == 122:
			openMobdro(url,page)


	except Exception as e:
		logger.error(XBMCUtils.getString(10009)+", "+str(e))
		XBMCUtils.getNotification("Error",XBMCUtils.getString(10009))
		pass
	if not isAnException(url,page,provider,mode):
		logger.debug("End of main menu to be displayed. Params -> page: "+page+", url: "+url+", provider: "+provider+", mode: "+str(mode))
		XBMCUtils.setEndOfDirectory(int(sys.argv[1]))