TOOLS/umpv: make it work with Python 3 (again)

Apparently, the 3rd (2nd) parameter to string.translate() function was
removed.

Also, make_abs() had a mistake - not sure how this passed testing.
This commit is contained in:
wm4 2014-04-29 02:21:59 +02:00
parent a8e6caf56b
commit c78142a973
1 changed files with 6 additions and 3 deletions

View File

@ -56,13 +56,16 @@ def is_url(filename):
return False return False
# protocol prefix has no special characters => it's an URL # protocol prefix has no special characters => it's an URL
prefix = parts[0] prefix = parts[0]
return len(prefix.translate(None, string.letters)) == 0 for c in prefix:
if string.ascii_letters.find(c) < 0:
return False
return True
# make them absolute; also makes them safe against interpretation as options # make them absolute; also makes them safe against interpretation as options
def make_abs(filename): def make_abs(filename):
if not is_url(filename): if not is_url(filename):
return os.path.abspath(f) return os.path.abspath(filename)
return f return filename
files = [make_abs(f) for f in files] files = [make_abs(f) for f in files]
opts_env = os.getenv("UMPV_OPTIONS") opts_env = os.getenv("UMPV_OPTIONS")