]> code.delx.au - notipod/blobdiff - libnotipod.py
Allow path_prefix to be set from a file in the playlists directory
[notipod] / libnotipod.py
index fdf22ee82b1253fbcd4bbf53b7ed0c0089275a2d..2a996ec1aa2fc849e0ac1b9d576d5060cf9283ac 100644 (file)
@@ -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)