Ejemplo n.º 1
0
def LISTMOVIES(murl, name, index, page=1):
    turl = murl

    totalMoviesToLoad = settings.getNoOfMoviesToLoad()

    dialogWait = xbmcgui.DialogProgress()

    ret = dialogWait.create("Please wait until [Movies] are cached.")
    loadedLinks = 0
    totalLinks = totalMoviesToLoad
    remaining_display = "Movies loaded :: [B]" + str(loadedLinks) + " / " + str(totalLinks) + "[/B]."
    dialogWait.update(0, "[B]Will load instantly from now on[/B]", remaining_display)
    xbmc.executebuiltin("XBMC.Dialog.Close(busydialog,true)")

    quality = None
    hindiMovie = False
    year = None
    pagesScanned = 0
    while (pagesScanned < 5) and (loadedLinks <= totalMoviesToLoad):
        purl = turl
        if int(page) > 1:
            purl = turl + "?paged=" + str(page)
        link = main.OPENURL(purl)
        soup = BeautifulSoup.BeautifulSoup(link).findAll("item")
        for item in soup:
            quality = ""
            hindiMovie = False
            year = ""

            name = item.title.text
            url = item.comments.text.replace("#comments", "")
            for category in item.findAll("category"):
                if category.text == "Hindi Movies":
                    # print item
                    hindiMovie = True
                elif re.search("DVD", category.text, flags=re.I):
                    quality = " [COLOR red][DVD][/COLOR] "
                elif re.search("/*BluRay/*", category.text, flags=re.I):
                    quality = " [COLOR red][HD][/COLOR] "
                elif re.search("[1-2][0,9][0-9][0-9]", category.text, flags=re.I):
                    year = category.text
                if dialogWait.iscanceled():
                    return False
            if dialogWait.iscanceled():
                return False
            if hindiMovie:
                pagesScanned = 0
                main.addDirX(
                    name + quality, url, constants.SOMINAL_LOADVIDEOS, "", searchMeta=True, metaType="Movies", year=year
                )
                loadedLinks = loadedLinks + 1
                percent = (loadedLinks * 100) / totalLinks
                remaining_display = "Movies loaded :: [B]" + str(loadedLinks) + " / " + str(totalLinks) + "[/B]."
                dialogWait.update(percent, "[B]Will load instantly from now on[/B]", remaining_display)
                if loadedLinks >= totalLinks:
                    print "BREAKING"
                    break
                if dialogWait.iscanceled():
                    return False
        if dialogWait.iscanceled():
            return False
        page = str(int(page) + 1)
        pagesScanned = pagesScanned + 1
    dialogWait.close()
    del dialogWait

    main.addDir(
        "[COLOR blue]Next[/COLOR]", murl, constants.SOMINAL_LISTMOVIES, art + "/next.png", index=index, page=str(page)
    )
    xbmcplugin.setContent(int(sys.argv[1]), "Movies")
    main.setSeasonView()
Ejemplo n.º 2
0
def buildCache(murl, channel, cacheFilePath, index):
    channels = {}
    channelDict = {}
    channelData = {}
    tvShows = []
    tvShow = {}
    pastTVShowURL = ""
    link = main.OPENURL(murl)
    link = link.decode("iso-8859-1").encode("utf-8")
    result = common.parseDOM(link, "h2", attrs={"class": "forumtitle"})
    label = "TV Shows"
    if len(result) <= 0:
        label = "Movies"
        result = common.parseDOM(link, "h3", attrs={"class": "threadtitle"})

    dialogWait = xbmcgui.DialogProgress()
    ret = dialogWait.create("Please wait until " + label + " Show list is cached.")
    totalLinks = len(result)
    loadedLinks = 0
    remaining_display = label + " loaded :: [B]" + str(loadedLinks) + " / " + str(totalLinks) + "[/B]."
    dialogWait.update(0, "[B]Will load instantly from now on[/B]", remaining_display)
    xbmc.executebuiltin("XBMC.Dialog.Close(busydialog,true)")

    for item in result:
        name = common.parseDOM(item, "a", attrs={"class": "title threadtitle_unread"})

        if not name:
            name = common.parseDOM(item, "a", attrs={"class": "title"})
            if name:
                name = name[0]
            else:
                name = common.parseDOM(item, "a")
                if len(name) > 1:
                    name = name[1]
                else:
                    name = name[0]
        elif len(name) > 1:
            name = name[1]
        else:
            name = name[0]

        url = common.parseDOM(item, "a", attrs={"class": "title threadtitle_unread"}, ret="href")
        url = common.parseDOM(item, "a", ret="href")

        if not url:
            url = common.parseDOM(item, "a", attrs={"class": "title"}, ret="href")
            if url:
                url = url[0]
        elif len(url) > 1:
            url = url[1]
        else:
            url = url[0]

        if "color" in name:
            name = name.replace("<b><font color=red>", "[COLOR red]").replace("</font></b>", "[/COLOR]")
            name = name.replace('<b><font color="red">', "[COLOR red]").replace("</font></b>", "[/COLOR]")
            pastTVShowURL = MainUrl + url
        elif label == "Movies":
            name = name.replace("Watch Online / Download", "")
            main.addDirX(name, MainUrl + url, constants.DESIRULEZ_VIDEOLINKS, "", searchMeta=True, metaType="Movies")
        else:
            tvShow["url"] = MainUrl + url
            tvShow["iconimage"] = getShowImage(channel, name, 2)
            tvShow["name"] = name
            tvShows.append(tvShow)
            tvShow = {}
        loadedLinks = loadedLinks + 1
        percent = (loadedLinks * 100) / totalLinks
        remaining_display = label + " loaded :: [B]" + str(loadedLinks) + " / " + str(totalLinks) + "[/B]."
        dialogWait.update(percent, "[B]Will load instantly from now on[/B]", remaining_display)
        if dialogWait.iscanceled():
            return False
    dialogWait.close()
    del dialogWait

    # Writing data to JSON File
    jsonChannelData = jsonutil.readJson(cacheFilePath)
    channels = jsonChannelData["channels"]
    try:
        channelData = channels[channel]
    except Exception, e:
        print "exception"
Ejemplo n.º 3
0
def LISTMOVIES(murl, name, index, page=1):
    turl = murl

    totalMoviesToLoad = settings.getNoOfMoviesToLoad()

    dialogWait = xbmcgui.DialogProgress()

    ret = dialogWait.create('Please wait until [Movies] are cached.')
    loadedLinks = 0
    totalLinks = totalMoviesToLoad
    remaining_display = 'Movies loaded :: [B]' + str(
        loadedLinks) + ' / ' + str(totalLinks) + '[/B].'
    dialogWait.update(0, '[B]Will load instantly from now on[/B]',
                      remaining_display)
    xbmc.executebuiltin("XBMC.Dialog.Close(busydialog,true)")

    quality = None
    hindiMovie = False
    year = None
    pagesScanned = 0
    while ((pagesScanned < 5) and (loadedLinks <= totalMoviesToLoad)):
        purl = turl
        if int(page) > 1:
            purl = turl + "?paged=" + str(page)
        link = main.OPENURL(purl)
        soup = BeautifulSoup.BeautifulSoup(link).findAll('item')
        for item in soup:
            quality = ''
            hindiMovie = False
            year = ''

            name = item.title.text
            url = item.comments.text.replace('#comments', '')
            for category in item.findAll('category'):
                if category.text == 'Hindi Movies':
                    #print item
                    hindiMovie = True
                elif re.search('DVD', category.text, flags=re.I):
                    quality = ' [COLOR red][DVD][/COLOR] '
                elif re.search('/*BluRay/*', category.text, flags=re.I):
                    quality = ' [COLOR red][HD][/COLOR] '
                elif re.search('[1-2][0,9][0-9][0-9]',
                               category.text,
                               flags=re.I):
                    year = category.text
                if dialogWait.iscanceled(): return False
            if dialogWait.iscanceled(): return False
            if hindiMovie:
                pagesScanned = 0
                main.addDirX(name + quality,
                             url,
                             constants.SOMINAL_LOADVIDEOS,
                             '',
                             searchMeta=True,
                             metaType='Movies',
                             year=year)
                loadedLinks = loadedLinks + 1
                percent = (loadedLinks * 100) / totalLinks
                remaining_display = 'Movies loaded :: [B]' + str(
                    loadedLinks) + ' / ' + str(totalLinks) + '[/B].'
                dialogWait.update(percent,
                                  '[B]Will load instantly from now on[/B]',
                                  remaining_display)
                if loadedLinks >= totalLinks:
                    print 'BREAKING'
                    break
                if dialogWait.iscanceled(): return False
        if dialogWait.iscanceled(): return False
        page = str(int(page) + 1)
        pagesScanned = pagesScanned + 1
    dialogWait.close()
    del dialogWait

    main.addDir('[COLOR blue]Next[/COLOR]',
                murl,
                constants.SOMINAL_LISTMOVIES,
                art + '/next.png',
                index=index,
                page=str(page))
    xbmcplugin.setContent(int(sys.argv[1]), 'Movies')
    main.setSeasonView()
Ejemplo n.º 4
0
def buildCache(murl, channel, cacheFilePath, index):
    channels = {}
    channelDict = {}
    channelData = {}
    tvShows = []
    tvShow = {}
    pastTVShowURL = ''
    link = main.OPENURL(murl)
    link = link.decode('iso-8859-1').encode('utf-8')
    result = common.parseDOM(link, "h2", attrs={"class": "forumtitle"})
    label = 'TV Shows'
    if len(result) <= 0:
        label = 'Movies'
        result = common.parseDOM(link, "h3", attrs={"class": "threadtitle"})

    dialogWait = xbmcgui.DialogProgress()
    ret = dialogWait.create('Please wait until ' + label +
                            ' Show list is cached.')
    totalLinks = len(result)
    loadedLinks = 0
    remaining_display = label + ' loaded :: [B]' + str(
        loadedLinks) + ' / ' + str(totalLinks) + '[/B].'
    dialogWait.update(0, '[B]Will load instantly from now on[/B]',
                      remaining_display)
    xbmc.executebuiltin("XBMC.Dialog.Close(busydialog,true)")

    for item in result:
        name = common.parseDOM(item,
                               "a",
                               attrs={"class": "title threadtitle_unread"})

        if not name:
            name = common.parseDOM(item, "a", attrs={"class": "title"})
            if name:
                name = name[0]
            else:
                name = common.parseDOM(item, "a")
                if len(name) > 1:
                    name = name[1]
                else:
                    name = name[0]
        elif len(name) > 1:
            name = name[1]
        else:
            name = name[0]

        url = common.parseDOM(item,
                              "a",
                              attrs={"class": "title threadtitle_unread"},
                              ret="href")
        url = common.parseDOM(item, "a", ret="href")

        if not url:
            url = common.parseDOM(item,
                                  "a",
                                  attrs={"class": "title"},
                                  ret="href")
            if url:
                url = url[0]
        elif len(url) > 1:
            url = url[1]
        else:
            url = url[0]

        if "color" in name:
            name = name.replace('<b><font color=red>',
                                '[COLOR red]').replace('</font></b>',
                                                       '[/COLOR]')
            name = name.replace('<b><font color="red">',
                                '[COLOR red]').replace('</font></b>',
                                                       '[/COLOR]')
            pastTVShowURL = MainUrl + url
        elif label == 'Movies':
            name = name.replace('Watch Online / Download', '')
            main.addDirX(name,
                         MainUrl + url,
                         constants.DESIRULEZ_VIDEOLINKS,
                         '',
                         searchMeta=True,
                         metaType='Movies')
        else:
            tvShow['url'] = MainUrl + url
            tvShow['iconimage'] = getShowImage(channel, name, 2)
            tvShow['name'] = name
            tvShows.append(tvShow)
            tvShow = {}
        loadedLinks = loadedLinks + 1
        percent = (loadedLinks * 100) / totalLinks
        remaining_display = label + ' loaded :: [B]' + str(
            loadedLinks) + ' / ' + str(totalLinks) + '[/B].'
        dialogWait.update(percent, '[B]Will load instantly from now on[/B]',
                          remaining_display)
        if dialogWait.iscanceled(): return False
    dialogWait.close()
    del dialogWait

    # Writing data to JSON File
    jsonChannelData = jsonutil.readJson(cacheFilePath)
    channels = jsonChannelData['channels']
    try:
        channelData = channels[channel]
    except Exception, e:
        print 'exception'