Пример #1
0
 def getBufferSize(self, message):
     global max_buffer_size
     if message == "" and plugin.get_setting("download_full_file", bool) == False:
         BUFFERSIZE = float(plugin.get_setting("min_download_size"))
     else:
         BUFFERSIZE = max_buffer_size
     return BUFFERSIZE
Пример #2
0
 def getBufferSize(self, extension):
     if plugin.get_setting("download_full_file", bool) or plugin.get_setting("download_full_file_MP4_M4V", bool) and (extension == ".mp4" or extension == ".m4v"):
         BUFFERSIZE = 1000000000000000000
         #Make BUFFERSIZE bigger than any video could be so the whole video downloads
         return BUFFERSIZE
     else:
         BUFFERSIZE = float(plugin.get_setting("min_download_size"))
         return BUFFERSIZE
Пример #3
0
 def getExtensionMessage(self, extension):
     message = ""
     if (extension == ".mp4" or extension == ".m4v") and plugin.get_setting("download_full_file_MP4_M4V", bool) and plugin.get_setting("MP4_M4V_message", bool):
         message = "File type is %s the whole file will download" % extension
     elif (extension == ".mp4" or extension == ".m4v") and plugin.get_setting("download_full_file_MP4_M4V", bool) == False and plugin.get_setting("MP4_M4V_message", bool):
         message = "%s files may not play. See settings to fix" % extension
     else:
         message = ""
     return message
Пример #4
0
def do_login():
    r = s.post('%s/takelogin.php' % BASE_URL,
               data={
                   'username': plugin.get_setting('z_usr'),
                   'password': plugin.get_setting('z_pass')
               },
               headers=HEADERS)
    if re.search(plugin.get_setting('z_usr'), r.text, re.IGNORECASE):
        return True
Пример #5
0
def url_get(url, params={}, headers={}, with_immunicity=True):
    import urllib2
    from contextlib import closing
    from koditorrent import plugin
    from koditorrent.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 koditorrent 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
Пример #6
0
def url_get(url, params={}, headers={}, with_immunicity=True):
    import urllib2
    from contextlib import closing
    from koditorrent import plugin
    from koditorrent.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 koditorrent 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
Пример #7
0
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())
Пример #8
0
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())
Пример #9
0
 def getExtensionMessage(self, extension):
     message = ""
     fileCanStream = False
     filename = os.path.join(plugin.get_setting("dlpath"), self.display_name)
     isFile = os.path.isfile(filename)
     if isFile:
         fileCanStream = processor.process(filename, filename);
         if (extension == ".mp4" or extension == ".m4v") and isFile and fileCanStream:
             message = ""                   
         elif (extension == ".mp4" or extension == ".m4v") and isFile and fileCanStream == False:
             message = "File can not fast start. The whole file must download."
     return message
Пример #10
0
def kat_index():
    cats = [
        {"label": "Search", "path": plugin.url_for("kat_search", sort_field="seeders", sort_order="desc")},
        {"label": "Movies", "path": plugin.url_for("kat_movies")},
        {"label": "Series", "path": plugin.url_for("kat_series", sort_field="seeders", sort_order="desc")},
        {"label": "Anime", "path": plugin.url_for("kat_anime")},
    ]
    if plugin.get_setting("p**n", bool):
        cats += [
            {"label": "XXX", "path": plugin.url_for("kat_porn")},
        ]
    return cats
Пример #11
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 koditorrent.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
Пример #12
0
    def init(self, uri, subtitles):
        if plugin.get_setting("dlpath") == "":
            addon = xbmcaddon.Addon()
            addonname = addon.getAddonInfo('name')
            line1 = "You have not set a download path in the settings."
            if plugin.get_setting("keep_files", bool):
                line2 = "This path will be used to store all your downloads."
            else:
                line2 = "This path will be used to store temp files that will be deleted after playback stops."
            line3 = "File will not play until a download path is set."
            xbmcgui.Dialog().ok(addonname,line1, line2, line3)
            raise Exception("Download path not set: You must set a download path in the settings.")
        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 koditorrent.utils import get_path_fs
            fs = get_path_fs(self.torrent2http_options["dlpath"])
            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 = []
        self.subtitles = subtitles
        return self
Пример #13
0
from koditorrent import plugin
from koditorrent.scrapers import scraper
from koditorrent.ga import tracked
from koditorrent.caching import cached_route
from koditorrent.utils import ensure_fanart
from koditorrent.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 = [
    ("Movies", 201, [
        ("in HD", 207),
        ("in 3D", 209),
    ]),
    ("Music videos", 203),
    ("TV shows", 205, [
        ("in HD", 208),
    ]),
    ("Other", 299),
]

if plugin.get_setting("p**n", bool):
    CATEGORIES += [
        ("XXX", 500, [
            ("Movies", 501),
Пример #14
0
from koditorrent import plugin
from koditorrent.scrapers import scraper
from koditorrent.ga import tracked
from koditorrent.caching import cached_route
from koditorrent.utils import ensure_fanart

# Temporary, will be fixed later by them
BASE_URL = "%s/" % plugin.get_setting("base_nyaa")
HEADERS = {
    "Referer": BASE_URL,
}

CATEGORIES = [
    ("Anime", "1_0", (
        ("English-translated Anime", "1_37"),
        ("Raw Anime", "1_11"),
        ("Non-English-translated Anime", "1_38"),
        ("Anime Music Video", "1_32"),
    )),
    ("Live Action (movies)", "5_0", (
        ("English-translated Live Action", "5_19"),
        ("Raw Live Action", "5_20"),
        ("Non-English-translated Live Action", "5_21"),
        ("Live Action Promotional Video", "5_22"),
    )),
]

SORT_DATE = 1
SORT_SEEDERS = 2
SORT_LEECHERS = 3
SORT_DOWNLOADS = 4
Пример #15
0
import stat
import subprocess
import xbmcaddon
from koditorrent.common import RESOURCES_PATH
from koditorrent.platform import PLATFORM
from koditorrent.utils import url_get
from koditorrent import plugin


ANDROID_XBMC_IDS = [
    "org.xbmc.kodi",                        # Stock XBMC Kodi
    "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"
Пример #16
0
from koditorrent import plugin
from koditorrent.scrapers import scraper
from koditorrent.ga import tracked
from koditorrent.caching import cached_route
from koditorrent.utils import ensure_fanart
from koditorrent.library import library_context


BASE_URL = plugin.get_setting("base_btdigg")
HEADERS = {
    "Referer": BASE_URL,
}
SORT_RELEVANCE = 0
SORT_POPULARITY = 1
SORT_ADDTIME = 2
SORT_SIZE = 3
SORT_FILES = 4


@scraper("%s"%plugin.get_setting("btdigg_label"), "%s"%plugin.get_setting("btdigg_picture"))
@plugin.route("/btdigg")
@ensure_fanart
@tracked
def btdigg_index():
    plugin.redirect(plugin.url_for("btdigg_search"))


@plugin.route("/btdigg/search/<query>/<sort>/<page>")
@library_context
@ensure_fanart
@tracked
Пример #17
0
from koditorrent import plugin
from koditorrent.scrapers import scraper
from koditorrent.ga import tracked
from koditorrent.caching import cached_route
from koditorrent.utils import ensure_fanart
from koditorrent.library import library_context

BASE_URL = "%s/" % plugin.get_setting("base_bitsnoop")
HEADERS = {
    "Referer": BASE_URL,
}
# Cache TTLs
DEFAULT_TTL = 24 * 3600  # 24 hours


@scraper("%s" % plugin.get_setting("bitsnoop_label"),
         "%s" % plugin.get_setting("bitsnoop_picture"))
@plugin.route("/bitsnoop")
@ensure_fanart
@tracked
def bitsnoop_index():
    plugin.redirect(plugin.url_for("bitsnoop_search"))


@plugin.route("/bitsnoop/browse/<root>/<page>")
@library_context
@ensure_fanart
@tracked
def bitsnoop_page(root, page):
    from urlparse import urljoin
    from koditorrent.scrapers import rss
Пример #18
0
from koditorrent import plugin
from koditorrent.scrapers import scraper
from koditorrent.ga import tracked
from koditorrent.caching import cached_route, shelf
from koditorrent.utils import ensure_fanart
from koditorrent.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

@scraper("%s"%str(plugin.get_setting("eztv_label")), "%s"%str(plugin.get_setting("eztv_picture")))
@plugin.route("/eztv")
@ensure_fanart
@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")
@ensure_fanart
Пример #19
0
from koditorrent import plugin
from koditorrent.scrapers import scraper
from koditorrent.ga import tracked
from koditorrent.caching import cached_route, shelf
from koditorrent.utils import ensure_fanart
from koditorrent.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

@scraper("TV Shows", "http://i.imgur.com/FDwFjse.png")
@plugin.route("/eztv")
@ensure_fanart
@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")
@ensure_fanart
Пример #20
0
import socket
from koditorrent import plugin, magnet, scrapers
from koditorrent.ga import tracked
from koditorrent.utils import ensure_fanart
from koditorrent.platform import PLATFORM

scrapers = [
    "eztv", "yify", "tpb", "kickass", "bitsnoop", "btdigg", "extratorrent",
    "nyaa", "zelka"
]
scrapersToDisplay = []
for scraper in scrapers:
    if plugin.get_setting("display_%s" % scraper, bool):
        scrapersToDisplay.append("%s" % scraper)

from koditorrent.scrapers import \
    MODULES
for scraper in scrapersToDisplay:
    __import__("koditorrent.scrapers", fromlist=[scraper])


@plugin.route("/")
@ensure_fanart
@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." %
                      PLATFORM,
                      delay=15000)

    for module in MODULES:
Пример #21
0
from koditorrent import plugin
from koditorrent.scrapers import scraper
from koditorrent.ga import tracked
from koditorrent.caching import cached_route
from koditorrent.utils import ensure_fanart
from koditorrent.library import library_context


BASE_URL = "%s/" % plugin.get_setting("base_bitsnoop")
HEADERS = {
    "Referer": BASE_URL,
}
# Cache TTLs
DEFAULT_TTL = 24 * 3600 # 24 hours


@scraper("%s"%plugin.get_setting("bitsnoop_label"), "%s"%plugin.get_setting("bitsnoop_picture"))
@plugin.route("/bitsnoop")
@ensure_fanart
@tracked
def bitsnoop_index():
    plugin.redirect(plugin.url_for("bitsnoop_search"))


@plugin.route("/bitsnoop/browse/<root>/<page>")
@library_context
@ensure_fanart
@tracked
def bitsnoop_page(root, page):
    from urlparse import urljoin
    from koditorrent.scrapers import rss
Пример #22
0
from koditorrent import plugin
from koditorrent.scrapers import scraper
from koditorrent.ga import tracked
from koditorrent.caching import cached_route
from koditorrent.utils import ensure_fanart
from koditorrent.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 = [
    ("Movies", 201, [
        ("in HD", 207),
        ("in 3D", 209),
    ]),
    ("Music videos", 203),
    ("TV shows", 205, [
        ("in HD", 208),
    ]),
    ("Other", 299),
]

if plugin.get_setting("p**n", bool):
    CATEGORIES += [
        ("XXX", 500, [
Пример #23
0
from koditorrent import plugin
from koditorrent.scrapers import scraper
from koditorrent.ga import tracked
from koditorrent.caching import cached_route
from koditorrent.utils import ensure_fanart


BASE_URL = "%s/" % plugin.get_setting("base_kickass")
HEADERS = {
    "Referer": BASE_URL,
}

MOVIES_GENRES = [
    "Action", "Adult", "Adventure", "Animation", "Biography", "Comedy", "Crime",
    "Documentary", "Drama", "Family", "Fantasy", "Film Noir", "Game Show",
    "History", "Horror", "Music", "Musical", "Mystery", "News", "Reality Tv",
    "Romance", "Sci Fi", "Short", "Sport", "Talk Show", "Thriller", "War",
    "Western",
]

MOVIES_CATEGORIES = [
    "3D Movies", "Music videos", "Movie clips", "Handheld", "iPad",
    "Highres Movies", "Bollywood", "Concerts", "Dubbed Movies", "Asian",
    "Documentary", "Trailer", "Other Movies",
]

TV_TAGS = [
    "Action", "Adventure", "Animation General", "Anime", "Anthology",
    "Celebrities", "Children", "Children Cartoons", "Comedy", "Cooking Food",
    "Cooking-Food", "Crime", "Current Events", "Discovery Science",
    "Discovery-Science", "Drama", "Educational", "Family", "Fantasy", "History",
Пример #24
0
from koditorrent import plugin
from koditorrent.scrapers import scraper
from koditorrent.ga import tracked
from koditorrent.caching import cached_route, shelf
from koditorrent.utils import ensure_fanart
from koditorrent.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


@scraper("%s" % str(plugin.get_setting("eztv_label")),
         "%s" % str(plugin.get_setting("eztv_picture")))
@plugin.route("/eztv")
@ensure_fanart
@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")
Пример #25
0
from koditorrent import plugin
from koditorrent.scrapers import scraper
from koditorrent.ga import tracked
from koditorrent.caching import cached_route
from koditorrent.utils import ensure_fanart
from koditorrent.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 = [
    ("Movies", 201, [
        ("in HD", 207),
        ("in 3D", 209),
    ]),
    ("Music videos", 203),
    ("TV shows", 205, [
        ("in HD", 208),
    ]),
    ("Other", 299),
]

if plugin.get_setting("p**n", bool):
    CATEGORIES += [
        ("XXX", 500, [
import stat
import time
import subprocess
import xbmcaddon
from koditorrent.common import RESOURCES_PATH
from koditorrent.platform import PLATFORM
from koditorrent.utils import url_get
from koditorrent import plugin

ANDROID_XBMC_IDS = [
    "org.xbmc.kodi",  # Stock XBMC Kodi
    "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"
Пример #27
0
from koditorrent import plugin
from koditorrent.scrapers import scraper
from koditorrent.ga import tracked
from koditorrent.caching import cached_route
from koditorrent.utils import ensure_fanart
from koditorrent.library import library_context

BASE_URL = plugin.get_setting("base_btdigg")
HEADERS = {
    "Referer": BASE_URL,
}
SORT_RELEVANCE = 0
SORT_POPULARITY = 1
SORT_ADDTIME = 2
SORT_SIZE = 3
SORT_FILES = 4


@scraper("%s" % plugin.get_setting("btdigg_label"),
         "%s" % plugin.get_setting("btdigg_picture"))
@plugin.route("/btdigg")
@ensure_fanart
@tracked
def btdigg_index():
    plugin.redirect(plugin.url_for("btdigg_search"))


@plugin.route("/btdigg/search/<query>/<sort>/<page>")
@library_context
@ensure_fanart
@tracked
Пример #28
0
from koditorrent import plugin
from koditorrent.scrapers import scraper
from koditorrent.ga import tracked
from koditorrent.caching import cached_route
from koditorrent.utils import ensure_fanart


BASE_URL = "%s/" % plugin.get_setting("base_extratorrent")
HEADERS = {
    "Referer": BASE_URL,
}
# Cache TTLs
DEFAULT_TTL = 24 * 3600 # 24 hours

MOVIES_CATEGORIES = [
    ("Action", "419"),
    ("Adventure", "28"),
    ("Animation", "29"),
    ("Asian", "30"),
    ("Automotive/Cars", "32"),
    ("Biography", "628"),
    ("Bollywood", "558"),
    ("Comedy", "33"),
    ("Concerts", "34"),
    ("Crime", "600"),
    ("Documentary", "35"),
    ("Drama", "37"),
    ("Dubbed Movies", "742"),
    ("DVD / Film Extras", "36"),
    ("Family", "149"),
    ("Fantasy", "38"),
Пример #29
0
from koditorrent import plugin
from koditorrent.scrapers import scraper
from koditorrent.ga import tracked
from koditorrent.caching import cached_route
from koditorrent.utils import ensure_fanart


# Temporary, will be fixed later by them
BASE_URL = "%s/" % plugin.get_setting("base_nyaa")
HEADERS = {
    "Referer": BASE_URL,
}


CATEGORIES = [
    ("Anime", "1_0", (
        ("English-translated Anime", "1_37"),
        ("Raw Anime", "1_11"),
        ("Non-English-translated Anime", "1_38"),
        ("Anime Music Video", "1_32"),
    )),
    ("Live Action (movies)", "5_0", (
        ("English-translated Live Action", "5_19"),
        ("Raw Live Action", "5_20"),
        ("Non-English-translated Live Action", "5_21"),
        ("Live Action Promotional Video", "5_22"),
    )),
]

SORT_DATE = 1
SORT_SEEDERS = 2
Пример #30
0
from koditorrent.library import library_context

import koditorrent.magnet as magnet
import requests
import re
from bs4 import BeautifulSoup
from bs4 import SoupStrainer

CUSTOM_TRACKERS = [
    "http://tracker.zelka.org/announce.php?passkey=28878cff72aef4b3d08765455c64c1bb",
    "http://flashtorrents.org/announce.php", "http://94.228.192.98/announce",
    "udp://9.rarbg.com:2710/announce"
]
magnet.PUBLIC_TRACKERS += CUSTOM_TRACKERS

BASE_URL = plugin.get_setting("base_zelka")
categories = [{
    'cat_ids': '5',
    'cat_name': u'Hd Movies'
}, {
    'cat_ids': '31',
    'cat_name': u'Science Movies'
}, {
    'cat_ids': '28',
    'cat_name': u'Russian Movies'
}, {
    'cat_ids': '35',
    'cat_name': u'x264 Movies'
}, {
    'cat_ids': '24',
    'cat_name': u'Bg Movies'
Пример #31
0
    def loop(self):
        from koditorrent.utils import SafeDialogProgress

        has_resolved = False

        plugin.log.info("Starting torrent2http...")
        with closing(torrent2http.start(**self.torrent2http_options)) as t2h_instance:
            t2h = lambda cmd: url_get_json("http://%s/%s" % (t2h_instance.bind_address, cmd), with_immunicity=False)
            if not self._wait_t2h_startup(t2h):
                return

            plugin.log.info("Opening download dialog...")
            with closing(SafeDialogProgress(delay_create=0)) as dialog:
                dialog.create(plugin.name)

                plugin.log.info("Waiting for file resolution...")
                
                while not has_resolved:
                    if xbmc.abortRequested or dialog.iscanceled():
                        return

                    status = t2h("status")
                    self.display_name = status["name"]
                    global buffer_percentage
                    global extension_message
                    global max_buffer_size
                    extension = self.getFileExtension(self.display_name)
                    BUFFERSIZE = self.getBufferSize(extension_message)
                    
                    if status["state"] >= 0 and buffer_percentage < 100 and BUFFERSIZE != max_buffer_size and extension_message == "":
                        dialog.update(int(buffer_percentage), *self._get_status_lines(status, "")) #buffering
                    elif status["state"] >= 0 and buffer_percentage >= 100 or BUFFERSIZE == max_buffer_size or extension_message != "": 
                        dialog.update(int(status["progress"] * 100), *self._get_status_lines(status, extension_message))#done buffering

                    if status["state"] >= 3 and not has_resolved: # Downloading?
                        files = t2h("ls")["files"]
                        progress = float(t2h("status")["progress"])
                        biggest_file = sorted(files, key=lambda x: x["size"])[-1]
                        biggest_file["name"] = biggest_file["name"].encode("utf-8")

                        # Estimate the video size using the biggest file size
                        # and the progress (progress is: <pcnt downloaded> / 100.0)
                        bytes_complete = float(biggest_file["size"]) * progress
                        mb_complete = bytes_complete / 1024.0 / 1024.0
                        buffer_percentage = (mb_complete / float(plugin.get_setting("min_download_size"))) * 100
                        if buffer_percentage >= 100 and BUFFERSIZE != max_buffer_size:
                            extension_message = self.getExtensionMessage(extension)
                        if extension_message == "File can not fast start. The whole file must download.":
                            BUFFERSIZE = max_buffer_size
                            
                        if mb_complete > BUFFERSIZE or bytes_complete >= biggest_file["size"]:
                            extension_message = ""
                            dialog.update(int(status["progress"] * 100), *self._get_status_lines(status, extension_message))
                            plugin.log.info("Resolving to http://%s/files/%s" % (t2h_instance.bind_address, biggest_file["name"]))
                            has_resolved = True
                            item = {
                                "path": "http://%s/files/%s" % (t2h_instance.bind_address, urllib.quote(biggest_file["name"])),
                            }
                            if not xbmc.getInfoLabel("ListItem.Title"):
                                item["label"] = self.display_name
                            plugin.set_resolved_url(item)
                            break
                    xbmc.sleep(TORRENT2HTTP_POLL)

            # We are now playing
            plugin.log.info("Now playing torrent...")
            last_playing_event = 0
            with closing(OverlayText(w=OVERLAY_WIDTH, h=OVERLAY_HEIGHT, alignment=XBFONT_CENTER_X | XBFONT_CENTER_Y)) as overlay:
                with nested(self.attach(overlay.show, self.on_playback_paused),
                            self.attach(overlay.hide, self.on_playback_resumed, self.on_playback_stopped)):
                    while not xbmc.abortRequested and self.isPlaying():
                        overlay.text = "\n".join(self._get_status_lines(t2h("status"), extension_message))
                        now = time.time()
                        if (now - last_playing_event) > PLAYING_EVENT_INTERVAL:
                            track_event("video", "playing", self.display_name)
                            last_playing_event = now
                        xbmc.sleep(TORRENT2HTTP_POLL)

        plugin.log.info("Closing Torrent player.")
Пример #32
0
from koditorrent import plugin
from koditorrent.scrapers import scraper
from koditorrent.ga import tracked
from koditorrent.caching import cached_route
from koditorrent.utils import ensure_fanart
from koditorrent.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 = 20
GENRES = [
    "Action",
    "Adventure",
    "Animation",
    "Biography",
    "Comedy",
    "Crime",
    "Documentary",
    "Drama",
    "Family",
    "Fantasy",
    "Film-Noir",
    "Game-Show",
    "History",
    "Horror",
    "Music",
    "Musical",
Пример #33
0
from koditorrent import plugin
from koditorrent.scrapers import scraper
from koditorrent.ga import tracked
from koditorrent.caching import cached_route
from koditorrent.utils import ensure_fanart
from koditorrent.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 = 20
GENRES = [
    "Action",
    "Adventure",
    "Animation",
    "Biography",
    "Comedy",
    "Crime",
    "Documentary",
    "Drama",
    "Family",
    "Fantasy",
    "Film-Noir",
    "Game-Show",
    "History",
    "Horror",
    "Music",
    "Musical",
Пример #34
0
from koditorrent import plugin
from koditorrent.scrapers import scraper
from koditorrent.ga import tracked
from koditorrent.caching import cached_route
from koditorrent.utils import ensure_fanart


BASE_URL = "%s/" % plugin.get_setting("base_kickass")
HEADERS = {
    "Referer": BASE_URL,
}

MOVIES_GENRES = [
    "Action", "Adult", "Adventure", "Animation", "Biography", "Comedy", "Crime",
    "Documentary", "Drama", "Family", "Fantasy", "Film Noir", "Game Show",
    "History", "Horror", "Music", "Musical", "Mystery", "News", "Reality Tv",
    "Romance", "Sci Fi", "Short", "Sport", "Talk Show", "Thriller", "War",
    "Western",
]

MOVIES_CATEGORIES = [
    "3D Movies", "Music videos", "Movie clips", "Handheld", "iPad",
    "Highres Movies", "Bollywood", "Concerts", "Dubbed Movies", "Asian",
    "Documentary", "Trailer", "Other Movies",
]

TV_TAGS = [
    "Action", "Adventure", "Animation General", "Anime", "Anthology",
    "Celebrities", "Children", "Children Cartoons", "Comedy", "Cooking Food",
    "Cooking-Food", "Crime", "Current Events", "Discovery Science",
    "Discovery-Science", "Drama", "Educational", "Family", "Fantasy", "History",
Пример #35
0
import socket
from koditorrent import plugin, magnet, scrapers, socks
from koditorrent.ga import tracked
from koditorrent.utils import ensure_fanart
from koditorrent.platform import PLATFORM

otherType = str(plugin.get_setting("other"))
if otherType == "The Pirate Bay":
    from koditorrent.scrapers import \
        MODULES, \
        eztv, \
        yify, \
        tpb
elif otherType == "Kickass Torrents":
    from koditorrent.scrapers import \
        MODULES, \
        eztv, \
        yify, \
        kickass


    
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("/")
@ensure_fanart
@tracked(force=True)
def index():
Пример #36
0
import socket
from koditorrent import plugin, magnet, scrapers
from koditorrent.ga import tracked
from koditorrent.utils import ensure_fanart
from koditorrent.platform import PLATFORM

scrapers = ["eztv","yify","tpb","kickass","bitsnoop","btdigg","extratorrent","nyaa","zelka"]
scrapersToDisplay = []
for scraper in scrapers:
    if plugin.get_setting("display_%s"%scraper, bool):
        scrapersToDisplay.append("%s"%scraper)

from koditorrent.scrapers import \
    MODULES
for scraper in scrapersToDisplay:
    __import__("koditorrent.scrapers", fromlist=[scraper])

@plugin.route("/")
@ensure_fanart
@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." % PLATFORM, delay=15000)

    for module in MODULES:
        yield {
            "label": module["name"],
            "thumbnail": module["image"],
            "path": plugin.url_for(module["view"]),
        }