예제 #1
0
    def init(self, uri):
        self.display_name = ""
        self.torrent2http_options = {
            "uri":
            uri,
            "dlpath":
            xbmc.validatePath(xbmc.translatePath(plugin.get_setting("dlpath")))
            or ".",
            "dlrate":
            plugin.get_setting("max_download_rate") or "0",
            "encryption":
            plugin.get_setting("encryption"),
        }

        if "://" in self.torrent2http_options["dlpath"]:
            # Translate smb:// url to UNC path on windows, very hackish
            if PLATFORM["os"] == "windows" and self.torrent2http_options[
                    "dlpath"].lower().startswith("smb://"):
                self.torrent2http_options[
                    "dlpath"] = self.torrent2http_options["dlpath"].replace(
                        "smb:", "").replace("/", "\\")
            else:
                plugin.notify(
                    "Downloading to an unmounted network share is not supported. Resetting.",
                    delay=15000)
                plugin.set_setting("dlpath", "")
                self.torrent2http_options["dlpath"] = "."

        # Check for Android and FAT32 SD card issues
        if PLATFORM["os"] == "android" and self.torrent2http_options[
                "dlpath"] != ".":
            from stream.utils import get_path_fs
            fs = get_path_fs(self.torrent2http_options["dlpath"])
            plugin.log.info("Download path filesytem is %s" % fs)
            if fs == "vfat":  # FAT32 is not supported
                plugin.notify(
                    "Downloading to FAT32 is not supported. Resetting.",
                    delay=15000)
                plugin.set_setting("dlpath", "")
                self.torrent2http_options["dlpath"] = "."

        if plugin.get_setting("keep_files", bool):
            plugin.log.info("Will keep file after playback.")
            self.torrent2http_options["keep"] = None
        self.on_playback_started = []
        self.on_playback_resumed = []
        self.on_playback_paused = []
        self.on_playback_stopped = []
        return self
예제 #2
0
파일: utils.py 프로젝트: platbr/Stream
def url_get(url, params={}, headers={}, with_immunicity=True):
    import urllib2
    from contextlib import closing
    from stream import plugin
    from stream.common import USER_AGENT

    if params:
        import urllib
        url = "%s?%s" % (url, urllib.urlencode(params))

    req = urllib2.Request(url)
    req.add_header("User-Agent", USER_AGENT)
    for k, v in headers.items():
        req.add_header(k, v)

    if with_immunicity and plugin.get_setting("immunicity", bool):
        from stream import immunicity
        proxy = immunicity.get_proxy_for(url)
        if proxy:
            from urlparse import urlsplit
            parts = urlsplit(url)
            req.set_proxy(proxy, parts[0])

    try:
        with closing(urllib2.urlopen(req)) as response:
            data = response.read()
            if response.headers.get("Content-Encoding", "") == "gzip":
                import zlib
                return zlib.decompressobj(16 + zlib.MAX_WBITS).decompress(data)
            return data
    except urllib2.HTTPError:
        return None
예제 #3
0
파일: utils.py 프로젝트: dizzelk/Stream
def url_get(url, params={}, headers={}, with_immunicity=True):
    import urllib2
    from contextlib import closing
    from stream import plugin
    from stream.common import USER_AGENT

    if params:
        import urllib
        url = "%s?%s" % (url, urllib.urlencode(params))

    req = urllib2.Request(url)
    req.add_header("User-Agent", USER_AGENT)
    for k, v in headers.items():
        req.add_header(k, v)

    if with_immunicity and plugin.get_setting("immunicity", bool):
        from stream import immunicity
        proxy = immunicity.get_proxy_for(url)
        if proxy:
            from urlparse import urlsplit
            parts = urlsplit(url)
            req.set_proxy(proxy, parts[0])

    try:
        with closing(urllib2.urlopen(req)) as response:
            data = response.read()
            if response.headers.get("Content-Encoding", "") == "gzip":
                import zlib
                return zlib.decompressobj(16 + zlib.MAX_WBITS).decompress(data)
            return data
    except urllib2.HTTPError:
        return None
예제 #4
0
파일: ga.py 프로젝트: dizzelk/Stream
def track_page(path, force=False):
    if not plugin.get_setting("ga_disable", bool) or force:
        try:
            from pyga.requests import Page
            tracker, session, visitor = get_ga()
            plugin.log.info("GA: Tracking %s" % path)
            tracker.track_pageview(Page(path), session, visitor)
        except Exception, e:
            import traceback
            plugin.log.error("GA: Call failed.")
            plugin.log.error(traceback.format_exc())
예제 #5
0
파일: ga.py 프로젝트: dizzelk/Stream
def track_event(*args, **kwargs):
    if not plugin.get_setting("ga_disable", bool) or kwargs.pop("force", False):
        try:
            from pyga.requests import Event
            tracker, session, visitor = get_ga()
            plugin.log.info("GA: Tracking event %s" % repr(args))
            tracker.track_event(Event(*args, **kwargs), session, visitor)
        except Exception, e:
            import traceback
            plugin.log.error("GA: Call failed.")
            plugin.log.error(traceback.format_exc())
예제 #6
0
파일: ga.py 프로젝트: platbr/Stream
def track_page(path, force=False):
    if not plugin.get_setting("ga_disable", bool) or force:
        try:
            from pyga.requests import Page
            tracker, session, visitor = get_ga()
            plugin.log.info("GA: Tracking %s" % path)
            tracker.track_pageview(Page(path), session, visitor)
        except Exception, e:
            import traceback
            plugin.log.error("GA: Call failed.")
            plugin.log.error(traceback.format_exc())
예제 #7
0
파일: ga.py 프로젝트: platbr/Stream
def track_event(*args, **kwargs):
    if not plugin.get_setting("ga_disable", bool) or kwargs.pop(
            "force", False):
        try:
            from pyga.requests import Event
            tracker, session, visitor = get_ga()
            plugin.log.info("GA: Tracking event %s" % repr(args))
            tracker.track_event(Event(*args, **kwargs), session, visitor)
        except Exception, e:
            import traceback
            plugin.log.error("GA: Call failed.")
            plugin.log.error(traceback.format_exc())
예제 #8
0
파일: player.py 프로젝트: fibelatti/Stream
    def init(self, uri):
        self.display_name = ""
        self.torrent2http_options = {
            "uri": uri,
            "dlpath": xbmc.validatePath(xbmc.translatePath(plugin.get_setting("dlpath"))) or ".",
            "dlrate": plugin.get_setting("max_download_rate") or "0",
            "encryption": plugin.get_setting("encryption"),
        }

        if "://" in self.torrent2http_options["dlpath"]:
            # Translate smb:// url to UNC path on windows, very hackish
            if PLATFORM["os"] == "windows" and self.torrent2http_options["dlpath"].lower().startswith("smb://"):
                self.torrent2http_options["dlpath"] = (
                    self.torrent2http_options["dlpath"].replace("smb:", "").replace("/", "\\")
                )
            else:
                plugin.notify("Downloading to an unmounted network share is not supported. Resetting.", delay=15000)
                plugin.set_setting("dlpath", "")
                self.torrent2http_options["dlpath"] = "."

        # Check for Android and FAT32 SD card issues
        if PLATFORM["os"] == "android" and self.torrent2http_options["dlpath"] != ".":
            from stream.utils import get_path_fs

            fs = get_path_fs(self.torrent2http_options["dlpath"])
            plugin.log.info("Download path filesytem is %s" % fs)
            if fs == "vfat":  # FAT32 is not supported
                plugin.notify("Downloading to FAT32 is not supported. Resetting.", delay=15000)
                plugin.set_setting("dlpath", "")
                self.torrent2http_options["dlpath"] = "."

        if plugin.get_setting("keep_files", bool):
            plugin.log.info("Will keep file after playback.")
            self.torrent2http_options["keep"] = None
        self.on_playback_started = []
        self.on_playback_resumed = []
        self.on_playback_paused = []
        self.on_playback_stopped = []
        return self
예제 #9
0
파일: eztv.py 프로젝트: frjanibo/Stream
from stream import plugin
from stream.scrapers import scraper
from stream.ga import tracked
from stream.caching import cached_route, shelf
from stream.utils import ensure_fanart
from stream.library import library_context


BASE_URL = "%s/" % plugin.get_setting("base_eztv")
HEADERS = {
    "Referer": BASE_URL,
}
SHOW_LIST_CACHE_TTL = 24 * 3600 # 24 hours caching


# Logo found on http://thesimurg.deviantart.com/art/Logo-for-EZTV-57874544 - , "http://i.imgur.com/XcH6WOg.jpg")
@scraper("TV Shows")
@plugin.route("/eztv")
@tracked
def eztv_index():
    import string
    for letter in ["0-9"] + list(string.ascii_uppercase):
        yield {
            "label": letter,
            "path": plugin.url_for("eztv_shows_by_letter", letter=letter),
            "is_playable": False,
        }


@plugin.route("/eztv/shows/<letter>")
@cached_route(ttl=SHOW_LIST_CACHE_TTL, content_type="tvshows")
예제 #10
0
파일: espoiler.py 프로젝트: frjanibo/Stream
from stream.caching import cached_route
from stream.utils import ensure_fanart
from stream.library import library_context
from stream.utils import url_get
from bs4 import BeautifulSoup
import re
import requests
import json

BASE_URL = "http://www.espoilertv.com/"
HEADERS = {
    "Referer": BASE_URL,
}

payload = {
        'mail':plugin.get_setting("espoiler_user"),
        'pass':plugin.get_setting("espoiler_pass")
    }
s = requests.Session()
p = s.post(BASE_URL+'serv/asincrono/logOn.php', data=payload)
print p.content


@plugin.route("/espoiler/marcar/<idEpisodio>/<accion>")
def espoiler_marcar_visto(idEpisodio, accion):
    import xbmc
    r = s.post(BASE_URL+"api/v1/mitv", {'accion':accion, 'idEpisodio':idEpisodio} )
    print r.content
    xbmc.executebuiltin('Container.Refresh')

@scraper("Espoiler TV")
예제 #11
0
파일: yify.py 프로젝트: platbr/Stream
from stream import plugin
from stream.scrapers import scraper
from stream.ga import tracked
from stream.caching import cached_route
from stream.utils import ensure_fanart
from stream.library import library_context


BASE_URL = "%s/" % plugin.get_setting("base_yify")
HEADERS = {
    "Referer": BASE_URL,
}
YOUTUBE_ACTION = "plugin://plugin.video.youtube/?path=/root/video&action=play_video&videoid=%s"
MOVIES_PER_PAGE = 50
GENRES = [
    "Action",
    "Adventure",
    "Animation",
    "Biography",
    "Comedy",
    "Crime",
    "Documentary",
    "Drama",
    "Family",
    "Fantasy",
    "History",
    "Horror",
    "Music",
    "Mystery",
    "Romance",
    "Sci-Fi",
예제 #12
0
import os
import sys
import stat
import subprocess
import xbmcaddon
from stream.common import RESOURCES_PATH
from stream.platform import PLATFORM
from stream.utils import url_get
from stream import plugin

ANDROID_XBMC_IDS = [
    "org.xbmc.xbmc",  # Stock XBMC
    "tv.ouya.xbmc",  # OUYA XBMC
    "com.semperpax.spmc",  # SemPer Media Center (OUYA XBMC fork)
    "hk.minix.xbmc",  # Minix XBMC
    plugin.get_setting("android_app_id"),  # Whatever the user sets
]


def ensure_exec_perms(file_):
    st = os.stat(file_)
    os.chmod(file_, st.st_mode | stat.S_IEXEC)
    return file_


def get_torrent2http_binary():
    binary = "torrent2http%s" % (PLATFORM["os"] == "windows" and ".exe" or "")

    platform = PLATFORM.copy()
    if platform["os"] == "darwin":  # 64 bits anyway on Darwin
        platform["arch"] = "x64"
예제 #13
0
파일: eztv.py 프로젝트: platbr/Stream
from stream import plugin
from stream.scrapers import scraper
from stream.ga import tracked
from stream.caching import cached_route, shelf
from stream.utils import ensure_fanart
from stream.library import library_context


BASE_URL = "%s/" % plugin.get_setting("base_eztv")
HEADERS = {
    "Referer": BASE_URL,
}
SHOW_LIST_CACHE_TTL = 24 * 3600 # 24 hours caching


# Logo found on http://thesimurg.deviantart.com/art/Logo-for-EZTV-57874544 - , "http://i.imgur.com/XcH6WOg.jpg")
@scraper("TV Shows")
@plugin.route("/eztv")
@tracked
def eztv_index():
    import string
    for letter in ["0-9"] + list(string.ascii_uppercase):
        yield {
            "label": letter,
            "path": plugin.url_for("eztv_shows_by_letter", letter=letter),
            "is_playable": False,
        }


@plugin.route("/eztv/shows/<letter>")
@cached_route(ttl=SHOW_LIST_CACHE_TTL, content_type="tvshows")
예제 #14
0
import sys
import stat
import subprocess
import xbmcaddon
from stream.common import RESOURCES_PATH
from stream.platform import PLATFORM
from stream.utils import url_get
from stream import plugin


ANDROID_XBMC_IDS = [
    "org.xbmc.xbmc",                        # Stock XBMC
    "tv.ouya.xbmc",                         # OUYA XBMC
    "com.semperpax.spmc",                   # SemPer Media Center (OUYA XBMC fork)
    "hk.minix.xbmc",                        # Minix XBMC
    plugin.get_setting("android_app_id"),   # Whatever the user sets
]


def ensure_exec_perms(file_):
    st = os.stat(file_)
    os.chmod(file_, st.st_mode | stat.S_IEXEC)
    return file_


def get_torrent2http_binary():
    binary = "torrent2http%s" % (PLATFORM["os"] == "windows" and ".exe" or "")

    platform = PLATFORM.copy()
    if platform["os"] == "darwin": # 64 bits anyway on Darwin
        platform["arch"] = "x64"
예제 #15
0
파일: tpb.py 프로젝트: alexanderwink/Stream
from stream import plugin
from stream.scrapers import scraper
from stream.ga import tracked
from stream.caching import cached_route
from stream.utils import ensure_fanart
from stream.library import library_context
import logging


# Temporary, will be fixed later by them
IMMUNICITY_TPB_URL = "http://thepiratebay.pe"
BASE_URL = "%s/" % (plugin.get_setting("immunicity", bool) and IMMUNICITY_TPB_URL or plugin.get_setting("base_tpb"))
HEADERS = {
    "Referer": BASE_URL,
}


CATEGORIES = [
    ("Audio", 100, [
        ("Music", 101),
        ("Audiobooks", 102),
    ]),

    ("Video", 200, [
        ("Movies - SD", 201),
        ("Movies - DVDR", 202),
        ("Movies - HD", 207),
        ("Movie Clips", 204),
        ("Music Videos", 203),
        ("TV Shows - SD", 205),
        ("TV Shows - HD", 208),
예제 #16
0
파일: index.py 프로젝트: frjanibo/Stream
import socket
from stream import plugin, magnet, scrapers, socks
from socks import wrapmodule
from stream.ga import tracked
from stream.utils import ensure_fanart
from stream.platform import PLATFORM
from stream.scrapers import \
    MODULES, \
    espoiler, \
    popcorn, \
    yify, \
    mejorenvo, \
    eztv, \
    tpb

if plugin.get_setting("use_socks", bool):
    socks.set_default_proxy(socks.SOCKS5, plugin.get_setting("proxy_url"), plugin.get_setting("proxy_port"), plugin.get_setting("proxy_user"), plugin.get_setting("proxy_pass"))
    socket.socket = socks.socksocket

@plugin.route("/")
@tracked(force=True)
def index():
    if PLATFORM["os"] not in ["android", "linux", "windows", "darwin"]:
        plugin.notify("Your system \"%(os)s_%(arch)s\" is not supported. Sorry about that." % PLATFORM, delay=15000)

    for module in MODULES:
        yield {
            "label": module["name"],
            "thumbnail": module["image"],
            "path": plugin.url_for(module["view"]),
        }
예제 #17
0
from stream import plugin
from stream.scrapers import scraper
from stream.ga import tracked
from stream.caching import cached_route
from stream.utils import ensure_fanart
from stream.library import library_context


# Temporary, will be fixed later by them
IMMUNICITY_TPB_URL = "http://thepiratebay.pe"
BASE_URL = "%s/" % (plugin.get_setting("immunicity", bool) and IMMUNICITY_TPB_URL or plugin.get_setting("base_tpb"))
HEADERS = {
    "Referer": BASE_URL,
}


CATEGORIES = [
    ("Audio", 100, [
        ("Music", 101),
        ("Audiobooks", 102),
    ]),

    ("Video", 200, [
        ("Movies - SD", 201),
        ("Movies - DVDR", 202),
        ("Movies - HD", 207),
        ("Movie Clips", 204),
        ("Music Videos", 203),
        ("TV Shows - SD", 205),
        ("TV Shows - HD", 208),
    ]),