From: James Bunton Date: Sun, 12 Feb 2012 09:57:03 +0000 (+1100) Subject: Allow path_prefix to be set from a file in the playlists directory X-Git-Url: https://code.delx.au/notipod/commitdiff_plain/d986ae4a0c2444f97d531451769245a9e6b9ab66 Allow path_prefix to be set from a file in the playlists directory --- diff --git a/libnotipod.py b/libnotipod.py index fdf22ee..2a996ec 100644 --- a/libnotipod.py +++ b/libnotipod.py @@ -187,9 +187,14 @@ def mkdirhier(path): def export_m3u(dry_run, dest, path_prefix, playlist_name, files): if dry_run: return + dest = os.path.join(dest, "-Playlists-") if not path_prefix: - path_prefix = "../" - playlist_file = os.path.join(dest, "-Playlists-", playlist_name) + ".m3u" + try: + f = open(os.path.join(dest, ".path_prefix")) + path_prefix = f.read().strip() + except: + path_prefix = "../" + playlist_file = os.path.join(dest, playlist_name) + ".m3u" playlist_file = encode_filename(playlist_file) mkdirhier(os.path.dirname(playlist_file)) logging.info("Writing: " + playlist_file)