pass
-def playlist_path(path):
+def playlist_path(path, expand=False):
"""Normalize playlist path extensions.
Examples
return None
if not path.endswith('.hkp'):
path += '.hkp'
+ if expand:
+ path = os.path.abspath(os.path.expanduser(path))
return path
if self._base_path == None:
self._base_path = os.getcwd()
else:
- path = playlist_path(path)
+ path = playlist_path(path, expand=True)
self.path = path
- self._base_path = os.path.dirname(os.path.abspath(
- os.path.expanduser(self.path)))
+ self._base_path = os.path.dirname(self.path)
if self.name == None:
self.name = os.path.basename(path)
if self._base_path != orig_base_path:
def load(path=None, drivers=None, identify=True, hooke=None):
"""Load a playlist from a file.
"""
- path = os.path.expanduser(playlist_path(path))
+ path = playlist_path(path, expand=True)
with open(path, 'r') as f:
text = f.read()
playlist = from_string(text)