summaryrefslogtreecommitdiffstats
path: root/TOOLS
diff options
context:
space:
mode:
authorshdown <shdownnine@gmail.com>2014-09-20 16:01:03 +0400
committerwm4 <wm4@nowhere>2014-09-20 15:18:53 +0200
commitbb005a385a937bc2a50233bb4f3f99188674c890 (patch)
tree1bc390c1729386b3f28a20f627c9a138fe285488 /TOOLS
parentdfbb4d03ee9ad19ba166f57421eb2fd880a8633f (diff)
downloadmpv-bb005a385a937bc2a50233bb4f3f99188674c890.tar.bz2
mpv-bb005a385a937bc2a50233bb4f3f99188674c890.tar.xz
TOOLS/umpv: make URL detection consistent with mpv method
See mp_is_url in options/path.c.
Diffstat (limited to 'TOOLS')
-rwxr-xr-xTOOLS/umpv10
1 files changed, 4 insertions, 6 deletions
diff --git a/TOOLS/umpv b/TOOLS/umpv
index 61644539b3..c90ecd8c1a 100755
--- a/TOOLS/umpv
+++ b/TOOLS/umpv
@@ -50,17 +50,15 @@ if len(sys.argv) < 1:
sys.exit(1)
files = sys.argv[1:]
-# this is about the same method mpv uses to decide this
+# this is the same method mpv uses to decide this
def is_url(filename):
- parts = filename.split(":", 1)
+ parts = filename.split("://", 1)
if len(parts) < 2:
return False
# protocol prefix has no special characters => it's an URL
+ allowed_symbols = string.ascii_letters + string.digits + '_'
prefix = parts[0]
- for c in prefix:
- if string.ascii_letters.find(c) < 0:
- return False
- return True
+ return all(map(lambda c: c in allowed_symbols, prefix))
# make them absolute; also makes them safe against interpretation as options
def make_abs(filename):