X-Git-Url: https://code.delx.au/notipod/blobdiff_plain/52fd13a71b7d431ab1c0d1b63a55d19210ee9466..9b9d4091c893e58ee0f3a39b243fac098f11a4d6:/libsyncitunes.py diff --git a/libsyncitunes.py b/libsyncitunes.py index e9ed9cd..3bccfec 100644 --- a/libsyncitunes.py +++ b/libsyncitunes.py @@ -120,10 +120,14 @@ class ITunesLibrary(NSObject): def export_m3u(dry_run, dest, path_prefix, playlist_name, files): if dry_run: return - f = open(os.path.join(dest, playlist_name) + ".m3u", "w") + playlist_file = os.path.join(dest, playlist_name) + ".m3u" + logging.info("Writing: " + playlist_file) + f = open(playlist_file, "w") for filename in files: - filename = filename.replace("/", "\\").encode("utf-8") - f.write("%s\\%s\\%s\n" % (path_prefix, filename)) + if path_prefix.find("\\") > 0: + filename = filename.replace("/", "\\") + filename = filename.encode("utf-8") + f.write("%s%s\n" % (path_prefix, filename)) f.close() def strip_prefix(s, prefix): @@ -173,7 +177,7 @@ def sync(dry_run, source, dest, files): else: logging.debug("update: " + filename) - elif not filename.startswith("Playlists/"): + elif not filename.endswith(".m3u"): logging.debug("delete: " + filename) if not dry_run: os.unlink(join(dest, filename))