From bb005a385a937bc2a50233bb4f3f99188674c890 Mon Sep 17 00:00:00 2001 From: shdown Date: Sat, 20 Sep 2014 16:01:03 +0400 Subject: TOOLS/umpv: make URL detection consistent with mpv method See mp_is_url in options/path.c. --- TOOLS/umpv | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'TOOLS') 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): -- cgit v1.2.3