Exemplo n.º 1
0
def mejorenvo_index():
    print "mejor en VO!"
    plugin.set_content("movies")

    from bs4 import BeautifulSoup
    from stream.utils import url_get
    from stream import tmdb
    import re

    def filter_Desgargar(el):
        return el.has_attr('href') and '-pelicula-' in el['href'] and not 'comentarios' in el['href']

    for url in ["http://www.mejorenvo.com/descargar-peliculas.html","http://www.mejorenvo.com/peliculas-p2.html"]:
        html_data = url_get( url, headers=HEADERS)
        soup = BeautifulSoup(html_data, "html5lib")
        nodes = soup.findAll(filter_Desgargar)
        for node in nodes:
            id = re.search(r'pelicula-(\d+).html', node['href']).group(1)
            torrent_url = 'http://www.mejorenvo.com/descargar.php?t=peliculas&id=' + id + '&torrent=1'

            title_year = node.get_text()
            title = node.stripped_strings.next()
            info = tmdb.search( title )

            info = info['results'][0]
            print title
            print info
            item = tmdb.get_list_item(info)
            item['label'] = '%s (%f)' % (info['title'], info['vote_average'])
            item['path'] = plugin.url_for("play", uri=torrent_url)
            item['is_playable']=True

            yield item
Exemplo n.º 2
0
def piratebay_record(node):
    import re
    from stream.utils import url_get
    from urlparse import urljoin
    from stream import tmdb

    node.seeds, node.peers = map(lambda x: x.text, node.parent.parent.findAll("td")[2:])
    node.magnet_node = node.parent.findAll("a")[1]
    node.desc_node = node.parent.findAll("font", "detDesc")[0]
    node.size = re.search("Size (.*?),", node.desc_node.text).group(1)
    node.txt = "%s (%s S:%s P:%s)" % (node.a.text, node.size.replace(" ", " "), node.seeds, node.peers)

    node.item = {}
    try:
        node.search_result = url_get(urljoin(BASE_URL, node.parent.findAll("a")[0]["href"]), headers=HEADERS)
    except:
        pass
    else:
        if node.search_result:
            try:
                node.imdb_url = re.search("http://www.imdb.com/title/tt[0-9]*", node.search_result).group(0)
            except:
                pass
            else:
                if node.imdb_url:
                    node.imdb_id = re.search(r"(tt\d+)", node.imdb_url).group(0)

                    if node.imdb_id:
                        node.release_tags = tmdb.get_list_item(tmdb.get(node.imdb_id))

                        if node.release_tags:
                            node.item.update(node.release_tags)

    node.item.update({
        "label": node.txt,
        "path": plugin.url_for("play", uri=node.magnet_node["href"]),
        "is_playable": True,
    })
    return node.item
Exemplo n.º 3
0
def piratebay_page2(root, page):
    import re
    from bs4 import BeautifulSoup
    from urlparse import urljoin
    from stream.utils import url_get
    from stream import tmdb

    page = int(page)
    html_data = url_get(urljoin(BASE_URL, "search/BluRay/%s/7/%s" % (page, root)), headers=HEADERS)
    soup = BeautifulSoup(html_data, "html5lib")
    nodes = soup.findAll("div", "detName")

    for node in nodes:
        seeds, peers = map(lambda x: x.text, node.parent.parent.findAll("td")[2:])
        magnet_node = node.parent.findAll("a")[1]
        desc_node = node.parent.findAll("font", "detDesc")[0]
        size = re.search("Size (.*?),", desc_node.text).group(1)
        text = "%s (%s S:%s P:%s)" % (node.a.text, size.replace(" ", " "), seeds, peers)

        try:
            title = re.search("(.*?)(\d{4}|720p|1080p|\()", node.a.text).group(1).replace(".", " ")
            tmdb_list = tmdb.search(title)
            if len(tmdb_list["results"]) > 0:
                tmdb_meta = tmdb.get(tmdb_list["results"][0]["id"])
                item = tmdb.get_list_item(tmdb_meta)

                width = 1920
                height = 1080
                if node.a.text.find("720p") >= 0:
                    width = 1280
                    height = 720

                item.update({
                    "path": plugin.url_for("play", uri=magnet_node["href"]),
                    "is_playable": True,
                    "label": "%s %sp (%s) S:%s P:%s" % (item["label"], height, size.replace(" ", " "), seeds, peers),
                })

                audio = "aac"
                if node.a.text.find("DTS") >= 0:
                    audio = "dts"

                item.setdefault("stream_info", {}).update({
                    "video": {
                        "codec": "h264",
                        "width": width,
                        "height": height,
                    },
                    "audio": {
                        "codec": audio,
                    },
                })

                yield item
            else:
                yield {
                    "label": text,
                    "path": plugin.url_for("play", uri=magnet_node["href"]),
                    "is_playable": True,
                }
        except Exception as e:
            print e
            yield {
                "label": text,
                "path": plugin.url_for("play", uri=magnet_node["href"]),
                "is_playable": True,
            }

    yield {
        "label": ">> Next page",
        "path": plugin.url_for("piratebay_page2", root=root, page=page + 1),
        "is_playable": False,
    }
Exemplo n.º 4
0
def yify_show_data(callback):
    import xbmc
    import xbmcgui
    from contextlib import nested, closing
    from itertools import izip, chain
    from concurrent import futures
    from stream import tmdb
    from stream.utils import url_get_json, terminating, SafeDialogProgress

    plugin.set_content("movies")
    args = dict((k, v[0]) for k, v in plugin.request.args.items())

    current_page = int(args["set"])
    limit = int(args["limit"])

    with closing(SafeDialogProgress(delay_close=0)) as dialog:
        dialog.create(plugin.name)
        dialog.update(percent=0, line1="Fetching movie information...", line2="", line3="")

        try:
            search_result = url_get_json("%s/api/list.json" % BASE_URL, params=args, headers=HEADERS)
        except:
            plugin.notify("Unable to connect to %s." % BASE_URL)
            raise
        movies = search_result.get("MovieList") or []

        if not movies:
            return

        state = {"done": 0}
        def on_movie(future):
            data = future.result()
            state["done"] += 1
            dialog.update(
                percent=int(state["done"] * 100.0 / len(movies)),
                line2=data.get("title") or data.get("MovieTitleClean") or "",
            )

        with futures.ThreadPoolExecutor(max_workers=2) as pool_tmdb:
            tmdb_list = [pool_tmdb.submit(tmdb.get, movie["ImdbCode"]) for movie in movies]
            [future.add_done_callback(on_movie) for future in tmdb_list]
            while not all(job.done() for job in tmdb_list):
                if dialog.iscanceled():
                    return
                xbmc.sleep(100)

        tmdb_list = map(lambda job: job.result(), tmdb_list)
        for movie, tmdb_meta in izip(movies, tmdb_list):
            if tmdb_meta:
                item = tmdb.get_list_item(tmdb_meta)
                if args.get("quality") == "all" and movie["Quality"] != "720p":
                    item["label"] = "%s (%s)" % (item["label"], movie["Quality"])
                item.update({
                    "path": plugin.url_for("play", uri=movie["TorrentMagnetUrl"]),
                    "is_playable": True,
                })
                item.setdefault("info", {}).update({
                    "count": movie["MovieID"],
                    "genre": "%s (%s S:%s P:%s)" % (item["info"]["genre"], movie["Size"], movie["TorrentSeeds"], movie["TorrentPeers"]),
                    "plot_outline": tmdb_meta["overview"],
                    "video_codec": "h264",
                })
                width = 1920
                height = 1080
                if movie["Quality"] == "720p":
                    width = 1280
                    height = 720
                item.setdefault("stream_info", {}).update({
                    "video": {
                        "codec": "h264",
                        "width": width,
                        "height": height,
                    },
                    "audio": {
                        "codec": "aac",
                    },
                })
                yield item

        if current_page < (int(search_result["MovieCount"]) / limit):
            next_args = args.copy()
            next_args["set"] = int(next_args["set"]) + 1
            yield {
                "label": ">> Next page",
                "path": plugin.url_for(callback, **next_args),
            }