예제 #1
0
    def init(self, uri, **kwargs):
        max_upload_rate = int(plugin.get_setting("max_upload_rate"))
        if max_upload_rate and max_upload_rate < 10:
            max_upload_rate = 0

        self.torrent2http_options = {
            "uri":
            uri,
            "dlpath":
            xbmc.validatePath(xbmc.translatePath(plugin.get_setting("dlpath")))
            or CACHE_DIR,
            "dlrate":
            plugin.get_setting("max_download_rate") or "0",
            "ulrate":
            max_upload_rate,
            "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 kodipopcorntime.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):
            self.torrent2http_options["keep"] = True

        self.on_playback_started = []
        self.on_playback_resumed = []
        self.on_playback_paused = []
        self.on_playback_stopped = []
        return self
예제 #2
0
    def init(self, uri, **kwargs):
        max_upload_rate = int(plugin.get_setting("max_upload_rate"))
        if max_upload_rate and max_upload_rate < 10:
            max_upload_rate = 0

        self.torrent2http_options = {
            "uri": uri,
            "dlpath": xbmc.validatePath(xbmc.translatePath(plugin.get_setting("dlpath"))) or CACHE_DIR,
            "dlrate": plugin.get_setting("max_download_rate") or "0",
            "ulrate":  max_upload_rate,
            "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 kodipopcorntime.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):
            self.torrent2http_options["keep"] = True

        self.on_playback_started = []
        self.on_playback_resumed = []
        self.on_playback_paused = []
        self.on_playback_stopped = []
        return self
예제 #3
0
def getURLS():
    # Default domain list
    urls = [
        "http://yts.to",
        "http://eqwww.image.yt"
    ]

    # Evaluate user domain
    userURL = urlparse(plugin.get_setting("base_yify"))
    if not userURL.scheme or not userURL.netloc:
        return urls

    fUserURL = "{url.scheme}://{url.netloc}".format(url=userURL)
    # Prioritize user domain
    if fUserURL in urls:
        urls.remove(fUserURL)
    urls.insert(0, fUserURL)

    return urls