Skip to content

Commit

Permalink
Prevent remote folders from being set, except for smb:// on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
steeve committed Dec 4, 2013
1 parent 34563e2 commit 4be1f53
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions resources/site-packages/xbmctorrent/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,16 @@ def init(self, magnet_uri):
"ulrate": plugin.get_setting("max_upload_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 xbmctorrent.utils import get_path_fs
Expand All @@ -118,9 +128,7 @@ def init(self, magnet_uri):
plugin.notify("Downloading to FAT32 is not supported. Resetting.", delay=15000)
plugin.set_setting("dlpath", "")
self.torrent2http_options["dlpath"] = "."
# Translate smb:// url to UNC path on windows, very hacky
if PLATFORM["os"] == "windows" and "smb://" in self.torrent2http_options["dlpath"].lower():
self.torrent2http_options["dlpath"] = self.torrent2http_options["dlpath"].replace("smb:", "").replace("/", "\\")

if plugin.get_setting("keep_files", bool):
plugin.log.info("Will keep file after playback.")
self.torrent2http_options["keep"] = None
Expand Down

0 comments on commit 4be1f53

Please sign in to comment.